@deslop/workbench 0.0.383 → 0.0.390

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 (58) hide show
  1. package/dist/{anthropic-C02QVQ9u.mjs → anthropic-DcE0yHBZ.mjs} +5 -5
  2. package/dist/{azure-openai-responses-CUFLNwdy.mjs → azure-openai-responses-ecGypQVA.mjs} +4 -4
  3. package/dist/client/assets/-workbench-terminal-BXoM87zf.js +145 -0
  4. package/dist/client/assets/agent-15Ys-EV7.js +1 -0
  5. package/dist/client/assets/agent-CwZrrVgw.js +2 -0
  6. package/dist/client/assets/{dialog-B0kBnYwI.js → dialog-D3SsOi-l.js} +17 -17
  7. package/dist/client/assets/{diff-o4xLJTw0.js → diff-CSExRPif.js} +51 -49
  8. package/dist/client/assets/diff-Dwyi9RiJ.js +2 -0
  9. package/dist/client/assets/{external-link-D7Q28KpR.js → external-link-Dg1sMSmg.js} +1 -1
  10. package/dist/client/assets/fallbacks-D1MIlTO6.js +16 -0
  11. package/dist/client/assets/index-B2S_w1d1.css +2 -0
  12. package/dist/client/assets/{index-ClCMMzj9.js → index-YdollqUD.js} +3 -3
  13. package/dist/client/assets/input-DZnkCVx3.js +1 -0
  14. package/dist/client/assets/portless-DGijexQV.js +2 -0
  15. package/dist/client/assets/portless-DSDYE-Pc.js +1 -0
  16. package/dist/client/assets/resizable-BWgF68j6.js +1 -0
  17. package/dist/client/assets/route-BuzkrubX.js +45 -0
  18. package/dist/client/assets/route-D3fj0Kxy.js +2 -0
  19. package/dist/client/assets/{run-wjcPjpA5.js → run-ByOu_fKi.js} +1 -1
  20. package/dist/client/assets/run-D-KGLETl.js +2 -0
  21. package/dist/client/assets/{sonner-DgKrvTU1.js → sonner-vAlNGB2c.js} +1 -1
  22. package/dist/client/assets/state-DipxiPcD.js +2 -0
  23. package/dist/client/assets/terminal-dP11iiPC.js +1 -0
  24. package/dist/client/assets/terminal-zDmQe2b5.js +2 -0
  25. package/dist/client/assets/{triangle-alert-cDPYgb7f.js → triangle-alert-CHTnDlTF.js} +1 -1
  26. package/dist/client/index.html +11 -11
  27. package/dist/{github-copilot-headers-B--aVYl2.mjs → github-copilot-headers-P0xZolzq.mjs} +2 -2
  28. package/dist/{google-DHtiCcEt.mjs → google-Jzn1v4-q.mjs} +4 -4
  29. package/dist/{google-shared-BT0mQb3v.mjs → google-shared-DNNqX1gf.mjs} +3 -3
  30. package/dist/{google-vertex-CRkz0MgQ.mjs → google-vertex-z0Cbw7eq.mjs} +4 -4
  31. package/dist/{hash-CDrrQIkY.mjs → hash-CScAQ-b_.mjs} +1 -1
  32. package/dist/{headers-m19bM8_9.mjs → headers-oksLmLNC.mjs} +1 -1
  33. package/dist/{mistral-DXtHhhUc.mjs → mistral-CxEIkz4y.mjs} +4 -4
  34. package/dist/{openai-codex-responses-BSLixEC8.mjs → openai-codex-responses-7ZUsVcbT.mjs} +6 -6
  35. package/dist/{openai-completions-CE-LDmL4.mjs → openai-completions-CaGFVr3X.mjs} +48 -10
  36. package/dist/{openai-responses-41QiypX_.mjs → openai-responses-Vjw8-3qm.mjs} +5 -5
  37. package/dist/{openai-responses-shared-BAoGGIxP.mjs → openai-responses-shared-DtEshy-7.mjs} +4 -4
  38. package/dist/{openrouter-CDq1vETJ.mjs → openrouter-CZ-H_QwG.mjs} +3 -3
  39. package/dist/{sanitize-unicode-CPcy0g31.mjs → sanitize-unicode-BbVojtka.mjs} +1 -1
  40. package/dist/server.js +2498 -1877
  41. package/dist/{transform-messages-CUKh2_5w.mjs → transform-messages-CLmkH5Gu.mjs} +2 -2
  42. package/package.json +1 -1
  43. package/dist/client/assets/-workbench-terminal-nnzNYgEY.js +0 -145
  44. package/dist/client/assets/agent-CnBPS10_.js +0 -1
  45. package/dist/client/assets/agent-XCbfwj2z.js +0 -2
  46. package/dist/client/assets/diff-ClnF3EUN.js +0 -2
  47. package/dist/client/assets/fallbacks-DwGmG_0c.js +0 -16
  48. package/dist/client/assets/index-DT_QSnKQ.css +0 -2
  49. package/dist/client/assets/input-CEh4Uy0l.js +0 -1
  50. package/dist/client/assets/portless-BEzC3sH4.js +0 -2
  51. package/dist/client/assets/portless-DLmFLaZz.js +0 -1
  52. package/dist/client/assets/resizable-A9BpOcmt.js +0 -1
  53. package/dist/client/assets/route-Da0uHKH9.js +0 -45
  54. package/dist/client/assets/route-ULg8h9n0.js +0 -2
  55. package/dist/client/assets/run-DY23jobN.js +0 -2
  56. package/dist/client/assets/state-_2CmL5IM.js +0 -2
  57. package/dist/client/assets/terminal-BC9WKciF.js +0 -1
  58. package/dist/client/assets/terminal-Bn9lFOEg.js +0 -2
@@ -1,19 +1,19 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/c4Diagram-AAUBKEIU-Ct3OGD9a.js","assets/src-DzxfdEt6.js","assets/rolldown-runtime-QTnfLwEv.js","assets/chunk-CSCIHK7Q-DoGVP1BZ.js","assets/preload-helper-CjdClQve.js","assets/dist-D9sYb5Oa.js","assets/chunk-5ZQYHXKU-DbN9DSns.js","assets/chunk-ND2GUHAM-CmHIi1wD.js","assets/flowDiagram-I6XJVG4X-C2H7PQev.js","assets/channel-S3CdaK6m.js","assets/chunk-XPW4576I-BjBK3ctW.js","assets/chunk-BSJP7CBP-C450xCVa.js","assets/chunk-L5ZTLDWV-D9P-YjsA.js","assets/chunk-NZK2D7GU-hkTOm2qR.js","assets/chunk-O5CBEL6O-D1fDxsSH.js","assets/chunk-3OPIFGDE-BlIdNnu8.js","assets/rough.esm-CSKSodPl.js","assets/chunk-KSCS5N6A-dbmnxO_p.js","assets/line-CcJ0IOWh.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-LZXEDZCA-BdVT_AWc.js","assets/chunk-FMBD7UC4-cqorOok8.js","assets/chunk-55IACEB6-nU8KvKB3.js","assets/chunk-2J33WTMH-BUMgKaV6.js","assets/erDiagram-TEJ5UH35-CbzdEpkS.js","assets/gitGraphDiagram-PVQCEYII-d2_5HIIo.js","assets/chunk-4BX2VUAB-CiBu5cRv.js","assets/mermaid-parser.core-CKHoAf1J.js","assets/chunk-NNHCCRGN-DlpIbxXb.js","assets/chunk-4EGX6M5U-BfCFom1o.js","assets/chunk-N66VUXT2-B6CG-CnY.js","assets/chunk-UIBZB4QT-r8p3pBHw.js","assets/chunk-5DO6E6H7-DP8QnaJj.js","assets/chunk-MPE355IW-C_vkbqLj.js","assets/chunk-MZUSXYTE-BnVcgphH.js","assets/chunk-FHYWG6QK-Ce318laP.js","assets/chunk-WCWK7LTN-DrKYkgXF.js","assets/chunk-BR22UD5L-CT6fcRkN.js","assets/chunk-PUPMXCY4-BZ88kQjK.js","assets/chunk-QZHKN3VN-BS_CF_l3.js","assets/ganttDiagram-6RSMTGT7-BZql2QFP.js","assets/linear-Ct8JHF0c.js","assets/defaultLocale-C8Fc0cco.js","assets/init-D6jRqBbL.js","assets/infoDiagram-5YYISTIA-DaDFMb3D.js","assets/chunk-WU5MYG2G-CtG2KJlt.js","assets/pieDiagram-4H26LBE5-BmpbjVUG.js","assets/ordinal-hYBb2elL.js","assets/arc-BjSQqbzd.js","assets/quadrantDiagram-W4KKPZXB-BncnX7WL.js","assets/xychartDiagram-2RQKCTM6-Cgc-2R8L.js","assets/requirementDiagram-4Y6WPE33-C4viwYDb.js","assets/sequenceDiagram-3UESZ5HK-D7Bj1Dg6.js","assets/classDiagram-4FO5ZUOK-BdTSUdNF.js","assets/chunk-727SXJPM-DkPu5ecB.js","assets/classDiagram-v2-Q7XG4LA2-BdTSUdNF.js","assets/stateDiagram-AJRCARHV-xBL-crbl.js","assets/graphlib-B8gBHxth.js","assets/dagre-Bx709z4p.js","assets/chunk-AQP2D5EJ-B8lrSg7a.js","assets/stateDiagram-v2-BHNVJYJU-ZbAyaVmU.js","assets/journeyDiagram-JHISSGLW-CYDeiigr.js","assets/timeline-definition-PNZ67QCA-Bs3JkoMQ.js","assets/mindmap-definition-RKZ34NQL-DTgZ_Z5F.js","assets/kanban-definition-UN3LZRKU-BFoF4JfY.js","assets/sankeyDiagram-5OEKKPKP-cs1kWOqp.js","assets/diagram-LMA3HP47-DAEPoAHp.js","assets/diagram-2AECGRRQ-DnobmroZ.js","assets/blockDiagram-GPEHLZMM-CISQUfO9.js","assets/diagram-5GNKFQAL-D6NqAeoi.js","assets/architectureDiagram-3BPJPVTR-CTWT1AFv.js","assets/cytoscape.esm-Kic9WIU3.js","assets/diagram-KO2AKTUF-y8QX4vEL.js","assets/ishikawaDiagram-YF4QCWOH-7tWPtPSR.js","assets/vennDiagram-CIIHVFJN-D25dPloy.js","assets/diagram-OG6HWLK6-B3KiYvxM.js","assets/wardleyDiagram-YWT4CUSO-B7X6xZZ7.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{$a as i,A as a,Aa as o,Ba as s,Dn as c,F as l,Fa as u,Fr as d,Ft as f,Ha as p,I as m,Ia as h,It as g,Ka as _,L as v,La as y,Lt as b,Mr as x,O as S,Or as C,Pa as w,Rt as T,Va as E,Wa as D,Xo as O,Ya as k,Za as A,_o as j,a as ee,bo as te,gs as M,hn as N,ho as ne,is as P,ja as re,ji as ie,k as F,kr as ae,lr as I,pn as oe,ps as L,qa as se,r as ce,rs as le,to as ue,ts as R,wo as de,za as fe}from"./fallbacks-DwGmG_0c.js";import{S as pe,_ as me,a as he,b as ge,c as _e,d as ve,g as ye,h as be,l as xe,m as Se,n as Ce,o as we,p as Te,s as Ee,t as De,v as Oe,x as ke,y as Ae}from"./dialog-B0kBnYwI.js";import{n as je,r as Me}from"./sonner-DgKrvTU1.js";import{n as Ne,r as Pe,t as Fe}from"./resizable-A9BpOcmt.js";import{t as Ie}from"./external-link-D7Q28KpR.js";import{A as Le,C as Re,D as ze,E as Be,M as Ve,O as He,S as Ue,_ as We,b as Ge,d as z,g as Ke,h as qe,j as Je,k as Ye,m as Xe,t as Ze,v as Qe,w as $e,y as et}from"./state-_2CmL5IM.js";import{t as B}from"./preload-helper-CjdClQve.js";import{t as tt}from"./diff-ClnF3EUN.js";import{_ as nt,g as V,h as H,p as U}from"./src-DzxfdEt6.js";import{$ as rt,C as it,E as at,I as ot,L as st,N as ct,P as lt,Q as ut,S as dt,T as ft,V as pt,W as mt,X as ht,Z as gt,_ as _t,b as vt,c as yt,g as bt,l as xt,m as St,n as Ct,p as wt,q as Tt,r as Et,t as Dt,u as Ot}from"./chunk-CSCIHK7Q-DoGVP1BZ.js";import{a as kt,b as At,f as jt,g as Mt,h as Nt,i as Pt,o as Ft,v as It,x as Lt,y as Rt}from"./chunk-5ZQYHXKU-DbN9DSns.js";import{t as zt}from"./chunk-WU5MYG2G-CtG2KJlt.js";import{n as Bt,t as Vt}from"./chunk-XPW4576I-BjBK3ctW.js";import"./chunk-BSJP7CBP-C450xCVa.js";import"./chunk-L5ZTLDWV-D9P-YjsA.js";import"./chunk-NZK2D7GU-hkTOm2qR.js";import{i as Ht,o as Ut}from"./chunk-O5CBEL6O-D1fDxsSH.js";import"./chunk-3OPIFGDE-BlIdNnu8.js";import"./chunk-KSCS5N6A-dbmnxO_p.js";import{n as Wt}from"./chunk-LZXEDZCA-BdVT_AWc.js";var Gt=M(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Kt=M(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),qt=M(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Jt=M(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Yt=M(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Xt=M(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),W=e(n(),1),Zt=(0,W.createContext)(null);function Qt(){return(0,W.useContext)(Zt)?.defaultOptions??{}}function $t(e){return typeof e==`object`&&!!e&&`current`in e}function en(){if(typeof navigator>`u`)return`linux`;let e=navigator.platform?.toLowerCase()??``,t=navigator.userAgent?.toLowerCase()??``;return e.includes(`mac`)||t.includes(`mac`)?`mac`:e.includes(`win`)||t.includes(`win`)?`windows`:`linux`}var tn=[`Control`,`Alt`,`Shift`,`Meta`];new Set(tn);var nn={Control:`Control`,Ctrl:`Control`,control:`Control`,ctrl:`Control`,Shift:`Shift`,shift:`Shift`,Alt:`Alt`,Option:`Alt`,alt:`Alt`,option:`Alt`,Command:`Meta`,Cmd:`Meta`,Meta:`Meta`,command:`Meta`,cmd:`Meta`,meta:`Meta`,OS:`Meta`,os:`Meta`,Win:`Meta`,win:`Meta`,CommandOrControl:`Mod`,Mod:`Mod`,commandorcontrol:`Mod`,mod:`Mod`};function rn(e,t=en()){return e===`Mod`?t===`mac`?`Meta`:`Control`:e}var an=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``)),on=new Set([`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`]),sn=new Set([`F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7`,`F8`,`F9`,`F10`,`F11`,`F12`]),cn=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),ln=new Set([`Enter`,`Escape`,`Space`,`Tab`,`Backspace`,`Delete`]),un=new Set([`/`,`[`,`]`,`\\`,`=`,`-`,`,`,`.`,`;`,"`"]),dn={Backquote:"`",Backslash:`\\`,BracketLeft:`[`,BracketRight:`]`,Comma:`,`,Equal:`=`,Minus:`-`,Period:`.`,Semicolon:`;`,Slash:`/`};new Set([...an,...on,...sn,...cn,...ln,...un]);var fn={Esc:`Escape`,esc:`Escape`,escape:`Escape`,Return:`Enter`,return:`Enter`,enter:`Enter`," ":`Space`,space:`Space`,Spacebar:`Space`,spacebar:`Space`,tab:`Tab`,backspace:`Backspace`,Del:`Delete`,del:`Delete`,delete:`Delete`,Up:`ArrowUp`,up:`ArrowUp`,arrowup:`ArrowUp`,Down:`ArrowDown`,down:`ArrowDown`,arrowdown:`ArrowDown`,Left:`ArrowLeft`,left:`ArrowLeft`,arrowleft:`ArrowLeft`,Right:`ArrowRight`,right:`ArrowRight`,arrowright:`ArrowRight`,home:`Home`,end:`End`,pageup:`PageUp`,pagedown:`PageDown`,PgUp:`PageUp`,PgDn:`PageDown`,pgup:`PageUp`,pgdn:`PageDown`};function pn(e){return/^\p{Letter}$/u.test(e)}function mn(e){if(!e)return``;if(e in fn)return fn[e];if(pn(e)){let t=e.toUpperCase();return t.length===1?t:e}let t=e.toUpperCase();return/^F([1-9]|1[0-2])$/.test(t)?t:e}function hn(e,t=en()){let n=e.split(`+`),r=new Set,i=``;for(let e=0;e<n.length;e++){let a=n[e].trim();if(e===n.length-1)i=mn(a);else{let e=nn[a]??nn[a.toLowerCase()];if(e){let n=rn(e,t);r.add(n)}else n.length===1&&(i=mn(a))}}return!i&&n.length>0&&(i=mn(n[n.length-1].trim())),{key:i,ctrl:r.has(`Control`),shift:r.has(`Shift`),alt:r.has(`Alt`),meta:r.has(`Meta`),modifiers:tn.filter(e=>r.has(e))}}function gn(e,t=en()){let n=e.ctrl??!1,r=e.shift??!1,i=e.alt??!1,a=e.meta??!1;e.mod&&(rn(`Mod`,t)===`Control`?n=!0:a=!0);let o=tn.filter(e=>{switch(e){case`Control`:return n;case`Shift`:return r;case`Alt`:return i;case`Meta`:return a;default:return!1}});return{key:e.key,ctrl:n,shift:r,alt:i,meta:a,modifiers:o}}function _n(e,t){let n=t===`mac`?e.meta&&!e.ctrl:e.ctrl&&!e.meta,r=[];if(n)r.push(`Mod`),e.alt&&r.push(`Alt`),e.shift&&r.push(`Shift`);else for(let t of tn)e.modifiers.includes(t)&&r.push(t);return r.push(mn(e.key)),r.join(`+`)}function vn(e,t=en()){return _n(hn(e,t),t)}function yn(e,t=en()){return _n(e,t)}function bn(e,t=en()){return typeof e==`string`?vn(e,t):yn(gn(e,t),t)}function xn(e){let t=[];for(let n of tn)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join(`+`)}function Sn(e,t,n=en()){let r=typeof t==`string`?hn(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;let i=mn(e.key),a=r.key;if(i!==`Dead`&&i.length===1&&a.length===1){if(i.toUpperCase()===a.toUpperCase())return!0;if(pn(i)&&(/^[A-Za-z]$/.test(i)||!e.altKey))return!1}if(e.code&&(i===`Dead`||i.length===1&&a.length===1)){if(e.code.startsWith(`Key`)){let t=e.code.slice(3);if(t.length===1&&/^[A-Za-z]$/.test(t))return t.toUpperCase()===a.toUpperCase()}if(e.code.startsWith(`Digit`)){let t=e.code.slice(5);if(t.length===1&&/^[0-9]$/.test(t))return t===a}return e.code in dn?dn[e.code]===a:!1}return i===a}var Cn={preventDefault:!0,stopPropagation:!0,eventType:`keydown`,enabled:!0,ignoreInputs:!0,conflictBehavior:`warn`};function wn(e){return!(e.ctrl||e.meta||e.key===`Escape`)}function Tn(e){if(!e)return!1;if(e instanceof HTMLInputElement){let t=e.type.toLowerCase();return!(t===`button`||t===`submit`||t===`reset`)}return!!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable)}function En(e){return typeof document>`u`?null:typeof Document<`u`&&e instanceof Document||typeof Node<`u`&&e.nodeType===Node.DOCUMENT_NODE?e.activeElement:typeof HTMLElement<`u`&&e instanceof HTMLElement?e.ownerDocument.activeElement??null:e.document.activeElement??null}function Dn(e,t,n){let r=En(t);return r&&Tn(r)&&r!==n||e.composedPath().some(e=>Tn(e)&&e!==n)?!0:Tn(e.target)&&e.target!==n}function On(e,t){return t===document||t===window?e.currentTarget===t||e.currentTarget===document.documentElement:t===window?e.currentTarget===window||e.currentTarget===document||e.currentTarget===document.documentElement:!!(t instanceof HTMLElement&&(e.currentTarget===t||e.target instanceof Node&&t.contains(e.target)))}function kn(e,t,n,r){if(n!==`allow`){if(n===`warn`){console.warn(`'${t}' is already registered. Multiple handlers will be triggered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to suppress this warning.`);return}if(n===`error`)throw Error(`'${t}' is already registered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to allow multiple registrations.`);r(e)}}var G=function(e){return e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e}({});function An({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&(G.RecursedCheck|G.Recursed|G.Dirty|G.Pending)?a&(G.RecursedCheck|G.Recursed)?a&G.RecursedCheck?!(a&(G.Dirty|G.Pending))&&c(e,i)?(i.flags=a|(G.Recursed|G.Pending),a&=G.Mutable):a=G.None:i.flags=a&~G.Recursed|G.Pending:a=G.None:i.flags=a|G.Pending,a&G.Watching&&t(i),a&G.Mutable){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&G.Dirty)a=!0;else if((c&(G.Mutable|G.Dirty))===(G.Mutable|G.Dirty)){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&(G.Mutable|G.Pending))===(G.Mutable|G.Pending)){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=~G.Pending;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&(G.Pending|G.Dirty))===G.Pending&&(n.flags=r|G.Dirty,(r&(G.Watching|G.RecursedCheck))===G.Watching&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function jn(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Mn=[],Nn=0,{link:Pn,unlink:Fn,propagate:In,checkDirty:Ln,shallowPropagate:Rn}=An({update(e){return e._update()},notify(e){Mn[Bn++]=e,e.flags&=~G.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=G.Mutable|G.Dirty,Un(e))}}),zn=0,Bn=0,Vn,Hn=0;function Un(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Fn(n,e)}function Wn(){if(!(Hn>0)){for(;zn<Bn;){let e=Mn[zn];Mn[zn++]=void 0,e.notify()}zn=0,Bn=0}}function Gn(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?G.None:G.Mutable,get(){return Vn!==void 0&&Pn(i,Vn,Nn),i._snapshot},subscribe(e){let t=jn(e),n={current:!1},r=Kn(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Vn,o=t?.compare??Object.is;if(n)Vn=i,++Nn,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=G.Mutable|G.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Vn=a,n&&(i.flags&=~G.RecursedCheck),Un(i)}}};return n?(i.flags=G.Mutable|G.Dirty,i.get=function(){let e=i.flags;if(e&G.Dirty||e&G.Pending&&Ln(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Rn(e)}}else e&G.Pending&&(i.flags=e&~G.Pending);return Vn!==void 0&&Pn(i,Vn,Nn),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(In(e),Rn(e),Wn())}},i}function Kn(e){let t=()=>{let t=Vn;Vn=n,++Nn,n.depsTail=void 0,n.flags=G.Watching|G.RecursedCheck;try{return e()}finally{Vn=t,n.flags&=~G.RecursedCheck,Un(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:G.Watching|G.RecursedCheck,notify(){let e=this.flags;e&G.Dirty||e&G.Pending&&Ln(this.deps,this)?t():this.flags=G.Watching},stop(){this.flags=G.None,this.depsTail=void 0,Un(this)}};return t(),n}var qn=class{constructor(e,t){this.atom=Gn(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(jn(e))}},Jn=0;function Yn(){return`hotkey_${++Jn}`}var Xn=class e{static#e=null;#t;#n=new Map;#r=new Map;constructor(){this.registrations=new qn(new Map),this.#t=en()}static getInstance(){return e.#e||=new e,e.#e}static resetInstance(){e.#e&&=(e.#e.destroy(),null)}register(e,t,n={}){if(typeof document>`u`&&!n.target){let e=t;return{id:Yn(),unregister:()=>{},get callback(){return e},set callback(t){e=t},setOptions:()=>{},get isActive(){return!1}}}let r=Yn(),i=n.platform??this.#t,a=typeof e==`string`?hn(e,i):gn(e,i),o=typeof e==`string`?e:xn(a),s=n.target??document,c=n.conflictBehavior??`warn`,l=this.#d(o,s);l&&kn(l.id,o,c,e=>this.#i(e));let u=n.ignoreInputs??wn(a),d={id:r,hotkey:o,parsedHotkey:a,callback:t,options:{...Cn,requireReset:!1,...n,platform:i,ignoreInputs:u},hasFired:!1,triggerCount:0,target:s};this.registrations.setState(e=>new Map(e).set(r,d)),this.#r.has(s)||this.#r.set(s,new Set),this.#r.get(s).add(r),this.#a(s);let f=this;return{get id(){return r},unregister:()=>{f.#i(r)},get callback(){return f.registrations.state.get(r)?.callback??t},set callback(e){let t=f.registrations.state.get(r);t&&(t.callback=e)},setOptions:e=>{f.registrations.setState(t=>{let n=t.get(r);if(n){let i=new Map(t);return i.set(r,{...n,options:{...n.options,...e}}),i}return t})},get isActive(){return f.registrations.state.has(r)}}}#i(e){let t=this.registrations.state.get(e);if(!t)return;let n=t.target;this.registrations.setState(t=>{let n=new Map(t);return n.delete(e),n});let r=this.#r.get(n);r&&(r.delete(e),r.size===0&&this.#o(n))}#a(e){if(typeof document>`u`||this.#n.has(e))return;let t=this.#l(e),n=this.#u(e);e.addEventListener(`keydown`,t),e.addEventListener(`keyup`,n),this.#n.set(e,{keydown:t,keyup:n})}#o(e){if(typeof document>`u`)return;let t=this.#n.get(e);t&&(e.removeEventListener(`keydown`,t.keydown),e.removeEventListener(`keyup`,t.keyup),this.#n.delete(e),this.#r.delete(e))}#s(e,t,n){let r=this.#r.get(t);if(r)for(let i of r){let r=this.registrations.state.get(i);if(r&&On(e,t)&&r.options.enabled&&!(r.options.ignoreInputs!==!1&&Dn(e,t,r.target)))if(n===`keydown`){if(r.options.eventType!==`keydown`)continue;Sn(e,r.parsedHotkey,r.options.platform)&&(r.options.preventDefault&&e.preventDefault(),r.options.stopPropagation&&e.stopPropagation(),(!r.options.requireReset||!r.hasFired)&&(this.#c(r,e),r.options.requireReset&&(r.hasFired=!0)))}else r.options.eventType===`keyup`&&Sn(e,r.parsedHotkey,r.options.platform)&&this.#c(r,e),r.options.requireReset&&r.hasFired&&this.#f(r,e)&&(r.hasFired=!1)}}#c(e,t){e.options.preventDefault&&t.preventDefault(),e.options.stopPropagation&&t.stopPropagation(),e.triggerCount++,this.registrations.setState(e=>new Map(e));let n={hotkey:e.hotkey,parsedHotkey:e.parsedHotkey};e.callback(t,n)}#l(e){return t=>{this.#s(t,e,`keydown`)}}#u(e){return t=>{this.#s(t,e,`keyup`)}}#d(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&n.target===t)return n;return null}#f(e,t){let n=e.parsedHotkey,r=mn(t.key),i=n.key.length===1?n.key.toUpperCase():n.key;return!!((r.length===1?r.toUpperCase():r)===i||n.ctrl&&r===`Control`||n.shift&&r===`Shift`||n.alt&&r===`Alt`||n.meta&&r===`Meta`)}triggerRegistration(e){let t=this.registrations.state.get(e);if(!t)return!1;let n=t.parsedHotkey,r=new KeyboardEvent(t.options.eventType??`keydown`,{key:n.key,ctrlKey:n.ctrl,shiftKey:n.shift,altKey:n.alt,metaKey:n.meta,bubbles:!0,cancelable:!0});return t.triggerCount++,this.registrations.setState(e=>new Map(e)),t.callback(r,{hotkey:t.hotkey,parsedHotkey:t.parsedHotkey}),!0}getRegistrationCount(){return this.registrations.state.size}isRegistered(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&(t===void 0||n.target===t))return!0;return!1}destroy(){for(let e of this.#n.keys())this.#o(e);this.registrations.setState(()=>new Map),this.#n.clear(),this.#r.clear()}};function Zn(){return Xn.getInstance()}function Qn(e,t,n={}){let r={...Qt().hotkey,...n},i=Zn(),a=(0,W.useRef)(null),o=(0,W.useRef)(t),s=(0,W.useRef)(r),c=(0,W.useRef)(i);o.current=t,s.current=r,c.current=i;let l=(0,W.useRef)(null),u=(0,W.useRef)(null),d=bn(e,r.platform??en()),{target:f,...p}=r;(0,W.useEffect)(()=>{let e=$t(s.current.target)?s.current.target.current:s.current.target??(typeof document<`u`?document:null);if(!e){a.current?.isActive&&(a.current.unregister(),a.current=null),l.current=null,u.current=null;return}let t=l.current!==null&&l.current!==e,n=u.current!==null&&u.current!==d;return a.current?.isActive&&(t||n)&&(a.current.unregister(),a.current=null),(!a.current||!a.current.isActive)&&(a.current=c.current.register(d,o.current,{...s.current,target:e})),l.current=e,u.current=d,()=>{a.current?.isActive&&(a.current.unregister(),a.current=null)}},[d]),a.current?.isActive&&(a.current.callback=t,a.current.setOptions(p))}var $n=`diffs-container`;(()=>{try{return!1}catch{return!1}})();var er=/(?=^From [a-f0-9]+ .+$)/m,tr=/(?=^diff --git)/gm,nr=/(?<=\n)/,rr=/^(---|\+\+\+)\s+([^\t\r\n]+)/,ir=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,ar=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,or=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,sr=`header-prefix`,cr=`header-metadata`,lr=`header-custom`,K={dark:`pierre-dark`,light:`pierre-light`},ur=`data-theme-css`,dr=`data-unsafe-css`,fr=`data-diffs-scrollbar-measure`,pr=`--diffs-scrollbar-gutter-measured`,mr=1e5,hr={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8};({...hr});var gr=Object.freeze({fromStart:0,fromEnd:0}),_r={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},vr={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function yr(e){return e.replace(/\n$|\r\n$/,``)}var br=new TextEncoder,xr=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Sr=/[\uD800-\uDFFF]/,Cr=1024,wr=new Uint8Array(Cr);function Tr(){wr.length!==Cr&&(wr=new Uint8Array(Cr))}function q(e){if(e.length===0)return e;if(Sr.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;wr.length<t&&(wr=new Uint8Array(t));let{written:n}=br.encodeInto(e,wr);return xr.decode(wr.subarray(0,n))}function Er(e,t,n){try{return Dr(e,t,n)}finally{Tr()}}function Dr(e,t,n=!1){let r=Gr(e),i=r?Pr(e):Fr(e),a,o=[];for(let e of i){if(r&&!tr.test(e)){if(a==null)a=q(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}else if(!r&&!Ir(e)){if(a==null)a=q(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let i=kr(e,{cacheKey:t==null?void 0:`${t}-${o.length}`,isGitDiff:r,throwOnError:n});i!=null&&o.push(i)}return{patchMetadata:a,files:o}}function Or(e,t){try{return kr(e,t)}finally{Tr()}}function kr(e,{cacheKey:t,isGitDiff:n=tr.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=Kr(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=Nr(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=Hr(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?Mr(i.contents):[],deletionLines:!l&&r!=null&&i!=null?Mr(r.contents):[],cacheKey:Jr(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(ar),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=q(r.trim()),n!==r&&(c.prevName=q(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?ir:rr):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=q(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=q(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=q(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=q(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=q(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=q(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(or)??[];t!=null&&(c.prevObjectId=q(t)),n!=null&&(c.newObjectId=q(n)),r!=null&&(c.mode=q(r))}e.startsWith(`rename from `)&&(c.prevName=q(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=q(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{$a as i,A as a,As as o,Ba as s,Bi as c,Bt as l,Cn as u,Fn as d,Gr as f,Gt as p,Hr as m,Ht as h,I as g,Ja as _,Ka as v,Kt as y,L as b,Lr as x,Ns as S,Oo as C,Po as w,R as T,Rr as E,To as D,Ua as O,Ut as ee,Vt as k,Wa as A,Wt as j,Xa as te,Ya as ne,Za as M,_r as N,_s as P,a as re,bs as ie,do as ae,ds as oe,gs as se,io as ce,j as le,jo as ue,k as F,ko as de,lo as I,no as fe,o as L,oo as pe,r as me,to as he,xn as ge,xs as _e,za as ve,zt as ye}from"./fallbacks-D1MIlTO6.js";import{S as be,_ as xe,a as Se,b as Ce,c as we,d as Te,g as Ee,h as De,l as Oe,m as ke,n as Ae,o as je,p as Me,s as Ne,t as Pe,v as Fe,x as Ie,y as Le}from"./dialog-D3SsOi-l.js";import{n as Re,r as ze}from"./sonner-vAlNGB2c.js";import{n as Be,r as Ve,t as He}from"./resizable-BWgF68j6.js";import{t as Ue}from"./external-link-Dg1sMSmg.js";import{B as We,D as Ge,E as Ke,F as qe,I as Je,L as Ye,M as Xe,N as Ze,O as Qe,R as $e,S as et,V as tt,_ as R,b as nt,j as rt,k as it,m as z,r as at,v as ot,x as st,y as ct,z as lt}from"./state-DipxiPcD.js";import{t as B}from"./preload-helper-CjdClQve.js";import{t as ut}from"./diff-Dwyi9RiJ.js";import{_ as dt,g as V,h as H,p as ft}from"./src-DzxfdEt6.js";import{$ as pt,C as mt,E as ht,I as gt,L as _t,N as vt,P as yt,Q as bt,S as xt,T as St,V as Ct,W as wt,X as Tt,Z as Et,_ as Dt,b as Ot,c as kt,g as At,l as jt,m as Mt,n as Nt,p as Pt,q as Ft,r as It,t as Lt,u as Rt}from"./chunk-CSCIHK7Q-DoGVP1BZ.js";import{a as zt,b as Bt,f as Vt,g as Ht,h as Ut,i as Wt,o as Gt,v as Kt,x as qt,y as Jt}from"./chunk-5ZQYHXKU-DbN9DSns.js";import{t as Yt}from"./chunk-WU5MYG2G-CtG2KJlt.js";import{n as Xt,t as Zt}from"./chunk-XPW4576I-BjBK3ctW.js";import"./chunk-BSJP7CBP-C450xCVa.js";import"./chunk-L5ZTLDWV-D9P-YjsA.js";import"./chunk-NZK2D7GU-hkTOm2qR.js";import{i as Qt,o as $t}from"./chunk-O5CBEL6O-D1fDxsSH.js";import"./chunk-3OPIFGDE-BlIdNnu8.js";import"./chunk-KSCS5N6A-dbmnxO_p.js";import{n as en}from"./chunk-LZXEDZCA-BdVT_AWc.js";var tn=S(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),nn=S(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),rn=S(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),an=S(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),on=S(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),sn=S(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),U=e(n(),1),cn=(0,U.createContext)(null);function ln(){return(0,U.useContext)(cn)?.defaultOptions??{}}function un(e){return typeof e==`object`&&!!e&&`current`in e}function dn(){if(typeof navigator>`u`)return`linux`;let e=navigator.platform?.toLowerCase()??``,t=navigator.userAgent?.toLowerCase()??``;return e.includes(`mac`)||t.includes(`mac`)?`mac`:e.includes(`win`)||t.includes(`win`)?`windows`:`linux`}var fn=[`Control`,`Alt`,`Shift`,`Meta`];new Set(fn);var pn={Control:`Control`,Ctrl:`Control`,control:`Control`,ctrl:`Control`,Shift:`Shift`,shift:`Shift`,Alt:`Alt`,Option:`Alt`,alt:`Alt`,option:`Alt`,Command:`Meta`,Cmd:`Meta`,Meta:`Meta`,command:`Meta`,cmd:`Meta`,meta:`Meta`,OS:`Meta`,os:`Meta`,Win:`Meta`,win:`Meta`,CommandOrControl:`Mod`,Mod:`Mod`,commandorcontrol:`Mod`,mod:`Mod`};function mn(e,t=dn()){return e===`Mod`?t===`mac`?`Meta`:`Control`:e}var hn=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``)),gn=new Set([`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`]),_n=new Set([`F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7`,`F8`,`F9`,`F10`,`F11`,`F12`]),vn=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),yn=new Set([`Enter`,`Escape`,`Space`,`Tab`,`Backspace`,`Delete`]),bn=new Set([`/`,`[`,`]`,`\\`,`=`,`-`,`,`,`.`,`;`,"`"]),xn={Backquote:"`",Backslash:`\\`,BracketLeft:`[`,BracketRight:`]`,Comma:`,`,Equal:`=`,Minus:`-`,Period:`.`,Semicolon:`;`,Slash:`/`};new Set([...hn,...gn,..._n,...vn,...yn,...bn]);var Sn={Esc:`Escape`,esc:`Escape`,escape:`Escape`,Return:`Enter`,return:`Enter`,enter:`Enter`," ":`Space`,space:`Space`,Spacebar:`Space`,spacebar:`Space`,tab:`Tab`,backspace:`Backspace`,Del:`Delete`,del:`Delete`,delete:`Delete`,Up:`ArrowUp`,up:`ArrowUp`,arrowup:`ArrowUp`,Down:`ArrowDown`,down:`ArrowDown`,arrowdown:`ArrowDown`,Left:`ArrowLeft`,left:`ArrowLeft`,arrowleft:`ArrowLeft`,Right:`ArrowRight`,right:`ArrowRight`,arrowright:`ArrowRight`,home:`Home`,end:`End`,pageup:`PageUp`,pagedown:`PageDown`,PgUp:`PageUp`,PgDn:`PageDown`,pgup:`PageUp`,pgdn:`PageDown`};function Cn(e){return/^\p{Letter}$/u.test(e)}function wn(e){if(!e)return``;if(e in Sn)return Sn[e];if(Cn(e)){let t=e.toUpperCase();return t.length===1?t:e}let t=e.toUpperCase();return/^F([1-9]|1[0-2])$/.test(t)?t:e}function Tn(e,t=dn()){let n=e.split(`+`),r=new Set,i=``;for(let e=0;e<n.length;e++){let a=n[e].trim();if(e===n.length-1)i=wn(a);else{let e=pn[a]??pn[a.toLowerCase()];if(e){let n=mn(e,t);r.add(n)}else n.length===1&&(i=wn(a))}}return!i&&n.length>0&&(i=wn(n[n.length-1].trim())),{key:i,ctrl:r.has(`Control`),shift:r.has(`Shift`),alt:r.has(`Alt`),meta:r.has(`Meta`),modifiers:fn.filter(e=>r.has(e))}}function En(e,t=dn()){let n=e.ctrl??!1,r=e.shift??!1,i=e.alt??!1,a=e.meta??!1;e.mod&&(mn(`Mod`,t)===`Control`?n=!0:a=!0);let o=fn.filter(e=>{switch(e){case`Control`:return n;case`Shift`:return r;case`Alt`:return i;case`Meta`:return a;default:return!1}});return{key:e.key,ctrl:n,shift:r,alt:i,meta:a,modifiers:o}}function Dn(e,t){let n=t===`mac`?e.meta&&!e.ctrl:e.ctrl&&!e.meta,r=[];if(n)r.push(`Mod`),e.alt&&r.push(`Alt`),e.shift&&r.push(`Shift`);else for(let t of fn)e.modifiers.includes(t)&&r.push(t);return r.push(wn(e.key)),r.join(`+`)}function On(e,t=dn()){return Dn(Tn(e,t),t)}function kn(e,t=dn()){return Dn(e,t)}function An(e,t=dn()){return typeof e==`string`?On(e,t):kn(En(e,t),t)}function jn(e){let t=[];for(let n of fn)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join(`+`)}function Mn(e,t,n=dn()){let r=typeof t==`string`?Tn(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;let i=wn(e.key),a=r.key;if(i!==`Dead`&&i.length===1&&a.length===1){if(i.toUpperCase()===a.toUpperCase())return!0;if(Cn(i)&&(/^[A-Za-z]$/.test(i)||!e.altKey))return!1}if(e.code&&(i===`Dead`||i.length===1&&a.length===1)){if(e.code.startsWith(`Key`)){let t=e.code.slice(3);if(t.length===1&&/^[A-Za-z]$/.test(t))return t.toUpperCase()===a.toUpperCase()}if(e.code.startsWith(`Digit`)){let t=e.code.slice(5);if(t.length===1&&/^[0-9]$/.test(t))return t===a}return e.code in xn?xn[e.code]===a:!1}return i===a}var Nn={preventDefault:!0,stopPropagation:!0,eventType:`keydown`,enabled:!0,ignoreInputs:!0,conflictBehavior:`warn`};function Pn(e){return!(e.ctrl||e.meta||e.key===`Escape`)}function Fn(e){if(!e)return!1;if(e instanceof HTMLInputElement){let t=e.type.toLowerCase();return!(t===`button`||t===`submit`||t===`reset`)}return!!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable)}function In(e){return typeof document>`u`?null:typeof Document<`u`&&e instanceof Document||typeof Node<`u`&&e.nodeType===Node.DOCUMENT_NODE?e.activeElement:typeof HTMLElement<`u`&&e instanceof HTMLElement?e.ownerDocument.activeElement??null:e.document.activeElement??null}function Ln(e,t,n){let r=In(t);return r&&Fn(r)&&r!==n||e.composedPath().some(e=>Fn(e)&&e!==n)?!0:Fn(e.target)&&e.target!==n}function Rn(e,t){return t===document||t===window?e.currentTarget===t||e.currentTarget===document.documentElement:t===window?e.currentTarget===window||e.currentTarget===document||e.currentTarget===document.documentElement:!!(t instanceof HTMLElement&&(e.currentTarget===t||e.target instanceof Node&&t.contains(e.target)))}function zn(e,t,n,r){if(n!==`allow`){if(n===`warn`){console.warn(`'${t}' is already registered. Multiple handlers will be triggered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to suppress this warning.`);return}if(n===`error`)throw Error(`'${t}' is already registered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to allow multiple registrations.`);r(e)}}var W=function(e){return e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e}({});function Bn({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&(W.RecursedCheck|W.Recursed|W.Dirty|W.Pending)?a&(W.RecursedCheck|W.Recursed)?a&W.RecursedCheck?!(a&(W.Dirty|W.Pending))&&c(e,i)?(i.flags=a|(W.Recursed|W.Pending),a&=W.Mutable):a=W.None:i.flags=a&~W.Recursed|W.Pending:a=W.None:i.flags=a|W.Pending,a&W.Watching&&t(i),a&W.Mutable){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&W.Dirty)a=!0;else if((c&(W.Mutable|W.Dirty))===(W.Mutable|W.Dirty)){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&(W.Mutable|W.Pending))===(W.Mutable|W.Pending)){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=~W.Pending;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&(W.Pending|W.Dirty))===W.Pending&&(n.flags=r|W.Dirty,(r&(W.Watching|W.RecursedCheck))===W.Watching&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Vn(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Hn=[],Un=0,{link:Wn,unlink:Gn,propagate:Kn,checkDirty:qn,shallowPropagate:Jn}=Bn({update(e){return e._update()},notify(e){Hn[Xn++]=e,e.flags&=~W.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=W.Mutable|W.Dirty,$n(e))}}),Yn=0,Xn=0,Zn,Qn=0;function $n(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Gn(n,e)}function er(){if(!(Qn>0)){for(;Yn<Xn;){let e=Hn[Yn];Hn[Yn++]=void 0,e.notify()}Yn=0,Xn=0}}function tr(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?W.None:W.Mutable,get(){return Zn!==void 0&&Wn(i,Zn,Un),i._snapshot},subscribe(e){let t=Vn(e),n={current:!1},r=nr(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Zn,o=t?.compare??Object.is;if(n)Zn=i,++Un,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=W.Mutable|W.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Zn=a,n&&(i.flags&=~W.RecursedCheck),$n(i)}}};return n?(i.flags=W.Mutable|W.Dirty,i.get=function(){let e=i.flags;if(e&W.Dirty||e&W.Pending&&qn(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Jn(e)}}else e&W.Pending&&(i.flags=e&~W.Pending);return Zn!==void 0&&Wn(i,Zn,Un),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Kn(e),Jn(e),er())}},i}function nr(e){let t=()=>{let t=Zn;Zn=n,++Un,n.depsTail=void 0,n.flags=W.Watching|W.RecursedCheck;try{return e()}finally{Zn=t,n.flags&=~W.RecursedCheck,$n(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:W.Watching|W.RecursedCheck,notify(){let e=this.flags;e&W.Dirty||e&W.Pending&&qn(this.deps,this)?t():this.flags=W.Watching},stop(){this.flags=W.None,this.depsTail=void 0,$n(this)}};return t(),n}var rr=class{constructor(e,t){this.atom=tr(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(Vn(e))}},ir=0;function ar(){return`hotkey_${++ir}`}var or=class e{static#e=null;#t;#n=new Map;#r=new Map;constructor(){this.registrations=new rr(new Map),this.#t=dn()}static getInstance(){return e.#e||=new e,e.#e}static resetInstance(){e.#e&&=(e.#e.destroy(),null)}register(e,t,n={}){if(typeof document>`u`&&!n.target){let e=t;return{id:ar(),unregister:()=>{},get callback(){return e},set callback(t){e=t},setOptions:()=>{},get isActive(){return!1}}}let r=ar(),i=n.platform??this.#t,a=typeof e==`string`?Tn(e,i):En(e,i),o=typeof e==`string`?e:jn(a),s=n.target??document,c=n.conflictBehavior??`warn`,l=this.#d(o,s);l&&zn(l.id,o,c,e=>this.#i(e));let u=n.ignoreInputs??Pn(a),d={id:r,hotkey:o,parsedHotkey:a,callback:t,options:{...Nn,requireReset:!1,...n,platform:i,ignoreInputs:u},hasFired:!1,triggerCount:0,target:s};this.registrations.setState(e=>new Map(e).set(r,d)),this.#r.has(s)||this.#r.set(s,new Set),this.#r.get(s).add(r),this.#a(s);let f=this;return{get id(){return r},unregister:()=>{f.#i(r)},get callback(){return f.registrations.state.get(r)?.callback??t},set callback(e){let t=f.registrations.state.get(r);t&&(t.callback=e)},setOptions:e=>{f.registrations.setState(t=>{let n=t.get(r);if(n){let i=new Map(t);return i.set(r,{...n,options:{...n.options,...e}}),i}return t})},get isActive(){return f.registrations.state.has(r)}}}#i(e){let t=this.registrations.state.get(e);if(!t)return;let n=t.target;this.registrations.setState(t=>{let n=new Map(t);return n.delete(e),n});let r=this.#r.get(n);r&&(r.delete(e),r.size===0&&this.#o(n))}#a(e){if(typeof document>`u`||this.#n.has(e))return;let t=this.#l(e),n=this.#u(e);e.addEventListener(`keydown`,t),e.addEventListener(`keyup`,n),this.#n.set(e,{keydown:t,keyup:n})}#o(e){if(typeof document>`u`)return;let t=this.#n.get(e);t&&(e.removeEventListener(`keydown`,t.keydown),e.removeEventListener(`keyup`,t.keyup),this.#n.delete(e),this.#r.delete(e))}#s(e,t,n){let r=this.#r.get(t);if(r)for(let i of r){let r=this.registrations.state.get(i);if(r&&Rn(e,t)&&r.options.enabled&&!(r.options.ignoreInputs!==!1&&Ln(e,t,r.target)))if(n===`keydown`){if(r.options.eventType!==`keydown`)continue;Mn(e,r.parsedHotkey,r.options.platform)&&(r.options.preventDefault&&e.preventDefault(),r.options.stopPropagation&&e.stopPropagation(),(!r.options.requireReset||!r.hasFired)&&(this.#c(r,e),r.options.requireReset&&(r.hasFired=!0)))}else r.options.eventType===`keyup`&&Mn(e,r.parsedHotkey,r.options.platform)&&this.#c(r,e),r.options.requireReset&&r.hasFired&&this.#f(r,e)&&(r.hasFired=!1)}}#c(e,t){e.options.preventDefault&&t.preventDefault(),e.options.stopPropagation&&t.stopPropagation(),e.triggerCount++,this.registrations.setState(e=>new Map(e));let n={hotkey:e.hotkey,parsedHotkey:e.parsedHotkey};e.callback(t,n)}#l(e){return t=>{this.#s(t,e,`keydown`)}}#u(e){return t=>{this.#s(t,e,`keyup`)}}#d(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&n.target===t)return n;return null}#f(e,t){let n=e.parsedHotkey,r=wn(t.key),i=n.key.length===1?n.key.toUpperCase():n.key;return!!((r.length===1?r.toUpperCase():r)===i||n.ctrl&&r===`Control`||n.shift&&r===`Shift`||n.alt&&r===`Alt`||n.meta&&r===`Meta`)}triggerRegistration(e){let t=this.registrations.state.get(e);if(!t)return!1;let n=t.parsedHotkey,r=new KeyboardEvent(t.options.eventType??`keydown`,{key:n.key,ctrlKey:n.ctrl,shiftKey:n.shift,altKey:n.alt,metaKey:n.meta,bubbles:!0,cancelable:!0});return t.triggerCount++,this.registrations.setState(e=>new Map(e)),t.callback(r,{hotkey:t.hotkey,parsedHotkey:t.parsedHotkey}),!0}getRegistrationCount(){return this.registrations.state.size}isRegistered(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&(t===void 0||n.target===t))return!0;return!1}destroy(){for(let e of this.#n.keys())this.#o(e);this.registrations.setState(()=>new Map),this.#n.clear(),this.#r.clear()}};function sr(){return or.getInstance()}function cr(e,t,n={}){let r={...ln().hotkey,...n},i=sr(),a=(0,U.useRef)(null),o=(0,U.useRef)(t),s=(0,U.useRef)(r),c=(0,U.useRef)(i);o.current=t,s.current=r,c.current=i;let l=(0,U.useRef)(null),u=(0,U.useRef)(null),d=An(e,r.platform??dn()),{target:f,...p}=r;(0,U.useEffect)(()=>{let e=un(s.current.target)?s.current.target.current:s.current.target??(typeof document<`u`?document:null);if(!e){a.current?.isActive&&(a.current.unregister(),a.current=null),l.current=null,u.current=null;return}let t=l.current!==null&&l.current!==e,n=u.current!==null&&u.current!==d;return a.current?.isActive&&(t||n)&&(a.current.unregister(),a.current=null),(!a.current||!a.current.isActive)&&(a.current=c.current.register(d,o.current,{...s.current,target:e})),l.current=e,u.current=d,()=>{a.current?.isActive&&(a.current.unregister(),a.current=null)}},[d]),a.current?.isActive&&(a.current.callback=t,a.current.setOptions(p))}var lr=`diffs-container`;(()=>{try{return!1}catch{return!1}})();var ur=/(?=^From [a-f0-9]+ .+$)/m,dr=/(?=^diff --git)/gm,fr=/(?<=\n)/,pr=/^(---|\+\+\+)\s+([^\t\r\n]+)/,mr=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,hr=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,gr=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,_r=`header-prefix`,vr=`header-metadata`,yr=`header-custom`,G={dark:`pierre-dark`,light:`pierre-light`},br=`data-theme-css`,xr=`data-unsafe-css`,Sr=`data-diffs-scrollbar-measure`,Cr=`--diffs-scrollbar-gutter-measured`,wr=1e5,Tr={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8};({...Tr});var Er=Object.freeze({fromStart:0,fromEnd:0}),Dr={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Or={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function kr(e){return e.replace(/\n$|\r\n$/,``)}var Ar=new TextEncoder,jr=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Mr=/[\uD800-\uDFFF]/,Nr=1024,Pr=new Uint8Array(Nr);function Fr(){Pr.length!==Nr&&(Pr=new Uint8Array(Nr))}function K(e){if(e.length===0)return e;if(Mr.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Pr.length<t&&(Pr=new Uint8Array(t));let{written:n}=Ar.encodeInto(e,Pr);return jr.decode(Pr.subarray(0,n))}function Ir(e,t,n){try{return Lr(e,t,n)}finally{Fr()}}function Lr(e,t,n=!1){let r=ti(e),i=r?Wr(e):Gr(e),a,o=[];for(let e of i){if(r&&!dr.test(e)){if(a==null)a=K(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}else if(!r&&!Kr(e)){if(a==null)a=K(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let i=zr(e,{cacheKey:t==null?void 0:`${t}-${o.length}`,isGitDiff:r,throwOnError:n});i!=null&&o.push(i)}return{patchMetadata:a,files:o}}function Rr(e,t){try{return zr(e,t)}finally{Fr()}}function zr(e,{cacheKey:t,isGitDiff:n=dr.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=ni(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=Ur(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=Qr(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?Hr(i.contents):[],deletionLines:!l&&r!=null&&i!=null?Hr(r.contents):[],cacheKey:ii(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(hr),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=K(r.trim()),n!==r&&(c.prevName=K(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?mr:pr):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=K(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=K(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=K(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=K(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=K(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=K(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(gr)??[];t!=null&&(c.prevObjectId=K(t)),n!=null&&(c.newObjectId=K(n)),r!=null&&(c.mode=K(r))}e.startsWith(`rename from `)&&(c.prevName=K(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=K(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
3
3
  `||s[s.length-1]===`\r`||s[s.length-1]===`\r
4
- `||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:Jr(p.hunkContext),hunkSpecs:q(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(a&&Br(t)&&!Vr(t))throw Error(`parsePatchContent: hunk has more lines than expected`);break}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=Yr(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=Xr(t);(g==null||g.type!==`change`)&&(g=Zr(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=Xr(t);(g==null||g.type!==`change`)&&(g=Zr(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=Xr(t);(g==null||g.type!==`context`)&&(g=Zr(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=yr(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=yr(c.deletionLines[e]))}}}if(a&&(x!==b.additionCount||S!==b.deletionCount))throw Error(`parsePatchContent: hunk line count mismatch`);b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(b.additionStart-1-o,0),c.hunks.push(b),o=b.additionStart+b.additionCount-1;for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=e.additionStart+e.additionCount-1,n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),c}}function Ar(e,t,n=!1){let r=[],i=jr(e)?e.split(er):[e];for(let e of i)try{r.push(Er(e,t==null?void 0:`${t}-${r.length}`,n))}catch(e){if(n)throw e;console.error(e)}return r}function jr(e){return e.startsWith(`From `)||e.includes(`
5
- From `)}function Mr(e){let t=Nr(e);for(let e=0;e<t.length;e++)t[e]=q(t[e]);return t}function Nr(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
6
- `,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function Pr(e){return Kr(e,`diff --git`)}function Fr(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=zr(e,r);if(i<=0&&a<=0){if(Lr(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=zr(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=Hr(e.slice(r,s));t!=null&&(i=t.deletionCount,a=t.additionCount)}r=s;continue}let c=e[r];if(c===`\\`){r=s;continue}c===` `?(i=Math.max(i-1,0),a=Math.max(a-1,0)):c===`-`?i=Math.max(i-1,0):c===`+`&&(a=Math.max(a-1,0)),r=s}return t.push(e.slice(n)),t}function Ir(e){return Lr(e,0)}function Lr(e,t){let n=zr(e,t);return Rr(e,t,`---`)&&Rr(e,n,`+++`)}function Rr(e,t,n){if(!e.startsWith(n,t))return!1;let r=e[t+n.length];if(r!==` `&&r!==` `)return!1;for(let r=t+n.length+1;r<e.length;r++){let t=e[r];if(t===`
7
- `||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function zr(e,t){let n=e.indexOf(`
8
- `,t);return n===-1?e.length:n+1}function Br(e){let t=e[0];return t===`+`||t===`-`||t===` `}function Vr(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
9
- `&&n!==`\r`)return!1}return!0}function Hr(e){if(!e.startsWith(`@@ -`))return;let t=4,n=Ur(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=Ur(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=Ur(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=Ur(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=Wr(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function Ur(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function Wr(e){return e.endsWith(`\r
4
+ `||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:ii(p.hunkContext),hunkSpecs:K(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(a&&Xr(t)&&!Zr(t))throw Error(`parsePatchContent: hunk has more lines than expected`);break}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=ai(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=oi(t);(g==null||g.type!==`change`)&&(g=si(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=oi(t);(g==null||g.type!==`change`)&&(g=si(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=oi(t);(g==null||g.type!==`context`)&&(g=si(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=kr(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=kr(c.deletionLines[e]))}}}if(a&&(x!==b.additionCount||S!==b.deletionCount))throw Error(`parsePatchContent: hunk line count mismatch`);b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(b.additionStart-1-o,0),c.hunks.push(b),o=b.additionStart+b.additionCount-1;for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=e.additionStart+e.additionCount-1,n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),c}}function Br(e,t,n=!1){let r=[],i=Vr(e)?e.split(ur):[e];for(let e of i)try{r.push(Ir(e,t==null?void 0:`${t}-${r.length}`,n))}catch(e){if(n)throw e;console.error(e)}return r}function Vr(e){return e.startsWith(`From `)||e.includes(`
5
+ From `)}function Hr(e){let t=Ur(e);for(let e=0;e<t.length;e++)t[e]=K(t[e]);return t}function Ur(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
6
+ `,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function Wr(e){return ni(e,`diff --git`)}function Gr(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=Yr(e,r);if(i<=0&&a<=0){if(qr(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=Yr(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=Qr(e.slice(r,s));t!=null&&(i=t.deletionCount,a=t.additionCount)}r=s;continue}let c=e[r];if(c===`\\`){r=s;continue}c===` `?(i=Math.max(i-1,0),a=Math.max(a-1,0)):c===`-`?i=Math.max(i-1,0):c===`+`&&(a=Math.max(a-1,0)),r=s}return t.push(e.slice(n)),t}function Kr(e){return qr(e,0)}function qr(e,t){let n=Yr(e,t);return Jr(e,t,`---`)&&Jr(e,n,`+++`)}function Jr(e,t,n){if(!e.startsWith(n,t))return!1;let r=e[t+n.length];if(r!==` `&&r!==` `)return!1;for(let r=t+n.length+1;r<e.length;r++){let t=e[r];if(t===`
7
+ `||t===`\r`)break;if(t!==` `&&t!==` `)return!0}return!1}function Yr(e,t){let n=e.indexOf(`
8
+ `,t);return n===-1?e.length:n+1}function Xr(e){let t=e[0];return t===`+`||t===`-`||t===` `}function Zr(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
9
+ `&&n!==`\r`)return!1}return!0}function Qr(e){if(!e.startsWith(`@@ -`))return;let t=4,n=$r(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=$r(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=$r(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=$r(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=ei(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function $r(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function ei(e){return e.endsWith(`\r
10
10
  `)?e.slice(0,-2):e.endsWith(`
11
- `)?e.slice(0,-1):e}function Gr(e){return e.startsWith(`diff --git`)||e.includes(`
12
- diff --git`)}function Kr(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:qr(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=qr(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function qr(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function Jr(e){return e==null?e:q(e)}function Yr(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function Xr(e){let t=e.slice(1);return q(t===``?`
13
- `:t)}function Zr(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}function Qr(e){let t=Ar(e);if(t.length!==1)throw console.error(t),Error(`PatchDiff: Provided patch must include only 1 patch, with 1 diff`);let{files:n}=t[0];if(n.length!==1)throw console.error(n),Error(`FileDiff: Provided patch must contain exactly 1 file diff`);return n[0]}function $r(e,t){return{...e,lang:t}}function ei(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}var ti={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},ni={display:`contents`};function ri(){return null}var J=t();function ii({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderMetadata:r,renderAnnotation:i,lineAnnotations:a,renderGutterUtility:o,getHoveredLine:s}){let c=t?.(e),l=n?.(e),u=r?.(e);return(0,J.jsxs)(J.Fragment,{children:[c==null?(0,J.jsxs)(J.Fragment,{children:[l!=null&&(0,J.jsx)(`div`,{slot:`header-prefix`,children:l}),u!=null&&(0,J.jsx)(`div`,{slot:`header-metadata`,children:u})]}):(0,J.jsx)(`div`,{slot:lr,children:c}),i!=null&&a?.map((e,t)=>(0,J.jsx)(`div`,{slot:ei(e),children:i(e)},t)),o!=null&&(0,J.jsx)(`div`,{slot:`gutter-utility-slot`,style:ti,children:o(s)})]})}function ai(e,t){return typeof window>`u`&&t!=null?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,J.jsx)(J.Fragment,{children:e})}function oi(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function si(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function ci(e,t){let n=e?.theme??K,r=t?.theme??K,i=li(e),a=li(t);return si(n,r)&&oi(e,t,[`theme`,`parseDiffOptions`])&&oi(i,a)}function li(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}function ui(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function di(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function fi(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function pi(e){return{type:`text`,value:e}}function Y({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function mi({name:e,width:t=16,height:n=16,properties:r}){return Y({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[Y({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function hi(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function gi(e){return Y({tagName:`div`,properties:{"data-gutter":``},children:e})}function _i(e,t,n,r={}){return Y({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[Y({tagName:`span`,properties:{"data-line-number-content":``},children:[pi(`${t}`)]})]})}function vi(e,t,n){return Y({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function yi(){return Y({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[mi({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}var bi=class{hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;proposedSelectedRange;renderedSelectionRange;selectionAnchor;queuedSelectionRender;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectionRange=void 0}isSelectionDirty(){return this.renderedSelectionRange===null}setSelection(e,t){let n=!(e===this.selectedRange||di(e??void 0,this.selectedRange??void 0));!this.isSelectionDirty()&&!n||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;t==null&&n==null&&r==null&&a==null&&i==null||this.options.onGutterUtilityClick!=null&&Li(e.composedPath())||(Ri(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e}))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;t===`disabled`&&!o&&n==null&&r==null&&i==null&&a==null||(Ri(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(Ri(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){Ri(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();Ri(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);Ri(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=Ti(i)&&this.hoveredLine?.lineElement===i.lineElement;wi(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),wi(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Ti(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(Di(i)&&p!=null){p(i);break}if(Ei(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Ti(i))break;wi(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,Ri(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),Ri(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),Ri(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();Li(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;e.preventDefault();let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;if(n==null)return;let r=this.currentSelectionEnds(),i=r?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),a=r?.top??i;i==null||a==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:a,current:i},t&&(this.selectionAnchor={lineNumber:a.lineNumber,side:a.side},this.updateSelection(i.lineNumber,i.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange())),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{let{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let n=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(n==null)return;this.pointerSession.current=n,t===!0&&this.updateSelection(n.lineNumber,n.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(fi(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(this.pointerSession.current=r,t&&this.updateSelection(r.lineNumber,r.side)),n?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=ge(yi());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);Ci(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(!(r==null||i==null))return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(Ai(t));if(Ci(n)&&!(this.mode===`diff`&&e.side!=null&&n.side!==e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(Ci(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(Ci(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&Li(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=Ai(e);if(t&&Li(n))return;let r=ji(e);return r==null?this.pathFromAnnotationSlot(e):Ai(r)}pathFromAnnotationSlot(e){let t=Ni(Mi(e));if(t==null)return;let n=this.targetForSelectionPoint(t);return n==null?void 0:Ai(n.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=Pi(t)?t:Pi(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}di(r??void 0,i??void 0)||(this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,this.queuedSelectionRender??=requestAnimationFrame(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}renderSelection=()=>{if(this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;let e=this.pre.querySelectorAll(`[data-selected-line]`);for(let t of e)t.removeAttribute(`data-selected-line`);if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;let{children:t}=this.pre;if(t.length===0)return;if(t.length>2)throw console.error(t),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let n=this.pre.getAttribute(`data-diff-type`)===`split`,r=this.getIndexesFromSelection(this.selectedRange,n);if(r==null)throw console.error({rowRange:r,selectedRange:this.selectedRange}),Error(`InteractionManager.renderSelection: No valid rowRange`);let i=r.start===r.end,a=Math.min(r.start,r.end),o=Math.max(r.start,r.end);for(let e of t){let[t,r]=e.children,s=r.children.length;if(s!==t.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);for(let e=0;e<s;e++){let s=r.children[e],c=t.children[e];if(!(s instanceof HTMLElement)||!(c instanceof HTMLElement))continue;let l=this.parseLineIndex(s,n);if((l??0)>o)break;if(l==null||l<a)continue;let u=i?`single`:l===a?`first`:l===o?`last`:``;s.setAttribute(`data-selected-line`,u),c.setAttribute(`data-selected-line`,u),c.nextSibling instanceof HTMLElement&&s.nextSibling instanceof HTMLElement&&(s.nextSibling.hasAttribute(`data-line-annotation`)||s.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(i?(u=`last`,s.setAttribute(`data-selected-line`,`first`)):l===a?u=``:l===o&&s.setAttribute(`data-selected-line`,``),s.nextSibling.setAttribute(`data-selected-line`,u),c.nextSibling.setAttribute(`data-selected-line`,u))}}};notifySelectionCommitted(){this.options.onLineSelected?.(this.getCurrentSelectionRange()??null)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);Oi(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=Ii(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=Ii(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:ki(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:ki(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:Fi(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:Fi(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function xi({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:Si({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function Si({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function Ci(e){return e!=null&&`kind`in e&&e.kind===`line`}function wi(e){return e!=null&&`kind`in e&&e.kind===`token`}function Ti(e){return Ci(e)||wi(e)}function Ei(e){return`type`in e&&e.type===`line-info`}function Di(e){return`kind`in e&&e.kind===`merge-conflict-action`}function Oi(e){return e===`current`||e===`incoming`||e===`both`}function ki(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Ai(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function ji(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function Mi(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function Ni(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function Pi(e){return e!=null&&typeof e.elementFromPoint==`function`}function Fi(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function Ii(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}function Li(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}function Ri(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return;break}console.log(...n)}var zi=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,t){let n=new Set,r=0,i=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(r===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;r++;let n=i.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let a=e.firstElementChild;a instanceof HTMLElement||(a=null),n==null?(n={type:`code`,codeElement:e,numberElement:a,codeWidth:`auto`,numberWidth:0},this.observedNodes.set(e,n),this.observe(e),a!=null&&(this.observedNodes.set(a,n),this.observe(a))):(this.observedNodes.set(e,n),i.delete(e),n.numberElement===a?n.numberElement==null?n.numberWidth=0:(i.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),i.delete(n.numberElement)),a!=null&&(this.observe(a),i.delete(a),this.observedNodes.set(a,n)),n.numberElement=a,n.numberWidth=0))}if(r>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),r=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let n=r.get(t);n??(n=[],r.set(t,n)),n.push(e)}for(let[e,t]of r){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[r,a]=t,o=r.firstElementChild,s=a.firstElementChild;if(!(r instanceof HTMLElement)||!(a instanceof HTMLElement)||!(o instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=i.get(o);if(c!=null){this.observedNodes.set(o,c),this.observedNodes.set(s,c),i.delete(o),i.delete(s);continue}let l=o.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:r,child:o,childHeight:l},column2:{container:a,child:s,childHeight:u},currentHeight:`auto`},n.add({child1:o,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of n)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);n.clear()}for(let[e,t]of i)this.unobserve(e),t.type===`code`?Hi(t):Ui(t);i.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:Bi(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:Vi(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;if(!(!i&&!a)&&(t.codeWidth=e,t.numberWidth=r,i&&t.codeElement.style.setProperty(`--diffs-column-width`,`${typeof e==`number`?`${e}px`:`auto`}`),a&&t.codeElement.style.setProperty(`--diffs-column-number-width`,`${r===0?`auto`:`${r}px`}`),i||a&&e!==`auto`)){let n=typeof e==`number`?Math.max(e-r,0):0;t.codeElement.style.setProperty(`--diffs-column-content-width`,`${n>0?`${n}px`:`auto`}`)}}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function Bi(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function Vi(e){return Math.max(Math.ceil(e),0)}function Hi(e){e.codeElement.isConnected&&(e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`))}function Ui(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}function Wi(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Gi(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}var Ki=new Map,qi={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function Ji(e){if(Ki.has(e))return Ki.get(e)??`text`;if(qi[e]!=null)return qi[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Ki.has(t[1]))return Ki.get(t[1])??`text`;if(qi[t[1]]!=null)return qi[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return Ki.has(n)?Ki.get(n)??`text`:qi[n]??`text`}function Yi(e){return(e.lang??Ji(e.name))===`text`}var Xi=`-1,-1`;function Zi(e){return e?.some(e=>e.lineNumber===0)??!1}function Qi(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function $i(e){return e.startingLine===0&&e.totalLines>0}function ea({lines:e,startingLine:t=0,totalLines:n=1/0,callback:r}){let i=Math.min(t+n,e.length),a=(()=>{let t=e.at(-1);return t===``||t===`
11
+ `)?e.slice(0,-1):e}function ti(e){return e.startsWith(`diff --git`)||e.includes(`
12
+ diff --git`)}function ni(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:ri(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=ri(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function ri(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function ii(e){return e==null?e:K(e)}function ai(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function oi(e){let t=e.slice(1);return K(t===``?`
13
+ `:t)}function si(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}function ci(e){let t=Br(e);if(t.length!==1)throw console.error(t),Error(`PatchDiff: Provided patch must include only 1 patch, with 1 diff`);let{files:n}=t[0];if(n.length!==1)throw console.error(n),Error(`FileDiff: Provided patch must contain exactly 1 file diff`);return n[0]}function li(e,t){return{...e,lang:t}}function ui(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}var di={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},fi={display:`contents`};function pi(){return null}var q=t();function mi({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderMetadata:r,renderAnnotation:i,lineAnnotations:a,renderGutterUtility:o,getHoveredLine:s}){let c=t?.(e),l=n?.(e),u=r?.(e);return(0,q.jsxs)(q.Fragment,{children:[c==null?(0,q.jsxs)(q.Fragment,{children:[l!=null&&(0,q.jsx)(`div`,{slot:`header-prefix`,children:l}),u!=null&&(0,q.jsx)(`div`,{slot:`header-metadata`,children:u})]}):(0,q.jsx)(`div`,{slot:yr,children:c}),i!=null&&a?.map((e,t)=>(0,q.jsx)(`div`,{slot:ui(e),children:i(e)},t)),o!=null&&(0,q.jsx)(`div`,{slot:`gutter-utility-slot`,style:di,children:o(s)})]})}function hi(e,t){return typeof window>`u`&&t!=null?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,q.jsx)(q.Fragment,{children:e})}function gi(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function _i(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function vi(e,t){let n=e?.theme??G,r=t?.theme??G,i=yi(e),a=yi(t);return _i(n,r)&&gi(e,t,[`theme`,`parseDiffOptions`])&&gi(i,a)}function yi(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}function bi(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function xi(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Si(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function Ci(e){return{type:`text`,value:e}}function J({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function wi({name:e,width:t=16,height:n=16,properties:r}){return J({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[J({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function Ti(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function Ei(e){return J({tagName:`div`,properties:{"data-gutter":``},children:e})}function Di(e,t,n,r={}){return J({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[J({tagName:`span`,properties:{"data-line-number-content":``},children:[Ci(`${t}`)]})]})}function Oi(e,t,n){return J({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function ki(){return J({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[wi({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}var Ai=class{hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;proposedSelectedRange;renderedSelectionRange;selectionAnchor;queuedSelectionRender;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectionRange=void 0}isSelectionDirty(){return this.renderedSelectionRange===null}setSelection(e,t){let n=!(e===this.selectedRange||xi(e??void 0,this.selectedRange??void 0));!this.isSelectionDirty()&&!n||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;t==null&&n==null&&r==null&&a==null&&i==null||this.options.onGutterUtilityClick!=null&&qi(e.composedPath())||(Ji(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e}))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;t===`disabled`&&!o&&n==null&&r==null&&i==null&&a==null||(Ji(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(Ji(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){Ji(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();Ji(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);Ji(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=Fi(i)&&this.hoveredLine?.lineElement===i.lineElement;Pi(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),Pi(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Fi(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(Li(i)&&p!=null){p(i);break}if(Ii(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Fi(i))break;Pi(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,Ji(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),Ji(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),Ji(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();qi(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;e.preventDefault();let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;if(n==null)return;let r=this.currentSelectionEnds(),i=r?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),a=r?.top??i;i==null||a==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:a,current:i},t&&(this.selectionAnchor={lineNumber:a.lineNumber,side:a.side},this.updateSelection(i.lineNumber,i.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange())),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{let{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let n=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(n==null)return;this.pointerSession.current=n,t===!0&&this.updateSelection(n.lineNumber,n.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(Si(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(this.pointerSession.current=r,t&&this.updateSelection(r.lineNumber,r.side)),n?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=Ce(ki());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);Ni(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(!(r==null||i==null))return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(Bi(t));if(Ni(n)&&!(this.mode===`diff`&&e.side!=null&&n.side!==e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(Ni(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(Ni(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&qi(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=Bi(e);if(t&&qi(n))return;let r=Vi(e);return r==null?this.pathFromAnnotationSlot(e):Bi(r)}pathFromAnnotationSlot(e){let t=Ui(Hi(e));if(t==null)return;let n=this.targetForSelectionPoint(t);return n==null?void 0:Bi(n.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=Wi(t)?t:Wi(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}xi(r??void 0,i??void 0)||(this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,this.queuedSelectionRender??=requestAnimationFrame(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}renderSelection=()=>{if(this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;let e=this.pre.querySelectorAll(`[data-selected-line]`);for(let t of e)t.removeAttribute(`data-selected-line`);if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;let{children:t}=this.pre;if(t.length===0)return;if(t.length>2)throw console.error(t),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let n=this.pre.getAttribute(`data-diff-type`)===`split`,r=this.getIndexesFromSelection(this.selectedRange,n);if(r==null)throw console.error({rowRange:r,selectedRange:this.selectedRange}),Error(`InteractionManager.renderSelection: No valid rowRange`);let i=r.start===r.end,a=Math.min(r.start,r.end),o=Math.max(r.start,r.end);for(let e of t){let[t,r]=e.children,s=r.children.length;if(s!==t.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);for(let e=0;e<s;e++){let s=r.children[e],c=t.children[e];if(!(s instanceof HTMLElement)||!(c instanceof HTMLElement))continue;let l=this.parseLineIndex(s,n);if((l??0)>o)break;if(l==null||l<a)continue;let u=i?`single`:l===a?`first`:l===o?`last`:``;s.setAttribute(`data-selected-line`,u),c.setAttribute(`data-selected-line`,u),c.nextSibling instanceof HTMLElement&&s.nextSibling instanceof HTMLElement&&(s.nextSibling.hasAttribute(`data-line-annotation`)||s.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(i?(u=`last`,s.setAttribute(`data-selected-line`,`first`)):l===a?u=``:l===o&&s.setAttribute(`data-selected-line`,``),s.nextSibling.setAttribute(`data-selected-line`,u),c.nextSibling.setAttribute(`data-selected-line`,u))}}};notifySelectionCommitted(){this.options.onLineSelected?.(this.getCurrentSelectionRange()??null)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);Ri(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=Ki(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=Ki(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:zi(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:zi(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:Gi(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:Gi(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function ji({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:Mi({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function Mi({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function Ni(e){return e!=null&&`kind`in e&&e.kind===`line`}function Pi(e){return e!=null&&`kind`in e&&e.kind===`token`}function Fi(e){return Ni(e)||Pi(e)}function Ii(e){return`type`in e&&e.type===`line-info`}function Li(e){return`kind`in e&&e.kind===`merge-conflict-action`}function Ri(e){return e===`current`||e===`incoming`||e===`both`}function zi(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Bi(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Vi(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function Hi(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function Ui(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function Wi(e){return e!=null&&typeof e.elementFromPoint==`function`}function Gi(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function Ki(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}function qi(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}function Ji(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return;break}console.log(...n)}var Yi=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,t){let n=new Set,r=0,i=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(r===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;r++;let n=i.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let a=e.firstElementChild;a instanceof HTMLElement||(a=null),n==null?(n={type:`code`,codeElement:e,numberElement:a,codeWidth:`auto`,numberWidth:0},this.observedNodes.set(e,n),this.observe(e),a!=null&&(this.observedNodes.set(a,n),this.observe(a))):(this.observedNodes.set(e,n),i.delete(e),n.numberElement===a?n.numberElement==null?n.numberWidth=0:(i.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),i.delete(n.numberElement)),a!=null&&(this.observe(a),i.delete(a),this.observedNodes.set(a,n)),n.numberElement=a,n.numberWidth=0))}if(r>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),r=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let n=r.get(t);n??(n=[],r.set(t,n)),n.push(e)}for(let[e,t]of r){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[r,a]=t,o=r.firstElementChild,s=a.firstElementChild;if(!(r instanceof HTMLElement)||!(a instanceof HTMLElement)||!(o instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=i.get(o);if(c!=null){this.observedNodes.set(o,c),this.observedNodes.set(s,c),i.delete(o),i.delete(s);continue}let l=o.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:r,child:o,childHeight:l},column2:{container:a,child:s,childHeight:u},currentHeight:`auto`},n.add({child1:o,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of n)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);n.clear()}for(let[e,t]of i)this.unobserve(e),t.type===`code`?Qi(t):$i(t);i.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:Xi(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:Zi(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;if(!(!i&&!a)&&(t.codeWidth=e,t.numberWidth=r,i&&t.codeElement.style.setProperty(`--diffs-column-width`,`${typeof e==`number`?`${e}px`:`auto`}`),a&&t.codeElement.style.setProperty(`--diffs-column-number-width`,`${r===0?`auto`:`${r}px`}`),i||a&&e!==`auto`)){let n=typeof e==`number`?Math.max(e-r,0):0;t.codeElement.style.setProperty(`--diffs-column-content-width`,`${n>0?`${n}px`:`auto`}`)}}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function Xi(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function Zi(e){return Math.max(Math.ceil(e),0)}function Qi(e){e.codeElement.isConnected&&(e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`))}function $i(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}function ea(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function ta(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}var na=new Map,ra={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function ia(e){if(na.has(e))return na.get(e)??`text`;if(ra[e]!=null)return ra[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(na.has(t[1]))return na.get(t[1])??`text`;if(ra[t[1]]!=null)return ra[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return na.has(n)?na.get(n)??`text`:ra[n]??`text`}function aa(e){return(e.lang??ia(e.name))===`text`}var oa=`-1,-1`;function sa(e){return e?.some(e=>e.lineNumber===0)??!1}function ca(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function la(e){return e.startingLine===0&&e.totalLines>0}function ua({lines:e,startingLine:t=0,totalLines:n=1/0,callback:r}){let i=Math.min(t+n,e.length),a=(()=>{let t=e.at(-1);return t===``||t===`
14
14
  `||t===`\r
15
- `||t===`\r`?Math.max(0,e.length-2):e.length-1})();for(let n=t;n<i;n++){let t=n===a;if(r({lineIndex:n,lineNumber:n+1,content:e[n],isLastLine:t})===!0||t)break}}function ta(e){for(let t of Array.isArray(e)?e:[e])if(!(t===`text`||t===`ansi`)&&!ke.has(t))return!1;return!0}function na(e=K){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}function ra(e){for(let t of na(e))if(!Oe.has(t))return!1;return!0}function ia(e){return Ae.hasResolvedThemes(e)}function aa(e,t){return si(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function oa(e){return Y({tagName:`div`,children:[Y({tagName:`div`,children:e.annotations?.map(e=>Y({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function sa(e,t){return Y({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function ca(e){switch(e){case`file`:return`diffs-icon-file-code`;case`change`:return`diffs-icon-symbol-modified`;case`new`:return`diffs-icon-symbol-added`;case`deleted`:return`diffs-icon-symbol-deleted`;case`rename-pure`:case`rename-changed`:return`diffs-icon-symbol-moved`}}function la({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return Y({tagName:`div`,children:[t===`custom`?Y({tagName:`slot`,properties:{name:lr}}):ua({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[da(r)]],properties:i})}function ua({name:e,prevName:t,iconType:n}){let r=[Y({tagName:`slot`,properties:{name:sr}}),mi({name:ca(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(Y({tagName:`div`,children:[Y({tagName:`bdi`,children:[pi(t)]})],properties:{"data-prev-name":``}})),r.push(mi({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(Y({tagName:`div`,children:[Y({tagName:`bdi`,children:[pi(e)]})],properties:{"data-title":``}})),Y({tagName:`div`,children:r,properties:{"data-header-content":``}})}function da(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(Y({tagName:`span`,children:[pi(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(Y({tagName:`span`,children:[pi(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(Y({tagName:`slot`,properties:{name:cr}})),Y({tagName:`div`,children:t,properties:{"data-metadata":``}})}function fa(e){return Y({tagName:`pre`,properties:pa(e)})}function pa({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,tabIndex:0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}function ma(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:na(t),preferredHighlighter:n}}function ha(e){return e===``?[]:e.split(nr)}function ga(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(pi(`
16
- `)),e}var _a=Symbol(`no-token`),va=Symbol(`multiple-tokens`);function ya(e){let t=ba(e);if(t!=null)return t;let n=_a,r=[],i=[],a,o=()=>{if(i.length===0||a==null){i=[],a=void 0;return}if(i.length===1){let e=i[0];if(e?.type===`element`){Sa(e,a);for(let t of e.children)xa(t)}else xa(e);r.push(e),i=[],a=void 0;return}for(let e of i)xa(e);r.push(Y({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==_a){if(e===va){n=va;return}if(n===_a){n=e;return}n!==e&&(n=va)}};for(let t of e.children){let e=t.type===`element`?ya(t):_a;if(s(e),typeof e!=`number`){o(),r.push(t);continue}a!=null&&a!==e&&o(),a??=e,i.push(t)}return o(),e.children=r,n}function ba(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function xa(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)xa(t)}}function Sa(e,t){e.properties[`data-char`]=t}function Ca(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=t+wa(typeof e==`string`?e:a(e))+n;return o=r(o),i.has(o)||i.set(o,typeof e==`string`?e:{...e}),o}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function wa(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}function Ta(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=hi(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&ya(a),i.push(ga(a,t,n)),t++);r.children=i}return t},...e?{tokens(e){for(let t of e){let e=0;for(let n of t){let t=n;t.__lineChar??=e,e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces=`never`},span(e,t,n,r,i){if(i?.offset!=null&&i.content!=null){let t=i.__lineChar;return t!=null&&(e.properties[`data-char`]=t),e}return e}}:null}];return t&&r.push(Da,Ea),{state:n,transformers:r,toClass:Ea}}var Ea=Ca({classPrefix:`hl-`}),Da={name:`token-style-normalizer`,tokens(e){for(let t of e)for(let e of t){if(e.htmlStyle!=null)continue;let t={};e.color!=null&&(t.color=e.color),e.bgColor!=null&&(t[`background-color`]=e.bgColor),e.fontStyle!=null&&e.fontStyle!==0&&(e.fontStyle&1&&(t[`font-style`]=`italic`),e.fontStyle&2&&(t[`font-weight`]=`bold`),e.fontStyle&4&&(t[`text-decoration`]=`underline`)),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function Oa(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var ka=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Aa=/^0(?:\.0+)?%?$/;function ja(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function Ma(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let n=t[1],r,i=1;return n.length===3?r=n.split(``).map(e=>e+e).join(``):n.length===6?r=n:(r=n.slice(0,6),i=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),i]}function Na(e){if(e==null)return null;let t=Ma(e);if(t==null)return null;let n=t[0]/255,r=t[1]/255,i=t[2]/255,a=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*a(n)+.7152*a(r)+.0722*a(i)}function Pa(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||ka.test(t))return!0;let n=ja(t);return n!=null&&Aa.test(n)}function Fa(e,t,n){if(t==null||n==null)return!1;let r=Na(e),i=Na(t),a=Na(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var Ia=new WeakMap;function La(e){let t=Ia.get(e);if(t!=null)return t;let n=e.colors??{},r={...n},i=n[`editor.background`]??e.bg,a=n[`editor.foreground`]??e.fg,o=n[`sideBar.background`]??i,s=n[`sideBar.foreground`]??a;Ra(r,`editor.background`,i),Ra(r,`editor.foreground`,a),Ra(r,`sideBar.background`,o),Ra(r,`sideBar.foreground`,s),Ra(r,`input.background`,n[`input.background`]??o),Ra(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),Ra(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),Ra(r,`gitDecoration.addedResourceForeground`,za(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),Ra(r,`gitDecoration.modifiedResourceForeground`,za(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),Ra(r,`gitDecoration.deletedResourceForeground`,za(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(Pa(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(Pa(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(Ba(l,o)||Fa(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return Ia.set(e,u),u}function Ra(e,t,n){n!=null&&n!==``&&(e[t]=n)}function za(...e){for(let t of e)if(t!=null&&t!==``)return t}function Ba(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function Va({theme:e=K,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=La(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${Oa(`global`)}fg:${a.fg};`,r+=`${Oa(`global`)}bg:${a.bg};`,r+=Ha(i,n)}else{let n=t.getTheme(e.dark),i=La(n);r+=`${Oa(`global`)}dark:${i.fg};`,r+=`${Oa(`global`)}dark-bg:${i.bg};`,r+=Ha(n,`dark`),n=t.getTheme(e.light),i=La(n),r+=`${Oa(`global`)}light:${i.fg};`,r+=`${Oa(`global`)}light-bg:${i.bg};`,r+=Ha(n,`light`)}return r}function Ha(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${Oa(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${Oa(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${Oa(`global`)}${t}modified-color:${a};`),n}function Ua(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}var Wa={forcePlainText:!1};function Ga(e,t,{theme:n=K,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,startingLine:o,totalLines:s,lines:c}=Wa){a?(o??=0,s??=1/0):(o=0,s=1/0);let l=o>0||s<1/0,{state:u,transformers:d}=Ta(i),f=a?`text`:e.lang??Ji(e.name),p=typeof n==`string`?t.getTheme(n).type:void 0,m=Va({theme:n,highlighter:t});u.lineInfo=e=>({type:`context`,lineIndex:e-1+o,lineNumber:e+o});let h=typeof n==`string`?{lang:f,theme:n,transformers:d,defaultColor:!1,cssVariablePrefix:Oa(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:d,defaultColor:!1,cssVariablePrefix:Oa(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},g=Ua(t.codeToHast(l?Ka(c??ha(e.contents),o,s):yr(e.contents),h)),_=l?Array(o):g;return l&&_.push(...g),{code:_,themeStyles:m,baseThemeType:p}}function Ka(e,t,n){let r=``;return ea({lines:e,startingLine:t,totalLines:n,callback({content:e}){r+=e}}),r}function qa(e){return e.useTokenTransformer===!0||e.onTokenClick!=null||e.onTokenEnter!=null||e.onTokenLeave!=null}var Ja=-1,Ya=class{__id=`file-renderer:${++Ja}`;highlighter;renderCache;computedLang=`text`;lineAnnotations={};lineCache;constructor(e={theme:K},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=ra(e.theme??K)?ye():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0}clearRenderCache(){this.renderCache=void 0}hydrate(e){let{options:t}=this.getRenderOptions(e),n=Xa(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!aa(t,r.options)&&(r=void 0),this.renderCache??={file:e,options:t,highlighted:!n&&!Yi(e),result:n?void 0:r?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter??(this.computedLang=e.lang??Ji(e.name),this.initializeHighlighter())}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getFileRenderOptions();let{theme:e=K,tokenizeMaxLineLength:t=1e3}=this.options;return{theme:e,useTokenTransformer:qa(this.options),tokenizeMaxLineLength:t}})(),{renderCache:n}=this;return n?.result==null||!Wi(e,n.file)||!aa(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getOrCreateLineCache(e){if(e.cacheKey==null)return this.lineCache=void 0,ha(e.contents);let{lineCache:t}=this;return(t==null||t.cacheKey!==e.cacheKey)&&(t={cacheKey:e.cacheKey,lines:ha(e.contents)}),this.lineCache=t,t.lines}renderFile(e=this.renderCache?.file,t=_r){if(e==null)return;let{options:n,forceHighlight:r}=this.getRenderOptions(e),i=this.getMatchingWorkerResultCache(e,n);i!=null&&!this.hasHighlightedRenderCache(e,n)&&(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...i},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=this.getOrCreateLineCache(e),o=e.contents.length>0,s=!o||Yi(e)||Xa(a.length,this.getTokenizeMaxLength()),c=!Wi(e,this.renderCache.file),l=!Gi(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(s||this.renderCache.result==null||!this.renderCache.highlighted&&(c||l))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||c||l||r)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,a)),this.renderCache.renderRange=t),!s&&o&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??Ji(e.name);let t=this.highlighter!=null&&ra(n.theme),i=this.highlighter!=null&&ta(this.computedLang),a=!s&&i;if(this.highlighter!=null&&t&&(r||s||!this.renderCache.highlighted&&a||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,s||!i);this.renderCache={file:e,options:n,highlighted:a,result:t,renderRange:void 0}}(!t||!s&&!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n,!s)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,t,this.renderCache.result)}async asyncRender(e,t=_r){let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=Xa(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Ji(e.name);let n=this.highlighter!=null&&ia(na(this.options.theme)),r=t||this.highlighter!=null&&ta(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:Ga(e,t,r,{forcePlainText:n}),options:r}}processFileResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{disableFileHeader:a=!1}=this.options,o=[],s=gi(),c=this.getOrCreateLineCache(e),l=0,u=$i(t)?Qi(this.lineAnnotations):void 0;return u!=null&&(s.children.push(vi(`context`,`annotation`,1)),o.push(oa({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:u.map(e=>ei(e))})),l++),ea({lines:c,startingLine:t.startingLine,totalLines:t.totalLines,callback:({lineIndex:t,lineNumber:r})=>{let i=n[t];if(i==null){let n=`FileRenderer.processFileResult: Line doesnt exist`;throw console.error(n,{name:e.name,lineIndex:t,lineNumber:r,lines:c}),Error(n)}if(i!=null){s.children.push(_i(`context`,r,`${t}`)),o.push(i),l++;let e=this.lineAnnotations[r];e!=null&&(s.children.push(vi(`context`,`annotation`,1)),o.push(oa({type:`annotation`,hunkIndex:0,lineIndex:r,annotations:e.map(e=>ei(e))})),l++)}}}),s.properties.style=`grid-row: span ${l}`,{gutterAST:s.children??[],contentAST:o,preAST:this.createPreElement(c.length),headerAST:a?void 0:this.renderHeader(e),totalLines:c.length,rowCount:l,themeStyles:r,baseThemeType:i,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return la({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return ge(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(Y({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=gi();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,sa(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return ge(t?Y({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await me(ma(this.computedLang,this.options)),this.highlighter}onHighlightSuccess(e,t,n,r=!0){if(this.renderCache==null)return;let i=!Wi(e,this.renderCache.file)||!this.renderCache.highlighted||!aa(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){let n=this.workerManager?.getFileResultCache(e);if(!(n==null||!aa(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Wi(e,n.file)&&aa(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return fa({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function Xa(e,t){return e>t}var Za=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
15
+ `||t===`\r`?Math.max(0,e.length-2):e.length-1})();for(let n=t;n<i;n++){let t=n===a;if(r({lineIndex:n,lineNumber:n+1,content:e[n],isLastLine:t})===!0||t)break}}function da(e){for(let t of Array.isArray(e)?e:[e])if(!(t===`text`||t===`ansi`)&&!Ie.has(t))return!1;return!0}function fa(e=G){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}function pa(e){for(let t of fa(e))if(!Fe.has(t))return!1;return!0}function ma(e){return Le.hasResolvedThemes(e)}function ha(e,t){return _i(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function ga(e){return J({tagName:`div`,children:[J({tagName:`div`,children:e.annotations?.map(e=>J({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function _a(e,t){return J({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function va(e){switch(e){case`file`:return`diffs-icon-file-code`;case`change`:return`diffs-icon-symbol-modified`;case`new`:return`diffs-icon-symbol-added`;case`deleted`:return`diffs-icon-symbol-deleted`;case`rename-pure`:case`rename-changed`:return`diffs-icon-symbol-moved`}}function ya({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return J({tagName:`div`,children:[t===`custom`?J({tagName:`slot`,properties:{name:yr}}):ba({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[xa(r)]],properties:i})}function ba({name:e,prevName:t,iconType:n}){let r=[J({tagName:`slot`,properties:{name:_r}}),wi({name:va(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(J({tagName:`div`,children:[J({tagName:`bdi`,children:[Ci(t)]})],properties:{"data-prev-name":``}})),r.push(wi({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(J({tagName:`div`,children:[J({tagName:`bdi`,children:[Ci(e)]})],properties:{"data-title":``}})),J({tagName:`div`,children:r,properties:{"data-header-content":``}})}function xa(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(J({tagName:`span`,children:[Ci(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(J({tagName:`span`,children:[Ci(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(J({tagName:`slot`,properties:{name:vr}})),J({tagName:`div`,children:t,properties:{"data-metadata":``}})}function Sa(e){return J({tagName:`pre`,properties:Ca(e)})}function Ca({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,tabIndex:0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}function wa(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:fa(t),preferredHighlighter:n}}function Ta(e){return e===``?[]:e.split(fr)}function Ea(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(Ci(`
16
+ `)),e}var Da=Symbol(`no-token`),Oa=Symbol(`multiple-tokens`);function ka(e){let t=Aa(e);if(t!=null)return t;let n=Da,r=[],i=[],a,o=()=>{if(i.length===0||a==null){i=[],a=void 0;return}if(i.length===1){let e=i[0];if(e?.type===`element`){Ma(e,a);for(let t of e.children)ja(t)}else ja(e);r.push(e),i=[],a=void 0;return}for(let e of i)ja(e);r.push(J({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==Da){if(e===Oa){n=Oa;return}if(n===Da){n=e;return}n!==e&&(n=Oa)}};for(let t of e.children){let e=t.type===`element`?ka(t):Da;if(s(e),typeof e!=`number`){o(),r.push(t);continue}a!=null&&a!==e&&o(),a??=e,i.push(t)}return o(),e.children=r,n}function Aa(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function ja(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)ja(t)}}function Ma(e,t){e.properties[`data-char`]=t}function Na(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=t+Pa(typeof e==`string`?e:a(e))+n;return o=r(o),i.has(o)||i.set(o,typeof e==`string`?e:{...e}),o}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function Pa(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}function Fa(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=Ti(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&ka(a),i.push(Ea(a,t,n)),t++);r.children=i}return t},...e?{tokens(e){for(let t of e){let e=0;for(let n of t){let t=n;t.__lineChar??=e,e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces=`never`},span(e,t,n,r,i){if(i?.offset!=null&&i.content!=null){let t=i.__lineChar;return t!=null&&(e.properties[`data-char`]=t),e}return e}}:null}];return t&&r.push(La,Ia),{state:n,transformers:r,toClass:Ia}}var Ia=Na({classPrefix:`hl-`}),La={name:`token-style-normalizer`,tokens(e){for(let t of e)for(let e of t){if(e.htmlStyle!=null)continue;let t={};e.color!=null&&(t.color=e.color),e.bgColor!=null&&(t[`background-color`]=e.bgColor),e.fontStyle!=null&&e.fontStyle!==0&&(e.fontStyle&1&&(t[`font-style`]=`italic`),e.fontStyle&2&&(t[`font-weight`]=`bold`),e.fontStyle&4&&(t[`text-decoration`]=`underline`)),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function Ra(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var za=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Ba=/^0(?:\.0+)?%?$/;function Va(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function Ha(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let n=t[1],r,i=1;return n.length===3?r=n.split(``).map(e=>e+e).join(``):n.length===6?r=n:(r=n.slice(0,6),i=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),i]}function Ua(e){if(e==null)return null;let t=Ha(e);if(t==null)return null;let n=t[0]/255,r=t[1]/255,i=t[2]/255,a=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*a(n)+.7152*a(r)+.0722*a(i)}function Wa(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||za.test(t))return!0;let n=Va(t);return n!=null&&Ba.test(n)}function Ga(e,t,n){if(t==null||n==null)return!1;let r=Ua(e),i=Ua(t),a=Ua(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var Ka=new WeakMap;function qa(e){let t=Ka.get(e);if(t!=null)return t;let n=e.colors??{},r={...n},i=n[`editor.background`]??e.bg,a=n[`editor.foreground`]??e.fg,o=n[`sideBar.background`]??i,s=n[`sideBar.foreground`]??a;Ja(r,`editor.background`,i),Ja(r,`editor.foreground`,a),Ja(r,`sideBar.background`,o),Ja(r,`sideBar.foreground`,s),Ja(r,`input.background`,n[`input.background`]??o),Ja(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),Ja(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),Ja(r,`gitDecoration.addedResourceForeground`,Ya(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),Ja(r,`gitDecoration.modifiedResourceForeground`,Ya(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),Ja(r,`gitDecoration.deletedResourceForeground`,Ya(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(Wa(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(Wa(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(Xa(l,o)||Ga(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return Ka.set(e,u),u}function Ja(e,t,n){n!=null&&n!==``&&(e[t]=n)}function Ya(...e){for(let t of e)if(t!=null&&t!==``)return t}function Xa(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function Za({theme:e=G,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=qa(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${Ra(`global`)}fg:${a.fg};`,r+=`${Ra(`global`)}bg:${a.bg};`,r+=Qa(i,n)}else{let n=t.getTheme(e.dark),i=qa(n);r+=`${Ra(`global`)}dark:${i.fg};`,r+=`${Ra(`global`)}dark-bg:${i.bg};`,r+=Qa(n,`dark`),n=t.getTheme(e.light),i=qa(n),r+=`${Ra(`global`)}light:${i.fg};`,r+=`${Ra(`global`)}light-bg:${i.bg};`,r+=Qa(n,`light`)}return r}function Qa(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${Ra(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${Ra(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${Ra(`global`)}${t}modified-color:${a};`),n}function $a(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}var eo={forcePlainText:!1};function to(e,t,{theme:n=G,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,startingLine:o,totalLines:s,lines:c}=eo){a?(o??=0,s??=1/0):(o=0,s=1/0);let l=o>0||s<1/0,{state:u,transformers:d}=Fa(i),f=a?`text`:e.lang??ia(e.name),p=typeof n==`string`?t.getTheme(n).type:void 0,m=Za({theme:n,highlighter:t});u.lineInfo=e=>({type:`context`,lineIndex:e-1+o,lineNumber:e+o});let h=typeof n==`string`?{lang:f,theme:n,transformers:d,defaultColor:!1,cssVariablePrefix:Ra(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:d,defaultColor:!1,cssVariablePrefix:Ra(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},g=$a(t.codeToHast(l?no(c??Ta(e.contents),o,s):kr(e.contents),h)),_=l?Array(o):g;return l&&_.push(...g),{code:_,themeStyles:m,baseThemeType:p}}function no(e,t,n){let r=``;return ua({lines:e,startingLine:t,totalLines:n,callback({content:e}){r+=e}}),r}function ro(e){return e.useTokenTransformer===!0||e.onTokenClick!=null||e.onTokenEnter!=null||e.onTokenLeave!=null}var io=-1,ao=class{__id=`file-renderer:${++io}`;highlighter;renderCache;computedLang=`text`;lineAnnotations={};lineCache;constructor(e={theme:G},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=pa(e.theme??G)?Ee():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0}clearRenderCache(){this.renderCache=void 0}hydrate(e){let{options:t}=this.getRenderOptions(e),n=oo(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!ha(t,r.options)&&(r=void 0),this.renderCache??={file:e,options:t,highlighted:!n&&!aa(e),result:n?void 0:r?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter??(this.computedLang=e.lang??ia(e.name),this.initializeHighlighter())}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getFileRenderOptions();let{theme:e=G,tokenizeMaxLineLength:t=1e3}=this.options;return{theme:e,useTokenTransformer:ro(this.options),tokenizeMaxLineLength:t}})(),{renderCache:n}=this;return n?.result==null||!ea(e,n.file)||!ha(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getOrCreateLineCache(e){if(e.cacheKey==null)return this.lineCache=void 0,Ta(e.contents);let{lineCache:t}=this;return(t==null||t.cacheKey!==e.cacheKey)&&(t={cacheKey:e.cacheKey,lines:Ta(e.contents)}),this.lineCache=t,t.lines}renderFile(e=this.renderCache?.file,t=Dr){if(e==null)return;let{options:n,forceHighlight:r}=this.getRenderOptions(e),i=this.getMatchingWorkerResultCache(e,n);i!=null&&!this.hasHighlightedRenderCache(e,n)&&(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...i},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=this.getOrCreateLineCache(e),o=e.contents.length>0,s=!o||aa(e)||oo(a.length,this.getTokenizeMaxLength()),c=!ea(e,this.renderCache.file),l=!ta(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(s||this.renderCache.result==null||!this.renderCache.highlighted&&(c||l))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||c||l||r)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,a)),this.renderCache.renderRange=t),!s&&o&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??ia(e.name);let t=this.highlighter!=null&&pa(n.theme),i=this.highlighter!=null&&da(this.computedLang),a=!s&&i;if(this.highlighter!=null&&t&&(r||s||!this.renderCache.highlighted&&a||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,s||!i);this.renderCache={file:e,options:n,highlighted:a,result:t,renderRange:void 0}}(!t||!s&&!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n,!s)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,t,this.renderCache.result)}async asyncRender(e,t=Dr){let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=oo(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??ia(e.name);let n=this.highlighter!=null&&ma(fa(this.options.theme)),r=t||this.highlighter!=null&&da(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:to(e,t,r,{forcePlainText:n}),options:r}}processFileResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{disableFileHeader:a=!1}=this.options,o=[],s=Ei(),c=this.getOrCreateLineCache(e),l=0,u=la(t)?ca(this.lineAnnotations):void 0;return u!=null&&(s.children.push(Oi(`context`,`annotation`,1)),o.push(ga({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:u.map(e=>ui(e))})),l++),ua({lines:c,startingLine:t.startingLine,totalLines:t.totalLines,callback:({lineIndex:t,lineNumber:r})=>{let i=n[t];if(i==null){let n=`FileRenderer.processFileResult: Line doesnt exist`;throw console.error(n,{name:e.name,lineIndex:t,lineNumber:r,lines:c}),Error(n)}if(i!=null){s.children.push(Di(`context`,r,`${t}`)),o.push(i),l++;let e=this.lineAnnotations[r];e!=null&&(s.children.push(Oi(`context`,`annotation`,1)),o.push(ga({type:`annotation`,hunkIndex:0,lineIndex:r,annotations:e.map(e=>ui(e))})),l++)}}}),s.properties.style=`grid-row: span ${l}`,{gutterAST:s.children??[],contentAST:o,preAST:this.createPreElement(c.length),headerAST:a?void 0:this.renderHeader(e),totalLines:c.length,rowCount:l,themeStyles:r,baseThemeType:i,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return ya({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return Ce(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(J({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=Ei();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,_a(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return Ce(t?J({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await xe(wa(this.computedLang,this.options)),this.highlighter}onHighlightSuccess(e,t,n,r=!0){if(this.renderCache==null)return;let i=!ea(e,this.renderCache.file)||!this.renderCache.highlighted||!ha(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){let n=this.workerManager?.getFileResultCache(e);if(!(n==null||!ha(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&ea(e,n.file)&&ha(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return Sa({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function oo(e,t){return e>t}var so=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
17
17
  <symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
18
18
  <path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/>
19
19
  </symbol>
@@ -65,38 +65,40 @@ diff --git`)}function Kr(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.star
65
65
  <symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
66
66
  <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706.286.286.71.54 1.41.73V1.86c-.7.19-1.124.444-1.41.73-.324.325-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8m4 6.397c.697.07 1.522.103 2.5.103 1.613 0 2.806-.088 3.704-.288.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5c-.978 0-1.803.033-2.5.103zM0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m7-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"/>
67
67
  </symbol>
68
- </svg>`;function Qa(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function $a(e,t){return e==null||t==null?e===t:to(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}var eo={};function to(e=eo,t=eo){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function no(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function ro(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}function io(){let e=document.createElement(`style`);return e.setAttribute(dr,``),e}var ao;function oo(e){if(ao!=null)return ao;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(fr,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),ao=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),ao}function so(e){return`${pr}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var co=`@layer base,theme,rendered,unsafe;@layer base{:host{--diffs-font-fallback:"SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "Courier New", monospace;--diffs-header-font-fallback:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;--diffs-mixer:light-dark(#000,#fff);--diffs-gap-fallback:8px;--diffs-scrollbar-gutter-fallback:6px;--diffs-scrollbar-gutter:var(--diffs-scrollbar-gutter-override,var(--diffs-scrollbar-gutter-measured,var(--diffs-scrollbar-gutter-fallback)));--diffs-added-light:#0dbe4e;--diffs-added-dark:#5ecc71;--diffs-modified-light:#009fff;--diffs-modified-dark:#69b1ff;--diffs-deleted-light:#ff2e3f;--diffs-deleted-dark:#ff6762;color-scheme:light dark;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);font-feature-settings:var(--diffs-font-features);--diffs-bg:light-dark(var(--diffs-light-bg,#fff),var(--diffs-dark-bg,#000));--diffs-bg-buffer:var(--diffs-bg-buffer-override,light-dark(color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))));--diffs-bg-context:var(--diffs-bg-context-override,light-dark(color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))));--diffs-bg-context-gutter:var(--diffs-bg-context-gutter-override,light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)),color-mix(in lab, var(--diffs-bg-context) 45%, var(--diffs-bg))));--diffs-bg-separator:var(--diffs-bg-separator-override,light-dark(color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))));--diffs-fg:light-dark(var(--diffs-light,#000),var(--diffs-dark,#fff));--diffs-fg-number:var(--diffs-fg-number-override,light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)),color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))));--diffs-fg-conflict-marker:var(--diffs-fg-conflict-marker-override,var(--diffs-fg-number));--diffs-deletion-base:var(--diffs-deletion-color-override,light-dark(var(--diffs-light-deletion-color,var(--diffs-deletion-color,var(--diffs-deleted-light))),var(--diffs-dark-deletion-color,var(--diffs-deletion-color,var(--diffs-deleted-dark)))));--diffs-addition-base:var(--diffs-addition-color-override,light-dark(var(--diffs-light-addition-color,var(--diffs-addition-color,var(--diffs-added-light))),var(--diffs-dark-addition-color,var(--diffs-addition-color,var(--diffs-added-dark)))));--diffs-modified-base:var(--diffs-modified-color-override,light-dark(var(--diffs-light-modified-color,var(--diffs-modified-color,var(--diffs-modified-light))),var(--diffs-dark-modified-color,var(--diffs-modified-color,var(--diffs-modified-dark)))));--diffs-bg-deletion:var(--diffs-bg-deletion-override,light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)),color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))));--diffs-bg-deletion-emphasis:var(--diffs-bg-deletion-emphasis-override,light-dark(rgb(from var(--diffs-deletion-base) r g b / .15),rgb(from var(--diffs-deletion-base) r g b / .2)));--diffs-bg-addition:var(--diffs-bg-addition-override,light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)),color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))));--diffs-bg-addition-emphasis:var(--diffs-bg-addition-emphasis-override,light-dark(rgb(from var(--diffs-addition-base) r g b / .15),rgb(from var(--diffs-addition-base) r g b / .2)));--diffs-selection-base:var(--diffs-modified-base);--diffs-selection-number-fg:light-dark(color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)));background-color:var(--diffs-bg);color:var(--diffs-fg);display:block}pre,code,[data-error-wrapper]{isolation:isolate;font-family:var(--diffs-font-family,var(--diffs-font-fallback));outline:none;margin:0;padding:0;display:block}pre,code{background-color:var(--diffs-bg)}code{contain:content}*,:before,:after{box-sizing:border-box}[data-icon-sprite]{display:none}[data-diffs-header],[data-separator]{font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback))}[data-diffs-header][data-sticky]{z-index:1;background-color:var(--diffs-bg);position:sticky;top:0}[data-file-info]{color:var(--fg);background-color:color-mix(in lab, var(--bg) 98%, var(--fg));border-block:1px solid color-mix(in lab, var(--bg) 95%, var(--fg));padding:10px;font-weight:700}[data-diff],[data-file]{--diffs-grid-number-column-width:minmax(min-content, max-content);--diffs-code-grid:var(--diffs-grid-number-column-width) 1fr}[data-dehydrated]:is([data-diff],[data-file]){--diffs-code-grid:var(--diffs-grid-number-column-width) minmax(0, 1fr)}:is([data-diff],[data-file]):hover [data-code]::-webkit-scrollbar-thumb{background-color:var(--diffs-bg-context)}@supports (-webkit-touch-callout:none){:host{--diffs-scrollbar-gutter-fallback:0px}}[data-line] span{color:light-dark(var(--diffs-token-light,var(--diffs-light)),var(--diffs-token-dark,var(--diffs-dark)));background-color:light-dark(var(--diffs-token-light-bg,inherit),var(--diffs-token-dark-bg,inherit));font-weight:light-dark(var(--diffs-token-light-font-weight,inherit),var(--diffs-token-dark-font-weight,inherit));font-style:light-dark(var(--diffs-token-light-font-style,inherit),var(--diffs-token-dark-font-style,inherit));-webkit-text-decoration:light-dark(var(--diffs-token-light-text-decoration,inherit),var(--diffs-token-dark-text-decoration,inherit));text-decoration:light-dark(var(--diffs-token-light-text-decoration,inherit),var(--diffs-token-dark-text-decoration,inherit))}[data-line],[data-gutter-buffer],[data-column-number],[data-line-annotation],[data-no-newline],[data-merge-conflict],[data-merge-conflict-actions]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-computed-diff-line-bg:var(--diffs-bg);--diffs-computed-selected-line-bg:var(--diffs-bg);color:var(--diffs-fg);background-color:var(--diffs-line-bg,var(--diffs-bg))}@media (pointer:fine){:is([data-line],[data-gutter-buffer],[data-column-number],[data-line-annotation],[data-no-newline],[data-merge-conflict],[data-merge-conflict-actions]):where([data-hovered]){--diffs-computed-hovered-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-selected-line-bg) 97%, var(--diffs-bg-hover-override,var(--diffs-mixer))),color-mix(in lab, var(--diffs-computed-selected-line-bg) 91%, var(--diffs-bg-hover-override,var(--diffs-mixer))));--diffs-line-bg:var(--diffs-computed-hovered-line-bg,inherit)}}[data-decoration-bg]:is([data-line],[data-no-newline]){--mix-deco-light:92%;--mix-deco-dark:85%}[data-decoration-bg][data-decoration-bg-depth="2"]:is([data-line],[data-no-newline]){--mix-deco-light:88%;--mix-deco-dark:80%}[data-decoration-bg][data-decoration-bg-depth="3"]:is([data-line],[data-no-newline]){--mix-deco-light:85%;--mix-deco-dark:78%}@media (pointer:fine){[data-decoration-bg][data-hovered]:is([data-line],[data-no-newline]):not([data-selected-line]){--mix-deco-light:85%;--mix-deco-dark:85%}[data-decoration-bg][data-hovered][data-decoration-bg-depth="2"]:is([data-line],[data-no-newline]):not([data-selected-line]){--mix-deco-light:83%;--mix-deco-dark:83%}[data-decoration-bg][data-hovered][data-decoration-bg-depth="3"]:is([data-line],[data-no-newline]):not([data-selected-line]){--mix-deco-light:81%;--mix-deco-dark:81%}}[data-decoration-bg]:is([data-line],[data-no-newline]){--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) var(--mix-deco-light), var(--diffs-decoration-bg)),color-mix(in lab, var(--diffs-bg) var(--mix-deco-dark), var(--diffs-decoration-bg)));--diffs-computed-diff-line-bg:var(--diffs-computed-decoration-bg);--diffs-computed-selected-line-bg:var(--diffs-computed-decoration-bg);--diffs-line-bg:var(--diffs-computed-decoration-bg)}[data-line-annotation],[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context);--diffs-computed-decoration-bg:var(--diffs-annotation-bg);--diffs-computed-diff-line-bg:var(--diffs-annotation-bg);--diffs-computed-selected-line-bg:var(--diffs-annotation-bg);--diffs-line-bg:var(--diffs-annotation-bg)}[data-merge-conflict-actions],[data-gutter-buffer=merge-conflict-action],[data-gutter-buffer=merge-conflict-marker-base],[data-gutter-buffer=merge-conflict-marker-separator],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator]{--diffs-computed-decoration-bg:var(--diffs-bg-context);--diffs-computed-diff-line-bg:var(--diffs-bg-context);--diffs-computed-selected-line-bg:var(--diffs-bg-context);--diffs-line-bg:var(--diffs-bg-context)}[data-gutter-buffer=merge-conflict-marker-start],[data-merge-conflict=marker-start]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))));--diffs-computed-diff-line-bg:var(--diffs-computed-decoration-bg);--diffs-computed-selected-line-bg:var(--diffs-computed-decoration-bg);--diffs-line-bg:var(--diffs-computed-decoration-bg)}[data-gutter-buffer=merge-conflict-marker-end],[data-merge-conflict=marker-end]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))));--diffs-computed-diff-line-bg:var(--diffs-computed-decoration-bg);--diffs-computed-selected-line-bg:var(--diffs-computed-decoration-bg);--diffs-line-bg:var(--diffs-computed-decoration-bg)}[data-has-merge-conflict] [data-line-annotation],[data-has-merge-conflict] [data-gutter-buffer=annotation]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-computed-diff-line-bg:var(--diffs-bg);--diffs-computed-selected-line-bg:var(--diffs-bg);--diffs-line-bg:var(--diffs-bg)}:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number]{--mix-light:91%;--mix-dark:85%}:where([data-background]) [data-line],:where([data-background]) [data-no-newline]{--mix-light:88%;--mix-dark:80%}:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]{--diffs-diff-line-mix-target:var(--diffs-bg)}[data-line-type=change-deletion]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--diffs-diff-line-mix-target:var(--diffs-bg-deletion-override,var(--diffs-deletion-base))}@media (pointer:fine){[data-line-type=change-deletion][data-hovered]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--mix-light:80%;--mix-dark:75%}}[data-line-type=change-deletion]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]):where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-deletion-override,var(--diffs-deletion-base));--diffs-diff-line-mix-target:var(--diffs-bg-deletion-number-override,var(--diffs-deletion-base))}[data-line-type=change-deletion]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)));--diffs-computed-selected-line-bg:var(--diffs-computed-diff-line-bg);--diffs-line-bg:var(--diffs-computed-diff-line-bg,inherit)}[data-line-type=change-addition]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--diffs-diff-line-mix-target:var(--diffs-bg-addition-override,var(--diffs-addition-base))}@media (pointer:fine){[data-line-type=change-addition][data-hovered]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--mix-light:80%;--mix-dark:70%}}[data-line-type=change-addition]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]):where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--diffs-bg-addition-number-override,var(--diffs-addition-base))}[data-line-type=change-addition]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)));--diffs-computed-selected-line-bg:var(--diffs-computed-diff-line-bg);--diffs-line-bg:var(--diffs-computed-diff-line-bg,inherit)}[data-merge-conflict=current]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--diffs-diff-line-mix-target:var(--conflict-bg-current-override,var(--diffs-addition-base))}[data-merge-conflict=current]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]):where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--conflict-bg-current-number-override,var(--diffs-addition-base))}@media (pointer:fine){[data-merge-conflict=current][data-hovered]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--mix-light:80%;--mix-dark:70%}}[data-merge-conflict=current]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)));--diffs-computed-selected-line-bg:var(--diffs-computed-diff-line-bg);--diffs-line-bg:var(--diffs-computed-diff-line-bg,inherit)}[data-merge-conflict=incoming]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--diffs-diff-line-mix-target:var(--conflict-bg-incoming-override,var(--diffs-modified-base))}[data-merge-conflict=incoming]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]):where([data-gutter-buffer],[data-column-number]){color:var(--diffs-modified-base);--diffs-diff-line-mix-target:var(--conflict-bg-incoming-number-override,var(--diffs-modified-base))}@media (pointer:fine){[data-merge-conflict=incoming][data-hovered]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--mix-light:80%;--mix-dark:70%}}[data-merge-conflict=incoming]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)));--diffs-computed-selected-line-bg:var(--diffs-computed-diff-line-bg);--diffs-line-bg:var(--diffs-computed-diff-line-bg,inherit)}[data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]{--diffs-selection-mix-target:var(--diffs-bg-selection-override,var(--diffs-selection-base))}[data-selected-line]:is([data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]):where([data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]){--mix-selection-light:82%;--mix-selection-dark:75%}@media (pointer:fine){[data-selected-line][data-hovered]:is([data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]):where([data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]):not([data-merge-conflict],[data-line-type=change-addition],[data-line-type=change-deletion]){--mix-selection-light:75%;--mix-selection-dark:70%}}[data-selected-line]:is([data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]):where([data-gutter-buffer],[data-column-number]){--mix-selection-light:75%;--mix-selection-dark:60%;--diffs-selection-mix-target:var(--diffs-bg-selection-number-override,var(--diffs-selection-base))}@media (pointer:fine){[data-selected-line][data-hovered]:is([data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]):where([data-gutter-buffer],[data-column-number]):not([data-merge-conflict],[data-line-type=change-addition],[data-line-type=change-deletion]){--mix-selection-light:70%;--mix-selection-dark:55%}}[data-selected-line]:is([data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]){--diffs-computed-selected-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-light), var(--diffs-selection-mix-target)),color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-dark), var(--diffs-selection-mix-target)));--diffs-line-bg:var(--diffs-computed-selected-line-bg,inherit)}[data-selected-line]:is([data-gutter-buffer],[data-column-number]){color:var(--diffs-selection-number-fg)}[data-no-newline]{-webkit-user-select:none;user-select:none}[data-no-newline] span{opacity:.6}[data-diff-type=split][data-overflow=scroll]{grid-template-columns:1fr 1fr;display:grid}[data-diff-type=split][data-overflow=scroll] [data-additions]{border-left:1px solid var(--diffs-bg)}[data-diff-type=split][data-overflow=scroll] [data-deletions]{border-right:1px solid var(--diffs-bg)}[data-code]{grid-auto-flow:dense;grid-template-columns:var(--diffs-code-grid);overflow:var(--diffs-overflow-override,scroll) clip;overscroll-behavior-x:none;tab-size:var(--diffs-tab-size,2);padding-top:var(--diffs-gap-block,var(--diffs-gap-fallback));padding-bottom:max(0px, calc(var(--diffs-gap-block,var(--diffs-gap-fallback)) - var(--diffs-scrollbar-gutter)));scrollbar-gutter:stable;align-self:flex-start;display:grid}[data-diffs-scrollbar-measure]{opacity:0;pointer-events:none;scrollbar-gutter:auto;grid-template-columns:none;width:100px;height:100px;padding:0;position:absolute;top:-200px;left:-200px}[data-container-size]{container-type:inline-size}[data-code]::-webkit-scrollbar{width:0;height:var(--diffs-scrollbar-gutter)}[data-code]::-webkit-scrollbar-track{background:0 0}[data-code]::-webkit-scrollbar-thumb{background-color:#0000;background-clip:content-box;border:1px solid #0000;border-radius:3px}[data-code]::-webkit-scrollbar-corner{background-color:#0000}@supports ((-moz-appearance:none)){[data-code]{scrollbar-width:thin;scrollbar-color:var(--diffs-bg-context) transparent;padding-bottom:var(--diffs-gap-block,var(--diffs-gap-fallback))}}:is([data-diffs-header]~[data-diff],[data-diffs-header]~[data-file]) [data-code],[data-overflow=wrap]:is([data-diffs-header]~[data-diff],[data-diffs-header]~[data-file]){padding-top:0}[data-gutter]{grid-template-rows:subgrid;grid-template-columns:subgrid;z-index:3;background-color:var(--diffs-bg);grid-column:1;display:grid;position:relative}[data-gutter] [data-gutter-buffer],[data-gutter] [data-column-number]{border-right:var(--diffs-gap-style,2px solid var(--diffs-bg))}[data-content]{grid-template-rows:subgrid;grid-template-columns:subgrid;background-color:var(--diffs-bg);grid-column:2;min-width:0;display:grid}[data-diff-type=split][data-overflow=wrap]{grid-auto-flow:dense;grid-template-columns:repeat(2, var(--diffs-code-grid));padding-block:var(--diffs-gap-block,var(--diffs-gap-fallback));display:grid}[data-diff-type=split][data-overflow=wrap] [data-deletions]{display:contents}:is([data-diff-type=split][data-overflow=wrap] [data-deletions]) [data-gutter]{grid-column:1}:is([data-diff-type=split][data-overflow=wrap] [data-deletions]) [data-content]{border-right:1px solid var(--diffs-bg);grid-column:2}[data-diff-type=split][data-overflow=wrap] [data-additions]{display:contents}:is([data-diff-type=split][data-overflow=wrap] [data-additions]) [data-gutter]{border-left:1px solid var(--diffs-bg);grid-column:3}:is([data-diff-type=split][data-overflow=wrap] [data-additions]) [data-content]{grid-column:4}[data-overflow=scroll] [data-gutter]{position:sticky;left:0}[data-interactive-lines] [data-line]{cursor:pointer}[data-interactive-line-numbers] [data-column-number]{cursor:pointer;touch-action:none}[data-content-buffer],[data-gutter-buffer]{-webkit-user-select:none;user-select:none;min-height:1lh;position:relative}[data-gutter-buffer]{padding-left:2ch;padding-right:1ch}[data-gutter-buffer]:before{content:"";min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));display:block}[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context-gutter);min-height:0}[data-gutter-buffer=buffer]{--diffs-line-bg:var(--diffs-bg-context-gutter)}[data-content-buffer]{background-position:5px 0;background-size:8px 8px;background-origin:border-box;background-image:repeating-linear-gradient(-45deg, transparent, transparent 4.242px, var(--diffs-bg-buffer) 4.242px, var(--diffs-bg-buffer) 5.656px);grid-column:1}[data-separator]{box-sizing:content-box;background-color:var(--diffs-bg)}[data-separator=simple]{min-height:4px}[data-separator=line-info],[data-separator=line-info-basic],[data-separator=metadata],[data-separator=simple]{background-color:var(--diffs-bg-separator)}[data-separator=line-info],[data-separator=line-info-basic],[data-separator=metadata]{height:32px;position:relative}[data-separator-wrapper]{-webkit-user-select:none;user-select:none;fill:currentColor;background-color:var(--diffs-bg);align-items:center;height:100%;display:flex;position:absolute;inset-inline:0}[data-content] [data-separator-wrapper]{display:none}[data-separator=metadata] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;color:var(--diffs-fg-number);white-space:nowrap;text-overflow:ellipsis;min-width:min-content;padding-inline:1ch;inset-inline:100% auto;overflow:hidden}[data-separator=line-info]{margin-block:var(--diffs-gap-block,var(--diffs-gap-fallback))}[data-separator=line-info] [data-separator-wrapper]{min-width:16px}[data-separator=line-info-basic],[data-separator=metadata]{margin-block:0}[data-separator=line-info][data-separator-first]{margin-top:0}[data-separator=line-info][data-separator-last]{margin-bottom:0}[data-expand-index] [data-separator-wrapper]{grid-template-columns:32px auto;display:grid}[data-expand-index] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:32px 32px auto}[data-expand-button],[data-separator-content]{background-color:var(--diffs-bg-separator);flex:none;align-items:center;display:flex}[data-expand-index] [data-separator-content]:hover{cursor:pointer;text-decoration:underline}[data-expand-button]{cursor:pointer;min-width:32px;color:var(--diffs-fg-number);border-right:2px solid var(--diffs-bg);flex-shrink:0;justify-content:center;align-self:stretch}[data-expand-button]:hover{color:var(--diffs-fg)}[data-expand-button][data-expand-all-button]{display:none}[data-expand-down] [data-icon]{transform:scaleY(-1)}[data-separator-content]{height:100%;color:var(--diffs-fg-number);flex:auto;justify-content:flex-start;padding:0 1ch;overflow:hidden}:is([data-separator=line-info],[data-separator=line-info-basic]) [data-separator-content]{-webkit-user-select:none;user-select:none;height:100%;overflow:clip}[data-unmodified-lines]{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;display:block;overflow:hidden}@supports (width:1cqi){[data-unified] [data-separator=line-info] [data-separator-wrapper]{padding-inline:var(--diffs-gap-inline,var(--diffs-gap-fallback));width:100cqi}:is([data-unified] [data-separator=line-info] [data-separator-wrapper]) [data-separator-content]{border-radius:6px}[data-unified] [data-separator=line-info][data-expand-index] [data-separator-wrapper] [data-separator-content]{border-top-left-radius:unset;border-bottom-left-radius:unset}[data-gutter] [data-separator=line-info] [data-separator-wrapper]{padding-left:var(--diffs-gap-inline,var(--diffs-gap-fallback))}[data-gutter] [data-separator=line-info] [data-separator-content]{border-top-left-radius:6px;border-bottom-left-radius:6px}[data-gutter] [data-separator=line-info][data-expand-index] [data-separator-content]{border-top-left-radius:unset;border-bottom-left-radius:unset}[data-additions] [data-content] [data-separator=line-info]{background-color:var(--diffs-bg)}:is([data-additions] [data-content] [data-separator=line-info]) [data-separator-wrapper]{display:none}[data-additions] [data-gutter] [data-separator=line-info] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);border-top-right-radius:6px;border-bottom-right-radius:6px;height:100%;display:block}:is([data-additions] [data-gutter] [data-separator=line-info] [data-separator-wrapper]) [data-separator-content],:is([data-additions] [data-gutter] [data-separator=line-info] [data-separator-wrapper]) [data-expand-button]{display:none}[data-overflow=scroll] [data-additions] [data-gutter] [data-separator=line-info] [data-separator-wrapper]{width:calc(100cqi - var(--diffs-gap-inline,var(--diffs-gap-fallback)))}[data-overflow=wrap] [data-additions] [data-content] [data-separator=line-info] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;margin-right:var(--diffs-gap-inline,var(--diffs-gap-fallback));border-top-right-radius:6px;border-bottom-right-radius:6px;display:block}:is([data-overflow=wrap] [data-additions] [data-content] [data-separator=line-info] [data-separator-wrapper]) [data-separator-content],:is([data-overflow=wrap] [data-additions] [data-content] [data-separator=line-info] [data-separator-wrapper]) [data-expand-button]{display:none}:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-both],:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-down],:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}@media (pointer:fine){[data-separator-multi-button]:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:unset}[data-separator-multi-button]:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-down]{border-bottom-left-radius:6px;border-top-left-radius:unset}}}@media (pointer:coarse){[data-separator=line-info-basic] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:34px 34px auto}:is([data-separator=line-info-basic] [data-separator-wrapper][data-separator-multi-button]) [data-separator-content]{grid-column:unset;grid-row:unset}@supports (width:1cqi){:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-both],:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-down],:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-up],[data-separator-multi-button]:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}[data-separator-multi-button]:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-down]{border-bottom-left-radius:unset;border-top-left-radius:unset}}}@media (pointer:fine){[data-separator-wrapper][data-separator-multi-button]{grid-template-rows:50% 50%;display:grid}[data-separator-wrapper][data-separator-multi-button] [data-separator-content]{grid-area:1/2/-1;min-width:min-content}[data-separator-wrapper][data-separator-multi-button] [data-expand-button]{grid-column:1}[data-separator=line-info] [data-separator-wrapper],[data-separator=line-info] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:34px auto}[data-separator=line-info-basic][data-expand-index] [data-separator-wrapper]{grid-template-columns:100% auto}:is(:is([data-separator=line-info],[data-separator=line-info-basic]) [data-separator-multi-button]) [data-expand-up]{border-bottom:1px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg)}:is(:is([data-separator=line-info],[data-separator=line-info-basic]) [data-separator-multi-button]) [data-expand-down]{border-top:1px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg)}}[data-additions] [data-gutter] [data-separator-wrapper],[data-additions] [data-separator=line-info-basic] [data-separator-wrapper],[data-content] [data-separator-wrapper]{display:none}[data-line-annotation]{min-height:var(--diffs-annotation-min-height,0);z-index:2}[data-merge-conflict-actions]{z-index:2}[data-separator=custom]{grid-template-columns:subgrid;display:grid}[data-line],[data-column-number],[data-no-newline]{padding-inline:1ch;position:relative}[data-indicators=classic] [data-line]{padding-inline-start:2ch}:is([data-no-newline]:is([data-indicators=classic] [data-line-type=change-addition],[data-indicators=classic] [data-line-type=change-deletion]),[data-line]:is([data-indicators=classic] [data-line-type=change-addition],[data-indicators=classic] [data-line-type=change-deletion])):before{-webkit-user-select:none;user-select:none;width:1ch;height:1lh;display:inline-block;position:absolute;top:0;left:0}:is([data-line]:is([data-indicators=classic] [data-line-type=change-addition]),[data-no-newline]:is([data-indicators=classic] [data-line-type=change-addition])):before{content:"+";color:var(--diffs-addition-base)}:is([data-line]:is([data-indicators=classic] [data-line-type=change-deletion]),[data-no-newline]:is([data-indicators=classic] [data-line-type=change-deletion])):before{content:"-";color:var(--diffs-deletion-base)}[data-column-number]:is([data-indicators=bars] [data-line-type=change-deletion],[data-indicators=bars] [data-line-type=change-addition]):before{content:"";-webkit-user-select:none;user-select:none;contain:strict;width:4px;height:100%;display:block;position:absolute;top:0;left:0}[data-column-number]:is([data-indicators=bars] [data-line-type=change-deletion]):before{background-image:linear-gradient(0deg, var(--diffs-bg-deletion) 50%, var(--diffs-deletion-base) 50%);background-repeat:repeat;background-size:2px 2px;background-size:calc(1lh/round(1lh / 2px)) calc(1lh/round(1lh / 2px))}[data-column-number]:is([data-indicators=bars] [data-line-type=change-addition]):before{background-color:var(--diffs-addition-base)}[data-overflow=wrap] [data-line],[data-overflow=wrap] [data-annotation-content]{white-space:pre-wrap;word-break:break-word}[data-overflow=scroll] [data-line]{white-space:pre;min-height:1lh}[data-column-number]{box-sizing:content-box;text-align:right;-webkit-user-select:none;user-select:none;color:var(--diffs-fg-number);padding-left:2ch}[data-line-number-content]{min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));z-index:1;display:inline-block;position:relative}[data-disable-line-numbers] [data-gutter-buffer],[data-disable-line-numbers] [data-column-number]{min-width:4px;padding:0}:is([data-disable-line-numbers] [data-gutter-buffer],[data-disable-line-numbers] [data-column-number]):before{min-width:0}[data-disable-line-numbers] [data-line-number-content]{display:none}[data-disable-line-numbers] [data-gutter-utility-slot]{right:unset;justify-content:flex-start;left:0}[data-disable-line-numbers][data-indicators=bars] [data-gutter-utility-slot]{left:6px}[data-file][data-disable-line-numbers] [data-gutter-buffer],[data-file][data-disable-line-numbers] [data-column-number]{border-right:0;min-width:0}[data-diff-span]{-webkit-box-decoration-break:clone;box-decoration-break:clone;border-radius:3px}[data-line-type=change-addition] [data-diff-span]{background-color:var(--diffs-bg-addition-emphasis)}[data-line-type=change-deletion] [data-diff-span]{background-color:var(--diffs-bg-deletion-emphasis)}[data-merge-conflict=marker-start],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator],[data-merge-conflict=marker-end]{color:var(--diffs-fg);padding-left:1ch}[data-merge-conflict=marker-start],[data-merge-conflict=marker-end]{align-items:center;display:flex}:is([data-merge-conflict=marker-start],[data-merge-conflict=marker-end]):after{color:var(--diffs-fg-conflict-marker);font-size:.75rem;font-style:normal;line-height:1.25rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));padding-left:1ch}[data-merge-conflict=marker-start]:after{content:"(Current Change)"}[data-merge-conflict=marker-end]:after{content:"(Incoming Change)"}[data-merge-conflict-actions-content]{min-height:1.75rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));color:var(--diffs-fg);align-items:center;gap:.25rem;padding-inline:.5rem;font-size:.75rem;line-height:1.2;display:flex}[data-merge-conflict-action]{appearance:none;color:var(--diffs-fg-number);font:inherit;cursor:pointer;background:0 0;border:0;padding:0;font-style:normal}[data-merge-conflict-action]:hover{color:var(--diffs-fg)}[data-merge-conflict-action=current]:hover{color:var(--diffs-addition-base)}[data-merge-conflict-action=incoming]:hover{color:var(--diffs-modified-base)}[data-merge-conflict-action-separator]{color:var(--diffs-fg-number);opacity:.6;-webkit-user-select:none;user-select:none}[data-diffs-header=default]{background-color:var(--diffs-bg);justify-content:space-between;align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));min-height:calc(1lh + var(--diffs-gap-block,var(--diffs-gap-fallback))*3);z-index:2;flex-direction:row;padding-inline:16px;display:flex;position:relative;top:0}[data-header-content]{align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));white-space:nowrap;flex-direction:row;min-width:0;display:flex}[data-header-content] [data-prev-name],[data-header-content] [data-title]{text-overflow:ellipsis;white-space:nowrap;direction:rtl;min-width:0;overflow:hidden}[data-prev-name]{opacity:.7}[data-rename-icon]{fill:currentColor;flex-grow:0;flex-shrink:0}[data-diffs-header=default] [data-metadata]{white-space:nowrap;align-items:center;gap:1ch;display:flex}[data-diffs-header=default] [data-additions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-addition-base)}[data-diffs-header=default] [data-deletions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-deletion-base)}[data-change-icon]{fill:currentColor;flex-shrink:0}[data-change-icon=change],[data-change-icon=rename-pure],[data-change-icon=rename-changed]{color:var(--diffs-modified-base)}[data-change-icon=new]{color:var(--diffs-addition-base)}[data-change-icon=deleted]{color:var(--diffs-deletion-base)}[data-change-icon=file]{opacity:.6}[data-annotation-content]{z-index:2;isolation:isolate;align-self:flex-start;min-width:0;display:flow-root;position:relative}[data-overflow=scroll] [data-annotation-content],[data-overflow=scroll] [data-merge-conflict-actions-content]{width:var(--diffs-column-content-width,auto);left:var(--diffs-column-number-width,0);position:sticky}[data-annotation-slot]{text-wrap-mode:wrap;word-break:normal;white-space-collapse:collapse}[data-gutter-utility-slot]{touch-action:none;justify-content:flex-end;display:flex;position:absolute;top:0;bottom:0;right:0}[data-utility-button]{appearance:none;cursor:pointer;width:1lh;height:1lh;font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);background-color:var(--diffs-modified-base);color:var(--diffs-bg);fill:currentColor;z-index:4;touch-action:none;border:none;border-radius:4px;justify-content:center;align-items:center;margin-right:calc(1ch - 1lh);padding:0;display:flex;position:relative}[data-utility-button]:before{content:"";display:block;position:absolute;inset:0 0 0 -4px}[data-decoration-bar-stack]{pointer-events:none;isolation:isolate;z-index:1;background-color:var(--diffs-decoration-bar-color,transparent);box-sizing:content-box;border-left:2px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg);width:6px;position:absolute;top:0;bottom:0;right:-2px}[data-decoration-bar-depth="1"] [data-decoration-bar-stack]{background-color:color-mix(in lab, var(--diffs-bg) 20%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="2"] [data-decoration-bar-stack]{background-color:color-mix(in lab, var(--diffs-bg) 45%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="3"] [data-decoration-bar-stack]{background-color:color-mix(in lab, var(--diffs-bg) 65%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-start] [data-decoration-bar-stack]{border-top-left-radius:5px;border-top-right-radius:5px}[data-decoration-bar-end] [data-decoration-bar-stack]{z-index:3;border-bottom-right-radius:5px;border-bottom-left-radius:5px}[data-placeholder]{contain:strict}[data-error-wrapper]{padding:var(--diffs-gap-block,var(--diffs-gap-fallback)) var(--diffs-gap-inline,var(--diffs-gap-fallback));scrollbar-width:none;max-height:400px;overflow:auto}[data-error-wrapper] [data-error-message]{color:var(--diffs-deletion-base);font-size:18px;font-weight:700}[data-error-wrapper] [data-error-stack]{color:var(--diffs-fg-number)}}@layer theme,rendered,unsafe;`,lo=`@layer base, theme, rendered, unsafe;`,uo=RegExp(`${ho(pr)}\\s*:\\s*[^;]+;`);function fo(e){return`${lo}
68
+ </svg>`;function co(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function lo(e,t){return e==null||t==null?e===t:fo(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}var uo={};function fo(e=uo,t=uo){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function po(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function mo(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}function ho(){let e=document.createElement(`style`);return e.setAttribute(xr,``),e}var go;function _o(e){if(go!=null)return go;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(Sr,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),go=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),go}function vo(e){return`${Cr}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var yo=`@layer base,theme,rendered,unsafe;@layer base{:host{--diffs-font-fallback:"SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "Courier New", monospace;--diffs-header-font-fallback:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;--diffs-mixer:light-dark(#000,#fff);--diffs-gap-fallback:8px;--diffs-scrollbar-gutter-fallback:6px;--diffs-scrollbar-gutter:var(--diffs-scrollbar-gutter-override,var(--diffs-scrollbar-gutter-measured,var(--diffs-scrollbar-gutter-fallback)));--diffs-added-light:#0dbe4e;--diffs-added-dark:#5ecc71;--diffs-modified-light:#009fff;--diffs-modified-dark:#69b1ff;--diffs-deleted-light:#ff2e3f;--diffs-deleted-dark:#ff6762;color-scheme:light dark;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);font-feature-settings:var(--diffs-font-features);--diffs-bg:light-dark(var(--diffs-light-bg,#fff),var(--diffs-dark-bg,#000));--diffs-bg-buffer:var(--diffs-bg-buffer-override,light-dark(color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))));--diffs-bg-context:var(--diffs-bg-context-override,light-dark(color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))));--diffs-bg-context-gutter:var(--diffs-bg-context-gutter-override,light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)),color-mix(in lab, var(--diffs-bg-context) 45%, var(--diffs-bg))));--diffs-bg-separator:var(--diffs-bg-separator-override,light-dark(color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))));--diffs-fg:light-dark(var(--diffs-light,#000),var(--diffs-dark,#fff));--diffs-fg-number:var(--diffs-fg-number-override,light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)),color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))));--diffs-fg-conflict-marker:var(--diffs-fg-conflict-marker-override,var(--diffs-fg-number));--diffs-deletion-base:var(--diffs-deletion-color-override,light-dark(var(--diffs-light-deletion-color,var(--diffs-deletion-color,var(--diffs-deleted-light))),var(--diffs-dark-deletion-color,var(--diffs-deletion-color,var(--diffs-deleted-dark)))));--diffs-addition-base:var(--diffs-addition-color-override,light-dark(var(--diffs-light-addition-color,var(--diffs-addition-color,var(--diffs-added-light))),var(--diffs-dark-addition-color,var(--diffs-addition-color,var(--diffs-added-dark)))));--diffs-modified-base:var(--diffs-modified-color-override,light-dark(var(--diffs-light-modified-color,var(--diffs-modified-color,var(--diffs-modified-light))),var(--diffs-dark-modified-color,var(--diffs-modified-color,var(--diffs-modified-dark)))));--diffs-bg-deletion:var(--diffs-bg-deletion-override,light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)),color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))));--diffs-bg-deletion-emphasis:var(--diffs-bg-deletion-emphasis-override,light-dark(rgb(from var(--diffs-deletion-base) r g b / .15),rgb(from var(--diffs-deletion-base) r g b / .2)));--diffs-bg-addition:var(--diffs-bg-addition-override,light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)),color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))));--diffs-bg-addition-emphasis:var(--diffs-bg-addition-emphasis-override,light-dark(rgb(from var(--diffs-addition-base) r g b / .15),rgb(from var(--diffs-addition-base) r g b / .2)));--diffs-selection-base:var(--diffs-modified-base);--diffs-selection-number-fg:light-dark(color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)));background-color:var(--diffs-bg);color:var(--diffs-fg);display:block}pre,code,[data-error-wrapper]{isolation:isolate;font-family:var(--diffs-font-family,var(--diffs-font-fallback));outline:none;margin:0;padding:0;display:block}pre,code{background-color:var(--diffs-bg)}code{contain:content}*,:before,:after{box-sizing:border-box}[data-icon-sprite]{display:none}[data-diffs-header],[data-separator]{font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback))}[data-diffs-header][data-sticky]{z-index:1;background-color:var(--diffs-bg);position:sticky;top:0}[data-file-info]{color:var(--fg);background-color:color-mix(in lab, var(--bg) 98%, var(--fg));border-block:1px solid color-mix(in lab, var(--bg) 95%, var(--fg));padding:10px;font-weight:700}[data-diff],[data-file]{--diffs-grid-number-column-width:minmax(min-content, max-content);--diffs-code-grid:var(--diffs-grid-number-column-width) 1fr}[data-dehydrated]:is([data-diff],[data-file]){--diffs-code-grid:var(--diffs-grid-number-column-width) minmax(0, 1fr)}:is([data-diff],[data-file]):hover [data-code]::-webkit-scrollbar-thumb{background-color:var(--diffs-bg-context)}@supports (-webkit-touch-callout:none){:host{--diffs-scrollbar-gutter-fallback:0px}}[data-line] span{color:light-dark(var(--diffs-token-light,var(--diffs-light)),var(--diffs-token-dark,var(--diffs-dark)));background-color:light-dark(var(--diffs-token-light-bg,inherit),var(--diffs-token-dark-bg,inherit));font-weight:light-dark(var(--diffs-token-light-font-weight,inherit),var(--diffs-token-dark-font-weight,inherit));font-style:light-dark(var(--diffs-token-light-font-style,inherit),var(--diffs-token-dark-font-style,inherit));-webkit-text-decoration:light-dark(var(--diffs-token-light-text-decoration,inherit),var(--diffs-token-dark-text-decoration,inherit));text-decoration:light-dark(var(--diffs-token-light-text-decoration,inherit),var(--diffs-token-dark-text-decoration,inherit))}[data-line],[data-gutter-buffer],[data-column-number],[data-line-annotation],[data-no-newline],[data-merge-conflict],[data-merge-conflict-actions]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-computed-diff-line-bg:var(--diffs-bg);--diffs-computed-selected-line-bg:var(--diffs-bg);color:var(--diffs-fg);background-color:var(--diffs-line-bg,var(--diffs-bg))}@media (pointer:fine){:is([data-line],[data-gutter-buffer],[data-column-number],[data-line-annotation],[data-no-newline],[data-merge-conflict],[data-merge-conflict-actions]):where([data-hovered]){--diffs-computed-hovered-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-selected-line-bg) 97%, var(--diffs-bg-hover-override,var(--diffs-mixer))),color-mix(in lab, var(--diffs-computed-selected-line-bg) 91%, var(--diffs-bg-hover-override,var(--diffs-mixer))));--diffs-line-bg:var(--diffs-computed-hovered-line-bg,inherit)}}[data-decoration-bg]:is([data-line],[data-no-newline]){--mix-deco-light:92%;--mix-deco-dark:85%}[data-decoration-bg][data-decoration-bg-depth="2"]:is([data-line],[data-no-newline]){--mix-deco-light:88%;--mix-deco-dark:80%}[data-decoration-bg][data-decoration-bg-depth="3"]:is([data-line],[data-no-newline]){--mix-deco-light:85%;--mix-deco-dark:78%}@media (pointer:fine){[data-decoration-bg][data-hovered]:is([data-line],[data-no-newline]):not([data-selected-line]){--mix-deco-light:85%;--mix-deco-dark:85%}[data-decoration-bg][data-hovered][data-decoration-bg-depth="2"]:is([data-line],[data-no-newline]):not([data-selected-line]){--mix-deco-light:83%;--mix-deco-dark:83%}[data-decoration-bg][data-hovered][data-decoration-bg-depth="3"]:is([data-line],[data-no-newline]):not([data-selected-line]){--mix-deco-light:81%;--mix-deco-dark:81%}}[data-decoration-bg]:is([data-line],[data-no-newline]){--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) var(--mix-deco-light), var(--diffs-decoration-bg)),color-mix(in lab, var(--diffs-bg) var(--mix-deco-dark), var(--diffs-decoration-bg)));--diffs-computed-diff-line-bg:var(--diffs-computed-decoration-bg);--diffs-computed-selected-line-bg:var(--diffs-computed-decoration-bg);--diffs-line-bg:var(--diffs-computed-decoration-bg)}[data-line-annotation],[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context);--diffs-computed-decoration-bg:var(--diffs-annotation-bg);--diffs-computed-diff-line-bg:var(--diffs-annotation-bg);--diffs-computed-selected-line-bg:var(--diffs-annotation-bg);--diffs-line-bg:var(--diffs-annotation-bg)}[data-merge-conflict-actions],[data-gutter-buffer=merge-conflict-action],[data-gutter-buffer=merge-conflict-marker-base],[data-gutter-buffer=merge-conflict-marker-separator],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator]{--diffs-computed-decoration-bg:var(--diffs-bg-context);--diffs-computed-diff-line-bg:var(--diffs-bg-context);--diffs-computed-selected-line-bg:var(--diffs-bg-context);--diffs-line-bg:var(--diffs-bg-context)}[data-gutter-buffer=merge-conflict-marker-start],[data-merge-conflict=marker-start]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))));--diffs-computed-diff-line-bg:var(--diffs-computed-decoration-bg);--diffs-computed-selected-line-bg:var(--diffs-computed-decoration-bg);--diffs-line-bg:var(--diffs-computed-decoration-bg)}[data-gutter-buffer=merge-conflict-marker-end],[data-merge-conflict=marker-end]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))));--diffs-computed-diff-line-bg:var(--diffs-computed-decoration-bg);--diffs-computed-selected-line-bg:var(--diffs-computed-decoration-bg);--diffs-line-bg:var(--diffs-computed-decoration-bg)}[data-has-merge-conflict] [data-line-annotation],[data-has-merge-conflict] [data-gutter-buffer=annotation]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-computed-diff-line-bg:var(--diffs-bg);--diffs-computed-selected-line-bg:var(--diffs-bg);--diffs-line-bg:var(--diffs-bg)}:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number]{--mix-light:91%;--mix-dark:85%}:where([data-background]) [data-line],:where([data-background]) [data-no-newline]{--mix-light:88%;--mix-dark:80%}:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]{--diffs-diff-line-mix-target:var(--diffs-bg)}[data-line-type=change-deletion]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--diffs-diff-line-mix-target:var(--diffs-bg-deletion-override,var(--diffs-deletion-base))}@media (pointer:fine){[data-line-type=change-deletion][data-hovered]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--mix-light:80%;--mix-dark:75%}}[data-line-type=change-deletion]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]):where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-deletion-override,var(--diffs-deletion-base));--diffs-diff-line-mix-target:var(--diffs-bg-deletion-number-override,var(--diffs-deletion-base))}[data-line-type=change-deletion]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)));--diffs-computed-selected-line-bg:var(--diffs-computed-diff-line-bg);--diffs-line-bg:var(--diffs-computed-diff-line-bg,inherit)}[data-line-type=change-addition]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--diffs-diff-line-mix-target:var(--diffs-bg-addition-override,var(--diffs-addition-base))}@media (pointer:fine){[data-line-type=change-addition][data-hovered]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--mix-light:80%;--mix-dark:70%}}[data-line-type=change-addition]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]):where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--diffs-bg-addition-number-override,var(--diffs-addition-base))}[data-line-type=change-addition]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)));--diffs-computed-selected-line-bg:var(--diffs-computed-diff-line-bg);--diffs-line-bg:var(--diffs-computed-diff-line-bg,inherit)}[data-merge-conflict=current]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--diffs-diff-line-mix-target:var(--conflict-bg-current-override,var(--diffs-addition-base))}[data-merge-conflict=current]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]):where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--conflict-bg-current-number-override,var(--diffs-addition-base))}@media (pointer:fine){[data-merge-conflict=current][data-hovered]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--mix-light:80%;--mix-dark:70%}}[data-merge-conflict=current]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)));--diffs-computed-selected-line-bg:var(--diffs-computed-diff-line-bg);--diffs-line-bg:var(--diffs-computed-diff-line-bg,inherit)}[data-merge-conflict=incoming]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--diffs-diff-line-mix-target:var(--conflict-bg-incoming-override,var(--diffs-modified-base))}[data-merge-conflict=incoming]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]):where([data-gutter-buffer],[data-column-number]){color:var(--diffs-modified-base);--diffs-diff-line-mix-target:var(--conflict-bg-incoming-number-override,var(--diffs-modified-base))}@media (pointer:fine){[data-merge-conflict=incoming][data-hovered]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--mix-light:80%;--mix-dark:70%}}[data-merge-conflict=incoming]:is(:where([data-background]) [data-gutter-buffer],:where([data-background]) [data-column-number],:where([data-background]) [data-line],:where([data-background]) [data-no-newline]){--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)));--diffs-computed-selected-line-bg:var(--diffs-computed-diff-line-bg);--diffs-line-bg:var(--diffs-computed-diff-line-bg,inherit)}[data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]{--diffs-selection-mix-target:var(--diffs-bg-selection-override,var(--diffs-selection-base))}[data-selected-line]:is([data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]):where([data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]){--mix-selection-light:82%;--mix-selection-dark:75%}@media (pointer:fine){[data-selected-line][data-hovered]:is([data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]):where([data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]):not([data-merge-conflict],[data-line-type=change-addition],[data-line-type=change-deletion]){--mix-selection-light:75%;--mix-selection-dark:70%}}[data-selected-line]:is([data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]):where([data-gutter-buffer],[data-column-number]){--mix-selection-light:75%;--mix-selection-dark:60%;--diffs-selection-mix-target:var(--diffs-bg-selection-number-override,var(--diffs-selection-base))}@media (pointer:fine){[data-selected-line][data-hovered]:is([data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]):where([data-gutter-buffer],[data-column-number]):not([data-merge-conflict],[data-line-type=change-addition],[data-line-type=change-deletion]){--mix-selection-light:70%;--mix-selection-dark:55%}}[data-selected-line]:is([data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]){--diffs-computed-selected-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-light), var(--diffs-selection-mix-target)),color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-dark), var(--diffs-selection-mix-target)));--diffs-line-bg:var(--diffs-computed-selected-line-bg,inherit)}[data-selected-line]:is([data-gutter-buffer],[data-column-number]){color:var(--diffs-selection-number-fg)}[data-no-newline]{-webkit-user-select:none;user-select:none}[data-no-newline] span{opacity:.6}[data-diff-type=split][data-overflow=scroll]{grid-template-columns:1fr 1fr;display:grid}[data-diff-type=split][data-overflow=scroll] [data-additions]{border-left:1px solid var(--diffs-bg)}[data-diff-type=split][data-overflow=scroll] [data-deletions]{border-right:1px solid var(--diffs-bg)}[data-code]{grid-auto-flow:dense;grid-template-columns:var(--diffs-code-grid);overflow:var(--diffs-overflow-override,scroll) clip;overscroll-behavior-x:none;tab-size:var(--diffs-tab-size,2);padding-top:var(--diffs-gap-block,var(--diffs-gap-fallback));padding-bottom:max(0px, calc(var(--diffs-gap-block,var(--diffs-gap-fallback)) - var(--diffs-scrollbar-gutter)));scrollbar-gutter:stable;align-self:flex-start;display:grid}[data-diffs-scrollbar-measure]{opacity:0;pointer-events:none;scrollbar-gutter:auto;grid-template-columns:none;width:100px;height:100px;padding:0;position:absolute;top:-200px;left:-200px}[data-container-size]{container-type:inline-size}[data-code]::-webkit-scrollbar{width:0;height:var(--diffs-scrollbar-gutter)}[data-code]::-webkit-scrollbar-track{background:0 0}[data-code]::-webkit-scrollbar-thumb{background-color:#0000;background-clip:content-box;border:1px solid #0000;border-radius:3px}[data-code]::-webkit-scrollbar-corner{background-color:#0000}@supports ((-moz-appearance:none)){[data-code]{scrollbar-width:thin;scrollbar-color:var(--diffs-bg-context) transparent;padding-bottom:var(--diffs-gap-block,var(--diffs-gap-fallback))}}:is([data-diffs-header]~[data-diff],[data-diffs-header]~[data-file]) [data-code],[data-overflow=wrap]:is([data-diffs-header]~[data-diff],[data-diffs-header]~[data-file]){padding-top:0}[data-gutter]{grid-template-rows:subgrid;grid-template-columns:subgrid;z-index:3;background-color:var(--diffs-bg);grid-column:1;display:grid;position:relative}[data-gutter] [data-gutter-buffer],[data-gutter] [data-column-number]{border-right:var(--diffs-gap-style,2px solid var(--diffs-bg))}[data-content]{grid-template-rows:subgrid;grid-template-columns:subgrid;background-color:var(--diffs-bg);grid-column:2;min-width:0;display:grid}[data-diff-type=split][data-overflow=wrap]{grid-auto-flow:dense;grid-template-columns:repeat(2, var(--diffs-code-grid));padding-block:var(--diffs-gap-block,var(--diffs-gap-fallback));display:grid}[data-diff-type=split][data-overflow=wrap] [data-deletions]{display:contents}:is([data-diff-type=split][data-overflow=wrap] [data-deletions]) [data-gutter]{grid-column:1}:is([data-diff-type=split][data-overflow=wrap] [data-deletions]) [data-content]{border-right:1px solid var(--diffs-bg);grid-column:2}[data-diff-type=split][data-overflow=wrap] [data-additions]{display:contents}:is([data-diff-type=split][data-overflow=wrap] [data-additions]) [data-gutter]{border-left:1px solid var(--diffs-bg);grid-column:3}:is([data-diff-type=split][data-overflow=wrap] [data-additions]) [data-content]{grid-column:4}[data-overflow=scroll] [data-gutter]{position:sticky;left:0}[data-interactive-lines] [data-line]{cursor:pointer}[data-interactive-line-numbers] [data-column-number]{cursor:pointer;touch-action:none}[data-content-buffer],[data-gutter-buffer]{-webkit-user-select:none;user-select:none;min-height:1lh;position:relative}[data-gutter-buffer]{padding-left:2ch;padding-right:1ch}[data-gutter-buffer]:before{content:"";min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));display:block}[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context-gutter);min-height:0}[data-gutter-buffer=buffer]{--diffs-line-bg:var(--diffs-bg-context-gutter)}[data-content-buffer]{background-position:5px 0;background-size:8px 8px;background-origin:border-box;background-image:repeating-linear-gradient(-45deg, transparent, transparent 4.242px, var(--diffs-bg-buffer) 4.242px, var(--diffs-bg-buffer) 5.656px);grid-column:1}[data-separator]{box-sizing:content-box;background-color:var(--diffs-bg)}[data-separator=simple]{min-height:4px}[data-separator=line-info],[data-separator=line-info-basic],[data-separator=metadata],[data-separator=simple]{background-color:var(--diffs-bg-separator)}[data-separator=line-info],[data-separator=line-info-basic],[data-separator=metadata]{height:32px;position:relative}[data-separator-wrapper]{-webkit-user-select:none;user-select:none;fill:currentColor;background-color:var(--diffs-bg);align-items:center;height:100%;display:flex;position:absolute;inset-inline:0}[data-content] [data-separator-wrapper]{display:none}[data-separator=metadata] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;color:var(--diffs-fg-number);white-space:nowrap;text-overflow:ellipsis;min-width:min-content;padding-inline:1ch;inset-inline:100% auto;overflow:hidden}[data-separator=line-info]{margin-block:var(--diffs-gap-block,var(--diffs-gap-fallback))}[data-separator=line-info] [data-separator-wrapper]{min-width:16px}[data-separator=line-info-basic],[data-separator=metadata]{margin-block:0}[data-separator=line-info][data-separator-first]{margin-top:0}[data-separator=line-info][data-separator-last]{margin-bottom:0}[data-expand-index] [data-separator-wrapper]{grid-template-columns:32px auto;display:grid}[data-expand-index] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:32px 32px auto}[data-expand-button],[data-separator-content]{background-color:var(--diffs-bg-separator);flex:none;align-items:center;display:flex}[data-expand-index] [data-separator-content]:hover{cursor:pointer;text-decoration:underline}[data-expand-button]{cursor:pointer;min-width:32px;color:var(--diffs-fg-number);border-right:2px solid var(--diffs-bg);flex-shrink:0;justify-content:center;align-self:stretch}[data-expand-button]:hover{color:var(--diffs-fg)}[data-expand-button][data-expand-all-button]{display:none}[data-expand-down] [data-icon]{transform:scaleY(-1)}[data-separator-content]{height:100%;color:var(--diffs-fg-number);flex:auto;justify-content:flex-start;padding:0 1ch;overflow:hidden}:is([data-separator=line-info],[data-separator=line-info-basic]) [data-separator-content]{-webkit-user-select:none;user-select:none;height:100%;overflow:clip}[data-unmodified-lines]{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;display:block;overflow:hidden}@supports (width:1cqi){[data-unified] [data-separator=line-info] [data-separator-wrapper]{padding-inline:var(--diffs-gap-inline,var(--diffs-gap-fallback));width:100cqi}:is([data-unified] [data-separator=line-info] [data-separator-wrapper]) [data-separator-content]{border-radius:6px}[data-unified] [data-separator=line-info][data-expand-index] [data-separator-wrapper] [data-separator-content]{border-top-left-radius:unset;border-bottom-left-radius:unset}[data-gutter] [data-separator=line-info] [data-separator-wrapper]{padding-left:var(--diffs-gap-inline,var(--diffs-gap-fallback))}[data-gutter] [data-separator=line-info] [data-separator-content]{border-top-left-radius:6px;border-bottom-left-radius:6px}[data-gutter] [data-separator=line-info][data-expand-index] [data-separator-content]{border-top-left-radius:unset;border-bottom-left-radius:unset}[data-additions] [data-content] [data-separator=line-info]{background-color:var(--diffs-bg)}:is([data-additions] [data-content] [data-separator=line-info]) [data-separator-wrapper]{display:none}[data-additions] [data-gutter] [data-separator=line-info] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);border-top-right-radius:6px;border-bottom-right-radius:6px;height:100%;display:block}:is([data-additions] [data-gutter] [data-separator=line-info] [data-separator-wrapper]) [data-separator-content],:is([data-additions] [data-gutter] [data-separator=line-info] [data-separator-wrapper]) [data-expand-button]{display:none}[data-overflow=scroll] [data-additions] [data-gutter] [data-separator=line-info] [data-separator-wrapper]{width:calc(100cqi - var(--diffs-gap-inline,var(--diffs-gap-fallback)))}[data-overflow=wrap] [data-additions] [data-content] [data-separator=line-info] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;margin-right:var(--diffs-gap-inline,var(--diffs-gap-fallback));border-top-right-radius:6px;border-bottom-right-radius:6px;display:block}:is([data-overflow=wrap] [data-additions] [data-content] [data-separator=line-info] [data-separator-wrapper]) [data-separator-content],:is([data-overflow=wrap] [data-additions] [data-content] [data-separator=line-info] [data-separator-wrapper]) [data-expand-button]{display:none}:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-both],:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-down],:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}@media (pointer:fine){[data-separator-multi-button]:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:unset}[data-separator-multi-button]:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-down]{border-bottom-left-radius:6px;border-top-left-radius:unset}}}@media (pointer:coarse){[data-separator=line-info-basic] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:34px 34px auto}:is([data-separator=line-info-basic] [data-separator-wrapper][data-separator-multi-button]) [data-separator-content]{grid-column:unset;grid-row:unset}@supports (width:1cqi){:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-both],:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-down],:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-up],[data-separator-multi-button]:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}[data-separator-multi-button]:is([data-separator=line-info] [data-separator-wrapper]) [data-expand-down]{border-bottom-left-radius:unset;border-top-left-radius:unset}}}@media (pointer:fine){[data-separator-wrapper][data-separator-multi-button]{grid-template-rows:50% 50%;display:grid}[data-separator-wrapper][data-separator-multi-button] [data-separator-content]{grid-area:1/2/-1;min-width:min-content}[data-separator-wrapper][data-separator-multi-button] [data-expand-button]{grid-column:1}[data-separator=line-info] [data-separator-wrapper],[data-separator=line-info] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:34px auto}[data-separator=line-info-basic][data-expand-index] [data-separator-wrapper]{grid-template-columns:100% auto}:is(:is([data-separator=line-info],[data-separator=line-info-basic]) [data-separator-multi-button]) [data-expand-up]{border-bottom:1px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg)}:is(:is([data-separator=line-info],[data-separator=line-info-basic]) [data-separator-multi-button]) [data-expand-down]{border-top:1px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg)}}[data-additions] [data-gutter] [data-separator-wrapper],[data-additions] [data-separator=line-info-basic] [data-separator-wrapper],[data-content] [data-separator-wrapper]{display:none}[data-line-annotation]{min-height:var(--diffs-annotation-min-height,0);z-index:2}[data-merge-conflict-actions]{z-index:2}[data-separator=custom]{grid-template-columns:subgrid;display:grid}[data-line],[data-column-number],[data-no-newline]{padding-inline:1ch;position:relative}[data-indicators=classic] [data-line]{padding-inline-start:2ch}:is([data-no-newline]:is([data-indicators=classic] [data-line-type=change-addition],[data-indicators=classic] [data-line-type=change-deletion]),[data-line]:is([data-indicators=classic] [data-line-type=change-addition],[data-indicators=classic] [data-line-type=change-deletion])):before{-webkit-user-select:none;user-select:none;width:1ch;height:1lh;display:inline-block;position:absolute;top:0;left:0}:is([data-line]:is([data-indicators=classic] [data-line-type=change-addition]),[data-no-newline]:is([data-indicators=classic] [data-line-type=change-addition])):before{content:"+";color:var(--diffs-addition-base)}:is([data-line]:is([data-indicators=classic] [data-line-type=change-deletion]),[data-no-newline]:is([data-indicators=classic] [data-line-type=change-deletion])):before{content:"-";color:var(--diffs-deletion-base)}[data-column-number]:is([data-indicators=bars] [data-line-type=change-deletion],[data-indicators=bars] [data-line-type=change-addition]):before{content:"";-webkit-user-select:none;user-select:none;contain:strict;width:4px;height:100%;display:block;position:absolute;top:0;left:0}[data-column-number]:is([data-indicators=bars] [data-line-type=change-deletion]):before{background-image:linear-gradient(0deg, var(--diffs-bg-deletion) 50%, var(--diffs-deletion-base) 50%);background-repeat:repeat;background-size:2px 2px;background-size:calc(1lh/round(1lh / 2px)) calc(1lh/round(1lh / 2px))}[data-column-number]:is([data-indicators=bars] [data-line-type=change-addition]):before{background-color:var(--diffs-addition-base)}[data-overflow=wrap] [data-line],[data-overflow=wrap] [data-annotation-content]{white-space:pre-wrap;word-break:break-word}[data-overflow=scroll] [data-line]{white-space:pre;min-height:1lh}[data-column-number]{box-sizing:content-box;text-align:right;-webkit-user-select:none;user-select:none;color:var(--diffs-fg-number);padding-left:2ch}[data-line-number-content]{min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));z-index:1;display:inline-block;position:relative}[data-disable-line-numbers] [data-gutter-buffer],[data-disable-line-numbers] [data-column-number]{min-width:4px;padding:0}:is([data-disable-line-numbers] [data-gutter-buffer],[data-disable-line-numbers] [data-column-number]):before{min-width:0}[data-disable-line-numbers] [data-line-number-content]{display:none}[data-disable-line-numbers] [data-gutter-utility-slot]{right:unset;justify-content:flex-start;left:0}[data-disable-line-numbers][data-indicators=bars] [data-gutter-utility-slot]{left:6px}[data-file][data-disable-line-numbers] [data-gutter-buffer],[data-file][data-disable-line-numbers] [data-column-number]{border-right:0;min-width:0}[data-diff-span]{-webkit-box-decoration-break:clone;box-decoration-break:clone;border-radius:3px}[data-line-type=change-addition] [data-diff-span]{background-color:var(--diffs-bg-addition-emphasis)}[data-line-type=change-deletion] [data-diff-span]{background-color:var(--diffs-bg-deletion-emphasis)}[data-merge-conflict=marker-start],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator],[data-merge-conflict=marker-end]{color:var(--diffs-fg);padding-left:1ch}[data-merge-conflict=marker-start],[data-merge-conflict=marker-end]{align-items:center;display:flex}:is([data-merge-conflict=marker-start],[data-merge-conflict=marker-end]):after{color:var(--diffs-fg-conflict-marker);font-size:.75rem;font-style:normal;line-height:1.25rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));padding-left:1ch}[data-merge-conflict=marker-start]:after{content:"(Current Change)"}[data-merge-conflict=marker-end]:after{content:"(Incoming Change)"}[data-merge-conflict-actions-content]{min-height:1.75rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));color:var(--diffs-fg);align-items:center;gap:.25rem;padding-inline:.5rem;font-size:.75rem;line-height:1.2;display:flex}[data-merge-conflict-action]{appearance:none;color:var(--diffs-fg-number);font:inherit;cursor:pointer;background:0 0;border:0;padding:0;font-style:normal}[data-merge-conflict-action]:hover{color:var(--diffs-fg)}[data-merge-conflict-action=current]:hover{color:var(--diffs-addition-base)}[data-merge-conflict-action=incoming]:hover{color:var(--diffs-modified-base)}[data-merge-conflict-action-separator]{color:var(--diffs-fg-number);opacity:.6;-webkit-user-select:none;user-select:none}[data-diffs-header=default]{background-color:var(--diffs-bg);justify-content:space-between;align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));min-height:calc(1lh + var(--diffs-gap-block,var(--diffs-gap-fallback))*3);z-index:2;flex-direction:row;padding-inline:16px;display:flex;position:relative;top:0}[data-header-content]{align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));white-space:nowrap;flex-direction:row;min-width:0;display:flex}[data-header-content] [data-prev-name],[data-header-content] [data-title]{text-overflow:ellipsis;white-space:nowrap;direction:rtl;min-width:0;overflow:hidden}[data-prev-name]{opacity:.7}[data-rename-icon]{fill:currentColor;flex-grow:0;flex-shrink:0}[data-diffs-header=default] [data-metadata]{white-space:nowrap;align-items:center;gap:1ch;display:flex}[data-diffs-header=default] [data-additions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-addition-base)}[data-diffs-header=default] [data-deletions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-deletion-base)}[data-change-icon]{fill:currentColor;flex-shrink:0}[data-change-icon=change],[data-change-icon=rename-pure],[data-change-icon=rename-changed]{color:var(--diffs-modified-base)}[data-change-icon=new]{color:var(--diffs-addition-base)}[data-change-icon=deleted]{color:var(--diffs-deletion-base)}[data-change-icon=file]{opacity:.6}[data-annotation-content]{z-index:2;isolation:isolate;align-self:flex-start;min-width:0;display:flow-root;position:relative}[data-overflow=scroll] [data-annotation-content],[data-overflow=scroll] [data-merge-conflict-actions-content]{width:var(--diffs-column-content-width,auto);left:var(--diffs-column-number-width,0);position:sticky}[data-annotation-slot]{text-wrap-mode:wrap;word-break:normal;white-space-collapse:collapse}[data-gutter-utility-slot]{touch-action:none;justify-content:flex-end;display:flex;position:absolute;top:0;bottom:0;right:0}[data-utility-button]{appearance:none;cursor:pointer;width:1lh;height:1lh;font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);background-color:var(--diffs-modified-base);color:var(--diffs-bg);fill:currentColor;z-index:4;touch-action:none;border:none;border-radius:4px;justify-content:center;align-items:center;margin-right:calc(1ch - 1lh);padding:0;display:flex;position:relative}[data-utility-button]:before{content:"";display:block;position:absolute;inset:0 0 0 -4px}[data-decoration-bar-stack]{pointer-events:none;isolation:isolate;z-index:1;background-color:var(--diffs-decoration-bar-color,transparent);box-sizing:content-box;border-left:2px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg);width:6px;position:absolute;top:0;bottom:0;right:-2px}[data-decoration-bar-depth="1"] [data-decoration-bar-stack]{background-color:color-mix(in lab, var(--diffs-bg) 20%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="2"] [data-decoration-bar-stack]{background-color:color-mix(in lab, var(--diffs-bg) 45%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="3"] [data-decoration-bar-stack]{background-color:color-mix(in lab, var(--diffs-bg) 65%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-start] [data-decoration-bar-stack]{border-top-left-radius:5px;border-top-right-radius:5px}[data-decoration-bar-end] [data-decoration-bar-stack]{z-index:3;border-bottom-right-radius:5px;border-bottom-left-radius:5px}[data-placeholder]{contain:strict}[data-error-wrapper]{padding:var(--diffs-gap-block,var(--diffs-gap-fallback)) var(--diffs-gap-inline,var(--diffs-gap-fallback));scrollbar-width:none;max-height:400px;overflow:auto}[data-error-wrapper] [data-error-message]{color:var(--diffs-deletion-base);font-size:18px;font-weight:700}[data-error-wrapper] [data-error-stack]{color:var(--diffs-fg-number)}}@layer theme,rendered,unsafe;`,bo=`@layer base, theme, rendered, unsafe;`,xo=RegExp(`${To(Cr)}\\s*:\\s*[^;]+;`);function So(e){return`${bo}
69
69
  @layer unsafe {
70
70
  ${e}
71
- }`}function po(e,t=`system`,n){return`${lo}
71
+ }`}function Co(e,t=`system`,n){return`${bo}
72
72
  @layer rendered {
73
73
  :host {${t===`system`?``:`
74
74
  color-scheme: ${t};`}
75
- ${so(n)}
75
+ ${vo(n)}
76
76
  ${e}
77
77
  }
78
- }`}function mo(e,t){let n=so(t);return e.replace(uo,n)}function ho(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function go(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:e?.useTokenTransformer,tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function _o({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function vo({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=yo(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function yo(){let e=document.createElement(`style`);return e.setAttribute(ur,``),e}function bo(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function xo(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`);break}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.tabIndex=0,e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(co)),t.adoptedStyleSheets=[e]}connectedCallback(){oo(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define($n,t)}var So=[],Co=-1,wo=class{static LoadedCustomComponent=!0;__id=`file:${++Co}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;renderRange;enabled=!0;constructor(e={theme:K},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new Ya(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new zi,this.interactionManager=new bi(`file`,xi(e)),this.workerManager?.subscribeToThemeChanges(this)}handleHighlightRender=()=>{this.rerender()};rerender(){!this.enabled||this.file==null||this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(xi(this.options))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType===t?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!si(this.appliedThemeCSS.theme,this.options.theme??K)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,e===`wrap`),this.managersDirty=!1}cleanUp(e=!1){this.emitPostRender(!0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.annotationCache.clear(),this.pre=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder=void 0,this.unsafeCSSStyle=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;this.hydrateElements(t,n),To(this.pre,i,this.options.collapsed)||Eo(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),bo(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(go(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.file){return e==null?So:this.fileRenderer.getOrCreateLineCache(e)}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){let{collapsed:c=!1,themeType:l=`system`}=this.options;if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);let u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.lineAnnotations.length>0)?o!==this.lineAnnotations:!1,m=!Wi(this.file,e);if(!c&&!n&&Gi(u,this.renderRange)&&!m&&!p&&!f)return this.applyCachedThemeState(l);this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.file=e,this.fileRenderer.setOptions(go(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:h=!1,disableFileHeader:g=!1}=this.options;if(g&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let n=this.fileRenderer.renderFile(e,vr);n!=null&&this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n?.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.injectUnsafeCSS()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}try{let r=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f)||!this.applyPartialRender(d,u)){let n=this.fileRenderer.renderFile(e,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.applyFullRender(n,r)}this.applyBuffers(r,u),this.injectUnsafeCSS(),this.managersDirty=!0,a||this.flushManagers(),this.renderAnnotations(),this.renderGutterUtility()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}primeHighlightCache(){let{file:e,workerManager:t}=this;e==null||e.cacheKey==null||t==null||Yi(e)||this.fileRenderer.getOrCreateLineCache(e).length>(this.options.tokenizeMaxLength??1e5)||t.primeFileHighlightCache(e)}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.gutterUtilityContent?.remove(),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.gutterUtilityContent=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${ei(r)}`,a=this.annotationCache.get(i);if(a==null||!Qa(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:no(ei(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=ro();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}this.unsafeCSSStyle?.parentNode===t&&this.appliedUnsafeCSS===e||(this.unsafeCSSStyle??=io(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=fo(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??K,s=typeof o==`string`?o:{...o},c=oo(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=vo({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:po(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=mo(this.themeCSSStyle.textContent??``,oo(e)))}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e),this.code=_o({code:this.code}),this.code.innerHTML=this.fileRenderer.renderPartialHTML(this.fileRenderer.renderCodeAST(e)),t.replaceChildren(this.code),this.lastRowCount=e.rowCount}applyPartialRender(e,t){if(e==null||t==null)return!1;let{file:n,code:r}=this,i=r==null?void 0:this.getColumns(r);if(n==null||r==null||i==null)return!1;let a=e.startingLine,o=t.startingLine,s=e.totalLines===1/0?1/0:a+e.totalLines,c=t.totalLines===1/0?1/0:o+t.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l||!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))return!1;let{length:d}=i.content.children,f=(e,t)=>{if(!(t<=0))return this.fileRenderer.renderFile(n,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,t){let{file:n}=this;if(n==null)return;this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??ge(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderCustomHeader:a,renderHeaderMetadata:o}=this.options;if(a!=null){let e=a(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,lr,e),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=o?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,sr,e),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,cr,r),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:ui(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):ui(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=Za;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};$a(i,this.appliedPreAttributes)||(xo(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function To(e,t,n=!1){return!n&&e==null&&t!=null}function Eo(e,t,n=!1){return e==null&&t!=null&&!n}function Do(e){return{...hr,...e}}function Oo(e,t){let n=ko(e,t);return t?n:e.diffHeaderHeight+n}function ko(e,t){return e.paddingTop??(t?e.spacing:0)}function Ao(e){return e.paddingBottom??e.spacing}function jo(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}var Mo=5e3,No=-1;function Po(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS}var Fo=class extends wo{__id=`virtualized-file:${++No}`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0};isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=hr,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){!t&&oi(this.metrics,e)||(this.metrics=e,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}hasLineAnnotations(){return this.lineAnnotations.some(e=>e.lineNumber>0)}getLineHeight(e,t=!1){let n=this.cache.heights.get(e);if(n!=null)return n;let r=t?2:1;return this.metrics.lineHeight*r}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!ci(t,e),r=Po(t,e);super.setOptions(e),r&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache(e=!1){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.renderRange!=null&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){let e=!1;if(this.fileContainer==null||this.file==null)return this.height!==0&&(e=!0),this.height=0,e;let{overflow:t=`scroll`}=this.options;if(this.top=this.getVirtualizedTop(),t===`scroll`&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled()||this.code==null)return e;let n=this.code.children[1];if(!(n instanceof HTMLElement))return e;let r=Zi(this.lineAnnotations);if(this.renderRange!=null&&r&&$i(this.renderRange)){let t=Io(n)??0;t!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=t,e=!0)}else!r&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(let t of n.children){if(!(t instanceof HTMLElement))continue;let n=t.dataset.lineIndex;if(n==null)continue;let r=Number(n),i=t.getBoundingClientRect().height,a=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(a=!0),i+=t.nextElementSibling.getBoundingClientRect().height);let o=this.getLineHeight(r,a);i!==o&&(e=!0,i===this.metrics.lineHeight*(a?2:1)?this.cache.heights.delete(r):this.cache.heights.set(r,i))}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null||this.file==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}));prepareCodeViewItem(e,t,n,r){let i=this.syncLineAnnotations(r),a=n?.resetFileLayoutCache===!0||i;n?.metrics!=null&&(this.metrics=n.metrics,a=!0);let{collapsed:o=!1}=this.options;return this.currentCollapsed!==o&&(this.currentCollapsed=o,a=!0),a&&this.resetLayoutCache(),this.file!==e&&(this.layoutDirty=!0),this.file=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e){if(this.file==null||e<1)return;let{disableFileHeader:t=!1,collapsed:n=!1}=this.options,r=Lo(this.getOrCreateLineCache(this.file)),i=Oo(this.metrics,t);if(n||r<0)return{top:i,height:0};let a=Math.min(Math.max(e-1,0),r),{overflow:o=`scroll`}=this.options,{lineHeight:s}=this.metrics;if(i+=this.cache.fileAnnotationHeight,o===`scroll`&&!this.hasLineAnnotations())return{top:i+a*s,height:s};let c=this.getLayoutCheckpointBeforeLineIndex(a);i=c?.top??i;for(let e=c?.lineIndex??0;e<a;e++)i+=this.getLineHeight(e,!1);return{top:i,height:this.getLineHeight(a,!1)}}getNumericScrollAnchor(e){if(this.file==null||this.renderRange==null)return;let{disableFileHeader:t=!1,collapsed:n=!1,overflow:r=`scroll`}=this.options;if(n||this.renderRange.totalLines<=0)return;let i=Lo(this.getOrCreateLineCache(this.file));if(i<0)return;let a=Oo(this.metrics,t),o=Math.min(this.renderRange.startingLine,i),s=Math.min(o+this.renderRange.totalLines-1,i);if(s<o)return;let{fileAnnotationHeight:c}=this.cache;if(r===`scroll`&&!this.hasLineAnnotations()){let{lineHeight:t}=this.metrics,n=a+(o===0?c:this.renderRange.bufferBefore),r=o+Math.max(Math.ceil((e-n)/t),0);return r>s?void 0:{lineNumber:r+1,top:a+c+r*t}}let l=a+(o===0?c:this.renderRange.bufferBefore);for(let t=o;t<=s;t++){if(l>=e)return{lineNumber:t+1,top:l};l+=this.getLineHeight(t)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.file==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let t=e==null?this.renderRange:this.computeRenderRangeFromWindow(this.file,this.top,e);if(t==null)return;let{bufferBefore:n,bufferAfter:r,totalLines:i}=t,a=0;if(i===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(a=r)}return{topOffset:this.top+n+a,height:this.height-(n+r)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache(),this.isSetup=!1,super.cleanUp(e)}computeApproximateSize(e=!1){let t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;let n=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.file==null){this.layoutDirty=!1;return}let{disableFileHeader:r=!1,collapsed:i=!1,overflow:a=`scroll`}=this.options,{lineHeight:o}=this.metrics,s=this.getOrCreateLineCache(this.file),c=Oo(this.metrics,r),l=Ao(this.metrics);if(this.height+=c,i){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,a===`scroll`&&!this.hasLineAnnotations()?this.height+=this.getOrCreateLineCache(this.file).length*o:ea({lines:s,callback:({lineIndex:e})=>{this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1)}}),s.length>0&&(this.height+=l),this.fileContainer!=null&&t&&!n){let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFile.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFile.computeApproximateSize: computed height doesnt match`,{name:this.file.name,elementHeight:e.height,computedHeight:this.height})}this.layoutDirty=!1}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.file==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:r,...i}){let{forceRenderOverride:a,isSetup:o}=this;this.forceRenderOverride=void 0;let s=this.syncLineAnnotations(r);if(s&&this.resetLayoutCache(),this.file??=t,e=this.getOrCreateFileContainerNode(e),this.file==null)return console.error(`VirtualizedFile.render: attempting to virtually render when we dont have file`),!1;if(o)this.top??=this.getVirtualizedTop();else{this.computeApproximateSize();let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFile.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode())return this.renderPlaceholder(this.height);let c=this.virtualizer.getWindowSpecs(),l=this.top??0,u=this.computeRenderRangeFromWindow(this.file,l,c);return super.render({file:this.file,fileContainer:e,renderRange:u,lineAnnotations:r,forceRender:(a??n)||s,...i})}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}addLayoutCheckpoint(e,t){e%Mo===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFile: invalid checkpoint index`);if(n.lineIndex%t===0)return n}}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,overflow:a=`scroll`}=this.options,{hunkLineCount:o,lineHeight:s}=this.metrics,c=this.getOrCreateLineCache(e),l=c.length,u=this.height,d=Oo(this.metrics,i),f=l>0?Ao(this.metrics):0,{fileAnnotationHeight:p}=this.cache,m=d+p,h=Math.max(0,u-d-p-f),g=Zi(this.lineAnnotations),_=t+d,v=p>0&&g&&_<r&&_+p>n;if(t<n-u||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:u-d-f};if(l<=o)return{startingLine:0,totalLines:o,bufferBefore:0,bufferAfter:0};let y=Math.ceil(Math.max(r-n,0)/s),b=Math.ceil(y/o)*o+o*2,x=b/o,S=(n+r)/2;if(a===`scroll`&&!this.hasLineAnnotations()){let e=t+m,i=e+h;if(!v&&!(e<r&&i>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:u-d-f};let a=Math.floor(v&&S<t+m?0:(S-(t+m))/s),c=Math.floor(a/o)-Math.floor(x/2),g=Math.ceil(l/o),_=Math.max(0,Math.min(c,g))*o,y=c<0?b+c*o:b,C=_===0?0:p+_*s,w=Math.min(y,l-_);return{startingLine:_,totalLines:y,bufferBefore:C,bufferAfter:Math.max(0,(l-_-w)*s)}}let C=x,w=[],T=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-b*s*2),o),E=t+(T?.top??m),D=T?.lineIndex??0,O,k,A;if(ea({lines:c,startingLine:T?.lineIndex??0,callback:({lineIndex:e})=>{let i=D%o===0,a=Math.floor(D/o);if(i&&(w[a]=E-(t+m),A!=null)){if(A<=0)return!0;A--}let s=this.getLineHeight(e,!1);return E>n-s&&E<r&&(O??=a),E+s>S&&(k??=a),A==null&&E>=r&&i&&(A=C),D++,E+=s,!1}}),O==null)if(v)O=0,k=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:u-d-f};k??=O;let j=Math.round(k-x/2),ee=Math.max(0,Math.ceil(l/o)-x),te=Math.max(0,Math.min(j,ee)),M=te*o,N=j<0?b+j*o:b,ne=w[te]??0,P=M===0?0:p+ne,re=te+N/o,ie=re<w.length?h-w[re]:h-(E-t-m);return{startingLine:M,totalLines:N,bufferBefore:P,bufferAfter:Math.max(0,ie)}}};function Io(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===Xi&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function Lo(e){let t=e.at(-1);return t==null||t===``||t===`
78
+ }`}function wo(e,t){let n=vo(t);return e.replace(xo,n)}function To(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Eo(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:e?.useTokenTransformer,tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function Do({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function Oo({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=ko(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function ko(){let e=document.createElement(`style`);return e.setAttribute(br,``),e}function Ao(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function jo(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`);break}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.tabIndex=0,e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(yo)),t.adoptedStyleSheets=[e]}connectedCallback(){_o(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(lr,t)}var Mo=[],No=-1,Po=class{static LoadedCustomComponent=!0;__id=`file:${++No}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;renderRange;enabled=!0;constructor(e={theme:G},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new ao(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new Yi,this.interactionManager=new Ai(`file`,ji(e)),this.workerManager?.subscribeToThemeChanges(this)}handleHighlightRender=()=>{this.rerender()};rerender(){!this.enabled||this.file==null||this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(ji(this.options))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType===t?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!_i(this.appliedThemeCSS.theme,this.options.theme??G)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,e===`wrap`),this.managersDirty=!1}cleanUp(e=!1){this.emitPostRender(!0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.annotationCache.clear(),this.pre=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder=void 0,this.unsafeCSSStyle=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;this.hydrateElements(t,n),Fo(this.pre,i,this.options.collapsed)||Io(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Ao(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(Eo(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.file){return e==null?Mo:this.fileRenderer.getOrCreateLineCache(e)}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){let{collapsed:c=!1,themeType:l=`system`}=this.options;if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);let u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.lineAnnotations.length>0)?o!==this.lineAnnotations:!1,m=!ea(this.file,e);if(!c&&!n&&ta(u,this.renderRange)&&!m&&!p&&!f)return this.applyCachedThemeState(l);this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.file=e,this.fileRenderer.setOptions(Eo(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:h=!1,disableFileHeader:g=!1}=this.options;if(g&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let n=this.fileRenderer.renderFile(e,Or);n!=null&&this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n?.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.injectUnsafeCSS()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}try{let r=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f)||!this.applyPartialRender(d,u)){let n=this.fileRenderer.renderFile(e,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.applyFullRender(n,r)}this.applyBuffers(r,u),this.injectUnsafeCSS(),this.managersDirty=!0,a||this.flushManagers(),this.renderAnnotations(),this.renderGutterUtility()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}primeHighlightCache(){let{file:e,workerManager:t}=this;e==null||e.cacheKey==null||t==null||aa(e)||this.fileRenderer.getOrCreateLineCache(e).length>(this.options.tokenizeMaxLength??1e5)||t.primeFileHighlightCache(e)}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.gutterUtilityContent?.remove(),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.gutterUtilityContent=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${ui(r)}`,a=this.annotationCache.get(i);if(a==null||!co(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:po(ui(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=mo();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}this.unsafeCSSStyle?.parentNode===t&&this.appliedUnsafeCSS===e||(this.unsafeCSSStyle??=ho(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=So(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??G,s=typeof o==`string`?o:{...o},c=_o(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=Oo({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Co(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=wo(this.themeCSSStyle.textContent??``,_o(e)))}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e),this.code=Do({code:this.code}),this.code.innerHTML=this.fileRenderer.renderPartialHTML(this.fileRenderer.renderCodeAST(e)),t.replaceChildren(this.code),this.lastRowCount=e.rowCount}applyPartialRender(e,t){if(e==null||t==null)return!1;let{file:n,code:r}=this,i=r==null?void 0:this.getColumns(r);if(n==null||r==null||i==null)return!1;let a=e.startingLine,o=t.startingLine,s=e.totalLines===1/0?1/0:a+e.totalLines,c=t.totalLines===1/0?1/0:o+t.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l||!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))return!1;let{length:d}=i.content.children,f=(e,t)=>{if(!(t<=0))return this.fileRenderer.renderFile(n,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,t){let{file:n}=this;if(n==null)return;this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??Ce(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderCustomHeader:a,renderHeaderMetadata:o}=this.options;if(a!=null){let e=a(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,yr,e),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=o?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,_r,e),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,vr,r),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:bi(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):bi(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=so;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};lo(i,this.appliedPreAttributes)||(jo(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Fo(e,t,n=!1){return!n&&e==null&&t!=null}function Io(e,t,n=!1){return e==null&&t!=null&&!n}function Lo(e){return{...Tr,...e}}function Ro(e,t){let n=zo(e,t);return t?n:e.diffHeaderHeight+n}function zo(e,t){return e.paddingTop??(t?e.spacing:0)}function Bo(e){return e.paddingBottom??e.spacing}function Vo(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}var Ho=5e3,Uo=-1;function Wo(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS}var Go=class extends Po{__id=`virtualized-file:${++Uo}`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0};isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=Tr,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){!t&&gi(this.metrics,e)||(this.metrics=e,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}hasLineAnnotations(){return this.lineAnnotations.some(e=>e.lineNumber>0)}getLineHeight(e,t=!1){let n=this.cache.heights.get(e);if(n!=null)return n;let r=t?2:1;return this.metrics.lineHeight*r}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!vi(t,e),r=Wo(t,e);super.setOptions(e),r&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache(e=!1){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.renderRange!=null&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){let e=!1;if(this.fileContainer==null||this.file==null)return this.height!==0&&(e=!0),this.height=0,e;let{overflow:t=`scroll`}=this.options;if(this.top=this.getVirtualizedTop(),t===`scroll`&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled()||this.code==null)return e;let n=this.code.children[1];if(!(n instanceof HTMLElement))return e;let r=sa(this.lineAnnotations);if(this.renderRange!=null&&r&&la(this.renderRange)){let t=Ko(n)??0;t!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=t,e=!0)}else!r&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(let t of n.children){if(!(t instanceof HTMLElement))continue;let n=t.dataset.lineIndex;if(n==null)continue;let r=Number(n),i=t.getBoundingClientRect().height,a=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(a=!0),i+=t.nextElementSibling.getBoundingClientRect().height);let o=this.getLineHeight(r,a);i!==o&&(e=!0,i===this.metrics.lineHeight*(a?2:1)?this.cache.heights.delete(r):this.cache.heights.set(r,i))}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null||this.file==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}));prepareCodeViewItem(e,t,n,r){let i=this.syncLineAnnotations(r),a=n?.resetFileLayoutCache===!0||i;n?.metrics!=null&&(this.metrics=n.metrics,a=!0);let{collapsed:o=!1}=this.options;return this.currentCollapsed!==o&&(this.currentCollapsed=o,a=!0),a&&this.resetLayoutCache(),this.file!==e&&(this.layoutDirty=!0),this.file=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e){if(this.file==null||e<1)return;let{disableFileHeader:t=!1,collapsed:n=!1}=this.options,r=qo(this.getOrCreateLineCache(this.file)),i=Ro(this.metrics,t);if(n||r<0)return{top:i,height:0};let a=Math.min(Math.max(e-1,0),r),{overflow:o=`scroll`}=this.options,{lineHeight:s}=this.metrics;if(i+=this.cache.fileAnnotationHeight,o===`scroll`&&!this.hasLineAnnotations())return{top:i+a*s,height:s};let c=this.getLayoutCheckpointBeforeLineIndex(a);i=c?.top??i;for(let e=c?.lineIndex??0;e<a;e++)i+=this.getLineHeight(e,!1);return{top:i,height:this.getLineHeight(a,!1)}}getNumericScrollAnchor(e){if(this.file==null||this.renderRange==null)return;let{disableFileHeader:t=!1,collapsed:n=!1,overflow:r=`scroll`}=this.options;if(n||this.renderRange.totalLines<=0)return;let i=qo(this.getOrCreateLineCache(this.file));if(i<0)return;let a=Ro(this.metrics,t),o=Math.min(this.renderRange.startingLine,i),s=Math.min(o+this.renderRange.totalLines-1,i);if(s<o)return;let{fileAnnotationHeight:c}=this.cache;if(r===`scroll`&&!this.hasLineAnnotations()){let{lineHeight:t}=this.metrics,n=a+(o===0?c:this.renderRange.bufferBefore),r=o+Math.max(Math.ceil((e-n)/t),0);return r>s?void 0:{lineNumber:r+1,top:a+c+r*t}}let l=a+(o===0?c:this.renderRange.bufferBefore);for(let t=o;t<=s;t++){if(l>=e)return{lineNumber:t+1,top:l};l+=this.getLineHeight(t)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.file==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let t=e==null?this.renderRange:this.computeRenderRangeFromWindow(this.file,this.top,e);if(t==null)return;let{bufferBefore:n,bufferAfter:r,totalLines:i}=t,a=0;if(i===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(a=r)}return{topOffset:this.top+n+a,height:this.height-(n+r)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache(),this.isSetup=!1,super.cleanUp(e)}computeApproximateSize(e=!1){let t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;let n=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.file==null){this.layoutDirty=!1;return}let{disableFileHeader:r=!1,collapsed:i=!1,overflow:a=`scroll`}=this.options,{lineHeight:o}=this.metrics,s=this.getOrCreateLineCache(this.file),c=Ro(this.metrics,r),l=Bo(this.metrics);if(this.height+=c,i){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,a===`scroll`&&!this.hasLineAnnotations()?this.height+=this.getOrCreateLineCache(this.file).length*o:ua({lines:s,callback:({lineIndex:e})=>{this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1)}}),s.length>0&&(this.height+=l),this.fileContainer!=null&&t&&!n){let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFile.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFile.computeApproximateSize: computed height doesnt match`,{name:this.file.name,elementHeight:e.height,computedHeight:this.height})}this.layoutDirty=!1}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.file==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:r,...i}){let{forceRenderOverride:a,isSetup:o}=this;this.forceRenderOverride=void 0;let s=this.syncLineAnnotations(r);if(s&&this.resetLayoutCache(),this.file??=t,e=this.getOrCreateFileContainerNode(e),this.file==null)return console.error(`VirtualizedFile.render: attempting to virtually render when we dont have file`),!1;if(o)this.top??=this.getVirtualizedTop();else{this.computeApproximateSize();let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFile.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode())return this.renderPlaceholder(this.height);let c=this.virtualizer.getWindowSpecs(),l=this.top??0,u=this.computeRenderRangeFromWindow(this.file,l,c);return super.render({file:this.file,fileContainer:e,renderRange:u,lineAnnotations:r,forceRender:(a??n)||s,...i})}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}addLayoutCheckpoint(e,t){e%Ho===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFile: invalid checkpoint index`);if(n.lineIndex%t===0)return n}}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,overflow:a=`scroll`}=this.options,{hunkLineCount:o,lineHeight:s}=this.metrics,c=this.getOrCreateLineCache(e),l=c.length,u=this.height,d=Ro(this.metrics,i),f=l>0?Bo(this.metrics):0,{fileAnnotationHeight:p}=this.cache,m=d+p,h=Math.max(0,u-d-p-f),g=sa(this.lineAnnotations),_=t+d,v=p>0&&g&&_<r&&_+p>n;if(t<n-u||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:u-d-f};if(l<=o)return{startingLine:0,totalLines:o,bufferBefore:0,bufferAfter:0};let y=Math.ceil(Math.max(r-n,0)/s),b=Math.ceil(y/o)*o+o*2,x=b/o,S=(n+r)/2;if(a===`scroll`&&!this.hasLineAnnotations()){let e=t+m,i=e+h;if(!v&&!(e<r&&i>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:u-d-f};let a=Math.floor(v&&S<t+m?0:(S-(t+m))/s),c=Math.floor(a/o)-Math.floor(x/2),g=Math.ceil(l/o),_=Math.max(0,Math.min(c,g))*o,y=c<0?b+c*o:b,C=_===0?0:p+_*s,w=Math.min(y,l-_);return{startingLine:_,totalLines:y,bufferBefore:C,bufferAfter:Math.max(0,(l-_-w)*s)}}let C=x,w=[],T=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-b*s*2),o),E=t+(T?.top??m),D=T?.lineIndex??0,O,ee,k;if(ua({lines:c,startingLine:T?.lineIndex??0,callback:({lineIndex:e})=>{let i=D%o===0,a=Math.floor(D/o);if(i&&(w[a]=E-(t+m),k!=null)){if(k<=0)return!0;k--}let s=this.getLineHeight(e,!1);return E>n-s&&E<r&&(O??=a),E+s>S&&(ee??=a),k==null&&E>=r&&i&&(k=C),D++,E+=s,!1}}),O==null)if(v)O=0,ee=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:u-d-f};ee??=O;let A=Math.round(ee-x/2),j=Math.max(0,Math.ceil(l/o)-x),te=Math.max(0,Math.min(A,j)),ne=te*o,M=A<0?b+A*o:b,N=w[te]??0,P=ne===0?0:p+N,re=te+M/o,ie=re<w.length?h-w[re]:h-(E-t-m);return{startingLine:ne,totalLines:M,bufferBefore:P,bufferAfter:Math.max(0,ie)}}};function Ko(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===oa&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function qo(e){let t=e.at(-1);return t==null||t===``||t===`
79
79
  `||t===`\r
80
- `||t===`\r`?e.length-2:e.length-1}function Ro(e){let t=(0,W.useRef)(e);return(0,W.useInsertionEffect)(()=>void(t.current=e)),(0,W.useCallback)((...e)=>t.current(...e),[])}function zo(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}function Bo(e,t){return si(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Vo(e){let t=e.lang??Ji(e.name),n=e.lang??(e.prevName==null?`text`:Ji(e.prevName));return t===`text`&&n===`text`}function Ho({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function Uo({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-(n.additionLineIndex+n.additionCount),i=e.deletionLines.length-(n.deletionLineIndex+n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function Wo({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=Uo({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function Go({type:e,metrics:t}){return t.hunkSeparatorHeight??jo(e)}function Ko({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function qo({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function Jo(e){return e!==`simple`&&e!==`metadata`}function Yo({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!qo({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=Go({type:e,metrics:t}),a=Ko({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function Xo({type:e,metrics:t}){if(!Jo(e))return;let n=Go({type:e,metrics:t}),r=Ko({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function Zo({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=Qo({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=c.unifiedCount+e<n,a=c.splitCount+r<n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=Ho({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),s=n===c.finalHunkIndex?Wo({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,l=o.fromStart+o.fromEnd;function u(e,n){return s==null||s.collapsedLines<=0||s.fromStart+s.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?s.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?s.collapsedLines:0}let d=o.collapsedLines===0;function f(){return d?0:(d=!0,o.collapsedLines)}if(c.shouldSkip(l,l))c.incrementCounts(l,l),f();else{let e=r.unifiedLineStart-o.rangeSize,i=r.splitLineStart-o.rangeSize,a=r.deletionLineIndex-o.rangeSize,s=r.additionLineIndex-o.rangeSize,l=r.deletionStart-o.rangeSize,u=r.additionStart-o.rangeSize;if(ts(c,o.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:l+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:s+t,lineNumber:u+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-o.fromEnd,i=r.splitLineStart-o.fromEnd,a=r.deletionLineIndex-o.fromEnd,s=r.additionLineIndex-o.fromEnd,l=r.deletionStart-o.fromEnd,u=r.additionStart-o.fromEnd,ts(c,o.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:f(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:l+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:s+t,lineNumber:u+t,noEOFCR:!1}}),()=>{f()})))break hunkIterator}let p=r.unifiedLineStart,m=r.splitLineStart,h=r.deletionLineIndex,g=r.additionLineIndex,_=r.deletionStart,v=r.additionStart,y=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===y;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),f();else if(ts(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=p+t,s=m+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:f(),collapsedAfter:u(o,s),type:`context`,deletionLine:{lineNumber:_+t,lineIndex:h+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:g+t,lineNumber:v+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{f()}))break hunkIterator;p+=e.lines,m+=e.lines,h+=e.lines,g+=e.lines,_+=e.lines,v+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=ns(c,e,t);(s[0]?.[0]??0)>0&&f();for(let[l,d]of s)for(let s=l;s<d;s++){let l=u(p+s,t===`unified`?m+(s<e.deletions?s:s-e.deletions):m+s);if(c.emit(rs({hunkIndex:n,hunk:r,collapsedBefore:f(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:p,splitLineIndex:m,additionLineIndex:g,deletionLineIndex:h,additionLineNumber:v,deletionLineNumber:_,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}f(),c.incrementCounts(o,a),p+=o,m+=a,h+=e.deletions,g+=e.additions,_+=e.deletions,v+=e.additions}}if(s!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=s,a=r+i;if(ts(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:_+t,lineIndex:h+t,noEOFCR:!1,unifiedLineIndex:p+t,splitLineIndex:m+t},additionLine:{unifiedLineIndex:p+t,splitLineIndex:m+t,lineIndex:g+t,lineNumber:v+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function Qo({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=$o({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function $o({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=Ho({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?Wo({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function es(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function ts(e,t,n,r,i,a){let[o,s]=es(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function ns(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function rs({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}var is=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},as=new class extends is{};function os(e,t,n){return as.diff(e,t,n)}function ss(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function cs(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function ls(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function us(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function ds(e,t){return ls(e,t,``)}function fs(e,t){return us(e,t,``)}function ps(e,t){return t.slice(0,ms(e,t))}function ms(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function hs(e){let t;for(t=e.length-1;t>=0&&e[t].match(/\s/);t--);return e.substring(t+1)}function gs(e){let t=e.match(/^\s*/);return t?t[0]:``}var _s=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,vs=RegExp(`[${_s}]+|\\s+|[^${_s}]`,`ug`);new class extends is{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=[];for(let t of Array.from(r.segment(e))){let e=t.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}}else n=e.match(vs)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&ys(n,i,r,e),n=e,r=null,i=null)}),(r||i)&&ys(n,i,r,null),e}};function ys(e,t,n,r){if(t&&n){let i=gs(t.value),a=hs(t.value),o=gs(n.value),s=hs(n.value);if(e){let r=ss(i,o);e.value=us(e.value,o,r),t.value=ds(t.value,r),n.value=ds(n.value,r)}if(r){let e=cs(a,s);r.value=ls(r.value,s,e),t.value=fs(t.value,e),n.value=fs(n.value,e)}}else if(n){if(e){let e=gs(n.value);n.value=n.value.substring(e.length)}if(r){let e=gs(r.value);r.value=r.value.substring(e.length)}}else if(e&&r){let n=gs(r.value),i=gs(t.value),a=hs(t.value),o=ss(n,i);t.value=ds(t.value,o);let s=cs(ds(n,o),a);t.value=fs(t.value,s),r.value=ls(r.value,n,s),e.value=us(e.value,n,n.slice(0,n.length-s.length))}else if(r){let e=gs(r.value),n=ps(hs(t.value),e);t.value=fs(t.value,n)}else if(e){let n=ps(hs(e.value),gs(t.value));t.value=ds(t.value,n)}}var bs=new class extends is{tokenize(e){let t=RegExp(`(\\r?\\n)|[${_s}]+|[^\\S\\n\\r]+|[^${_s}]`,`ug`);return e.match(t)||[]}};function xs(e,t,n){return bs.diff(e,t,n)}var Ss=new class extends is{constructor(){super(...arguments),this.tokenize=ws}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
80
+ `||t===`\r`?e.length-2:e.length-1}function Jo(e){let t=(0,U.useRef)(e);return(0,U.useInsertionEffect)(()=>void(t.current=e)),(0,U.useCallback)((...e)=>t.current(...e),[])}function Yo(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}function Xo(e,t){return _i(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Zo(e){let t=e.lang??ia(e.name),n=e.lang??(e.prevName==null?`text`:ia(e.prevName));return t===`text`&&n===`text`}function Qo({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function $o({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-(n.additionLineIndex+n.additionCount),i=e.deletionLines.length-(n.deletionLineIndex+n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function es({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=$o({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function ts({type:e,metrics:t}){return t.hunkSeparatorHeight??Vo(e)}function ns({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function rs({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function is(e){return e!==`simple`&&e!==`metadata`}function as({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!rs({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=ts({type:e,metrics:t}),a=ns({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function os({type:e,metrics:t}){if(!is(e))return;let n=ts({type:e,metrics:t}),r=ns({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function ss({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=cs({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=c.unifiedCount+e<n,a=c.splitCount+r<n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=Qo({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),s=n===c.finalHunkIndex?es({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,l=o.fromStart+o.fromEnd;function u(e,n){return s==null||s.collapsedLines<=0||s.fromStart+s.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?s.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?s.collapsedLines:0}let d=o.collapsedLines===0;function f(){return d?0:(d=!0,o.collapsedLines)}if(c.shouldSkip(l,l))c.incrementCounts(l,l),f();else{let e=r.unifiedLineStart-o.rangeSize,i=r.splitLineStart-o.rangeSize,a=r.deletionLineIndex-o.rangeSize,s=r.additionLineIndex-o.rangeSize,l=r.deletionStart-o.rangeSize,u=r.additionStart-o.rangeSize;if(ds(c,o.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:l+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:s+t,lineNumber:u+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-o.fromEnd,i=r.splitLineStart-o.fromEnd,a=r.deletionLineIndex-o.fromEnd,s=r.additionLineIndex-o.fromEnd,l=r.deletionStart-o.fromEnd,u=r.additionStart-o.fromEnd,ds(c,o.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:f(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:l+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:s+t,lineNumber:u+t,noEOFCR:!1}}),()=>{f()})))break hunkIterator}let p=r.unifiedLineStart,m=r.splitLineStart,h=r.deletionLineIndex,g=r.additionLineIndex,_=r.deletionStart,v=r.additionStart,y=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===y;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),f();else if(ds(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=p+t,s=m+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:f(),collapsedAfter:u(o,s),type:`context`,deletionLine:{lineNumber:_+t,lineIndex:h+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:g+t,lineNumber:v+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{f()}))break hunkIterator;p+=e.lines,m+=e.lines,h+=e.lines,g+=e.lines,_+=e.lines,v+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=fs(c,e,t);(s[0]?.[0]??0)>0&&f();for(let[l,d]of s)for(let s=l;s<d;s++){let l=u(p+s,t===`unified`?m+(s<e.deletions?s:s-e.deletions):m+s);if(c.emit(ps({hunkIndex:n,hunk:r,collapsedBefore:f(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:p,splitLineIndex:m,additionLineIndex:g,deletionLineIndex:h,additionLineNumber:v,deletionLineNumber:_,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}f(),c.incrementCounts(o,a),p+=o,m+=a,h+=e.deletions,g+=e.additions,_+=e.deletions,v+=e.additions}}if(s!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=s,a=r+i;if(ds(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:_+t,lineIndex:h+t,noEOFCR:!1,unifiedLineIndex:p+t,splitLineIndex:m+t},additionLine:{unifiedLineIndex:p+t,splitLineIndex:m+t,lineIndex:g+t,lineNumber:v+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function cs({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=ls({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function ls({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=Qo({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?es({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function us(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function ds(e,t,n,r,i,a){let[o,s]=us(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function fs(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function ps({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}var ms=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},hs=new class extends ms{};function gs(e,t,n){return hs.diff(e,t,n)}function _s(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function vs(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function ys(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function bs(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function xs(e,t){return ys(e,t,``)}function Ss(e,t){return bs(e,t,``)}function Cs(e,t){return t.slice(0,ws(e,t))}function ws(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Ts(e){let t;for(t=e.length-1;t>=0&&e[t].match(/\s/);t--);return e.substring(t+1)}function Es(e){let t=e.match(/^\s*/);return t?t[0]:``}var Ds=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Os=RegExp(`[${Ds}]+|\\s+|[^${Ds}]`,`ug`);new class extends ms{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=[];for(let t of Array.from(r.segment(e))){let e=t.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}}else n=e.match(Os)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&ks(n,i,r,e),n=e,r=null,i=null)}),(r||i)&&ks(n,i,r,null),e}};function ks(e,t,n,r){if(t&&n){let i=Es(t.value),a=Ts(t.value),o=Es(n.value),s=Ts(n.value);if(e){let r=_s(i,o);e.value=bs(e.value,o,r),t.value=xs(t.value,r),n.value=xs(n.value,r)}if(r){let e=vs(a,s);r.value=ys(r.value,s,e),t.value=Ss(t.value,e),n.value=Ss(n.value,e)}}else if(n){if(e){let e=Es(n.value);n.value=n.value.substring(e.length)}if(r){let e=Es(r.value);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Es(r.value),i=Es(t.value),a=Ts(t.value),o=_s(n,i);t.value=xs(t.value,o);let s=vs(xs(n,o),a);t.value=Ss(t.value,s),r.value=ys(r.value,n,s),e.value=bs(e.value,n,n.slice(0,n.length-s.length))}else if(r){let e=Es(r.value),n=Cs(Ts(t.value),e);t.value=Ss(t.value,n)}else if(e){let n=Cs(Ts(e.value),Es(t.value));t.value=xs(t.value,n)}}var As=new class extends ms{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Ds}]+|[^\\S\\n\\r]+|[^${Ds}]`,`ug`);return e.match(t)||[]}};function js(e,t,n){return As.diff(e,t,n)}var Ms=new class extends ms{constructor(){super(...arguments),this.tokenize=Ps}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
81
81
  `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
82
82
  `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
83
83
  `)&&(e=e.slice(0,-1)),t.endsWith(`
84
- `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Cs(e,t,n){return Ss.diff(e,t,n)}function ws(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
85
- `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function Ts(e){return e==`.`||e==`!`||e==`?`}new class extends is{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(Ts(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends is{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends is{constructor(){super(...arguments),this.tokenize=ws}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(Es(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function Es(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=Es(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=Es(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends is{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};var Ds={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Os(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;Cs(n,r,Object.assign(Object.assign({},s),{callback:t=>{e(l(t))}}))}else return l(Cs(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||js(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s)if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
86
- `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function ks(e,t){if(t||=Ds,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders)throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>ks(e,t)).join(`
84
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Ns(e,t,n){return Ms.diff(e,t,n)}function Ps(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
85
+ `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function Fs(e){return e==`.`||e==`!`||e==`?`}new class extends ms{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(Fs(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends ms{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends ms{constructor(){super(...arguments),this.tokenize=Ps}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(Is(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function Is(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=Is(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=Is(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends ms{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};var Ls={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Rs(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;Ns(n,r,Object.assign(Object.assign({},s),{callback:t=>{e(l(t))}}))}else return l(Ns(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||Vs(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s)if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
86
+ `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function zs(e,t){if(t||=Ls,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders)throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>zs(e,t)).join(`
87
87
  `)}let n=[];t.includeIndex&&e.oldFileName==e.newFileName&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`),t.includeFileHeaders&&(n.push(`--- `+e.oldFileName+(e.oldHeader===void 0?``:` `+e.oldHeader)),n.push(`+++ `+e.newFileName+(e.newHeader===void 0?``:` `+e.newHeader)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t];r.oldLines===0&&--r.oldStart,r.newLines===0&&--r.newStart,n.push(`@@ -`+r.oldStart+`,`+r.oldLines+` +`+r.newStart+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
88
88
  `)+`
89
- `}function As(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Os(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?ks(e,o.headerOptions):void 0)}}))}else{let s=Os(e,t,n,r,i,a,o);return s?ks(s,o?.headerOptions):void 0}}function js(e){let t=e.endsWith(`
89
+ `}function Bs(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Rs(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?zs(e,o.headerOptions):void 0)}}))}else{let s=Rs(e,t,n,r,i,a,o);return s?zs(s,o?.headerOptions):void 0}}function Vs(e){let t=e.endsWith(`
90
90
  `),n=e.split(`
91
91
  `).map(e=>e+`
92
- `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Ms({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function Ns({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;if(r===o||r&&e.value.length===1&&!o){a[1]+=e.value;return}t.push([+!r,e.value])}var Ps={forcePlainText:!1};function Fs(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=Ps){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=Va({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??Ls();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}Zo({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:c?h:!0,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&Is({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=Rs({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else f.deletionLines.push(...s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else f.additionLines.push(...c)}return{code:f,themeStyles:u,baseThemeType:l}}function Is({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=yr(e),t=yr(t),e.length>s||t.length>s))return;let c=o===`char`?os(e,t):xs(e,t),l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(Ns({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),Ns({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?Ns({item:e,arr:l,enableJoin:d,isLastItem:t}):Ns({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(Ms({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(Ms({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function Ls(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Rs({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c=K,...l}}){let u=s??Ji(e.name),d=s??Ji(t.name),{state:f,transformers:p}=Ta(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Oa(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Oa(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,Ua(i.codeToHast(yr(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,Ua(i.codeToHast(yr(t.contents),m)))}}var zs=(0,W.createContext)(void 0),Bs=(0,W.createContext)(void 0);function Vs(){return(0,W.useContext)(Bs)}var Hs=typeof window>`u`?W.useEffect:W.useLayoutEffect;function Us({file:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,metrics:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c}){let l=Vs(),u=r!==void 0,d=(0,W.useContext)(zs),f=(0,W.useRef)(null),p=Ro(r=>{if(r!=null){if(f.current!=null)throw Error(`File: An instance should not already exist when a node is created`);l==null?f.current=new wo(Ws({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c?void 0:d,!0):f.current=new Fo(Ws({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),l,a,c?void 0:d,!0),f.current.hydrate({file:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:i})}else{if(f.current==null)throw Error(`File: A File instance should exist when unmounting`);f.current.cleanUp(),f.current=null}});return Hs(()=>{if(f.current==null)return;let i=Ws({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),a=!ci(f.current.options,i);f.current.setOptions(i),f.current.render({file:e,lineAnnotations:n,forceRender:a}),r!==void 0&&f.current.setSelectedLines(r)}),{ref:p,getHoveredLine:(0,W.useCallback)(()=>f.current?.getHoveredLine(),[])}}function Ws({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return!t&&!r&&!n?e:{...e,controlledSelection:t,renderCustomHeader:n?ri:e?.renderCustomHeader,renderGutterUtility:r?ri:e?.renderGutterUtility}}function Gs({file:e,lineAnnotations:t,selectedLines:n,options:r,metrics:i,className:a,style:o,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderMetadata:u,prerenderedHTML:d,renderGutterUtility:f,disableWorkerPool:p=!1}){let{ref:m,getHoveredLine:h}=Us({file:e,options:r,metrics:i,lineAnnotations:t,selectedLines:n,prerenderedHTML:d,hasGutterRenderUtility:f!=null,hasCustomHeader:c!=null,disableWorkerPool:p});return(0,J.jsx)($n,{ref:m,className:a,style:o,children:ai(ii({file:e,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderMetadata:u,renderGutterUtility:f,lineAnnotations:t,getHoveredLine:h}),d)})}function Ks({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function qs(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:Js(n,e.startContentIndex)}}function Js(e,t){let n=e.unifiedLineStart;for(let r=0;r<t;r++){let t=e.hunkContent[r];n+=t.type===`context`?t.lines:t.deletions+t.additions}return n}function Ys({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o,renderMergeConflictUtility:s,lineAnnotations:c,getHoveredLine:l,getInstance:u}){let d=n?.(e),f=r?.(e),p=i?.(e);return(0,J.jsxs)(J.Fragment,{children:[d==null?(0,J.jsxs)(J.Fragment,{children:[f!=null&&(0,J.jsx)(`div`,{slot:`header-prefix`,children:f}),p!=null&&(0,J.jsx)(`div`,{slot:`header-metadata`,children:p})]}):(0,J.jsx)(`div`,{slot:lr,children:d}),a!=null&&c?.map((e,t)=>(0,J.jsx)(`div`,{slot:ei(e),children:a(e)},t)),t!=null&&s!=null&&u!=null&&t.map(t=>{if(t==null)return;let n=Xs(t,e);return(0,J.jsx)(`div`,{slot:n,style:ni,children:s(t,u)},n)}),o!=null&&(0,J.jsx)(`div`,{slot:`gutter-utility-slot`,style:ti,children:o(l)})]})}function Xs(e,t){let n=qs(e,t);return n==null?void 0:Ks({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}function Zs(e,t,n,r=!1){let i=Or(As(e.name,t.name,e.contents,t.contents,e.header,t.header,n),{cacheKey:(()=>{if(e.cacheKey!=null&&t.cacheKey!=null)return`${e.cacheKey}:${t.cacheKey}`})(),oldFile:e,newFile:t,throwOnError:r});if(i==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);return t.lang!=null&&(i.lang=t.lang),i}var Qs=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&=(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener(`scroll`,this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener(`scroll`,this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function $s(e){return Y({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function ec(e){return Y({tagName:`div`,children:[Y({tagName:`span`,children:[pi(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function tc(e){return Y({tagName:`div`,children:[mi({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{role:`button`,"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function nc({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(Y({tagName:`div`,children:[pi(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(tc(`up`)),s++),o||(e.push(tc(`down`)),s++)):(e.push(tc(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(Y({tagName:`div`,children:[Y({tagName:`span`,children:[pi(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(Y({tagName:`div`,children:[pi(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(Y({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(Y({tagName:`slot`,properties:{name:i}})),Y({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function rc(e,t){return`hunk-separator-${e}-${t}`}function ic(e){let t=e.at(-1);return t==null?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function ac(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}var oc=-1,sc=class{__id=`diff-hunks-renderer:${++oc}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;constructor(e={theme:K},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=ra(e.theme??K)?ye():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}clearRenderCache(){this.renderCache=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??gr}getExpandedHunksMap(){return this.expandedHunks}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e}}getSplitLineDecoration({side:e,type:t}){return t===`change`?{gutterLineType:e===`deletions`?`change-deletion`:`change-addition`}:{gutterLineType:t}}createAnnotationElement=e=>oa(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=K,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=mr,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await me(ma(this.computedLang,this.options)),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=hc(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!Bo(t,r.options)&&(r=void 0),this.renderCache??={diff:e,highlighted:!n&&!Vo(e),options:t,result:n?void 0:r?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLang=e.lang??Ji(e.name),this.initializeHighlighter())}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getDiffRenderOptions();let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:qa(this.options),tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!zo(e,n.diff)||!Bo(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=_r){if(e==null)return;let{expandUnchanged:n=!1,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getMatchingWorkerResultCache(e,i);o!=null&&!this.hasHighlightedRenderCache(e,i)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...o},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||Vo(e)||hc(e,this.getTokenizeMaxLength()),l=!zo(e,this.renderCache.diff),u=!Gi(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(c||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,ac(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e);else{this.computedLang=e.lang??Ji(e.name);let t=this.highlighter!=null&&ra(i.theme),n=this.highlighter!=null&&ta(this.computedLang),r=!c&&n;if(this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=_r){let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return fa({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=hc(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Ji(e.name);let n=this.highlighter!=null&&ra(this.options.theme??K),r=t||this.highlighter!=null&&ta(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults();return{result:Fs(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i}),options:r}}onHighlightSuccess(e,t,n,r=!0){if(this.renderCache==null)return;let i=!this.renderCache.highlighted||!Bo(this.renderCache.options,n)||!zo(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!Bo(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&zo(e,n.diff)&&Bo(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults();this.diff=e;let d=a===`unified`,f=[],p=[],m=[],h=[],{additionLines:g,deletionLines:_}=n,v={rowCount:0,hunkSeparators:u,additionsContentAST:f,deletionsContentAST:p,unifiedContentAST:m,unifiedGutterAST:gi(),deletionsGutterAST:gi(),additionsGutterAST:gi(),expansionLineCount:c,hunkData:h,incrementRowCount(e=1){v.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:v.unifiedGutterAST.children.push(t);break;case`deletions`:v.deletionsGutterAST.children.push(t);break;case`additions`:v.additionsGutterAST.children.push(t);break}}},y=Uo({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),b={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(v.pushToGutter(`additions`,vi(void 0,`buffer`,this.size)),f?.push($s(this.size))):(v.pushToGutter(`deletions`,vi(void 0,`buffer`,this.size)),p?.push($s(this.size))),this.size=0,this.side=void 0}}},x=(e,t,n,r,i)=>{v.pushToGutter(e,_i(t,n,r,i))};function S(e){b.flush(),a===`unified`?pc(`unified`,e,v):(pc(`deletions`,e,v),pc(`additions`,e,v))}this.pushFileLevelAnnotations(e,a,t,v),Zo({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,d=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&b.flush(),r>0&&S({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:!e.isPartial});let f=a===`unified`?d:l,p={type:c,hunkIndex:t,lineIndex:f,unifiedLineIndex:d,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(p);n?.before!=null&&uc(n.before,v);let r=s==null?void 0:_[s.lineIndex],i=o==null?void 0:g[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});x(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${d},${l}`,u.gutterProperties),i==null?r!=null&&(r=mc(r,u.contentProperties)):i=mc(i,u.contentProperties),fc({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,f),createAnnotationElement:e=>this.createAnnotationElement(e),context:v}),n?.after!=null&&uc(n.after,v)}else{let n=this.getSplitInjectedRowsForLine?.(p);n?.before!=null&&dc(n.before,v,b);let r=s==null?void 0:_[s.lineIndex],i=o==null?void 0:g[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let d=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();if(d!=null){if(b.side!=null&&b.side!==d)throw Error(`DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits`);b.side=d,b.increment()}let m=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,f);if(m!=null&&b.size>0&&b.flush(),s!=null){let e=mc(r,a.contentProperties);x(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=mc(i,u.contentProperties);x(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}fc({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...m,createAnnotationElement:e=>this.createAnnotationElement(e),context:v}),n?.after!=null&&dc(n.after,v,b)}let m=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,h=m?n.noEOFCRDeletions:!1,C=m?n.noEOFCRAdditions:!1,w=(s?.noEOFCR??!1)||h,T=(o?.noEOFCR??!1)||C;if(T||w){if(a===`split`&&b.flush(),w){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(v.unifiedContentAST.push(ec(e)),v.pushToGutter(`unified`,vi(e,`metadata`,1))):(v.deletionsContentAST.push(ec(e)),v.pushToGutter(`deletions`,vi(e,`metadata`,1)),T||(v.pushToGutter(`additions`,vi(void 0,`buffer`,1)),v.additionsContentAST.push($s(1))))}if(T){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(v.unifiedContentAST.push(ec(e)),v.pushToGutter(`unified`,vi(e,`metadata`,1))):(v.additionsContentAST.push(ec(e)),v.pushToGutter(`additions`,vi(e,`metadata`,1)),w||(v.pushToGutter(`deletions`,vi(void 0,`buffer`,1)),v.deletionsContentAST.push($s(1))))}v.incrementRowCount(1)}i>0&&u!==`simple`&&S({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:i,rangeSize:y,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!e.isPartial}),v.incrementRowCount(1)}}),a===`split`&&b.flush();let C=Math.max(ic(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),w=t.bufferBefore>0||t.bufferAfter>0,T=!d&&e.type!==`deleted`,E=!d&&e.type!==`new`,D=v.rowCount>0||w;f=T&&D?f:void 0,p=E&&D?p:void 0,m=d&&D?m:void 0;let O=this.createPreElement(p!=null&&f!=null,C);return{unifiedGutterAST:d&&D?v.unifiedGutterAST.children:void 0,unifiedContentAST:m,deletionsGutterAST:E&&D?v.deletionsGutterAST.children:void 0,deletionsContentAST:p,additionsGutterAST:T&&D?v.additionsGutterAST.children:void 0,additionsContentAST:f,hunkData:h,preNode:O,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:C,rowCount:v.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=gi(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,sa(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(Y({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(Y({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(Y({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return ge(this.renderFullAST(e,t))}renderPartialHTML(e,t){return ge(t==null?e:Y({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!$i(n))return;let i=e.type===`new`?[]:cc(Qi(this.deletionAnnotations)),a=e.type===`deleted`?[]:cc(Qi(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){fc({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}fc({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(ei(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(ei(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(!(o.annotations.length===0&&a.annotations.length===0))return{deletionSpan:a,additionSpan:o}}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return la({fileOrDiff:e,mode:t,stickyHeader:n})}};function cc(e){return e?.map(e=>ei(e))??[]}function lc(e){return`${e} unmodified line${e>1?`s`:``}`}function uc(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function dc(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function fc({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,vi(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,vi(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,vi(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function pc(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,nc({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(nc({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,nc({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(nc({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=rc(e,t),d=r>c.expansionLineCount,f=s?t:void 0;c.pushToGutter(e,nc({type:c.hunkSeparators,content:lc(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(nc({type:c.hunkSeparators,content:lc(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:n,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function mc(e,t){return e==null||e.type!==`element`||t==null?e:{...e,properties:{...e.properties,...t}}}function hc(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function gc(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function _c(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function vc(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:e?.useTokenTransformer,tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}var yc=-1,bc=class{static LoadedCustomComponent=!0;__id=`file-diff:${++yc}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;constructor(e={theme:K},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new zi,this.scrollSyncManager=new Qs,this.interactionManager=new bi(`diff`,xi(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getHunksRendererOptions(e){return vc(e)}createHunksRenderer(e){return new sc(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{if(this.fileDiff==null)return;let n=this.fileDiff.hunks.at(-1),r,i;hunkIterator:for(let a of this.fileDiff.hunks){let o=t===`deletions`?a.deletionStart:a.additionStart,s=t===`deletions`?a.deletionCount:a.additionCount,c=a.splitLineStart,l=a.unifiedLineStart;if(e<o){let t=o-e;r=Math.max(l-t,0),i=Math.max(c-t,0);break hunkIterator}if(e>=o+s){if(a===n){let t=e-(o+s);r=l+a.unifiedLineCount+t,i=c+a.splitLineCount+t;break hunkIterator}continue}for(let n of a.hunkContent)if(n.type===`context`)if(e<o+n.lines){let t=e-o;i=c+t,r=l+t;break hunkIterator}else o+=n.lines,c+=n.lines,l+=n.lines;else{let a=t===`deletions`?n.deletions:n.additions;if(e<o+a){let a=e-o;r=l+(t===`additions`?n.deletions:0)+a,i=c+a;break hunkIterator}else o+=a,c+=Math.max(n.deletions,n.additions),l+=n.deletions+n.additions}break hunkIterator}if(!(r==null||i==null))return[r,i]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(xi(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType===t?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!si(this.appliedThemeCSS.theme,this.options.theme??K)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,t===`wrap`),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}cleanUp(e=!1){this.emitPostRender(!0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,lineAnnotations:i,oldFile:a,newFile:o,fileDiff:s}=e;this.hydrateElements(t,n),Cc(this.pre,xc({fileDiff:s,oldFile:a,newFile:o}),this.options.collapsed)||wc(this.headerElement,Sc({fileDiff:s,oldFile:a,newFile:o}),this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({fileDiff:s,oldFile:a,newFile:o,lineAnnotations:i}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),bo(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)!(e instanceof HTMLElement)||e.tagName.toLowerCase()!==`code`||(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!=null&&n!=null?Zs(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.rerender()};render({oldFile:e,newFile:t,fileDiff:n,deferManagers:r=!1,forceRender:i=!1,preventEmit:a=!1,lineAnnotations:o,fileContainer:s,containerWrapper:c,renderRange:l}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let{collapsed:u=!1,themeType:d=`system`}=this.options,f=u?void 0:l,p=this.hasThemeChanged(),m=e!=null&&t!=null&&(!Wi(e,this.deletionFile)||!Wi(t,this.additionFile)),h=n!=null&&n!==this.fileDiff,g=o!=null&&(o.length>0||this.lineAnnotations.length>0)?o!==this.lineAnnotations:!1;if(!u&&Gi(f,this.renderRange)&&!i&&!g&&!p&&(n!=null&&n===this.fileDiff||n==null&&!m))return this.applyCachedThemeState(d);let{renderRange:_}=this;if(this.renderRange=f,this.deletionFile=e,this.additionFile=t,n==null?e!=null&&t!=null&&m&&(h=!0,this.fileDiff=Zs(e,t,this.options.parseDiffOptions)):this.fileDiff=n,h&&(this.cachedHeaderHTML=void 0),o!=null&&this.setLineAnnotations(o),this.fileDiff==null)return!1;this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:v=!1,disableFileHeader:y=!1}=this.options;if(y&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),s=this.getOrCreateFileContainer(s,c),this.applyCachedThemeState(d),u){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,vr);e!=null&&this.applyThemeState(s,e.themeStyles,d,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,s),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(v)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,s)}return a||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(s);if(!(this.canPartiallyRender(i,g,m||h||p)&&this.applyPartialRender({previousRenderRange:_,renderRange:f}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,f);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(s,t.themeStyles,d,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,s),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,f),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,r||this.flushManagers()}catch(e){if(v)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,s)}return a||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}primeHighlightCache(){let{fileDiff:e,workerManager:t}=this;if(e==null||t==null||Vo(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||t.primeDiffHighlightCache(e)}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!_c(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${ei(r)}`,a=this.annotationCache.get(i);if(a==null||!gc(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:no(ei(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=ro();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:ui(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):ui(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=Za;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,r=this.cachedHeaderHTML??ge(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:a,renderHeaderMetadata:o}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,lr,e),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0;return}let s=a?.(n)??void 0,c=o?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,sr,s),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,cr,c),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}this.unsafeCSSStyle?.parentNode===t&&this.appliedUnsafeCSS===e||(this.unsafeCSSStyle??=io(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=fo(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??K,s=typeof o==`string`?o:{...o},c=oo(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=vo({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:po(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=mo(this.themeCSSStyle.textContent??``,oo(e)))}applyHunksToDOM(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=_o({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=_o({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=_o({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:a,options:{diffStyle:o=`split`}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let s=this.getCodeColumns(o,r,a,i);if(s==null)return!1;let c=e.startingLine,l=t.startingLine,u=c+e.totalLines,d=l+t.totalLines,f=Math.max(c,l),p=Math.min(u,d);if(p<=f)return!1;let m=Math.max(0,f-c),h=Math.max(0,u-p),g=this.trimColumns({columns:s,trimStart:m,trimEnd:h,previousStart:c,overlapStart:f,overlapEnd:p,diffStyle:o});if(g<0)throw Error(`applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`applyPartialRender: trimmed beyond DOM row count`);let _=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(l,Math.max(f-l,0));if(y==null&&l<f)return!1;let b=v(p,Math.max(d-p,0));if(b==null&&d>p)return!1;let x=(e,t)=>{if(e!=null){if(o===`unified`&&!Array.isArray(s))this.insertPartialHTML(o,s,e,t);else if(o===`split`&&Array.isArray(s))this.insertPartialHTML(o,s,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);_+=e.rowCount}};return this.cleanupErrorWrapper(),x(y,`afterbegin`),x(b,`beforeend`),this.lastRowCount!==_&&(this.applyRowSpan(o,s,_),this.lastRowCount=_),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=Tc(t[0]),i=Tc(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}else throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getCodeColumns(e,t,n,r){function i(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}if(e===`unified`)return i(t);{let e=i(n),t=i(r);return e!=null||t!=null?[e,t]:void 0}}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l===`unified`?!1:t!=null&&n!=null,totalLines:r,customProperties:i};$a(u,this.appliedPreAttributes)||(xo(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function xc({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Sc({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function Cc(e,t,n=!1){return!n&&e==null&&t}function wc(e,t,n=!1){return e==null&&t&&!n}function Tc(e){if(!(e==null||e.type!==`element`))return e.children??[]}function Ec({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o}){let s=Oo(t,n),c=s,l=i?!0:a,u=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=Ho({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:l,hunkIndex:n,collapsedContextThreshold:o}),d=(a.fromStart+a.fromEnd)*t.lineHeight;if(s+=d,c+=d,a.collapsedLines>0){let e=Yo({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;s+=e,c+=e}s+=i.splitLineCount*t.lineHeight,c+=i.unifiedLineCount*t.lineHeight;let f=Dc(i);s+=f.split*t.lineHeight,c+=f.unified*t.lineHeight;let p=n===u?Wo({fileDiff:e,hunkIndex:n,expandedHunks:l,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(p!=null){let e=(p.fromStart+p.fromEnd)*t.lineHeight;if(s+=e,c+=e,p.collapsedLines>0){let e=Xo({type:r,metrics:t})?.totalHeight??0;s+=e,c+=e}}}if(e.hunks.length>0){let e=Ao(t);s+=e,c+=e}return{splitHeight:s,unifiedHeight:c}}function Dc(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type===`context`){let e=+(t.lines>0);return{split:e,unified:e}}return Oc(e,t)}function Oc(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}var kc=5e3,Ac=-1,jc=class extends bc{__id=`little-virtualized-file-diff:${++Ac}`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=Do(n)}setMetrics(e,t=!1){let n=Do(e);!t&&oi(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e===t?!1:(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e=this.fileDiff){return e==null||!Zi(this.lineAnnotations)?!1:this.lineAnnotations.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type===`deleted`?t.side===`deletions`:!0:!1)}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!ci(t,e),r=n&&zc(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Bc(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.size>0&&this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal!==0&&(this.cache.measuredHeightDeltaTotal=0),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),t&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){let e=!1,{overflow:t=`scroll`}=this.options;if(this.fileContainer==null||this.fileDiff==null)return this.height!==0&&(e=!0),this.height=0,e;if(this.top=this.getVirtualizedTop(),t===`scroll`&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled())return e;let n=this.getDiffStyle(),r=n===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],i=this.hasFileAnnotations(this.fileDiff);if(this.renderRange!=null&&i&&$i(this.renderRange)){let t=Mc(r)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!i&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of r){if(t==null)continue;let r=t.children[1];if(r instanceof HTMLElement)for(let t of r.children){if(!(t instanceof HTMLElement))continue;let r=t.dataset.lineIndex;if(r==null)continue;let i=Hc(r,n),a=t.getBoundingClientRect().height,o=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(o=!0),a+=t.nextElementSibling.getBoundingClientRect().height);let s=this.getEstimatedLineHeight(o),c=this.cache.heightDeltas.get(i)??0,l=a-s;l!==c&&(e=!0,this.cache.measuredHeightDeltaTotal+=l-c,l===0?this.cache.heightDeltas.delete(i):this.cache.heightDeltas.set(i,l))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render());prepareCodeViewItem(e,t,n,r){let i=!zo(this.fileDiff,e),a=this.syncLineAnnotations(r),o=n?.resetDiffLayoutCache===!0||i||a,s=i||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights;n?.metrics!=null&&(this.metrics=Do(n.metrics),o=!0,s=!0);let{collapsed:c=!1}=this.options;return this.currentCollapsed!==c&&(this.currentCollapsed=c,o=!0),o&&this.resetLayoutCache({includeEstimatedHeights:s}),this.fileDiff=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e,t=`additions`){if(this.fileDiff==null||e<1)return;let n=this.getLineIndex(e,t);if(n==null)return;let{disableFileHeader:r=!1,expandUnchanged:i=!1,collapsed:a=!1,collapsedContextThreshold:o=1}=this.options,s=this.getDiffStyle(),c=this.getHunkSeparatorType(),l=s===`split`?n[1]:n[0];this.approximateLayoutCheckpoints();let u=Oo(this.metrics,r),d=this.getLayoutCheckpointBeforeLineIndex(l),f=d?.top??u+this.cache.fileAnnotationHeight;if(a)return{top:u,height:0};let p;return Zo({diff:this.fileDiff,diffStyle:s,startingLine:d?.renderedLineIndex??0,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=s===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=Yo({type:c,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(f+=r.gapBefore,l>=o-n&&l<o)return p={top:f,height:r.height},!0;f+=r.height+r.gapAfter}}let u=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===l)return p={top:f,height:u},!0;if(f+=u,r>0){let e=Xo({type:c,metrics:this.metrics});if(e!=null){if(l>o&&l<=o+r)return p={top:f+e.gapBefore,height:e.height},!0;f+=e.totalHeight}}return!1}}),p}getNumericScrollAnchor(e){if(this.fileDiff==null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:r=!1,collapsedContextThreshold:i=1}=this.options;if(r)return;let a=this.getDiffStyle(),o=this.getHunkSeparatorType();this.approximateLayoutCheckpoints();let s=this.getLayoutCheckpointBeforeTop(e),c=s?.top??Oo(this.metrics,t)+this.cache.fileAnnotationHeight,l;return Zo({diff:this.fileDiff,diffStyle:a,startingLine:s?.renderedLineIndex??0,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:s,additionLine:u})=>{let d=a===`split`?u?.splitLineIndex??s?.splitLineIndex:u?.unifiedLineIndex??s?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=Yo({type:o,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(c+=e.totalHeight)}if(c>=e&&(s==null?u!=null&&(l={lineNumber:u.lineNumber,side:`additions`,top:c}):l={lineNumber:s.lineNumber,side:`deletions`,top:c},l!=null))return!0;let f=this.getLineHeight(d,(u?.noEOFCR??!1)||(s?.noEOFCR??!1));if(c+=f,i>0){let e=Xo({type:o,metrics:this.metrics});e!=null&&(c+=e.totalHeight)}return!1}}),l}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.fileDiff==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let t=e==null?this.renderRange:this.computeRenderRangeFromWindow(this.fileDiff,this.top,e);if(t==null)return;let{bufferBefore:n,bufferAfter:r,totalLines:i}=t,a=0;if(i===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(a=r)}return{topOffset:this.top+n+a,height:this.height-(n+r)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache({includeEstimatedHeights:!0}),this.isSetup=!1,super.cleanUp(e)}expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,this.resetLayoutCache({includeEstimatedHeights:!0}),this.isSimpleMode()&&this.computeApproximateSize(),this.virtualizer.instanceChanged(this,!0)};setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}computeApproximateSize(e=!1){let t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;let n=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,this.fileDiff==null){this.layoutDirty=!1;return}let{disableFileHeader:r=!1,collapsed:i=!1}=this.options,a=Oo(this.metrics,r);if(this.height+=a,i){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight()+this.cache.measuredHeightDeltaTotal,t&&!n&&this.validateComputedHeight(),this.layoutDirty=!1}getActiveEstimatedHeight(){this.ensureEstimatedDiffHeights();let e=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(e==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return e}ensureEstimatedDiffHeights(){if(this.fileDiff==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:e=!1,expandUnchanged:t=!1,collapsedContextThreshold:n=1}=this.options,{splitHeight:r,unifiedHeight:i}=Ec({fileDiff:this.fileDiff,metrics:this.metrics,disableFileHeader:e,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:t,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:n});this.cache.estimatedSplitHeight=r,this.cache.estimatedUnifiedHeight=i}validateComputedHeight(){if(this.fileContainer==null||this.fileDiff==null)return;let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:this.fileDiff.name,elementHeight:e.height,computedHeight:this.height})}render({fileContainer:e,oldFile:t,newFile:n,fileDiff:r,forceRender:i=!1,lineAnnotations:a,...o}={}){let{forceRenderOverride:s,isSetup:c}=this;this.forceRenderOverride=void 0;let l=this.syncLineAnnotations(a);if(l&&this.resetLayoutCache({includeEstimatedHeights:!1}),this.fileDiff??=r??(t!=null&&n!=null?Zs(t,n,this.options.parseDiffOptions):void 0),e=this.getOrCreateFileContainer(e),this.fileDiff==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;if(c)this.top??=this.getVirtualizedTop();else{this.computeApproximateSize();let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode())return this.renderPlaceholder(this.height);let u=this.virtualizer.getWindowSpecs(),d=this.top??0,f=this.computeRenderRangeFromWindow(this.fileDiff,d,u);return super.render({fileDiff:this.fileDiff,fileContainer:e,renderRange:f,oldFile:t,newFile:n,lineAnnotations:a,forceRender:(s??i)||l,...o})}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return Vc(this.options.hunkSeparators)}approximateLayoutCheckpoints(){if(this.cache.checkpoints.length>0||this.fileDiff==null||this.fileDiff.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:e=!1,expandUnchanged:t=!1,collapsedContextThreshold:n=1}=this.options,r=this.fileDiff.hunks.length-1,i=this.getDiffStyle(),a=this.getHunkSeparatorType(),o=t?!0:this.hunksRenderer.getExpandedHunksMap(),s=Nc(this.cache.heightDeltas),c=Oo(this.metrics,e)+this.cache.fileAnnotationHeight,l=0,u=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=l,o=l+e,u=Ic(a);for(;u<o;){let e=u-a,r=c+(e>0?n:0)+e*this.metrics.lineHeight+Lc(i,e)*this.metrics.lineHeight+Pc(s,t,t+e);this.cache.checkpoints.push({renderedLineIndex:u,lineIndex:t+e,top:r}),u+=kc}c+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Pc(s,t,t+e)+r,l=o};for(let e=0;e<this.fileDiff.hunks.length;e++){let t=this.fileDiff.hunks[e];if(t==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let s=Ho({isPartial:this.fileDiff.isPartial,rangeSize:t.collapsedBefore,expandedHunks:o,hunkIndex:e,collapsedContextThreshold:n}),c=s.collapsedLines>0?Yo({type:a,metrics:this.metrics,hunkIndex:e,hunkSpecs:t.hunkSpecs})?.totalHeight??0:0;u({rowCount:s.fromStart,startLineIndex:(i===`split`?t.splitLineStart:t.unifiedLineStart)-s.rangeSize});let l=c;u({rowCount:s.fromEnd,startLineIndex:(i===`split`?t.splitLineStart:t.unifiedLineStart)-s.fromEnd,preSeparatorHeight:l}),s.fromEnd>0&&(l=0);let d=e===r?Wo({fileDiff:this.fileDiff,hunkIndex:e,expandedHunks:o,collapsedContextThreshold:n,errorPrefix:`VirtualizedFileDiff`}):void 0,f=d!=null&&d.collapsedLines>0?Xo({type:a,metrics:this.metrics})?.totalHeight??0:0,p=d==null?0:d.fromStart+d.fromEnd,m=i===`split`?t.splitLineCount:t.unifiedLineCount,h=i===`split`?t.splitLineStart:t.unifiedLineStart;u({rowCount:m,startLineIndex:h,preSeparatorHeight:l,postSeparatorHeight:p===0?f:0,metadataOffsets:Rc({diffStyle:i,hunk:t,rowCount:m})}),d!=null&&p>0&&u({rowCount:p,startLineIndex:h+m,postSeparatorHeight:f})}this.cache.totalLines=l}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=Ho({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=Wo({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=this.height,f=this.cache.totalLines>0?this.cache.totalLines:this.getExpandedLineCount(e,l),p=Oo(this.metrics,i),m=e.hunks.length>0?Ao(this.metrics):0,{fileAnnotationHeight:h}=this.cache,g=p+h,_=Math.max(0,d-p-h-m),v=this.hasFileAnnotations(e),y=t+p,b=h>0&&v&&y<r&&y+h>n;if(t<n-d||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:d-p-m};if(f<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(),f=this.cache.totalLines>0?this.cache.totalLines:f;let x=Math.ceil(Math.max(r-n,0)/c),S=Math.ceil(x/s)*s+s,C=S/s,w=C,T=[],E=(n+r)/2,D=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-S*c*2),s),O=t+(D?.top??g),k=D?.renderedLineIndex??0,A,j,ee;if(Zo({diff:e,diffStyle:l,startingLine:D?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,hunk:i,collapsedBefore:a,collapsedAfter:o,deletionLine:c,additionLine:d})=>{let f=d==null?c.splitLineIndex:d.splitLineIndex,p=d==null?c.unifiedLineIndex:d.unifiedLineIndex,m=(d?.noEOFCR??!1)||(c?.noEOFCR??!1),h=(a>0?Yo({type:u,metrics:this.metrics,hunkIndex:e,hunkSpecs:i?.hunkSpecs}):void 0)?.totalHeight??0;O+=h;let _=k%s===0,v=Math.floor(k/s);if(_&&(T[v]=O-(t+g+h),ee!=null)){if(ee<=0)return!0;ee--}let y=this.getLineHeight(l===`split`?f:p,m);return O>n-y&&O<r&&(A??=v),j==null&&O+y>E&&(j=v),ee==null&&O>=r&&_&&(ee=w),k++,O+=y,o>0&&(O+=Xo({type:u,metrics:this.metrics})?.totalHeight??0),!1}}),A==null)if(b)A=0,j=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:d-p-m};j??=A;let te=Math.round(j-C/2),M=Math.max(0,Math.ceil(f/s)-C),N=Math.max(0,Math.min(te,M)),ne=N*s,P=te<0?S+te*s:S,re=T[N]??0,ie=ne===0?0:h+re,F=N+P/s,ae=F<T.length?_-T[F]:_-(O-t-g);return{startingLine:ne,totalLines:P,bufferBefore:ie,bufferAfter:Math.max(0,ae)}}};function Mc(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===Xi&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function Nc(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function Pc({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=Fc(e,n);return(t[Fc(e,r)]??0)-(t[i]??0)}function Fc(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function Ic(e){return Math.ceil(e/kc)*kc}function Lc(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Rc({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function zc(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Bc(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 Vc(e){return typeof e==`function`?`custom`:e??`line-info`}function Hc(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}var Uc=typeof window>`u`?W.useEffect:W.useLayoutEffect;function Wc({fileDiff:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,metrics:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c}){let l=Vs(),u=r!==void 0,d=(0,W.useContext)(zs),f=(0,W.useRef)(null),p=Ro(r=>{if(r!=null){if(f.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);l==null?f.current=new bc(Gc({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c?void 0:d,!0):f.current=new jc(Gc({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),l,a,c?void 0:d,!0),f.current.hydrate({fileDiff:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:i})}else{if(f.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);f.current.cleanUp(),f.current=null}});return Uc(()=>{let{current:i}=f;if(i==null)return;let a=Gc({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c=!ci(i.options,a);i.setOptions(a),i.render({forceRender:c,fileDiff:e,lineAnnotations:n}),r!==void 0&&i.setSelectedLines(r)}),{ref:p,getHoveredLine:(0,W.useCallback)(()=>f.current?.getHoveredLine(),[])}}function Gc({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return!t&&!r&&!n?e:{...e,controlledSelection:t,renderCustomHeader:n?ri:e?.renderCustomHeader,renderGutterUtility:r?ri:e?.renderGutterUtility}}function Kc({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,className:a,style:o,prerenderedHTML:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderMetadata:d,renderGutterUtility:f,disableWorkerPool:p=!1}){let{ref:m,getHoveredLine:h}=Wc({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:s,hasGutterRenderUtility:f!=null,hasCustomHeader:l!=null,disableWorkerPool:p});return(0,J.jsx)($n,{ref:m,className:a,style:o,children:ai(Ys({fileDiff:e,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderMetadata:d,renderAnnotation:c,renderGutterUtility:f,lineAnnotations:r,getHoveredLine:h}),s)})}var qc=r(),Jc=e=>{let t=(0,qc.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,J.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M512 0C229.12 0 0 229.12 0 512c0 226.56 146.56 417.92 350.08 485.76 25.6 4.48 35.2-10.88 35.2-24.32 0-12.16-.64-52.48-.64-95.36-128.64 23.68-161.92-31.36-172.16-60.16-5.76-14.72-30.72-60.16-52.48-72.32-17.92-9.6-43.52-33.28-.64-33.92 40.32-.64 69.12 37.12 78.72 52.48 46.08 77.44 119.68 55.68 149.12 42.24 4.48-33.28 17.92-55.68 32.64-68.48-113.92-12.8-232.96-56.96-232.96-252.8 0-55.68 19.84-101.76 52.48-137.6-5.12-12.8-23.04-65.28 5.12-135.68 0 0 42.88-13.44 140.8 52.48 40.96-11.52 84.48-17.28 128-17.28s87.04 5.76 128 17.28c97.92-66.56 140.8-52.48 140.8-52.48 28.16 70.4 10.24 122.88 5.12 135.68 32.64 35.84 52.48 81.28 52.48 137.6 0 196.48-119.68 240-233.6 252.8 18.56 16 34.56 46.72 34.56 94.72 0 68.48-.64 123.52-.64 140.8 0 13.44 9.6 29.44 35.2 24.32C877.44 929.92 1024 737.92 1024 512 1024 229.12 794.88 0 512 0`,clipRule:`evenodd`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,J.jsx)(`svg`,{...e,viewBox:`0 0 1024 1024`,fill:`none`,children:n}),t[1]=e,t[2]=r),r};function Yc(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Xc=Yc();function Zc(e){Xc=e}var Qc={exec:()=>null};function $c(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function X(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(Z.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var el=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),Z={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:$c(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:$c(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:$c(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:$c(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:$c(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:$c(e=>RegExp(`^ {0,${e}}>`))},tl=/^(?:[ \t]*(?:\n|$))+/,nl=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,rl=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,il=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,al=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ol=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,sl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,cl=X(sl).replace(/bull/g,ol).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),ll=X(sl).replace(/bull/g,ol).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ul=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,dl=/^[^\n]+/,fl=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,pl=X(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,fl).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ml=X(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ol).getRegex(),hl=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,gl=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,_l=X(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,gl).replace(`tag`,hl).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vl=X(ul).replace(`hr`,il).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,hl).getRegex(),yl={blockquote:X(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,vl).getRegex(),code:nl,def:pl,fences:rl,heading:al,hr:il,html:_l,lheading:cl,list:ml,newline:tl,paragraph:vl,table:Qc,text:dl},bl=X(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,il).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,hl).getRegex(),xl={...yl,lheading:ll,table:bl,paragraph:X(ul).replace(`hr`,il).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,bl).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,hl).getRegex()},Sl={...yl,html:X(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,gl).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Qc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:X(ul).replace(`hr`,il).replace(`heading`,` *#{1,6} *[^
93
- ]`).replace(`lheading`,cl).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Cl=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,wl=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Tl=/^( {2,}|\\)\n(?!\s*$)/,El=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Dl=/[\p{P}\p{S}]/u,Ol=/[\s\p{P}\p{S}]/u,kl=/[^\s\p{P}\p{S}]/u,Al=X(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Ol).getRegex(),jl=/(?!~)[\p{P}\p{S}]/u,Ml=/(?!~)[\s\p{P}\p{S}]/u,Nl=/(?:[^\s\p{P}\p{S}]|~)/u,Pl=X(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,el?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Fl=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Il=X(Fl,`u`).replace(/punct/g,Dl).getRegex(),Ll=X(Fl,`u`).replace(/punct/g,jl).getRegex(),Rl=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,zl=X(Rl,`gu`).replace(/notPunctSpace/g,kl).replace(/punctSpace/g,Ol).replace(/punct/g,Dl).getRegex(),Bl=X(Rl,`gu`).replace(/notPunctSpace/g,Nl).replace(/punctSpace/g,Ml).replace(/punct/g,jl).getRegex(),Vl=X(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,kl).replace(/punctSpace/g,Ol).replace(/punct/g,Dl).getRegex(),Hl=X(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Dl).getRegex(),Ul=X(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,kl).replace(/punctSpace/g,Ol).replace(/punct/g,Dl).getRegex(),Wl=X(/\\(punct)/,`gu`).replace(/punct/g,Dl).getRegex(),Gl=X(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Kl=X(gl).replace(`(?:-->|$)`,`-->`).getRegex(),ql=X(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Kl).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Jl=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Yl=X(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Jl).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Xl=X(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Jl).replace(`ref`,fl).getRegex(),Zl=X(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,fl).getRegex(),Ql=X(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Xl).replace(`nolink`,Zl).getRegex(),$l=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,eu={_backpedal:Qc,anyPunctuation:Wl,autolink:Gl,blockSkip:Pl,br:Tl,code:wl,del:Qc,delLDelim:Qc,delRDelim:Qc,emStrongLDelim:Il,emStrongRDelimAst:zl,emStrongRDelimUnd:Vl,escape:Cl,link:Yl,nolink:Zl,punctuation:Al,reflink:Xl,reflinkSearch:Ql,tag:ql,text:El,url:Qc},tu={...eu,link:X(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Jl).getRegex(),reflink:X(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Jl).getRegex()},nu={...eu,emStrongRDelimAst:Bl,emStrongLDelim:Ll,delLDelim:Hl,delRDelim:Ul,url:X(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,$l).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:X(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,$l).getRegex()},ru={...nu,br:X(Tl).replace(`{2,}`,`*`).getRegex(),text:X(nu.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},iu={normal:yl,gfm:xl,pedantic:Sl},au={normal:eu,gfm:nu,breaks:ru,pedantic:tu},ou={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},su=e=>ou[e];function cu(e,t){if(t){if(Z.escapeTest.test(e))return e.replace(Z.escapeReplace,su)}else if(Z.escapeTestNoEncode.test(e))return e.replace(Z.escapeReplaceNoEncode,su);return e}function lu(e){try{e=encodeURI(e).replace(Z.percentDecode,`%`)}catch{return null}return e}function uu(e,t){let n=e.replace(Z.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Z.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(Z.slashPipe,`|`);return n}function du(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function fu(e){let t=e.split(`
94
- `),n=t.length-1;for(;n>=0&&Z.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
95
- `)}function pu(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function mu(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function hu(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function gu(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
92
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Hs({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function Us({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;if(r===o||r&&e.value.length===1&&!o){a[1]+=e.value;return}t.push([+!r,e.value])}var Ws={forcePlainText:!1};function Gs(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=Ws){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=Za({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??qs();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}ss({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:c?h:!0,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&Ks({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=Js({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else f.deletionLines.push(...s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else f.additionLines.push(...c)}return{code:f,themeStyles:u,baseThemeType:l}}function Ks({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=kr(e),t=kr(t),e.length>s||t.length>s))return;let c=o===`char`?gs(e,t):js(e,t),l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(Us({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),Us({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?Us({item:e,arr:l,enableJoin:d,isLastItem:t}):Us({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(Hs({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(Hs({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function qs(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Js({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c=G,...l}}){let u=s??ia(e.name),d=s??ia(t.name),{state:f,transformers:p}=Fa(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Ra(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Ra(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,$a(i.codeToHast(kr(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,$a(i.codeToHast(kr(t.contents),m)))}}var Ys=(0,U.createContext)(void 0),Xs=(0,U.createContext)(void 0);function Zs(){return(0,U.useContext)(Xs)}var Qs=typeof window>`u`?U.useEffect:U.useLayoutEffect;function $s({file:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,metrics:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c}){let l=Zs(),u=r!==void 0,d=(0,U.useContext)(Ys),f=(0,U.useRef)(null),p=Jo(r=>{if(r!=null){if(f.current!=null)throw Error(`File: An instance should not already exist when a node is created`);l==null?f.current=new Po(ec({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c?void 0:d,!0):f.current=new Go(ec({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),l,a,c?void 0:d,!0),f.current.hydrate({file:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:i})}else{if(f.current==null)throw Error(`File: A File instance should exist when unmounting`);f.current.cleanUp(),f.current=null}});return Qs(()=>{if(f.current==null)return;let i=ec({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),a=!vi(f.current.options,i);f.current.setOptions(i),f.current.render({file:e,lineAnnotations:n,forceRender:a}),r!==void 0&&f.current.setSelectedLines(r)}),{ref:p,getHoveredLine:(0,U.useCallback)(()=>f.current?.getHoveredLine(),[])}}function ec({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return!t&&!r&&!n?e:{...e,controlledSelection:t,renderCustomHeader:n?pi:e?.renderCustomHeader,renderGutterUtility:r?pi:e?.renderGutterUtility}}function tc({file:e,lineAnnotations:t,selectedLines:n,options:r,metrics:i,className:a,style:o,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderMetadata:u,prerenderedHTML:d,renderGutterUtility:f,disableWorkerPool:p=!1}){let{ref:m,getHoveredLine:h}=$s({file:e,options:r,metrics:i,lineAnnotations:t,selectedLines:n,prerenderedHTML:d,hasGutterRenderUtility:f!=null,hasCustomHeader:c!=null,disableWorkerPool:p});return(0,q.jsx)(lr,{ref:m,className:a,style:o,children:hi(mi({file:e,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderMetadata:u,renderGutterUtility:f,lineAnnotations:t,getHoveredLine:h}),d)})}function nc({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function rc(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:ic(n,e.startContentIndex)}}function ic(e,t){let n=e.unifiedLineStart;for(let r=0;r<t;r++){let t=e.hunkContent[r];n+=t.type===`context`?t.lines:t.deletions+t.additions}return n}function ac({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o,renderMergeConflictUtility:s,lineAnnotations:c,getHoveredLine:l,getInstance:u}){let d=n?.(e),f=r?.(e),p=i?.(e);return(0,q.jsxs)(q.Fragment,{children:[d==null?(0,q.jsxs)(q.Fragment,{children:[f!=null&&(0,q.jsx)(`div`,{slot:`header-prefix`,children:f}),p!=null&&(0,q.jsx)(`div`,{slot:`header-metadata`,children:p})]}):(0,q.jsx)(`div`,{slot:yr,children:d}),a!=null&&c?.map((e,t)=>(0,q.jsx)(`div`,{slot:ui(e),children:a(e)},t)),t!=null&&s!=null&&u!=null&&t.map(t=>{if(t==null)return;let n=oc(t,e);return(0,q.jsx)(`div`,{slot:n,style:fi,children:s(t,u)},n)}),o!=null&&(0,q.jsx)(`div`,{slot:`gutter-utility-slot`,style:di,children:o(l)})]})}function oc(e,t){let n=rc(e,t);return n==null?void 0:nc({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}function sc(e,t,n,r=!1){let i=Rr(Bs(e.name,t.name,e.contents,t.contents,e.header,t.header,n),{cacheKey:(()=>{if(e.cacheKey!=null&&t.cacheKey!=null)return`${e.cacheKey}:${t.cacheKey}`})(),oldFile:e,newFile:t,throwOnError:r});if(i==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);return t.lang!=null&&(i.lang=t.lang),i}var cc=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&=(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener(`scroll`,this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener(`scroll`,this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function lc(e){return J({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function uc(e){return J({tagName:`div`,children:[J({tagName:`span`,children:[Ci(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function dc(e){return J({tagName:`div`,children:[wi({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{role:`button`,"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function fc({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(J({tagName:`div`,children:[Ci(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(dc(`up`)),s++),o||(e.push(dc(`down`)),s++)):(e.push(dc(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(J({tagName:`div`,children:[J({tagName:`span`,children:[Ci(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(J({tagName:`div`,children:[Ci(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(J({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(J({tagName:`slot`,properties:{name:i}})),J({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function pc(e,t){return`hunk-separator-${e}-${t}`}function mc(e){let t=e.at(-1);return t==null?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function hc(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}var gc=-1,_c=class{__id=`diff-hunks-renderer:${++gc}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;constructor(e={theme:G},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=pa(e.theme??G)?Ee():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}clearRenderCache(){this.renderCache=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??Er}getExpandedHunksMap(){return this.expandedHunks}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e}}getSplitLineDecoration({side:e,type:t}){return t===`change`?{gutterLineType:e===`deletions`?`change-deletion`:`change-addition`}:{gutterLineType:t}}createAnnotationElement=e=>ga(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=G,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=wr,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await xe(wa(this.computedLang,this.options)),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=Tc(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!Xo(t,r.options)&&(r=void 0),this.renderCache??={diff:e,highlighted:!n&&!Zo(e),options:t,result:n?void 0:r?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLang=e.lang??ia(e.name),this.initializeHighlighter())}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getDiffRenderOptions();let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:ro(this.options),tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!Yo(e,n.diff)||!Xo(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=Dr){if(e==null)return;let{expandUnchanged:n=!1,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getMatchingWorkerResultCache(e,i);o!=null&&!this.hasHighlightedRenderCache(e,i)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...o},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||Zo(e)||Tc(e,this.getTokenizeMaxLength()),l=!Yo(e,this.renderCache.diff),u=!ta(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(c||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,hc(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e);else{this.computedLang=e.lang??ia(e.name);let t=this.highlighter!=null&&pa(i.theme),n=this.highlighter!=null&&da(this.computedLang),r=!c&&n;if(this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=Dr){let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return Sa({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=Tc(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??ia(e.name);let n=this.highlighter!=null&&pa(this.options.theme??G),r=t||this.highlighter!=null&&da(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults();return{result:Gs(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i}),options:r}}onHighlightSuccess(e,t,n,r=!0){if(this.renderCache==null)return;let i=!this.renderCache.highlighted||!Xo(this.renderCache.options,n)||!Yo(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!Xo(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Yo(e,n.diff)&&Xo(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults();this.diff=e;let d=a===`unified`,f=[],p=[],m=[],h=[],{additionLines:g,deletionLines:_}=n,v={rowCount:0,hunkSeparators:u,additionsContentAST:f,deletionsContentAST:p,unifiedContentAST:m,unifiedGutterAST:Ei(),deletionsGutterAST:Ei(),additionsGutterAST:Ei(),expansionLineCount:c,hunkData:h,incrementRowCount(e=1){v.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:v.unifiedGutterAST.children.push(t);break;case`deletions`:v.deletionsGutterAST.children.push(t);break;case`additions`:v.additionsGutterAST.children.push(t);break}}},y=$o({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),b={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(v.pushToGutter(`additions`,Oi(void 0,`buffer`,this.size)),f?.push(lc(this.size))):(v.pushToGutter(`deletions`,Oi(void 0,`buffer`,this.size)),p?.push(lc(this.size))),this.size=0,this.side=void 0}}},x=(e,t,n,r,i)=>{v.pushToGutter(e,Di(t,n,r,i))};function S(e){b.flush(),a===`unified`?Cc(`unified`,e,v):(Cc(`deletions`,e,v),Cc(`additions`,e,v))}this.pushFileLevelAnnotations(e,a,t,v),ss({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,d=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&b.flush(),r>0&&S({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:!e.isPartial});let f=a===`unified`?d:l,p={type:c,hunkIndex:t,lineIndex:f,unifiedLineIndex:d,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(p);n?.before!=null&&bc(n.before,v);let r=s==null?void 0:_[s.lineIndex],i=o==null?void 0:g[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});x(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${d},${l}`,u.gutterProperties),i==null?r!=null&&(r=wc(r,u.contentProperties)):i=wc(i,u.contentProperties),Sc({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,f),createAnnotationElement:e=>this.createAnnotationElement(e),context:v}),n?.after!=null&&bc(n.after,v)}else{let n=this.getSplitInjectedRowsForLine?.(p);n?.before!=null&&xc(n.before,v,b);let r=s==null?void 0:_[s.lineIndex],i=o==null?void 0:g[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let d=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();if(d!=null){if(b.side!=null&&b.side!==d)throw Error(`DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits`);b.side=d,b.increment()}let m=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,f);if(m!=null&&b.size>0&&b.flush(),s!=null){let e=wc(r,a.contentProperties);x(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=wc(i,u.contentProperties);x(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Sc({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...m,createAnnotationElement:e=>this.createAnnotationElement(e),context:v}),n?.after!=null&&xc(n.after,v,b)}let m=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,h=m?n.noEOFCRDeletions:!1,C=m?n.noEOFCRAdditions:!1,w=(s?.noEOFCR??!1)||h,T=(o?.noEOFCR??!1)||C;if(T||w){if(a===`split`&&b.flush(),w){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(v.unifiedContentAST.push(uc(e)),v.pushToGutter(`unified`,Oi(e,`metadata`,1))):(v.deletionsContentAST.push(uc(e)),v.pushToGutter(`deletions`,Oi(e,`metadata`,1)),T||(v.pushToGutter(`additions`,Oi(void 0,`buffer`,1)),v.additionsContentAST.push(lc(1))))}if(T){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(v.unifiedContentAST.push(uc(e)),v.pushToGutter(`unified`,Oi(e,`metadata`,1))):(v.additionsContentAST.push(uc(e)),v.pushToGutter(`additions`,Oi(e,`metadata`,1)),w||(v.pushToGutter(`deletions`,Oi(void 0,`buffer`,1)),v.deletionsContentAST.push(lc(1))))}v.incrementRowCount(1)}i>0&&u!==`simple`&&S({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:i,rangeSize:y,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!e.isPartial}),v.incrementRowCount(1)}}),a===`split`&&b.flush();let C=Math.max(mc(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),w=t.bufferBefore>0||t.bufferAfter>0,T=!d&&e.type!==`deleted`,E=!d&&e.type!==`new`,D=v.rowCount>0||w;f=T&&D?f:void 0,p=E&&D?p:void 0,m=d&&D?m:void 0;let O=this.createPreElement(p!=null&&f!=null,C);return{unifiedGutterAST:d&&D?v.unifiedGutterAST.children:void 0,unifiedContentAST:m,deletionsGutterAST:E&&D?v.deletionsGutterAST.children:void 0,deletionsContentAST:p,additionsGutterAST:T&&D?v.additionsGutterAST.children:void 0,additionsContentAST:f,hunkData:h,preNode:O,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:C,rowCount:v.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=Ei(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,_a(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(J({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(J({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(J({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return Ce(this.renderFullAST(e,t))}renderPartialHTML(e,t){return Ce(t==null?e:J({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!la(n))return;let i=e.type===`new`?[]:vc(ca(this.deletionAnnotations)),a=e.type===`deleted`?[]:vc(ca(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){Sc({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}Sc({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(ui(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(ui(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(!(o.annotations.length===0&&a.annotations.length===0))return{deletionSpan:a,additionSpan:o}}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return ya({fileOrDiff:e,mode:t,stickyHeader:n})}};function vc(e){return e?.map(e=>ui(e))??[]}function yc(e){return`${e} unmodified line${e>1?`s`:``}`}function bc(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function xc(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function Sc({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,Oi(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,Oi(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,Oi(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function Cc(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,fc({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(fc({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,fc({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(fc({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=pc(e,t),d=r>c.expansionLineCount,f=s?t:void 0;c.pushToGutter(e,fc({type:c.hunkSeparators,content:yc(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(fc({type:c.hunkSeparators,content:yc(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:n,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function wc(e,t){return e==null||e.type!==`element`||t==null?e:{...e,properties:{...e.properties,...t}}}function Tc(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Ec(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Dc(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function Oc(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:e?.useTokenTransformer,tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}var kc=-1,Ac=class{static LoadedCustomComponent=!0;__id=`file-diff:${++kc}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;constructor(e={theme:G},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Yi,this.scrollSyncManager=new cc,this.interactionManager=new Ai(`diff`,ji(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getHunksRendererOptions(e){return Oc(e)}createHunksRenderer(e){return new _c(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{if(this.fileDiff==null)return;let n=this.fileDiff.hunks.at(-1),r,i;hunkIterator:for(let a of this.fileDiff.hunks){let o=t===`deletions`?a.deletionStart:a.additionStart,s=t===`deletions`?a.deletionCount:a.additionCount,c=a.splitLineStart,l=a.unifiedLineStart;if(e<o){let t=o-e;r=Math.max(l-t,0),i=Math.max(c-t,0);break hunkIterator}if(e>=o+s){if(a===n){let t=e-(o+s);r=l+a.unifiedLineCount+t,i=c+a.splitLineCount+t;break hunkIterator}continue}for(let n of a.hunkContent)if(n.type===`context`)if(e<o+n.lines){let t=e-o;i=c+t,r=l+t;break hunkIterator}else o+=n.lines,c+=n.lines,l+=n.lines;else{let a=t===`deletions`?n.deletions:n.additions;if(e<o+a){let a=e-o;r=l+(t===`additions`?n.deletions:0)+a,i=c+a;break hunkIterator}else o+=a,c+=Math.max(n.deletions,n.additions),l+=n.deletions+n.additions}break hunkIterator}if(!(r==null||i==null))return[r,i]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(ji(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType===t?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!_i(this.appliedThemeCSS.theme,this.options.theme??G)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,t===`wrap`),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}cleanUp(e=!1){this.emitPostRender(!0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,lineAnnotations:i,oldFile:a,newFile:o,fileDiff:s}=e;this.hydrateElements(t,n),Nc(this.pre,jc({fileDiff:s,oldFile:a,newFile:o}),this.options.collapsed)||Pc(this.headerElement,Mc({fileDiff:s,oldFile:a,newFile:o}),this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({fileDiff:s,oldFile:a,newFile:o,lineAnnotations:i}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Ao(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)!(e instanceof HTMLElement)||e.tagName.toLowerCase()!==`code`||(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!=null&&n!=null?sc(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.rerender()};render({oldFile:e,newFile:t,fileDiff:n,deferManagers:r=!1,forceRender:i=!1,preventEmit:a=!1,lineAnnotations:o,fileContainer:s,containerWrapper:c,renderRange:l}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let{collapsed:u=!1,themeType:d=`system`}=this.options,f=u?void 0:l,p=this.hasThemeChanged(),m=e!=null&&t!=null&&(!ea(e,this.deletionFile)||!ea(t,this.additionFile)),h=n!=null&&n!==this.fileDiff,g=o!=null&&(o.length>0||this.lineAnnotations.length>0)?o!==this.lineAnnotations:!1;if(!u&&ta(f,this.renderRange)&&!i&&!g&&!p&&(n!=null&&n===this.fileDiff||n==null&&!m))return this.applyCachedThemeState(d);let{renderRange:_}=this;if(this.renderRange=f,this.deletionFile=e,this.additionFile=t,n==null?e!=null&&t!=null&&m&&(h=!0,this.fileDiff=sc(e,t,this.options.parseDiffOptions)):this.fileDiff=n,h&&(this.cachedHeaderHTML=void 0),o!=null&&this.setLineAnnotations(o),this.fileDiff==null)return!1;this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:v=!1,disableFileHeader:y=!1}=this.options;if(y&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),s=this.getOrCreateFileContainer(s,c),this.applyCachedThemeState(d),u){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,Or);e!=null&&this.applyThemeState(s,e.themeStyles,d,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,s),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(v)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,s)}return a||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(s);if(!(this.canPartiallyRender(i,g,m||h||p)&&this.applyPartialRender({previousRenderRange:_,renderRange:f}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,f);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(s,t.themeStyles,d,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,s),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,f),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,r||this.flushManagers()}catch(e){if(v)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,s)}return a||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}primeHighlightCache(){let{fileDiff:e,workerManager:t}=this;if(e==null||t==null||Zo(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||t.primeDiffHighlightCache(e)}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!Dc(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${ui(r)}`,a=this.annotationCache.get(i);if(a==null||!Ec(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:po(ui(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=mo();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:bi(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):bi(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=so;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,r=this.cachedHeaderHTML??Ce(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:a,renderHeaderMetadata:o}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,yr,e),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0;return}let s=a?.(n)??void 0,c=o?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,_r,s),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,vr,c),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}this.unsafeCSSStyle?.parentNode===t&&this.appliedUnsafeCSS===e||(this.unsafeCSSStyle??=ho(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=So(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??G,s=typeof o==`string`?o:{...o},c=_o(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=Oo({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:Co(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=wo(this.themeCSSStyle.textContent??``,_o(e)))}applyHunksToDOM(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Do({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Do({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=Do({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:a,options:{diffStyle:o=`split`}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let s=this.getCodeColumns(o,r,a,i);if(s==null)return!1;let c=e.startingLine,l=t.startingLine,u=c+e.totalLines,d=l+t.totalLines,f=Math.max(c,l),p=Math.min(u,d);if(p<=f)return!1;let m=Math.max(0,f-c),h=Math.max(0,u-p),g=this.trimColumns({columns:s,trimStart:m,trimEnd:h,previousStart:c,overlapStart:f,overlapEnd:p,diffStyle:o});if(g<0)throw Error(`applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`applyPartialRender: trimmed beyond DOM row count`);let _=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(l,Math.max(f-l,0));if(y==null&&l<f)return!1;let b=v(p,Math.max(d-p,0));if(b==null&&d>p)return!1;let x=(e,t)=>{if(e!=null){if(o===`unified`&&!Array.isArray(s))this.insertPartialHTML(o,s,e,t);else if(o===`split`&&Array.isArray(s))this.insertPartialHTML(o,s,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);_+=e.rowCount}};return this.cleanupErrorWrapper(),x(y,`afterbegin`),x(b,`beforeend`),this.lastRowCount!==_&&(this.applyRowSpan(o,s,_),this.lastRowCount=_),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=Fc(t[0]),i=Fc(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}else throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getCodeColumns(e,t,n,r){function i(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}if(e===`unified`)return i(t);{let e=i(n),t=i(r);return e!=null||t!=null?[e,t]:void 0}}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l===`unified`?!1:t!=null&&n!=null,totalLines:r,customProperties:i};lo(u,this.appliedPreAttributes)||(jo(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function jc({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Mc({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function Nc(e,t,n=!1){return!n&&e==null&&t}function Pc(e,t,n=!1){return e==null&&t&&!n}function Fc(e){if(!(e==null||e.type!==`element`))return e.children??[]}function Ic({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o}){let s=Ro(t,n),c=s,l=i?!0:a,u=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=Qo({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:l,hunkIndex:n,collapsedContextThreshold:o}),d=(a.fromStart+a.fromEnd)*t.lineHeight;if(s+=d,c+=d,a.collapsedLines>0){let e=as({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;s+=e,c+=e}s+=i.splitLineCount*t.lineHeight,c+=i.unifiedLineCount*t.lineHeight;let f=Lc(i);s+=f.split*t.lineHeight,c+=f.unified*t.lineHeight;let p=n===u?es({fileDiff:e,hunkIndex:n,expandedHunks:l,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(p!=null){let e=(p.fromStart+p.fromEnd)*t.lineHeight;if(s+=e,c+=e,p.collapsedLines>0){let e=os({type:r,metrics:t})?.totalHeight??0;s+=e,c+=e}}}if(e.hunks.length>0){let e=Bo(t);s+=e,c+=e}return{splitHeight:s,unifiedHeight:c}}function Lc(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type===`context`){let e=+(t.lines>0);return{split:e,unified:e}}return Rc(e,t)}function Rc(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}var zc=5e3,Bc=-1,Vc=class extends Ac{__id=`little-virtualized-file-diff:${++Bc}`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=Lo(n)}setMetrics(e,t=!1){let n=Lo(e);!t&&gi(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e===t?!1:(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e=this.fileDiff){return e==null||!sa(this.lineAnnotations)?!1:this.lineAnnotations.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type===`deleted`?t.side===`deletions`:!0:!1)}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!vi(t,e),r=n&&Yc(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Xc(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.size>0&&this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal!==0&&(this.cache.measuredHeightDeltaTotal=0),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),t&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){let e=!1,{overflow:t=`scroll`}=this.options;if(this.fileContainer==null||this.fileDiff==null)return this.height!==0&&(e=!0),this.height=0,e;if(this.top=this.getVirtualizedTop(),t===`scroll`&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled())return e;let n=this.getDiffStyle(),r=n===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],i=this.hasFileAnnotations(this.fileDiff);if(this.renderRange!=null&&i&&la(this.renderRange)){let t=Hc(r)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!i&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of r){if(t==null)continue;let r=t.children[1];if(r instanceof HTMLElement)for(let t of r.children){if(!(t instanceof HTMLElement))continue;let r=t.dataset.lineIndex;if(r==null)continue;let i=Qc(r,n),a=t.getBoundingClientRect().height,o=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(o=!0),a+=t.nextElementSibling.getBoundingClientRect().height);let s=this.getEstimatedLineHeight(o),c=this.cache.heightDeltas.get(i)??0,l=a-s;l!==c&&(e=!0,this.cache.measuredHeightDeltaTotal+=l-c,l===0?this.cache.heightDeltas.delete(i):this.cache.heightDeltas.set(i,l))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render());prepareCodeViewItem(e,t,n,r){let i=!Yo(this.fileDiff,e),a=this.syncLineAnnotations(r),o=n?.resetDiffLayoutCache===!0||i||a,s=i||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights;n?.metrics!=null&&(this.metrics=Lo(n.metrics),o=!0,s=!0);let{collapsed:c=!1}=this.options;return this.currentCollapsed!==c&&(this.currentCollapsed=c,o=!0),o&&this.resetLayoutCache({includeEstimatedHeights:s}),this.fileDiff=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e,t=`additions`){if(this.fileDiff==null||e<1)return;let n=this.getLineIndex(e,t);if(n==null)return;let{disableFileHeader:r=!1,expandUnchanged:i=!1,collapsed:a=!1,collapsedContextThreshold:o=1}=this.options,s=this.getDiffStyle(),c=this.getHunkSeparatorType(),l=s===`split`?n[1]:n[0];this.approximateLayoutCheckpoints();let u=Ro(this.metrics,r),d=this.getLayoutCheckpointBeforeLineIndex(l),f=d?.top??u+this.cache.fileAnnotationHeight;if(a)return{top:u,height:0};let p;return ss({diff:this.fileDiff,diffStyle:s,startingLine:d?.renderedLineIndex??0,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=s===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=as({type:c,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(f+=r.gapBefore,l>=o-n&&l<o)return p={top:f,height:r.height},!0;f+=r.height+r.gapAfter}}let u=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===l)return p={top:f,height:u},!0;if(f+=u,r>0){let e=os({type:c,metrics:this.metrics});if(e!=null){if(l>o&&l<=o+r)return p={top:f+e.gapBefore,height:e.height},!0;f+=e.totalHeight}}return!1}}),p}getNumericScrollAnchor(e){if(this.fileDiff==null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:r=!1,collapsedContextThreshold:i=1}=this.options;if(r)return;let a=this.getDiffStyle(),o=this.getHunkSeparatorType();this.approximateLayoutCheckpoints();let s=this.getLayoutCheckpointBeforeTop(e),c=s?.top??Ro(this.metrics,t)+this.cache.fileAnnotationHeight,l;return ss({diff:this.fileDiff,diffStyle:a,startingLine:s?.renderedLineIndex??0,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:s,additionLine:u})=>{let d=a===`split`?u?.splitLineIndex??s?.splitLineIndex:u?.unifiedLineIndex??s?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=as({type:o,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(c+=e.totalHeight)}if(c>=e&&(s==null?u!=null&&(l={lineNumber:u.lineNumber,side:`additions`,top:c}):l={lineNumber:s.lineNumber,side:`deletions`,top:c},l!=null))return!0;let f=this.getLineHeight(d,(u?.noEOFCR??!1)||(s?.noEOFCR??!1));if(c+=f,i>0){let e=os({type:o,metrics:this.metrics});e!=null&&(c+=e.totalHeight)}return!1}}),l}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.fileDiff==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let t=e==null?this.renderRange:this.computeRenderRangeFromWindow(this.fileDiff,this.top,e);if(t==null)return;let{bufferBefore:n,bufferAfter:r,totalLines:i}=t,a=0;if(i===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(a=r)}return{topOffset:this.top+n+a,height:this.height-(n+r)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache({includeEstimatedHeights:!0}),this.isSetup=!1,super.cleanUp(e)}expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,this.resetLayoutCache({includeEstimatedHeights:!0}),this.isSimpleMode()&&this.computeApproximateSize(),this.virtualizer.instanceChanged(this,!0)};setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}computeApproximateSize(e=!1){let t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;let n=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,this.fileDiff==null){this.layoutDirty=!1;return}let{disableFileHeader:r=!1,collapsed:i=!1}=this.options,a=Ro(this.metrics,r);if(this.height+=a,i){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight()+this.cache.measuredHeightDeltaTotal,t&&!n&&this.validateComputedHeight(),this.layoutDirty=!1}getActiveEstimatedHeight(){this.ensureEstimatedDiffHeights();let e=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(e==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return e}ensureEstimatedDiffHeights(){if(this.fileDiff==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:e=!1,expandUnchanged:t=!1,collapsedContextThreshold:n=1}=this.options,{splitHeight:r,unifiedHeight:i}=Ic({fileDiff:this.fileDiff,metrics:this.metrics,disableFileHeader:e,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:t,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:n});this.cache.estimatedSplitHeight=r,this.cache.estimatedUnifiedHeight=i}validateComputedHeight(){if(this.fileContainer==null||this.fileDiff==null)return;let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:this.fileDiff.name,elementHeight:e.height,computedHeight:this.height})}render({fileContainer:e,oldFile:t,newFile:n,fileDiff:r,forceRender:i=!1,lineAnnotations:a,...o}={}){let{forceRenderOverride:s,isSetup:c}=this;this.forceRenderOverride=void 0;let l=this.syncLineAnnotations(a);if(l&&this.resetLayoutCache({includeEstimatedHeights:!1}),this.fileDiff??=r??(t!=null&&n!=null?sc(t,n,this.options.parseDiffOptions):void 0),e=this.getOrCreateFileContainer(e),this.fileDiff==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;if(c)this.top??=this.getVirtualizedTop();else{this.computeApproximateSize();let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode())return this.renderPlaceholder(this.height);let u=this.virtualizer.getWindowSpecs(),d=this.top??0,f=this.computeRenderRangeFromWindow(this.fileDiff,d,u);return super.render({fileDiff:this.fileDiff,fileContainer:e,renderRange:f,oldFile:t,newFile:n,lineAnnotations:a,forceRender:(s??i)||l,...o})}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return Zc(this.options.hunkSeparators)}approximateLayoutCheckpoints(){if(this.cache.checkpoints.length>0||this.fileDiff==null||this.fileDiff.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:e=!1,expandUnchanged:t=!1,collapsedContextThreshold:n=1}=this.options,r=this.fileDiff.hunks.length-1,i=this.getDiffStyle(),a=this.getHunkSeparatorType(),o=t?!0:this.hunksRenderer.getExpandedHunksMap(),s=Uc(this.cache.heightDeltas),c=Ro(this.metrics,e)+this.cache.fileAnnotationHeight,l=0,u=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=l,o=l+e,u=Kc(a);for(;u<o;){let e=u-a,r=c+(e>0?n:0)+e*this.metrics.lineHeight+qc(i,e)*this.metrics.lineHeight+Wc(s,t,t+e);this.cache.checkpoints.push({renderedLineIndex:u,lineIndex:t+e,top:r}),u+=zc}c+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Wc(s,t,t+e)+r,l=o};for(let e=0;e<this.fileDiff.hunks.length;e++){let t=this.fileDiff.hunks[e];if(t==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let s=Qo({isPartial:this.fileDiff.isPartial,rangeSize:t.collapsedBefore,expandedHunks:o,hunkIndex:e,collapsedContextThreshold:n}),c=s.collapsedLines>0?as({type:a,metrics:this.metrics,hunkIndex:e,hunkSpecs:t.hunkSpecs})?.totalHeight??0:0;u({rowCount:s.fromStart,startLineIndex:(i===`split`?t.splitLineStart:t.unifiedLineStart)-s.rangeSize});let l=c;u({rowCount:s.fromEnd,startLineIndex:(i===`split`?t.splitLineStart:t.unifiedLineStart)-s.fromEnd,preSeparatorHeight:l}),s.fromEnd>0&&(l=0);let d=e===r?es({fileDiff:this.fileDiff,hunkIndex:e,expandedHunks:o,collapsedContextThreshold:n,errorPrefix:`VirtualizedFileDiff`}):void 0,f=d!=null&&d.collapsedLines>0?os({type:a,metrics:this.metrics})?.totalHeight??0:0,p=d==null?0:d.fromStart+d.fromEnd,m=i===`split`?t.splitLineCount:t.unifiedLineCount,h=i===`split`?t.splitLineStart:t.unifiedLineStart;u({rowCount:m,startLineIndex:h,preSeparatorHeight:l,postSeparatorHeight:p===0?f:0,metadataOffsets:Jc({diffStyle:i,hunk:t,rowCount:m})}),d!=null&&p>0&&u({rowCount:p,startLineIndex:h+m,postSeparatorHeight:f})}this.cache.totalLines=l}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=Qo({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=es({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=this.height,f=this.cache.totalLines>0?this.cache.totalLines:this.getExpandedLineCount(e,l),p=Ro(this.metrics,i),m=e.hunks.length>0?Bo(this.metrics):0,{fileAnnotationHeight:h}=this.cache,g=p+h,_=Math.max(0,d-p-h-m),v=this.hasFileAnnotations(e),y=t+p,b=h>0&&v&&y<r&&y+h>n;if(t<n-d||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:d-p-m};if(f<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(),f=this.cache.totalLines>0?this.cache.totalLines:f;let x=Math.ceil(Math.max(r-n,0)/c),S=Math.ceil(x/s)*s+s,C=S/s,w=C,T=[],E=(n+r)/2,D=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-S*c*2),s),O=t+(D?.top??g),ee=D?.renderedLineIndex??0,k,A,j;if(ss({diff:e,diffStyle:l,startingLine:D?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,hunk:i,collapsedBefore:a,collapsedAfter:o,deletionLine:c,additionLine:d})=>{let f=d==null?c.splitLineIndex:d.splitLineIndex,p=d==null?c.unifiedLineIndex:d.unifiedLineIndex,m=(d?.noEOFCR??!1)||(c?.noEOFCR??!1),h=(a>0?as({type:u,metrics:this.metrics,hunkIndex:e,hunkSpecs:i?.hunkSpecs}):void 0)?.totalHeight??0;O+=h;let _=ee%s===0,v=Math.floor(ee/s);if(_&&(T[v]=O-(t+g+h),j!=null)){if(j<=0)return!0;j--}let y=this.getLineHeight(l===`split`?f:p,m);return O>n-y&&O<r&&(k??=v),A==null&&O+y>E&&(A=v),j==null&&O>=r&&_&&(j=w),ee++,O+=y,o>0&&(O+=os({type:u,metrics:this.metrics})?.totalHeight??0),!1}}),k==null)if(b)k=0,A=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:d-p-m};A??=k;let te=Math.round(A-C/2),ne=Math.max(0,Math.ceil(f/s)-C),M=Math.max(0,Math.min(te,ne)),N=M*s,P=te<0?S+te*s:S,re=T[M]??0,ie=N===0?0:h+re,ae=M+P/s,oe=ae<T.length?_-T[ae]:_-(O-t-g);return{startingLine:N,totalLines:P,bufferBefore:ie,bufferAfter:Math.max(0,oe)}}};function Hc(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===oa&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function Uc(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function Wc({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=Gc(e,n);return(t[Gc(e,r)]??0)-(t[i]??0)}function Gc(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function Kc(e){return Math.ceil(e/zc)*zc}function qc(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Jc({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function Yc(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Xc(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 Zc(e){return typeof e==`function`?`custom`:e??`line-info`}function Qc(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}var $c=typeof window>`u`?U.useEffect:U.useLayoutEffect;function el({fileDiff:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,metrics:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c}){let l=Zs(),u=r!==void 0,d=(0,U.useContext)(Ys),f=(0,U.useRef)(null),p=Jo(r=>{if(r!=null){if(f.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);l==null?f.current=new Ac(tl({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c?void 0:d,!0):f.current=new Vc(tl({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),l,a,c?void 0:d,!0),f.current.hydrate({fileDiff:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:i})}else{if(f.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);f.current.cleanUp(),f.current=null}});return $c(()=>{let{current:i}=f;if(i==null)return;let a=tl({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c=!vi(i.options,a);i.setOptions(a),i.render({forceRender:c,fileDiff:e,lineAnnotations:n}),r!==void 0&&i.setSelectedLines(r)}),{ref:p,getHoveredLine:(0,U.useCallback)(()=>f.current?.getHoveredLine(),[])}}function tl({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return!t&&!r&&!n?e:{...e,controlledSelection:t,renderCustomHeader:n?pi:e?.renderCustomHeader,renderGutterUtility:r?pi:e?.renderGutterUtility}}function nl({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,className:a,style:o,prerenderedHTML:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderMetadata:d,renderGutterUtility:f,disableWorkerPool:p=!1}){let{ref:m,getHoveredLine:h}=el({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:s,hasGutterRenderUtility:f!=null,hasCustomHeader:l!=null,disableWorkerPool:p});return(0,q.jsx)(lr,{ref:m,className:a,style:o,children:hi(ac({fileDiff:e,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderMetadata:d,renderAnnotation:c,renderGutterUtility:f,lineAnnotations:r,getHoveredLine:h}),s)})}var rl=r(),il=e=>{let t=(0,rl.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,q.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M512 0C229.12 0 0 229.12 0 512c0 226.56 146.56 417.92 350.08 485.76 25.6 4.48 35.2-10.88 35.2-24.32 0-12.16-.64-52.48-.64-95.36-128.64 23.68-161.92-31.36-172.16-60.16-5.76-14.72-30.72-60.16-52.48-72.32-17.92-9.6-43.52-33.28-.64-33.92 40.32-.64 69.12 37.12 78.72 52.48 46.08 77.44 119.68 55.68 149.12 42.24 4.48-33.28 17.92-55.68 32.64-68.48-113.92-12.8-232.96-56.96-232.96-252.8 0-55.68 19.84-101.76 52.48-137.6-5.12-12.8-23.04-65.28 5.12-135.68 0 0 42.88-13.44 140.8 52.48 40.96-11.52 84.48-17.28 128-17.28s87.04 5.76 128 17.28c97.92-66.56 140.8-52.48 140.8-52.48 28.16 70.4 10.24 122.88 5.12 135.68 32.64 35.84 52.48 81.28 52.48 137.6 0 196.48-119.68 240-233.6 252.8 18.56 16 34.56 46.72 34.56 94.72 0 68.48-.64 123.52-.64 140.8 0 13.44 9.6 29.44 35.2 24.32C877.44 929.92 1024 737.92 1024 512 1024 229.12 794.88 0 512 0`,clipRule:`evenodd`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,q.jsx)(`svg`,{...e,viewBox:`0 0 1024 1024`,fill:`none`,children:n}),t[1]=e,t[2]=r),r};function al(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ol(e){if(Array.isArray(e))return e}function sl(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function cl(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
93
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ll(e,t){return ol(e)||sl(e,t)||ul(e,t)||cl()}function ul(e,t){if(e){if(typeof e==`string`)return al(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?al(e,t):void 0}}var dl=Object.entries,fl=Object.setPrototypeOf,pl=Object.isFrozen,ml=Object.getPrototypeOf,hl=Object.getOwnPropertyDescriptor,gl=Object.freeze,_l=Object.seal,vl=Object.create,yl=typeof Reflect<`u`&&Reflect,bl=yl.apply,xl=yl.construct;gl||=function(e){return e},_l||=function(e){return e},bl||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},xl||=function(e){return new e(...[...arguments].slice(1))};var Sl=Y(Array.prototype.forEach),Cl=Y(Array.prototype.lastIndexOf),wl=Y(Array.prototype.pop),Tl=Y(Array.prototype.push),El=Y(Array.prototype.splice),Dl=Array.isArray,Ol=Y(String.prototype.toLowerCase),kl=Y(String.prototype.toString),Al=Y(String.prototype.match),jl=Y(String.prototype.replace),Ml=Y(String.prototype.indexOf),Nl=Y(String.prototype.trim),Pl=Y(Number.prototype.toString),Fl=Y(Boolean.prototype.toString),Il=typeof BigInt>`u`?null:Y(BigInt.prototype.toString),Ll=typeof Symbol>`u`?null:Y(Symbol.prototype.toString),Rl=Y(Object.prototype.hasOwnProperty),zl=Y(Object.prototype.toString),Bl=Y(RegExp.prototype.test),Vl=Hl(TypeError);function Y(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return bl(e,t,n)}}function Hl(e){return function(){return xl(e,[...arguments])}}function X(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ol;if(fl&&fl(e,null),!Dl(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(pl(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Ul(e){for(let t=0;t<e.length;t++)Rl(e,t)||(e[t]=null);return e}function Wl(e){let t=vl(null);for(let r of dl(e)){var n=ll(r,2);let i=n[0],a=n[1];Rl(e,i)&&(Dl(a)?t[i]=Ul(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=Wl(a):t[i]=a)}return t}function Gl(e){switch(typeof e){case`string`:return e;case`number`:return Pl(e);case`boolean`:return Fl(e);case`bigint`:return Il?Il(e):`0`;case`symbol`:return Ll?Ll(e):`Symbol()`;case`undefined`:return zl(e);case`function`:case`object`:{if(e===null)return zl(e);let t=e,n=Kl(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:zl(e)}return zl(e)}default:return zl(e)}}function Kl(e,t){for(;e!==null;){let n=hl(e,t);if(n){if(n.get)return Y(n.get);if(typeof n.value==`function`)return Y(n.value)}e=ml(e)}function n(){return null}return n}function ql(e){try{return Bl(e,``),!0}catch{return!1}}var Jl=gl(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Yl=gl(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Xl=gl([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Zl=gl([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Ql=gl(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),$l=gl([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),eu=gl([`#text`]),tu=gl(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),nu=gl(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),ru=gl(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),iu=gl([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),au=_l(/{{[\w\W]*|^[\w\W]*}}/g),ou=_l(/<%[\w\W]*|^[\w\W]*%>/g),su=_l(/\${[\w\W]*/g),cu=_l(/^data-[\-\w.\u00B7-\uFFFF]+$/),lu=_l(/^aria-[\-\w]+$/),uu=_l(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),du=_l(/^(?:\w+script|data):/i),fu=_l(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),pu=_l(/^html$/i),mu=_l(/^[a-z][.\w]*(-[.\w]+)+$/i),hu=_l(/<[/\w!]/g),gu=_l(/<[/\w]/g),_u=_l(/<\/no(script|embed|frames)/i),vu=_l(/\/>/i),yu={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},bu=function(){return typeof window>`u`?null:window},xu=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Su=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Cu=function(e,t,n,r){return Rl(e,t)&&Dl(e[t])?X(r.base?Wl(r.base):{},e[t],r.transform):n};function wu(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:bu(),t=e=>wu(e);if(t.version=`3.4.11`,t.removed=[],!e||!e.document||e.document.nodeType!==yu.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Kl(d,`cloneNode`),p=Kl(d,`remove`),m=Kl(d,`nextSibling`),h=Kl(d,`childNodes`),g=Kl(d,`parentNode`),_=Kl(d,`shadowRoot`),v=Kl(d,`attributes`),y=o&&o.prototype?Kl(o.prototype,`nodeType`):null,b=o&&o.prototype?Kl(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S=``,C,w=!1,T=0,E=function(){if(T>0)throw Vl(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},D=function(e){E(),T++;try{return x.createHTML(e)}finally{T--}},O=function(e){E(),T++;try{return x.createScriptURL(e)}finally{T--}},ee=function(){return w||=(C=xu(u,i),!0),C},k=n,A=k.implementation,j=k.createNodeIterator,te=k.createDocumentFragment,ne=k.getElementsByTagName,M=r.importNode,N=Su();t.isSupported=typeof dl==`function`&&typeof g==`function`&&A&&A.createHTMLDocument!==void 0;let P=au,re=ou,ie=su,ae=cu,oe=lu,se=du,ce=fu,le=mu,ue=uu,F=null,de=X({},[...Jl,...Yl,...Xl,...Ql,...eu]),I=null,fe=X({},[...tu,...nu,...ru,...iu]),L=Object.seal(vl(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),pe=null,me=null,he=Object.seal(vl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ge=!0,_e=!0,ve=!1,ye=!0,be=!1,xe=!0,Se=!1,Ce=!1,we=null,Te=null,Ee=!1,De=!1,Oe=!1,ke=!1,Ae=!0,je=!1,Me=`user-content-`,Ne=!0,Pe=!1,Fe={},Ie=null,Le=X({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Re=null,ze=X({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Be=null,Ve=X({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),He=`http://www.w3.org/1998/Math/MathML`,Ue=`http://www.w3.org/2000/svg`,We=`http://www.w3.org/1999/xhtml`,Ge=We,Ke=!1,qe=null,Je=X({},[He,Ue,We],kl),Ye=gl([`mi`,`mo`,`mn`,`ms`,`mtext`]),Xe=X({},Ye),Ze=gl([`annotation-xml`]),Qe=X({},Ze),$e=X({},[`title`,`style`,`font`,`a`,`script`]),et=null,tt=[`application/xhtml+xml`,`text/html`],R=null,nt=null,rt=n.createElement(`form`),it=function(e){return e instanceof RegExp||e instanceof Function},z=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(nt&&nt===e)return;(!e||typeof e!=`object`)&&(e={}),e=Wl(e),et=tt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,R=et===`application/xhtml+xml`?kl:Ol,F=Cu(e,`ALLOWED_TAGS`,de,{transform:R}),I=Cu(e,`ALLOWED_ATTR`,fe,{transform:R}),qe=Cu(e,`ALLOWED_NAMESPACES`,Je,{transform:kl}),Be=Cu(e,`ADD_URI_SAFE_ATTR`,Ve,{transform:R,base:Ve}),Re=Cu(e,`ADD_DATA_URI_TAGS`,ze,{transform:R,base:ze}),Ie=Cu(e,`FORBID_CONTENTS`,Le,{transform:R}),pe=Cu(e,`FORBID_TAGS`,Wl({}),{transform:R}),me=Cu(e,`FORBID_ATTR`,Wl({}),{transform:R}),Fe=Rl(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Wl(e.USE_PROFILES):e.USE_PROFILES:!1,ge=e.ALLOW_ARIA_ATTR!==!1,_e=e.ALLOW_DATA_ATTR!==!1,ve=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ye=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,be=e.SAFE_FOR_TEMPLATES||!1,xe=e.SAFE_FOR_XML!==!1,Se=e.WHOLE_DOCUMENT||!1,De=e.RETURN_DOM||!1,Oe=e.RETURN_DOM_FRAGMENT||!1,ke=e.RETURN_TRUSTED_TYPE||!1,Ee=e.FORCE_BODY||!1,Ae=e.SANITIZE_DOM!==!1,je=e.SANITIZE_NAMED_PROPS||!1,Ne=e.KEEP_CONTENT!==!1,Pe=e.IN_PLACE||!1,ue=ql(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:uu,Ge=typeof e.NAMESPACE==`string`?e.NAMESPACE:We,Xe=Rl(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?Wl(e.MATHML_TEXT_INTEGRATION_POINTS):X({},Ye),Qe=Rl(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?Wl(e.HTML_INTEGRATION_POINTS):X({},Ze);let t=Rl(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?Wl(e.CUSTOM_ELEMENT_HANDLING):vl(null);if(L=vl(null),Rl(t,`tagNameCheck`)&&it(t.tagNameCheck)&&(L.tagNameCheck=t.tagNameCheck),Rl(t,`attributeNameCheck`)&&it(t.attributeNameCheck)&&(L.attributeNameCheck=t.attributeNameCheck),Rl(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(L.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),_l(L),be&&(_e=!1),Oe&&(De=!0),Fe&&(F=X({},eu),I=vl(null),Fe.html===!0&&(X(F,Jl),X(I,tu)),Fe.svg===!0&&(X(F,Yl),X(I,nu),X(I,iu)),Fe.svgFilters===!0&&(X(F,Xl),X(I,nu),X(I,iu)),Fe.mathMl===!0&&(X(F,Ql),X(I,ru),X(I,iu))),he.tagCheck=null,he.attributeCheck=null,Rl(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?he.tagCheck=e.ADD_TAGS:Dl(e.ADD_TAGS)&&(F===de&&(F=Wl(F)),X(F,e.ADD_TAGS,R))),Rl(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?he.attributeCheck=e.ADD_ATTR:Dl(e.ADD_ATTR)&&(I===fe&&(I=Wl(I)),X(I,e.ADD_ATTR,R))),Rl(e,`ADD_URI_SAFE_ATTR`)&&Dl(e.ADD_URI_SAFE_ATTR)&&X(Be,e.ADD_URI_SAFE_ATTR,R),Rl(e,`FORBID_CONTENTS`)&&Dl(e.FORBID_CONTENTS)&&(Ie===Le&&(Ie=Wl(Ie)),X(Ie,e.FORBID_CONTENTS,R)),Rl(e,`ADD_FORBID_CONTENTS`)&&Dl(e.ADD_FORBID_CONTENTS)&&(Ie===Le&&(Ie=Wl(Ie)),X(Ie,e.ADD_FORBID_CONTENTS,R)),Ne&&(F[`#text`]=!0),Se&&X(F,[`html`,`head`,`body`]),F.table&&(X(F,[`tbody`]),delete pe.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Vl(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Vl(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=x;x=e.TRUSTED_TYPES_POLICY;try{S=D(``)}catch(e){throw x=t,e}}else e.TRUSTED_TYPES_POLICY===null?(x=void 0,S=``):(x===void 0&&(x=ee()),x&&typeof S==`string`&&(S=D(``)));gl&&gl(e),nt=e},at=X({},[...Yl,...Xl,...Zl]),ot=X({},[...Ql,...$l]),st=function(e,t,n){return t.namespaceURI===We?e===`svg`:t.namespaceURI===He?e===`svg`&&(n===`annotation-xml`||Xe[n]):!!at[e]},ct=function(e,t,n){return t.namespaceURI===We?e===`math`:t.namespaceURI===Ue?e===`math`&&Qe[n]:!!ot[e]},lt=function(e,t,n){return t.namespaceURI===Ue&&!Qe[n]||t.namespaceURI===He&&!Xe[n]?!1:!ot[e]&&($e[e]||!at[e])},B=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Ge,tagName:`template`});let n=Ol(e.tagName),r=Ol(t.tagName);return qe[e.namespaceURI]?e.namespaceURI===Ue?st(n,t,r):e.namespaceURI===He?ct(n,t,r):e.namespaceURI===We?lt(n,t,r):!!(et===`application/xhtml+xml`&&qe[e.namespaceURI]):!1},ut=function(e){Tl(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw Vl(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},dt=function(e){let t=h(e);if(t){let e=[];Sl(t,t=>{Tl(e,t)}),Sl(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},V=function(e,n){try{Tl(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{Tl(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(De||Oe)try{ut(n)}catch{}else try{n.setAttribute(e,``)}catch{}},H=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||I[R(i)]))try{e.removeAttribute(i)}catch{}}},ft=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===yu.element&&H(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},pt=function(e){let t=null,r=null;if(Ee)e=`<remove></remove>`+e;else{let t=Al(e,/^[\r\n\t ]+/);r=t&&t[0]}et===`application/xhtml+xml`&&Ge===We&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?D(e):e;if(Ge===We)try{t=new l().parseFromString(i,et)}catch{}if(!t||!t.documentElement){t=A.createDocument(Ge,`template`,null);try{t.documentElement.innerHTML=Ke?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ge===We?ne.call(t,Se?`html`:`body`)[0]:Se?t.documentElement:a},mt=function(e){return j.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ht=function(e){return e=jl(e,P,` `),e=jl(e,re,` `),e=jl(e,ie,` `),e},gt=function(e){e.normalize();let t=j.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=ht(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&Sl(r,e=>{vt(e.content)&&gt(e.content)})},_t=function(e){let t=b?b(e):null;return typeof t!=`string`||R(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},vt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===yu.documentFragment}catch{return!1}},yt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function bt(e,n,r){e.length!==0&&Sl(e,e=>{e.call(t,n,r,nt)})}let xt=function(e,t){return!!(xe&&e.hasChildNodes()&&!yt(e.firstElementChild)&&Bl(hu,e.textContent)&&Bl(hu,e.innerHTML)||xe&&e.namespaceURI===We&&t===`style`&&yt(e.firstElementChild)||e.nodeType===yu.processingInstruction||xe&&e.nodeType===yu.comment&&Bl(gu,e.data))},St=function(e,t){if(!pe[t]&&Et(t)&&(L.tagNameCheck instanceof RegExp&&Bl(L.tagNameCheck,t)||L.tagNameCheck instanceof Function&&L.tagNameCheck(t)))return!1;if(Ne&&!Ie[t]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=Pe?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return ut(e),!0},Ct=function(e){if(bt(N.beforeSanitizeElements,e,null),_t(e))return ut(e),!0;let n=R(b?b(e):e.nodeName);if(bt(N.uponSanitizeElement,e,{tagName:n,allowedTags:F}),xt(e,n))return ut(e),!0;if(pe[n]||!(he.tagCheck instanceof Function&&he.tagCheck(n))&&!F[n])return St(e,n);if((y?y(e):e.nodeType)===yu.element&&!B(e)||(n===`noscript`||n===`noembed`||n===`noframes`)&&Bl(_u,e.innerHTML))return ut(e),!0;if(be&&e.nodeType===yu.text){let n=ht(e.textContent);e.textContent!==n&&(Tl(t.removed,{element:e.cloneNode()}),e.textContent=n)}return bt(N.afterSanitizeElements,e,null),!1},wt=function(e,t,r){if(me[t]||Ae&&(t===`id`||t===`name`)&&(r in n||r in rt))return!1;let i=I[t]||he.attributeCheck instanceof Function&&he.attributeCheck(t,e);if(!(_e&&Bl(ae,t))&&!(ge&&Bl(oe,t))){if(!i){if(!(Et(e)&&(L.tagNameCheck instanceof RegExp&&Bl(L.tagNameCheck,e)||L.tagNameCheck instanceof Function&&L.tagNameCheck(e))&&(L.attributeNameCheck instanceof RegExp&&Bl(L.attributeNameCheck,t)||L.attributeNameCheck instanceof Function&&L.attributeNameCheck(t,e))||t===`is`&&L.allowCustomizedBuiltInElements&&(L.tagNameCheck instanceof RegExp&&Bl(L.tagNameCheck,r)||L.tagNameCheck instanceof Function&&L.tagNameCheck(r))))return!1}else if(!Be[t]&&!Bl(ue,jl(r,ce,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Ml(r,`data:`)===0&&Re[e])&&!(ve&&!Bl(se,jl(r,ce,``)))&&r)return!1}return!0},Tt=X({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Et=function(e){return!Tt[Ol(e)]&&Bl(le,e)},Dt=function(e,t,n,r){if(x&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return D(r);case`TrustedScriptURL`:return O(r)}return r},Ot=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),_t(e)?ut(e):wl(t.removed)}catch{V(n,e)}},kt=function(e){bt(N.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||_t(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:I,forceKeepAttr:void 0},r=t.length,i=R(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=R(o),u=c,d=o===`value`?u:Nl(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,bt(N.uponSanitizeAttribute,e,n),d=n.attrValue,je&&(l===`id`||l===`name`)&&Ml(d,Me)!==0&&(V(o,e),d=Me+d),xe&&Bl(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){V(o,e);continue}if(l===`attributename`&&Al(d,`href`)){V(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){V(o,e);continue}if(!ye&&Bl(vu,d)){V(o,e);continue}if(be&&(d=ht(d)),!wt(i,l,d)){V(o,e);continue}d=Dt(i,l,s,d),d!==u&&Ot(e,o,s,d)}}bt(N.afterSanitizeAttributes,e,null)},At=function(e){let t=null,n=mt(e);for(bt(N.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(bt(N.uponSanitizeShadowNode,t,null),Ct(t),kt(t),vt(t.content)&&At(t.content),(y?y(t):t.nodeType)===yu.element){let e=_(t);vt(e)&&(jt(e),At(e))}bt(N.afterSanitizeShadowDOM,e,null)},jt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){At(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===yu.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&R(e)===`template`){let e=n.content;vt(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);vt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Ke=!e,Ke&&(e=`<!-->`),typeof e!=`string`&&!yt(e)&&(e=Gl(e),typeof e!=`string`))throw Vl(`dirty is not a string, aborting`);if(!t.isSupported)return e;Ce?(F=we,I=Te):z(n),(N.uponSanitizeElement.length>0||N.uponSanitizeAttribute.length>0)&&(F=Wl(F)),N.uponSanitizeAttribute.length>0&&(I=Wl(I)),t.removed=[];let c=Pe&&typeof e!=`string`&&yt(e);if(c){let t=b?b(e):e.nodeName;if(typeof t==`string`){let e=R(t);if(!F[e]||pe[e])throw Vl(`root node is forbidden and cannot be sanitized in-place`)}if(_t(e))throw Vl(`root node is clobbered and cannot be sanitized in-place`);try{jt(e)}catch(t){throw dt(e),t}}else if(yt(e))i=pt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===yu.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),jt(a);else{if(!De&&!be&&!Se&&e.indexOf(`<`)===-1)return x&&ke?D(e):e;if(i=pt(e),!i)return De?null:ke?S:``}i&&Ee&&ut(i.firstChild);let l=mt(c?e:i);try{for(;o=l.nextNode();)Ct(o),kt(o),vt(o.content)&&At(o.content)}catch(t){throw c&&dt(e),t}if(c)return Sl(t.removed,e=>{e.element&&ft(e.element)}),be&&gt(e),e;if(De){if(be&&gt(i),Oe)for(s=te.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(I.shadowroot||I.shadowrootmode)&&(s=M.call(r,s,!0)),s}let u=Se?i.outerHTML:i.innerHTML;return Se&&F[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Bl(pu,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
94
+ `+u),be&&(u=ht(u)),x&&ke?D(u):u},t.setConfig=function(){z(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Ce=!0,we=F,Te=I},t.clearConfig=function(){nt=null,Ce=!1,we=null,Te=null,x=C,S=``},t.isValidAttribute=function(e,t,n){return nt||z({}),wt(R(e),R(t),n)},t.addHook=function(e,t){typeof t==`function`&&Rl(N,e)&&Tl(N[e],t)},t.removeHook=function(e,t){if(Rl(N,e)){if(t!==void 0){let n=Cl(N[e],t);return n===-1?void 0:El(N[e],n,1)[0]}return wl(N[e])}},t.removeHooks=function(e){Rl(N,e)&&(N[e]=[])},t.removeAllHooks=function(){N=Su()},t}var Tu=wu();function Eu(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Du=Eu();function Ou(e){Du=e}var ku={exec:()=>null};function Au(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function Z(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(Mu.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var ju=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),Mu={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Au(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Au(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Au(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Au(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Au(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:Au(e=>RegExp(`^ {0,${e}}>`))},Nu=/^(?:[ \t]*(?:\n|$))+/,Pu=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Fu=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Iu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Lu=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ru=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,zu=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Bu=Z(zu).replace(/bull/g,Ru).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Vu=Z(zu).replace(/bull/g,Ru).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Hu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Uu=/^[^\n]+/,Wu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Gu=Z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Wu).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ku=Z(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ru).getRegex(),qu=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Ju=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Yu=Z(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Ju).replace(`tag`,qu).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Xu=Z(Hu).replace(`hr`,Iu).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,qu).getRegex(),Zu={blockquote:Z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Xu).getRegex(),code:Pu,def:Gu,fences:Fu,heading:Lu,hr:Iu,html:Yu,lheading:Bu,list:Ku,newline:Nu,paragraph:Xu,table:ku,text:Uu},Qu=Z(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Iu).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,qu).getRegex(),$u={...Zu,lheading:Vu,table:Qu,paragraph:Z(Hu).replace(`hr`,Iu).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Qu).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,qu).getRegex()},ed={...Zu,html:Z(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Ju).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ku,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Z(Hu).replace(`hr`,Iu).replace(`heading`,` *#{1,6} *[^
95
+ ]`).replace(`lheading`,Bu).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},td=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,nd=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,rd=/^( {2,}|\\)\n(?!\s*$)/,id=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ad=/[\p{P}\p{S}]/u,od=/[\s\p{P}\p{S}]/u,sd=/[^\s\p{P}\p{S}]/u,cd=Z(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,od).getRegex(),ld=/(?!~)[\p{P}\p{S}]/u,ud=/(?!~)[\s\p{P}\p{S}]/u,dd=/(?:[^\s\p{P}\p{S}]|~)/u,fd=Z(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,ju?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),pd=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,md=Z(pd,`u`).replace(/punct/g,ad).getRegex(),hd=Z(pd,`u`).replace(/punct/g,ld).getRegex(),gd=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,_d=Z(gd,`gu`).replace(/notPunctSpace/g,sd).replace(/punctSpace/g,od).replace(/punct/g,ad).getRegex(),vd=Z(gd,`gu`).replace(/notPunctSpace/g,dd).replace(/punctSpace/g,ud).replace(/punct/g,ld).getRegex(),yd=Z(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,sd).replace(/punctSpace/g,od).replace(/punct/g,ad).getRegex(),bd=Z(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,ad).getRegex(),xd=Z(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,sd).replace(/punctSpace/g,od).replace(/punct/g,ad).getRegex(),Sd=Z(/\\(punct)/,`gu`).replace(/punct/g,ad).getRegex(),Cd=Z(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),wd=Z(Ju).replace(`(?:-->|$)`,`-->`).getRegex(),Td=Z(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,wd).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ed=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Dd=Z(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Ed).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Od=Z(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Ed).replace(`ref`,Wu).getRegex(),kd=Z(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Wu).getRegex(),Ad=Z(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Od).replace(`nolink`,kd).getRegex(),jd=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Md={_backpedal:ku,anyPunctuation:Sd,autolink:Cd,blockSkip:fd,br:rd,code:nd,del:ku,delLDelim:ku,delRDelim:ku,emStrongLDelim:md,emStrongRDelimAst:_d,emStrongRDelimUnd:yd,escape:td,link:Dd,nolink:kd,punctuation:cd,reflink:Od,reflinkSearch:Ad,tag:Td,text:id,url:ku},Nd={...Md,link:Z(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Ed).getRegex(),reflink:Z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Ed).getRegex()},Pd={...Md,emStrongRDelimAst:vd,emStrongLDelim:hd,delLDelim:bd,delRDelim:xd,url:Z(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,jd).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Z(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,jd).getRegex()},Fd={...Pd,br:Z(rd).replace(`{2,}`,`*`).getRegex(),text:Z(Pd.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Id={normal:Zu,gfm:$u,pedantic:ed},Ld={normal:Md,gfm:Pd,breaks:Fd,pedantic:Nd},Rd={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},zd=e=>Rd[e];function Bd(e,t){if(t){if(Mu.escapeTest.test(e))return e.replace(Mu.escapeReplace,zd)}else if(Mu.escapeTestNoEncode.test(e))return e.replace(Mu.escapeReplaceNoEncode,zd);return e}function Vd(e){try{e=encodeURI(e).replace(Mu.percentDecode,`%`)}catch{return null}return e}function Hd(e,t){let n=e.replace(Mu.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Mu.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(Mu.slashPipe,`|`);return n}function Ud(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Wd(e){let t=e.split(`
96
+ `),n=t.length-1;for(;n>=0&&Mu.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
97
+ `)}function Gd(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Kd(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function qd(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Jd(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
96
98
  `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
97
- `)}var _u=class{options;rules;lexer;constructor(e){this.options=e||Xc}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:fu(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=gu(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=du(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:du(t[0],`
98
- `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:du(t[0],`
99
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=du(t[0],`
99
+ `)}var Yd=class{options;rules;lexer;constructor(e){this.options=e||Du}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:Wd(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Jd(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Ud(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Ud(t[0],`
100
+ `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Ud(t[0],`
101
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Ud(t[0],`
100
102
  `).split(`
101
103
  `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
102
104
  `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
@@ -107,20 +109,20 @@ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
107
109
  `),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
108
110
  `+e.join(`
109
111
  `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
110
- `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=mu(t[2].split(`
112
+ `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=Kd(t[2].split(`
111
113
  `,1)[0],t[1].length),l=e.split(`
112
114
  `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
113
115
  `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
114
116
  `,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
115
117
  `+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
116
118
  `+l}u=!l.trim(),r+=p+`
117
- `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1;if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=fu(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:du(t[0],`
118
- `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=uu(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
119
- `):[],a={type:`table`,raw:du(t[0],`
120
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(uu(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:du(t[0],`
119
+ `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1;if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=Wd(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:Ud(t[0],`
120
+ `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Hd(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
121
+ `):[],a={type:`table`,raw:Ud(t[0],`
122
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Hd(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:Ud(t[0],`
121
123
  `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
122
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=du(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=pu(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),hu(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return hu(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},vu=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Xc,this.options.tokenizer=this.options.tokenizer||new _u,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Z,block:iu.normal,inline:au.normal};this.options.pedantic?(t.block=iu.pedantic,t.inline=au.pedantic):this.options.gfm&&(t.block=iu.gfm,this.options.breaks?t.inline=au.breaks:t.inline=au.gfm),this.tokenizer.rules=t}static get rules(){return{block:iu,inline:au}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(Z.carriageReturn,`
123
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Z.tabCharGlobal,` `).replace(Z.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
124
+ `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Ud(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Gd(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),qd(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return qd(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},Xd=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Du,this.options.tokenizer=this.options.tokenizer||new Yd,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Mu,block:Id.normal,inline:Ld.normal};this.options.pedantic?(t.block=Id.pedantic,t.inline=Ld.pedantic):this.options.gfm&&(t.block=Id.gfm,this.options.breaks?t.inline=Ld.breaks:t.inline=Ld.gfm),this.tokenizer.rules=t}static get rules(){return{block:Id,inline:Ld}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(Mu.carriageReturn,`
125
+ `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Mu.tabCharGlobal,` `).replace(Mu.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
124
126
  `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
125
127
  `)?``:`
126
128
  `)+i.raw,n.text+=`
@@ -133,9 +135,9 @@ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
133
135
  `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
134
136
  `)?``:`
135
137
  `)+i.raw,n.text+=`
136
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``,s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},yu=class{options;parser;constructor(e){this.options=e||Xc}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Z.notSpaceStart)?.[0],i=e.replace(Z.endingNewline,``)+`
137
- `;return r?`<pre><code class="language-`+cu(r)+`">`+(n?i:cu(i,!0))+`</code></pre>
138
- `:`<pre><code>`+(n?i:cu(i,!0))+`</code></pre>
138
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``,s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},Zd=class{options;parser;constructor(e){this.options=e||Du}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Mu.notSpaceStart)?.[0],i=e.replace(Mu.endingNewline,``)+`
139
+ `;return r?`<pre><code class="language-`+Bd(r)+`">`+(n?i:Bd(i,!0))+`</code></pre>
140
+ `:`<pre><code>`+(n?i:Bd(i,!0))+`</code></pre>
139
141
  `}blockquote({tokens:e}){return`<blockquote>
140
142
  ${this.parser.parse(e)}</blockquote>
141
143
  `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
@@ -151,15 +153,15 @@ ${this.parser.parse(e)}</blockquote>
151
153
  `}tablerow({text:e}){return`<tr>
152
154
  ${e}</tr>
153
155
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
154
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${cu(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=lu(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+cu(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=lu(e);if(i===null)return cu(n);e=i;let a=`<img src="${e}" alt="${cu(n)}"`;return t&&(a+=` title="${cu(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:cu(e.text)}},bu=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},xu=class e{options;renderer;textRenderer;constructor(e){this.options=e||Xc,this.options.renderer=this.options.renderer||new yu,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new bu}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Su=class{options;block;constructor(e){this.options=e||Xc}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?vu.lex:vu.lexInline}provideParser(e=this.block){return e?xu.parse:xu.parseInline}},Cu=class{defaults=Yc();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=xu;Renderer=yu;TextRenderer=bu;Lexer=vu;Tokenizer=_u;Hooks=Su;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new yu(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new _u(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Su;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];Su.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Su.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return vu.lex(e,t??this.defaults)}parser(e,t){return xu.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?vu.lex:vu.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?xu.parse:xu.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?vu.lex:vu.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?xu.parse:xu.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
155
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+cu(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},wu=new Cu;function Q(e,t){return wu.parse(e,t)}Q.options=Q.setOptions=function(e){return wu.setOptions(e),Q.defaults=wu.defaults,Zc(Q.defaults),Q},Q.getDefaults=Yc,Q.defaults=Xc,Q.use=function(...e){return wu.use(...e),Q.defaults=wu.defaults,Zc(Q.defaults),Q},Q.walkTokens=function(e,t){return wu.walkTokens(e,t)},Q.parseInline=wu.parseInline,Q.Parser=xu,Q.parser=xu.parse,Q.Renderer=yu,Q.TextRenderer=bu,Q.Lexer=vu,Q.lexer=vu.lex,Q.Tokenizer=_u,Q.Hooks=Su,Q.parse=Q,Q.options,Q.setOptions,Q.use,Q.walkTokens,Q.parseInline,xu.parse,vu.lex;function Tu(e){let t=(0,qc.c)(10),n;t[0]!==e.children||t[1]!==e.lang?(n=Se(e.children,e.lang),t[0]=e.children,t[1]=e.lang,t[2]=n):n=t[2];let r;t[3]===n?r=t[4]:(r={__html:n},t[3]=n,t[4]=r);let i;t[5]===e.className?i=t[6]:(i=F(`bg-muted/30 overflow-hidden select-text [&_*]:select-text`,e.className),t[5]=e.className,t[6]=i);let a;return t[7]!==r||t[8]!==i?(a=(0,J.jsx)(`div`,{"data-code-block":!0,dangerouslySetInnerHTML:r,className:i}),t[7]=r,t[8]=i,t[9]=a):a=t[9],a}function Eu(e){let t=e?.constructor;return e===(typeof t==`function`?t.prototype:Object.prototype)}function Du(e){if(e==null)return!0;if(It(e))return typeof e.splice!=`function`&&typeof e!=`string`&&!At(e)&&!Lt(e)&&!Rt(e)?!1:e.length===0;if(typeof e==`object`){if(e instanceof Map||e instanceof Set)return e.size===0;let t=Object.keys(e);return Eu(e)?t.filter(e=>e!==`constructor`).length===0:t.length===0}return!0}var Ou=`comm`,ku=`rule`,Au=`decl`,ju=`@import`,Mu=`@namespace`,Nu=`@keyframes`,Pu=`@layer`,Fu=Math.abs,Iu=String.fromCharCode;function Lu(e){return e.trim()}function Ru(e,t,n){return e.replace(t,n)}function zu(e,t){return e.charCodeAt(t)|0}function Bu(e,t,n){return e.slice(t,n)}function Vu(e){return e.length}function Hu(e){return e.length}function Uu(e,t){return t.push(e),e}var Wu=1,Gu=1,Ku=0,qu=0,$=0,Ju=``;function Yu(e,t,n,r,i,a,o,s){return{value:e,root:t,parent:n,type:r,props:i,children:a,line:Wu,column:Gu,length:o,return:``,siblings:s}}function Xu(){return $}function Zu(){return $=qu>0?zu(Ju,--qu):0,Gu--,$===10&&(Gu=1,Wu--),$}function Qu(){return $=qu<Ku?zu(Ju,qu++):0,Gu++,$===10&&(Gu=1,Wu++),$}function $u(){return zu(Ju,qu)}function ed(){return qu}function td(e,t){return Bu(Ju,e,t)}function nd(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function rd(e){return Wu=Gu=1,Ku=Vu(Ju=e),qu=0,[]}function id(e){return Ju=``,e}function ad(e){return Lu(td(qu-1,cd(e===91?e+2:e===40?e+1:e)))}function od(e){for(;($=$u())&&$<33;)Qu();return nd(e)>2||nd($)>3?``:` `}function sd(e,t){for(;--t&&Qu()&&!($<48||$>102||$>57&&$<65||$>70&&$<97););return td(e,ed()+(t<6&&$u()==32&&Qu()==32))}function cd(e){for(;Qu();)switch($){case e:return qu;case 34:case 39:e!==34&&e!==39&&cd($);break;case 40:e===41&&cd(e);break;case 92:Qu();break}return qu}function ld(e,t){for(;Qu()&&e+$!==57&&!(e+$===84&&$u()===47););return`/*`+td(t,qu-1)+`*`+Iu(e===47?e:Qu())}function ud(e){for(;!nd($u());)Qu();return td(e,qu)}function dd(e){return id(fd(``,null,null,null,[``],e=rd(e),0,[0],e))}function fd(e,t,n,r,i,a,o,s,c){for(var l=0,u=0,d=o,f=0,p=0,m=0,h=1,g=1,_=1,v=0,y=0,b=``,x=i,S=a,C=r,w=b;g;)switch(m=y,y=Qu()){case 40:m!=108&&zu(w,d-1)==58?(v++,w+=`(`):w+=ad(y);break;case 41:v--,w+=`)`;break;case 34:case 39:case 91:w+=ad(y);break;case 9:case 10:case 13:case 32:if(v>0){w+=Iu(y);break}w+=od(m);break;case 92:w+=sd(ed()-1,7);continue;case 47:switch($u()){case 42:case 47:Uu(md(ld(Qu(),ed()),t,n,c),c),(nd(m||1)==5||nd($u()||1)==5)&&Vu(w)&&Bu(w,-1,void 0)!==` `&&(w+=` `);break;default:w+=`/`}break;case 123*h:s[l++]=Vu(w)*_;case 125*h:case 59:case 0:if(v>0&&y){w+=Iu(y);break}switch(y){case 0:case 125:g=0;case 59+u:_==-1&&(w=Ru(w,/\f/g,``)),p>0&&(Vu(w)-d||h===0)&&Uu(p>32?hd(w+`;`,r,n,d-1,c):hd(Ru(w,` `,``)+`;`,r,n,d-2,c),c);break;case 59:w+=`;`;default:if(Uu(C=pd(w,t,n,l,u,i,s,b,x=[],S=[],d,a),a),y===123)if(u===0)fd(w,t,C,C,x,a,d,s,S);else{switch(f){case 99:if(zu(w,3)===110)break;case 108:if(zu(w,2)===97)break;default:u=0;case 100:case 109:case 115:}u?fd(e,C,C,r&&Uu(pd(e,C,C,0,0,i,s,b,i,x=[],d,S),S),i,S,d,s,r?x:S):fd(w,C,C,C,[``],S,0,s,S)}}l=u=p=0,h=_=1,b=w=``,d=o;break;case 58:d=1+Vu(w),p=m;default:if(h<1){if(y==123)--h;else if(y==125&&h++==0&&Zu()==125)continue}switch(w+=Iu(y),y*h){case 38:_=u>0?1:(w+=`\f`,-1);break;case 44:if(v>0)break;s[l++]=(Vu(w)-1)*_,_=1;break;case 64:$u()===45&&(w+=ad(Qu())),f=$u(),u=d=Vu(b=w+=ud(ed())),y++;break;case 45:m===45&&Vu(w)==2&&(h=0)}}return a}function pd(e,t,n,r,i,a,o,s,c,l,u,d){for(var f=i-1,p=i===0?a:[``],m=Hu(p),h=0,g=0,_=0;h<r;++h)for(var v=0,y=Bu(e,f+1,f=Fu(g=o[h])),b=e;v<m;++v)(b=Lu(g>0?p[v]+` `+y:Ru(y,/&\f/g,p[v])))&&(c[_++]=b);return Yu(e,t,n,i===0?ku:s,c,l,u,d)}function md(e,t,n,r){return Yu(e,t,n,Ou,Iu(Xu()),Bu(e,2,-2),0,r)}function hd(e,t,n,r,i){return Yu(e,t,n,Au,Bu(e,0,r),Bu(e,r+1,-1),r,i)}function gd(e,t){for(var n=``,r=0;r<e.length;r++)n+=t(e[r],r,e,t)||``;return n}function _d(e,t,n,r){switch(e.type){case Pu:if(e.children.length)break;case ju:case Mu:case Au:return e.return=e.return||e.value;case Ou:return``;case Nu:return e.return=e.value+`{`+gd(e.children,r)+`}`;case ku:if(!Vu(e.value=e.props.join(`,`)))return``}return Vu(n=gd(e.children,r))?e.return=e.value+`{`+n+`}`:``}function vd(e){var t=Hu(e);return function(n,r,i,a){for(var o=``,s=0;s<t;s++)o+=e[s](n,r,i,a)||``;return o}}var yd=`c4`,bd={id:yd,detector:H(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./c4Diagram-AAUBKEIU-Ct3OGD9a.js`);return{diagram:e}},__vite__mapDeps([0,1,2,3,4,5,6,7]));return{id:yd,diagram:e}},`loader`)},xd=`flowchart`,Sd={id:xd,detector:H((e,t)=>t?.flowchart?.defaultRenderer===`dagre-wrapper`||t?.flowchart?.defaultRenderer===`elk`?!1:/^\s*graph/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./flowDiagram-I6XJVG4X-C2H7PQev.js`);return{diagram:e}},__vite__mapDeps([8,1,2,3,4,9,6,5,10,11,12,13,14,15,16,17,18,19,20,21,22,7,23,24]));return{id:xd,diagram:e}},`loader`)},Cd=`flowchart-v2`,wd={id:Cd,detector:H((e,t)=>t?.flowchart?.defaultRenderer===`dagre-d3`?!1:(t?.flowchart?.defaultRenderer===`elk`&&(t.layout=`elk`),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer===`dagre-wrapper`?!0:/^\s*flowchart/.test(e)),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./flowDiagram-I6XJVG4X-C2H7PQev.js`);return{diagram:e}},__vite__mapDeps([8,1,2,3,4,9,6,5,10,11,12,13,14,15,16,17,18,19,20,21,22,7,23,24]));return{id:Cd,diagram:e}},`loader`)},Td=`er`,Ed={id:Td,detector:H(e=>/^\s*erDiagram/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./erDiagram-TEJ5UH35-CbzdEpkS.js`);return{diagram:e}},__vite__mapDeps([25,1,2,3,4,9,6,5,11,12,13,14,15,16,17,18,19,20,21,23,24]));return{id:Td,diagram:e}},`loader`)},Dd=`gitGraph`,Od={id:Dd,detector:H(e=>/^\s*gitGraph/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./gitGraphDiagram-PVQCEYII-d2_5HIIo.js`);return{diagram:e}},__vite__mapDeps([26,1,2,3,4,6,5,27,28,29,30,31,32,33,34,35,36,37,38,39,40]));return{id:Dd,diagram:e}},`loader`)},kd=`gantt`,Ad={id:kd,detector:H(e=>/^\s*gantt/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./ganttDiagram-6RSMTGT7-BZql2QFP.js`);return{diagram:e}},__vite__mapDeps([41,2,1,3,4,42,43,44,5,6]));return{id:kd,diagram:e}},`loader`)},jd=`info`,Md={id:jd,detector:H(e=>/^\s*info/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./infoDiagram-5YYISTIA-DaDFMb3D.js`);return{diagram:e}},__vite__mapDeps([45,1,2,3,4,46,28,29,30,31,32,33,34,35,36,37,38,39]));return{id:jd,diagram:e}},`loader`)},Nd=`pie`,Pd={id:Nd,detector:H(e=>/^\s*pie/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./pieDiagram-4H26LBE5-BmpbjVUG.js`);return{diagram:e}},__vite__mapDeps([47,1,2,3,4,48,44,19,5,49,20,6,46,27,28,29,30,31,32,33,34,35,36,37,38,39]));return{id:Nd,diagram:e}},`loader`)},Fd=`quadrantChart`,Id={id:Fd,detector:H(e=>/^\s*quadrantChart/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./quadrantDiagram-W4KKPZXB-BncnX7WL.js`);return{diagram:e}},__vite__mapDeps([50,1,2,3,4,42,43,44]));return{id:Fd,diagram:e}},`loader`)},Ld=`xychart`,Rd={id:Ld,detector:H(e=>/^\s*xychart(-beta)?/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./xychartDiagram-2RQKCTM6-Cgc-2R8L.js`);return{diagram:e}},__vite__mapDeps([51,1,2,3,4,42,43,44,48,6,5,18,19,20,46,14]));return{id:Ld,diagram:e}},`loader`)},zd=`requirement`,Bd={id:zd,detector:H(e=>/^\s*requirement(Diagram)?/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./requirementDiagram-4Y6WPE33-C4viwYDb.js`);return{diagram:e}},__vite__mapDeps([52,1,2,3,4,6,5,11,12,13,14,15,16,17,18,19,20,21,23,24]));return{id:zd,diagram:e}},`loader`)},Vd=`sequence`,Hd={id:Vd,detector:H(e=>/^\s*sequenceDiagram/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./sequenceDiagram-3UESZ5HK-D7Bj1Dg6.js`);return{diagram:e}},__vite__mapDeps([53,1,2,3,4,5,6,10,7,40]));return{id:Vd,diagram:e}},`loader`)},Ud=`class`,Wd={id:Ud,detector:H((e,t)=>t?.class?.defaultRenderer===`dagre-wrapper`?!1:/^\s*classDiagram/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./classDiagram-4FO5ZUOK-BdTSUdNF.js`);return{diagram:e}},__vite__mapDeps([54,1,2,3,4,6,5,11,12,13,14,15,16,17,18,19,20,21,22,7,23,24,55]));return{id:Ud,diagram:e}},`loader`)},Gd=`classDiagram`,Kd={id:Gd,detector:H((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer===`dagre-wrapper`?!0:/^\s*classDiagram-v2/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./classDiagram-v2-Q7XG4LA2-BdTSUdNF.js`);return{diagram:e}},__vite__mapDeps([56,1,2,3,4,6,5,11,12,13,14,15,16,17,18,19,20,21,22,7,23,24,55]));return{id:Gd,diagram:e}},`loader`)},qd=`state`,Jd={id:qd,detector:H((e,t)=>t?.state?.defaultRenderer===`dagre-wrapper`?!1:/^\s*stateDiagram/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./stateDiagram-AJRCARHV-xBL-crbl.js`);return{diagram:e}},__vite__mapDeps([57,1,2,3,4,6,5,18,19,20,11,12,13,14,15,16,17,21,58,59,23,24,60]));return{id:qd,diagram:e}},`loader`)},Yd=`stateDiagram`,Xd={id:Yd,detector:H((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer===`dagre-wrapper`),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./stateDiagram-v2-BHNVJYJU-ZbAyaVmU.js`);return{diagram:e}},__vite__mapDeps([61,1,2,3,4,6,5,11,12,13,14,15,16,17,18,19,20,21,23,24,60]));return{id:Yd,diagram:e}},`loader`)},Zd=`journey`,Qd={id:Zd,detector:H(e=>/^\s*journey/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./journeyDiagram-JHISSGLW-CYDeiigr.js`);return{diagram:e}},__vite__mapDeps([62,1,2,3,4,49,19,5,22,7]));return{id:Zd,diagram:e}},`loader`)},$d={draw:H((e,t,n)=>{V.debug(`rendering svg for syntax error
156
- `);let r=zt(t),i=r.append(`g`);r.attr(`viewBox`,`0 0 2412 512`),yt(r,100,512,!0),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z`),i.append(`text`).attr(`class`,`error-text`).attr(`x`,1440).attr(`y`,250).attr(`font-size`,`150px`).style(`text-anchor`,`middle`).text(`Syntax error in text`),i.append(`text`).attr(`class`,`error-text`).attr(`x`,1250).attr(`y`,400).attr(`font-size`,`100px`).style(`text-anchor`,`middle`).text(`mermaid version ${n}`)},`draw`)},ef=$d,tf={db:{},renderer:$d,parser:{parse:H(()=>{},`parse`)}},nf=`flowchart-elk`,rf={id:nf,detector:H((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer===`elk`?(t.layout=`elk`,!0):!1,`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./flowDiagram-I6XJVG4X-C2H7PQev.js`);return{diagram:e}},__vite__mapDeps([8,1,2,3,4,9,6,5,10,11,12,13,14,15,16,17,18,19,20,21,22,7,23,24]));return{id:nf,diagram:e}},`loader`)},af=`timeline`,of={id:af,detector:H(e=>/^\s*timeline/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./timeline-definition-PNZ67QCA-Bs3JkoMQ.js`);return{diagram:e}},__vite__mapDeps([63,1,2,3,4,49,19,5,6,46]));return{id:af,diagram:e}},`loader`)},sf=`mindmap`,cf={id:sf,detector:H(e=>/^\s*mindmap/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./mindmap-definition-RKZ34NQL-DTgZ_Z5F.js`);return{diagram:e}},__vite__mapDeps([64,1,2,3,4,6,5,11,12,13,14,15,16,17,18,19,20,21,23,24]));return{id:sf,diagram:e}},`loader`)},lf=`kanban`,uf={id:lf,detector:H(e=>/^\s*kanban/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./kanban-definition-UN3LZRKU-BFoF4JfY.js`);return{diagram:e}},__vite__mapDeps([65,1,2,3,4,6,5,46,10,12,13,14,15,16,22]));return{id:lf,diagram:e}},`loader`)},df=`sankey`,ff={id:df,detector:H(e=>/^\s*sankey(-beta)?/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./sankeyDiagram-5OEKKPKP-cs1kWOqp.js`);return{diagram:e}},__vite__mapDeps([66,1,2,3,4,48,44]));return{id:df,diagram:e}},`loader`)},pf=`packet`,mf={id:pf,detector:H(e=>/^\s*packet(-beta)?/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./diagram-LMA3HP47-DAEPoAHp.js`);return{diagram:e}},__vite__mapDeps([67,1,2,3,4,6,5,46,27,28,29,30,31,32,33,34,35,36,37,38,39]));return{id:pf,diagram:e}},`loader`)},hf=`radar`,gf={id:hf,detector:H(e=>/^\s*radar-beta/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./diagram-2AECGRRQ-DnobmroZ.js`);return{diagram:e}},__vite__mapDeps([68,1,2,3,4,6,5,46,27,28,29,30,31,32,33,34,35,36,37,38,39]));return{id:hf,diagram:e}},`loader`)},_f=`block`,vf={id:_f,detector:H(e=>/^\s*block(-beta)?/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./blockDiagram-GPEHLZMM-CISQUfO9.js`);return{diagram:e}},__vite__mapDeps([69,1,2,3,4,9,6,5,18,19,20,11,12,14,22,58]));return{id:_f,diagram:e}},`loader`)},yf=`treeView`,bf={id:yf,detector:H(e=>/^\s*treeView-beta/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./diagram-5GNKFQAL-D6NqAeoi.js`);return{diagram:e}},__vite__mapDeps([70,1,2,3,4,6,5,46,27,28,29,30,31,32,33,34,35,36,37,38,39,40]));return{id:yf,diagram:e}},`loader`)},xf=`architecture`,Sf={id:xf,detector:H(e=>/^\s*architecture/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./architectureDiagram-3BPJPVTR-CTWT1AFv.js`);return{diagram:e}},__vite__mapDeps([71,2,1,3,4,6,5,46,14,27,28,29,30,31,32,33,34,35,36,37,38,39,72]));return{id:xf,diagram:e}},`loader`)},Cf=`eventmodeling`,wf={id:Cf,detector:H(e=>/^\s*eventmodeling/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./diagram-KO2AKTUF-y8QX4vEL.js`);return{diagram:e}},__vite__mapDeps([73,1,2,3,4,6,5,29,27,28,30,31,32,33,34,35,36,37,38,39]));return{id:Cf,diagram:e}},`loader`)},Tf=`ishikawa`,Ef={id:Tf,detector:H(e=>/^\s*ishikawa(-beta)?\b/i.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./ishikawaDiagram-YF4QCWOH-7tWPtPSR.js`);return{diagram:e}},__vite__mapDeps([74,1,2,3,4,6,5,46,16]));return{id:Tf,diagram:e}},`loader`)},Df=`venn`,Of={id:Df,detector:H(e=>/^\s*venn-beta/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./vennDiagram-CIIHVFJN-D25dPloy.js`);return{diagram:e}},__vite__mapDeps([75,1,2,3,4,6,5,46,16]));return{id:Df,diagram:e}},`loader`)},kf=`treemap`,Af={id:kf,detector:H(e=>/^\s*treemap/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./diagram-OG6HWLK6-B3KiYvxM.js`);return{diagram:e}},__vite__mapDeps([76,1,2,3,4,48,44,43,6,5,46,13,27,28,29,30,31,32,33,34,35,36,37,38,39,24]));return{id:kf,diagram:e}},`loader`)},jf=`wardley-beta`,Mf={id:jf,detector:H(e=>/^\s*wardley-beta/i.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./wardleyDiagram-YWT4CUSO-B7X6xZZ7.js`);return{diagram:e}},__vite__mapDeps([77,1,2,3,4,6,5,46,27,28,29,30,31,32,33,34,35,36,37,38,39]));return{id:jf,diagram:e}},`loader`)},Nf=!1,Pf=H(()=>{Nf||(Nf=!0,ct(`error`,tf,e=>e.toLowerCase().trim()===`error`),ct(`---`,{db:{clear:H(()=>{},`clear`)},styles:{},renderer:{draw:H(()=>{},`draw`)},parser:{parse:H(()=>{throw Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},`parse`)},init:H(()=>null,`init`)},e=>e.toLowerCase().trimStart().startsWith(`---`)),lt(rf,cf,Sf),lt(bd,uf,Kd,Wd,Ed,Ad,Md,Pd,Bd,Hd,wd,Sd,of,Od,Xd,Jd,Qd,Id,ff,mf,Rd,vf,wf,bf,gf,Ef,Af,Of,Mf))},`addDiagrams`),Ff=H(async()=>{V.debug(`Loading registered diagrams`);let e=(await Promise.allSettled(Object.entries(St).map(async([e,{detector:t,loader:n}])=>{if(n)try{dt(e)}catch{try{let{diagram:e,id:r}=await n();ct(r,e,t)}catch(t){throw V.error(`Failed to load external diagram with key ${e}. Removing from detectors.`),delete St[e],t}}}))).filter(e=>e.status===`rejected`);if(e.length>0){V.error(`Failed to load ${e.length} external diagrams`);for(let t of e)V.error(t);throw Error(`Failed to load ${e.length} external diagrams`)}},`loadRegisteredDiagrams`),If=`graphics-document document`;function Lf(e,t){e.attr(`role`,If),t!==``&&e.attr(`aria-roledescription`,t)}H(Lf,`setA11yDiagramInfo`);function Rf(e,t,n,r){if(e.insert!==void 0){if(n){let t=`chart-desc-${r}`;e.attr(`aria-describedby`,t),e.insert(`desc`,`:first-child`).attr(`id`,t).text(n)}if(t){let n=`chart-title-${r}`;e.attr(`aria-labelledby`,n),e.insert(`title`,`:first-child`).attr(`id`,n).text(t)}}}H(Rf,`addSVGa11yTitleDescription`);var zf=class e{constructor(e,t,n,r,i){this.type=e,this.text=t,this.db=n,this.parser=r,this.renderer=i}static{H(this,`Diagram`)}static async fromText(t,n={}){let r=vt(),i=wt(t,r);t=Ft(t)+`
157
- `;try{dt(i)}catch{let e=it(i);if(!e)throw new Dt(`Diagram ${i} not found.`);let{id:t,diagram:n}=await e();ct(t,n)}let{db:a,parser:o,renderer:s,init:c}=dt(i);return o.parser&&(o.parser.yy=a),a.clear?.(),c?.(r),n.title&&a.setDiagramTitle?.(n.title),await o.parse(t),new e(i,t,a,o,s)}async render(e,t){await this.renderer.draw(this.text,e,t,this)}getParser(){return this.parser}getType(){return this.type}},Bf=[],Vf=H(()=>{Bf.forEach(e=>{e()}),Bf=[]},`attachFunctions`),Hf=H(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,``).trimStart(),`cleanupComments`);function Uf(e){let t=e.match(_t);if(!t)return{text:e,metadata:{}};let n=Bt(t[1],{schema:Vt})??{};n=typeof n==`object`&&!Array.isArray(n)?n:{};let r={};return n.displayMode&&(r.displayMode=n.displayMode.toString()),n.title&&(r.title=n.title.toString()),n.config&&(r.config=n.config),{text:e.slice(t[0].length),metadata:r}}H(Uf,`extractFrontMatter`);var Wf=H(e=>e.replace(/\r\n?/g,`
158
- `).replace(/<(\w+)([^>]*)>/g,(e,t,n)=>`<`+t+n.replace(/="([^"]*)"/g,`='$1'`)+`>`),`cleanupText`),Gf=H(e=>{let{text:t,metadata:n}=Uf(e),{displayMode:r,title:i,config:a={}}=n;return r&&(a.gantt||={},a.gantt.displayMode=r),{title:i,config:a,text:t}},`processFrontmatter`),Kf=H(e=>{let t=Mt.detectInit(e)??{},n=Mt.detectDirective(e,`wrap`);return Array.isArray(n)?t.wrap=n.some(({type:e})=>e===`wrap`):n?.type===`wrap`&&(t.wrap=!0),{text:Nt(e),directive:t}},`processDirectives`);function qf(e){let t=Gf(Wf(e)),n=Kf(t.text),r=Pt(t.config,n.directive);return e=Hf(n.text),{code:e,title:t.title,config:r}}H(qf,`preprocessDiagram`);function Jf(e){let t=new TextEncoder().encode(e),n=Array.from(t,e=>String.fromCodePoint(e)).join(``);return btoa(n)}H(Jf,`toBase64`);var Yf=5e4,Xf=`graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa`,Zf=`sandbox`,Qf=`loose`,$f=`http://www.w3.org/2000/svg`,ep=`http://www.w3.org/1999/xlink`,tp=`http://www.w3.org/1999/xhtml`,np=`100%`,rp=`100%`,ip=`border:0;margin:0;`,ap=`margin:0`,op=`allow-top-navigation-by-user-activation allow-popups`,sp=`The "iframe" tag is not supported by your browser.`,cp=[`foreignobject`],lp=[`dominant-baseline`];function up(e){let t=qf(e);return ot(),Ct(t.config??{}),t}H(up,`processAndSetConfigs`);async function dp(e,t){Pf();try{let{code:t,config:n}=up(e);return{diagramType:(await Cp(t)).type,config:n}}catch(e){if(t?.suppressErrors)return!1;throw e}}H(dp,`parse`);var fp=H((e,t,n=[])=>`.${e} ${t} ${st(`{ ${n.join(` !important; `)} !important; }`)}`,`cssImportantStyles`),pp=H((e,t=new Map)=>{let n=new CSSStyleSheet;if(e.fontFamily!==void 0&&n.insertRule(`:root { --mermaid-font-family: ${e.fontFamily}}`,n.cssRules.length),e.altFontFamily!==void 0&&n.insertRule(`:root { --mermaid-alt-font-family: ${e.altFontFamily}}`,n.cssRules.length),t instanceof Map){let r=ft(e)?[`> *`,`span`]:[`rect`,`polygon`,`ellipse`,`circle`,`path`];t.forEach(e=>{Du(e.styles)||r.forEach(t=>{n.insertRule(fp(e.id,t,e.styles),n.cssRules.length)}),Du(e.textStyles)||n.insertRule(fp(e.id,`tspan`,(e?.textStyles||[]).map(e=>e.replace(`color`,`fill`))),n.cssRules.length)})}let r=``;if(e.themeCSS!==void 0)if(typeof n.replaceSync==`function`){let t=new CSSStyleSheet;t.replaceSync(e.themeCSS),r=xt(t)+`
156
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Bd(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Vd(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Bd(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Vd(e);if(i===null)return Bd(n);e=i;let a=`<img src="${e}" alt="${Bd(n)}"`;return t&&(a+=` title="${Bd(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Bd(e.text)}},Qd=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},$d=class e{options;renderer;textRenderer;constructor(e){this.options=e||Du,this.options.renderer=this.options.renderer||new Zd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Qd}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},ef=class{options;block;constructor(e){this.options=e||Du}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Xd.lex:Xd.lexInline}provideParser(e=this.block){return e?$d.parse:$d.parseInline}},tf=class{defaults=Eu();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=$d;Renderer=Zd;TextRenderer=Qd;Lexer=Xd;Tokenizer=Yd;Hooks=ef;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Zd(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Yd(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new ef;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];ef.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&ef.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Xd.lex(e,t??this.defaults)}parser(e,t){return $d.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?Xd.lex:Xd.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?$d.parse:$d.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?Xd.lex:Xd.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?$d.parse:$d.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
157
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Bd(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},nf=new tf;function Q(e,t){return nf.parse(e,t)}Q.options=Q.setOptions=function(e){return nf.setOptions(e),Q.defaults=nf.defaults,Ou(Q.defaults),Q},Q.getDefaults=Eu,Q.defaults=Du,Q.use=function(...e){return nf.use(...e),Q.defaults=nf.defaults,Ou(Q.defaults),Q},Q.walkTokens=function(e,t){return nf.walkTokens(e,t)},Q.parseInline=nf.parseInline,Q.Parser=$d,Q.parser=$d.parse,Q.Renderer=Zd,Q.TextRenderer=Qd,Q.Lexer=Xd,Q.lexer=Xd.lex,Q.Tokenizer=Yd,Q.Hooks=ef,Q.parse=Q,Q.options,Q.setOptions,Q.use,Q.walkTokens,Q.parseInline,$d.parse,Xd.lex;function rf(e){let t=(0,rl.c)(10),n;t[0]!==e.children||t[1]!==e.lang?(n=Tu.sanitize(ke(e.children,e.lang)),t[0]=e.children,t[1]=e.lang,t[2]=n):n=t[2];let r;t[3]===n?r=t[4]:(r={__html:n},t[3]=n,t[4]=r);let i;t[5]===e.className?i=t[6]:(i=a(`bg-muted/30 overflow-hidden select-text [&_*]:select-text`,e.className),t[5]=e.className,t[6]=i);let o;return t[7]!==r||t[8]!==i?(o=(0,q.jsx)(`div`,{"data-code-block":!0,dangerouslySetInnerHTML:r,className:i}),t[7]=r,t[8]=i,t[9]=o):o=t[9],o}function af(e){let t=e?.constructor;return e===(typeof t==`function`?t.prototype:Object.prototype)}function of(e){if(e==null)return!0;if(Kt(e))return typeof e.splice!=`function`&&typeof e!=`string`&&!Bt(e)&&!qt(e)&&!Jt(e)?!1:e.length===0;if(typeof e==`object`){if(e instanceof Map||e instanceof Set)return e.size===0;let t=Object.keys(e);return af(e)?t.filter(e=>e!==`constructor`).length===0:t.length===0}return!0}var sf=`comm`,cf=`rule`,lf=`decl`,uf=`@import`,df=`@namespace`,ff=`@keyframes`,pf=`@layer`,mf=Math.abs,hf=String.fromCharCode;function gf(e){return e.trim()}function _f(e,t,n){return e.replace(t,n)}function vf(e,t){return e.charCodeAt(t)|0}function yf(e,t,n){return e.slice(t,n)}function bf(e){return e.length}function xf(e){return e.length}function Sf(e,t){return t.push(e),e}var Cf=1,wf=1,Tf=0,Ef=0,$=0,Df=``;function Of(e,t,n,r,i,a,o,s){return{value:e,root:t,parent:n,type:r,props:i,children:a,line:Cf,column:wf,length:o,return:``,siblings:s}}function kf(){return $}function Af(){return $=Ef>0?vf(Df,--Ef):0,wf--,$===10&&(wf=1,Cf--),$}function jf(){return $=Ef<Tf?vf(Df,Ef++):0,wf++,$===10&&(wf=1,Cf++),$}function Mf(){return vf(Df,Ef)}function Nf(){return Ef}function Pf(e,t){return yf(Df,e,t)}function Ff(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function If(e){return Cf=wf=1,Tf=bf(Df=e),Ef=0,[]}function Lf(e){return Df=``,e}function Rf(e){return gf(Pf(Ef-1,Vf(e===91?e+2:e===40?e+1:e)))}function zf(e){for(;($=Mf())&&$<33;)jf();return Ff(e)>2||Ff($)>3?``:` `}function Bf(e,t){for(;--t&&jf()&&!($<48||$>102||$>57&&$<65||$>70&&$<97););return Pf(e,Nf()+(t<6&&Mf()==32&&jf()==32))}function Vf(e){for(;jf();)switch($){case e:return Ef;case 34:case 39:e!==34&&e!==39&&Vf($);break;case 40:e===41&&Vf(e);break;case 92:jf();break}return Ef}function Hf(e,t){for(;jf()&&e+$!==57&&!(e+$===84&&Mf()===47););return`/*`+Pf(t,Ef-1)+`*`+hf(e===47?e:jf())}function Uf(e){for(;!Ff(Mf());)jf();return Pf(e,Ef)}function Wf(e){return Lf(Gf(``,null,null,null,[``],e=If(e),0,[0],e))}function Gf(e,t,n,r,i,a,o,s,c){for(var l=0,u=0,d=o,f=0,p=0,m=0,h=1,g=1,_=1,v=0,y=0,b=``,x=i,S=a,C=r,w=b;g;)switch(m=y,y=jf()){case 40:m!=108&&vf(w,d-1)==58?(v++,w+=`(`):w+=Rf(y);break;case 41:v--,w+=`)`;break;case 34:case 39:case 91:w+=Rf(y);break;case 9:case 10:case 13:case 32:if(v>0){w+=hf(y);break}w+=zf(m);break;case 92:w+=Bf(Nf()-1,7);continue;case 47:switch(Mf()){case 42:case 47:Sf(qf(Hf(jf(),Nf()),t,n,c),c),(Ff(m||1)==5||Ff(Mf()||1)==5)&&bf(w)&&yf(w,-1,void 0)!==` `&&(w+=` `);break;default:w+=`/`}break;case 123*h:s[l++]=bf(w)*_;case 125*h:case 59:case 0:if(v>0&&y){w+=hf(y);break}switch(y){case 0:case 125:g=0;case 59+u:_==-1&&(w=_f(w,/\f/g,``)),p>0&&(bf(w)-d||h===0)&&Sf(p>32?Jf(w+`;`,r,n,d-1,c):Jf(_f(w,` `,``)+`;`,r,n,d-2,c),c);break;case 59:w+=`;`;default:if(Sf(C=Kf(w,t,n,l,u,i,s,b,x=[],S=[],d,a),a),y===123)if(u===0)Gf(w,t,C,C,x,a,d,s,S);else{switch(f){case 99:if(vf(w,3)===110)break;case 108:if(vf(w,2)===97)break;default:u=0;case 100:case 109:case 115:}u?Gf(e,C,C,r&&Sf(Kf(e,C,C,0,0,i,s,b,i,x=[],d,S),S),i,S,d,s,r?x:S):Gf(w,C,C,C,[``],S,0,s,S)}}l=u=p=0,h=_=1,b=w=``,d=o;break;case 58:d=1+bf(w),p=m;default:if(h<1){if(y==123)--h;else if(y==125&&h++==0&&Af()==125)continue}switch(w+=hf(y),y*h){case 38:_=u>0?1:(w+=`\f`,-1);break;case 44:if(v>0)break;s[l++]=(bf(w)-1)*_,_=1;break;case 64:Mf()===45&&(w+=Rf(jf())),f=Mf(),u=d=bf(b=w+=Uf(Nf())),y++;break;case 45:m===45&&bf(w)==2&&(h=0)}}return a}function Kf(e,t,n,r,i,a,o,s,c,l,u,d){for(var f=i-1,p=i===0?a:[``],m=xf(p),h=0,g=0,_=0;h<r;++h)for(var v=0,y=yf(e,f+1,f=mf(g=o[h])),b=e;v<m;++v)(b=gf(g>0?p[v]+` `+y:_f(y,/&\f/g,p[v])))&&(c[_++]=b);return Of(e,t,n,i===0?cf:s,c,l,u,d)}function qf(e,t,n,r){return Of(e,t,n,sf,hf(kf()),yf(e,2,-2),0,r)}function Jf(e,t,n,r,i){return Of(e,t,n,lf,yf(e,0,r),yf(e,r+1,-1),r,i)}function Yf(e,t){for(var n=``,r=0;r<e.length;r++)n+=t(e[r],r,e,t)||``;return n}function Xf(e,t,n,r){switch(e.type){case pf:if(e.children.length)break;case uf:case df:case lf:return e.return=e.return||e.value;case sf:return``;case ff:return e.return=e.value+`{`+Yf(e.children,r)+`}`;case cf:if(!bf(e.value=e.props.join(`,`)))return``}return bf(n=Yf(e.children,r))?e.return=e.value+`{`+n+`}`:``}function Zf(e){var t=xf(e);return function(n,r,i,a){for(var o=``,s=0;s<t;s++)o+=e[s](n,r,i,a)||``;return o}}var Qf=`c4`,$f={id:Qf,detector:H(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./c4Diagram-AAUBKEIU-Ct3OGD9a.js`);return{diagram:e}},__vite__mapDeps([0,1,2,3,4,5,6,7]));return{id:Qf,diagram:e}},`loader`)},ep=`flowchart`,tp={id:ep,detector:H((e,t)=>t?.flowchart?.defaultRenderer===`dagre-wrapper`||t?.flowchart?.defaultRenderer===`elk`?!1:/^\s*graph/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./flowDiagram-I6XJVG4X-C2H7PQev.js`);return{diagram:e}},__vite__mapDeps([8,1,2,3,4,9,6,5,10,11,12,13,14,15,16,17,18,19,20,21,22,7,23,24]));return{id:ep,diagram:e}},`loader`)},np=`flowchart-v2`,rp={id:np,detector:H((e,t)=>t?.flowchart?.defaultRenderer===`dagre-d3`?!1:(t?.flowchart?.defaultRenderer===`elk`&&(t.layout=`elk`),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer===`dagre-wrapper`?!0:/^\s*flowchart/.test(e)),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./flowDiagram-I6XJVG4X-C2H7PQev.js`);return{diagram:e}},__vite__mapDeps([8,1,2,3,4,9,6,5,10,11,12,13,14,15,16,17,18,19,20,21,22,7,23,24]));return{id:np,diagram:e}},`loader`)},ip=`er`,ap={id:ip,detector:H(e=>/^\s*erDiagram/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./erDiagram-TEJ5UH35-CbzdEpkS.js`);return{diagram:e}},__vite__mapDeps([25,1,2,3,4,9,6,5,11,12,13,14,15,16,17,18,19,20,21,23,24]));return{id:ip,diagram:e}},`loader`)},op=`gitGraph`,sp={id:op,detector:H(e=>/^\s*gitGraph/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./gitGraphDiagram-PVQCEYII-d2_5HIIo.js`);return{diagram:e}},__vite__mapDeps([26,1,2,3,4,6,5,27,28,29,30,31,32,33,34,35,36,37,38,39,40]));return{id:op,diagram:e}},`loader`)},cp=`gantt`,lp={id:cp,detector:H(e=>/^\s*gantt/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./ganttDiagram-6RSMTGT7-BZql2QFP.js`);return{diagram:e}},__vite__mapDeps([41,2,1,3,4,42,43,44,5,6]));return{id:cp,diagram:e}},`loader`)},up=`info`,dp={id:up,detector:H(e=>/^\s*info/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./infoDiagram-5YYISTIA-DaDFMb3D.js`);return{diagram:e}},__vite__mapDeps([45,1,2,3,4,46,28,29,30,31,32,33,34,35,36,37,38,39]));return{id:up,diagram:e}},`loader`)},fp=`pie`,pp={id:fp,detector:H(e=>/^\s*pie/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./pieDiagram-4H26LBE5-BmpbjVUG.js`);return{diagram:e}},__vite__mapDeps([47,1,2,3,4,48,44,19,5,49,20,6,46,27,28,29,30,31,32,33,34,35,36,37,38,39]));return{id:fp,diagram:e}},`loader`)},mp=`quadrantChart`,hp={id:mp,detector:H(e=>/^\s*quadrantChart/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./quadrantDiagram-W4KKPZXB-BncnX7WL.js`);return{diagram:e}},__vite__mapDeps([50,1,2,3,4,42,43,44]));return{id:mp,diagram:e}},`loader`)},gp=`xychart`,_p={id:gp,detector:H(e=>/^\s*xychart(-beta)?/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./xychartDiagram-2RQKCTM6-Cgc-2R8L.js`);return{diagram:e}},__vite__mapDeps([51,1,2,3,4,42,43,44,48,6,5,18,19,20,46,14]));return{id:gp,diagram:e}},`loader`)},vp=`requirement`,yp={id:vp,detector:H(e=>/^\s*requirement(Diagram)?/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./requirementDiagram-4Y6WPE33-C4viwYDb.js`);return{diagram:e}},__vite__mapDeps([52,1,2,3,4,6,5,11,12,13,14,15,16,17,18,19,20,21,23,24]));return{id:vp,diagram:e}},`loader`)},bp=`sequence`,xp={id:bp,detector:H(e=>/^\s*sequenceDiagram/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./sequenceDiagram-3UESZ5HK-D7Bj1Dg6.js`);return{diagram:e}},__vite__mapDeps([53,1,2,3,4,5,6,10,7,40]));return{id:bp,diagram:e}},`loader`)},Sp=`class`,Cp={id:Sp,detector:H((e,t)=>t?.class?.defaultRenderer===`dagre-wrapper`?!1:/^\s*classDiagram/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./classDiagram-4FO5ZUOK-BdTSUdNF.js`);return{diagram:e}},__vite__mapDeps([54,1,2,3,4,6,5,11,12,13,14,15,16,17,18,19,20,21,22,7,23,24,55]));return{id:Sp,diagram:e}},`loader`)},wp=`classDiagram`,Tp={id:wp,detector:H((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer===`dagre-wrapper`?!0:/^\s*classDiagram-v2/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./classDiagram-v2-Q7XG4LA2-BdTSUdNF.js`);return{diagram:e}},__vite__mapDeps([56,1,2,3,4,6,5,11,12,13,14,15,16,17,18,19,20,21,22,7,23,24,55]));return{id:wp,diagram:e}},`loader`)},Ep=`state`,Dp={id:Ep,detector:H((e,t)=>t?.state?.defaultRenderer===`dagre-wrapper`?!1:/^\s*stateDiagram/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./stateDiagram-AJRCARHV-xBL-crbl.js`);return{diagram:e}},__vite__mapDeps([57,1,2,3,4,6,5,18,19,20,11,12,13,14,15,16,17,21,58,59,23,24,60]));return{id:Ep,diagram:e}},`loader`)},Op=`stateDiagram`,kp={id:Op,detector:H((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer===`dagre-wrapper`),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./stateDiagram-v2-BHNVJYJU-ZbAyaVmU.js`);return{diagram:e}},__vite__mapDeps([61,1,2,3,4,6,5,11,12,13,14,15,16,17,18,19,20,21,23,24,60]));return{id:Op,diagram:e}},`loader`)},Ap=`journey`,jp={id:Ap,detector:H(e=>/^\s*journey/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./journeyDiagram-JHISSGLW-CYDeiigr.js`);return{diagram:e}},__vite__mapDeps([62,1,2,3,4,49,19,5,22,7]));return{id:Ap,diagram:e}},`loader`)},Mp={draw:H((e,t,n)=>{V.debug(`rendering svg for syntax error
158
+ `);let r=Yt(t),i=r.append(`g`);r.attr(`viewBox`,`0 0 2412 512`),kt(r,100,512,!0),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z`),i.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z`),i.append(`text`).attr(`class`,`error-text`).attr(`x`,1440).attr(`y`,250).attr(`font-size`,`150px`).style(`text-anchor`,`middle`).text(`Syntax error in text`),i.append(`text`).attr(`class`,`error-text`).attr(`x`,1250).attr(`y`,400).attr(`font-size`,`100px`).style(`text-anchor`,`middle`).text(`mermaid version ${n}`)},`draw`)},Np=Mp,Pp={db:{},renderer:Mp,parser:{parse:H(()=>{},`parse`)}},Fp=`flowchart-elk`,Ip={id:Fp,detector:H((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer===`elk`?(t.layout=`elk`,!0):!1,`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./flowDiagram-I6XJVG4X-C2H7PQev.js`);return{diagram:e}},__vite__mapDeps([8,1,2,3,4,9,6,5,10,11,12,13,14,15,16,17,18,19,20,21,22,7,23,24]));return{id:Fp,diagram:e}},`loader`)},Lp=`timeline`,Rp={id:Lp,detector:H(e=>/^\s*timeline/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./timeline-definition-PNZ67QCA-Bs3JkoMQ.js`);return{diagram:e}},__vite__mapDeps([63,1,2,3,4,49,19,5,6,46]));return{id:Lp,diagram:e}},`loader`)},zp=`mindmap`,Bp={id:zp,detector:H(e=>/^\s*mindmap/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./mindmap-definition-RKZ34NQL-DTgZ_Z5F.js`);return{diagram:e}},__vite__mapDeps([64,1,2,3,4,6,5,11,12,13,14,15,16,17,18,19,20,21,23,24]));return{id:zp,diagram:e}},`loader`)},Vp=`kanban`,Hp={id:Vp,detector:H(e=>/^\s*kanban/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./kanban-definition-UN3LZRKU-BFoF4JfY.js`);return{diagram:e}},__vite__mapDeps([65,1,2,3,4,6,5,46,10,12,13,14,15,16,22]));return{id:Vp,diagram:e}},`loader`)},Up=`sankey`,Wp={id:Up,detector:H(e=>/^\s*sankey(-beta)?/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./sankeyDiagram-5OEKKPKP-cs1kWOqp.js`);return{diagram:e}},__vite__mapDeps([66,1,2,3,4,48,44]));return{id:Up,diagram:e}},`loader`)},Gp=`packet`,Kp={id:Gp,detector:H(e=>/^\s*packet(-beta)?/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./diagram-LMA3HP47-DAEPoAHp.js`);return{diagram:e}},__vite__mapDeps([67,1,2,3,4,6,5,46,27,28,29,30,31,32,33,34,35,36,37,38,39]));return{id:Gp,diagram:e}},`loader`)},qp=`radar`,Jp={id:qp,detector:H(e=>/^\s*radar-beta/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./diagram-2AECGRRQ-DnobmroZ.js`);return{diagram:e}},__vite__mapDeps([68,1,2,3,4,6,5,46,27,28,29,30,31,32,33,34,35,36,37,38,39]));return{id:qp,diagram:e}},`loader`)},Yp=`block`,Xp={id:Yp,detector:H(e=>/^\s*block(-beta)?/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./blockDiagram-GPEHLZMM-CISQUfO9.js`);return{diagram:e}},__vite__mapDeps([69,1,2,3,4,9,6,5,18,19,20,11,12,14,22,58]));return{id:Yp,diagram:e}},`loader`)},Zp=`treeView`,Qp={id:Zp,detector:H(e=>/^\s*treeView-beta/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./diagram-5GNKFQAL-D6NqAeoi.js`);return{diagram:e}},__vite__mapDeps([70,1,2,3,4,6,5,46,27,28,29,30,31,32,33,34,35,36,37,38,39,40]));return{id:Zp,diagram:e}},`loader`)},$p=`architecture`,em={id:$p,detector:H(e=>/^\s*architecture/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./architectureDiagram-3BPJPVTR-CTWT1AFv.js`);return{diagram:e}},__vite__mapDeps([71,2,1,3,4,6,5,46,14,27,28,29,30,31,32,33,34,35,36,37,38,39,72]));return{id:$p,diagram:e}},`loader`)},tm=`eventmodeling`,nm={id:tm,detector:H(e=>/^\s*eventmodeling/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./diagram-KO2AKTUF-y8QX4vEL.js`);return{diagram:e}},__vite__mapDeps([73,1,2,3,4,6,5,29,27,28,30,31,32,33,34,35,36,37,38,39]));return{id:tm,diagram:e}},`loader`)},rm=`ishikawa`,im={id:rm,detector:H(e=>/^\s*ishikawa(-beta)?\b/i.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./ishikawaDiagram-YF4QCWOH-7tWPtPSR.js`);return{diagram:e}},__vite__mapDeps([74,1,2,3,4,6,5,46,16]));return{id:rm,diagram:e}},`loader`)},am=`venn`,om={id:am,detector:H(e=>/^\s*venn-beta/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./vennDiagram-CIIHVFJN-D25dPloy.js`);return{diagram:e}},__vite__mapDeps([75,1,2,3,4,6,5,46,16]));return{id:am,diagram:e}},`loader`)},sm=`treemap`,cm={id:sm,detector:H(e=>/^\s*treemap/.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./diagram-OG6HWLK6-B3KiYvxM.js`);return{diagram:e}},__vite__mapDeps([76,1,2,3,4,48,44,43,6,5,46,13,27,28,29,30,31,32,33,34,35,36,37,38,39,24]));return{id:sm,diagram:e}},`loader`)},lm=`wardley-beta`,um={id:lm,detector:H(e=>/^\s*wardley-beta/i.test(e),`detector`),loader:H(async()=>{let{diagram:e}=await B(async()=>{let{diagram:e}=await import(`./wardleyDiagram-YWT4CUSO-B7X6xZZ7.js`);return{diagram:e}},__vite__mapDeps([77,1,2,3,4,6,5,46,27,28,29,30,31,32,33,34,35,36,37,38,39]));return{id:lm,diagram:e}},`loader`)},dm=!1,fm=H(()=>{dm||(dm=!0,vt(`error`,Pp,e=>e.toLowerCase().trim()===`error`),vt(`---`,{db:{clear:H(()=>{},`clear`)},styles:{},renderer:{draw:H(()=>{},`draw`)},parser:{parse:H(()=>{throw Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},`parse`)},init:H(()=>null,`init`)},e=>e.toLowerCase().trimStart().startsWith(`---`)),yt(Ip,Bp,em),yt($f,Hp,Tp,Cp,ap,lp,dp,pp,yp,xp,rp,tp,Rp,sp,kp,Dp,jp,hp,Wp,Kp,_p,Xp,nm,Qp,Jp,im,cm,om,um))},`addDiagrams`),pm=H(async()=>{V.debug(`Loading registered diagrams`);let e=(await Promise.allSettled(Object.entries(Mt).map(async([e,{detector:t,loader:n}])=>{if(n)try{xt(e)}catch{try{let{diagram:e,id:r}=await n();vt(r,e,t)}catch(t){throw V.error(`Failed to load external diagram with key ${e}. Removing from detectors.`),delete Mt[e],t}}}))).filter(e=>e.status===`rejected`);if(e.length>0){V.error(`Failed to load ${e.length} external diagrams`);for(let t of e)V.error(t);throw Error(`Failed to load ${e.length} external diagrams`)}},`loadRegisteredDiagrams`),mm=`graphics-document document`;function hm(e,t){e.attr(`role`,mm),t!==``&&e.attr(`aria-roledescription`,t)}H(hm,`setA11yDiagramInfo`);function gm(e,t,n,r){if(e.insert!==void 0){if(n){let t=`chart-desc-${r}`;e.attr(`aria-describedby`,t),e.insert(`desc`,`:first-child`).attr(`id`,t).text(n)}if(t){let n=`chart-title-${r}`;e.attr(`aria-labelledby`,n),e.insert(`title`,`:first-child`).attr(`id`,n).text(t)}}}H(gm,`addSVGa11yTitleDescription`);var _m=class e{constructor(e,t,n,r,i){this.type=e,this.text=t,this.db=n,this.parser=r,this.renderer=i}static{H(this,`Diagram`)}static async fromText(t,n={}){let r=Ot(),i=Pt(t,r);t=Gt(t)+`
159
+ `;try{xt(i)}catch{let e=mt(i);if(!e)throw new Lt(`Diagram ${i} not found.`);let{id:t,diagram:n}=await e();vt(t,n)}let{db:a,parser:o,renderer:s,init:c}=xt(i);return o.parser&&(o.parser.yy=a),a.clear?.(),c?.(r),n.title&&a.setDiagramTitle?.(n.title),await o.parse(t),new e(i,t,a,o,s)}async render(e,t){await this.renderer.draw(this.text,e,t,this)}getParser(){return this.parser}getType(){return this.type}},vm=[],ym=H(()=>{vm.forEach(e=>{e()}),vm=[]},`attachFunctions`),bm=H(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,``).trimStart(),`cleanupComments`);function xm(e){let t=e.match(Dt);if(!t)return{text:e,metadata:{}};let n=Xt(t[1],{schema:Zt})??{};n=typeof n==`object`&&!Array.isArray(n)?n:{};let r={};return n.displayMode&&(r.displayMode=n.displayMode.toString()),n.title&&(r.title=n.title.toString()),n.config&&(r.config=n.config),{text:e.slice(t[0].length),metadata:r}}H(xm,`extractFrontMatter`);var Sm=H(e=>e.replace(/\r\n?/g,`
160
+ `).replace(/<(\w+)([^>]*)>/g,(e,t,n)=>`<`+t+n.replace(/="([^"]*)"/g,`='$1'`)+`>`),`cleanupText`),Cm=H(e=>{let{text:t,metadata:n}=xm(e),{displayMode:r,title:i,config:a={}}=n;return r&&(a.gantt||={},a.gantt.displayMode=r),{title:i,config:a,text:t}},`processFrontmatter`),wm=H(e=>{let t=Ht.detectInit(e)??{},n=Ht.detectDirective(e,`wrap`);return Array.isArray(n)?t.wrap=n.some(({type:e})=>e===`wrap`):n?.type===`wrap`&&(t.wrap=!0),{text:Ut(e),directive:t}},`processDirectives`);function Tm(e){let t=Cm(Sm(e)),n=wm(t.text),r=Wt(t.config,n.directive);return e=bm(n.text),{code:e,title:t.title,config:r}}H(Tm,`preprocessDiagram`);function Em(e){let t=new TextEncoder().encode(e),n=Array.from(t,e=>String.fromCodePoint(e)).join(``);return btoa(n)}H(Em,`toBase64`);var Dm=5e4,Om=`graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa`,km=`sandbox`,Am=`loose`,jm=`http://www.w3.org/2000/svg`,Mm=`http://www.w3.org/1999/xlink`,Nm=`http://www.w3.org/1999/xhtml`,Pm=`100%`,Fm=`100%`,Im=`border:0;margin:0;`,Lm=`margin:0`,Rm=`allow-top-navigation-by-user-activation allow-popups`,zm=`The "iframe" tag is not supported by your browser.`,Bm=[`foreignobject`],Vm=[`dominant-baseline`];function Hm(e){let t=Tm(e);return gt(),Nt(t.config??{}),t}H(Hm,`processAndSetConfigs`);async function Um(e,t){fm();try{let{code:t,config:n}=Hm(e);return{diagramType:(await th(t)).type,config:n}}catch(e){if(t?.suppressErrors)return!1;throw e}}H(Um,`parse`);var Wm=H((e,t,n=[])=>`.${e} ${t} ${_t(`{ ${n.join(` !important; `)} !important; }`)}`,`cssImportantStyles`),Gm=H((e,t=new Map)=>{let n=new CSSStyleSheet;if(e.fontFamily!==void 0&&n.insertRule(`:root { --mermaid-font-family: ${e.fontFamily}}`,n.cssRules.length),e.altFontFamily!==void 0&&n.insertRule(`:root { --mermaid-alt-font-family: ${e.altFontFamily}}`,n.cssRules.length),t instanceof Map){let r=St(e)?[`> *`,`span`]:[`rect`,`polygon`,`ellipse`,`circle`,`path`];t.forEach(e=>{of(e.styles)||r.forEach(t=>{n.insertRule(Wm(e.id,t,e.styles),n.cssRules.length)}),of(e.textStyles)||n.insertRule(Wm(e.id,`tspan`,(e?.textStyles||[]).map(e=>e.replace(`color`,`fill`))),n.cssRules.length)})}let r=``;if(e.themeCSS!==void 0)if(typeof n.replaceSync==`function`){let t=new CSSStyleSheet;t.replaceSync(e.themeCSS),r=jt(t)+`
159
161
  `}else r+=`${e.themeCSS}
160
- `;return r+xt(n)},`createCssStyles`),mp=H((e,t)=>gd(dd(`${e}{${t}}`),vd([H(function(t,n,r,i){if(t.type===`rule`&&Array.isArray(t.props)){if(t.parent&&t.parent.type===`@keyframes`)return;t.props=t.props.map(t=>t.startsWith(e)?t:`${e} ${t}`)}else t.type.startsWith(`@`)&&([`@media`,`@supports`,`@layer`,`@scope`,`@container`,`@starting-style`,`@keyframes`].includes(t.type)||(V.warn(`Removing unsupported at-rule ${t.type} from CSS`),t.type=Ou))},`addNamespace`),_d])),`compileCSS`),hp=H((e,t,n,r)=>mp(r,ht(t,pp(e,n),{...e.themeVariables,theme:e.theme,look:e.look},r)),`createUserStyles`),gp=H((e=``,t,n)=>{let r=e;return!n&&!t&&(r=r.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,`marker-end="url(#`)),r=kt(r),r=r.replace(/<br>/g,`<br/>`),r},`cleanUpSvgCode`),_p=H((e=``,t)=>`<iframe style="width:${np};height:${t?.viewBox?.baseVal?.height?t.viewBox.baseVal.height+`px`:rp};${ip}" src="data:text/html;charset=UTF-8;base64,${Jf(`<body style="${ap}">${e}</body>`)}" sandbox="${op}">
161
- ${sp}
162
- </iframe>`,`putIntoIFrame`),vp=H((e,t,n,r,i)=>{let a=e.append(`div`);a.attr(`id`,n),r&&a.attr(`style`,r);let o=a.append(`svg`).attr(`id`,t).attr(`width`,`100%`).attr(`xmlns`,$f);return i&&o.attr(`xmlns:xlink`,i),o.append(`g`),e},`appendDivSvgG`);function yp(e,t){return e.append(`iframe`).attr(`id`,t).attr(`style`,`width: 100%; height: 100%;`).attr(`sandbox`,``)}H(yp,`sandboxedIframe`);var bp=H((e,t,n,r)=>{e.getElementById(t)?.remove(),e.getElementById(n)?.remove(),e.getElementById(r)?.remove()},`removeExistingElements`),xp=H(async function(e,t,n){Pf();let r=up(t);t=r.code;let i=vt();V.debug(i),t.length>(i?.maxTextSize??Yf)&&(t=Xf);let a=`#${e}`,o=`i`+e,s=`#`+o,c=`d`+e,l=`#`+c,u=H(()=>{let e=U(f?s:l).node();e&&`remove`in e&&e.remove()},`removeTempElements`),d=U(document.body),f=i.securityLevel===Zf,p=i.securityLevel===Qf,m=i.fontFamily;n===void 0?(bp(document,e,c,o),f?(d=U(yp(U(document.body),o).nodes()[0].contentDocument.body),d.node().style.margin=`0`):d=U(`body`),vp(d,e,c)):(n&&(n.innerHTML=``),f?(d=U(yp(U(n),o).nodes()[0].contentDocument.body),d.node().style.margin=`0`):d=U(n),vp(d,e,c,`font-family: ${m}`,ep));let h,g;try{h=await zf.fromText(t,{title:r.title})}catch(e){if(i.suppressErrorRendering)throw u(),e;h=await zf.fromText(`error`),g=e}let _=d.select(l).node(),v=h.type,y=_.firstChild,b=y.firstChild,x=h.renderer.getClasses?.(t,h),S=hp(i,v,x,a),C=document.createElement(`style`);C.innerHTML=S,y.insertBefore(C,b);try{await h.renderer.draw(t,e,`11.15.0`,h)}catch(n){throw i.suppressErrorRendering?u():ef.draw(t,e,`11.15.0`),n}let w=d.select(`${l} svg`),T=h.db.getAccTitle?.(),E=h.db.getAccDescription?.();wp(v,w,T,E),d.select(`[id="${e}"]`).selectAll(`foreignobject > *`).attr(`xmlns`,tp);let D=d.select(l).node().innerHTML;if(V.debug(`config.arrowMarkerAbsolute`,i.arrowMarkerAbsolute),D=gp(D,f,bt(i.arrowMarkerAbsolute)),f){let e=d.select(l+` svg`).node();D=_p(D,e)}else p||(D=rt.sanitize(D,{ADD_TAGS:cp,ADD_ATTR:lp,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(Vf(),g)throw g;return u(),{diagramType:v,svg:D,bindFunctions:h.db.bindFunctions}},`render`);function Sp(e={}){let t=Et({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||={},t.themeVariables.fontFamily=t.fontFamily),pt(t),t?.theme&&t.theme in gt?t.themeVariables=gt[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=gt.default.getThemeVariables(t.themeVariables)),nt((typeof t==`object`?Tt(t):at()).logLevel),Pf()}H(Sp,`initialize`);var Cp=H((e,t={})=>{let{code:n}=qf(e);return zf.fromText(n,t)},`getDiagramFromText`);function wp(e,t,n,r){Lf(t,e),Rf(t,n,r,t.attr(`id`))}H(wp,`addA11yInfo`);var Tp=Object.freeze({render:xp,parse:dp,getDiagramFromText:Cp,initialize:Sp,getConfig:vt,setConfig:mt,getSiteConfig:at,updateSiteConfig:ut,reset:H(()=>{ot()},`reset`),globalReset:H(()=>{ot(Ot)},`globalReset`),defaultConfig:Ot});nt(vt().logLevel),ot(vt());var Ep=H((e,t,n)=>{V.warn(e),jt(e)?(n&&n(e.str,e.hash),t.push({...e,message:e.str,error:e})):(n&&n(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},`handleError`),Dp=H(async function(e={querySelector:`.mermaid`}){try{await Op(e)}catch(t){if(jt(t)&&V.error(t.str),zp.parseError&&zp.parseError(t),!e.suppressErrors)throw V.error(`Use the suppressErrors option to suppress these errors`),t}},`run`),Op=H(async function({postRenderCallback:e,querySelector:t,nodes:n}={querySelector:`.mermaid`}){let r=Tp.getConfig();V.debug(`${e?``:`No `}Callback function found`);let i;if(n)i=n;else if(t)i=document.querySelectorAll(t);else throw Error(`Nodes and querySelector are both undefined`);V.debug(`Found ${i.length} diagrams`),r?.startOnLoad!==void 0&&(V.debug(`Start On Load: `+r?.startOnLoad),Tp.updateSiteConfig({startOnLoad:r?.startOnLoad}));let a=new Mt.InitIDGenerator(r.deterministicIds,r.deterministicIDSeed),o,s=[];for(let t of Array.from(i)){if(V.info(`Rendering diagram: `+t.id),t.getAttribute(`data-processed`))continue;t.setAttribute(`data-processed`,`true`);let n=`mermaid-${a.next()}`;o=t.innerHTML,o=Ut(Mt.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,`<br/>`);let r=Mt.detectInit(o);r&&V.debug(`Detected early reinit: `,r);try{let{svg:r,bindFunctions:i}=await Rp(n,o,t);t.innerHTML=r,e&&await e(n),i&&i(t)}catch(e){Ep(e,s,zp.parseError)}}if(s.length>0)throw s[0]},`runThrowsErrors`),kp=H(function(e){Tp.initialize(e)},`initialize`),Ap=H(async function(e,t,n){V.warn(`mermaid.init is deprecated. Please use run instead.`),e&&kp(e);let r={postRenderCallback:n,querySelector:`.mermaid`};typeof t==`string`?r.querySelector=t:t&&(t instanceof HTMLElement?r.nodes=[t]:r.nodes=t),await Dp(r)},`init`),jp=H(async(e,{lazyLoad:t=!0}={})=>{Pf(),lt(...e),t===!1&&await Ff()},`registerExternalDiagrams`),Mp=H(function(){if(zp.startOnLoad){let{startOnLoad:e}=Tp.getConfig();e&&zp.run().catch(e=>V.error(`Mermaid failed to initialize`,e))}},`contentLoaded`);typeof document<`u`&&window.addEventListener(`load`,Mp,!1);var Np=H(function(e){zp.parseError=e},`setParseErrorHandler`),Pp=[],Fp=!1,Ip=H(async()=>{if(!Fp){for(Fp=!0;Pp.length>0;){let e=Pp.shift();if(e)try{await e()}catch(e){V.error(`Error executing queue`,e)}}Fp=!1}},`executeQueue`),Lp=H(async(e,t)=>new Promise((n,r)=>{let i=H(()=>new Promise((i,a)=>{Tp.parse(e,t).then(e=>{i(e),n(e)},e=>{V.error(`Error parsing`,e),zp.parseError?.(e),a(e),r(e)})}),`performCall`);Pp.push(i),Ip().catch(r)}),`parse`),Rp=H((e,t,n)=>new Promise((r,i)=>{let a=H(()=>new Promise((a,o)=>{Tp.render(e,t,n).then(e=>{a(e),r(e)},e=>{V.error(`Error parsing`,e),zp.parseError?.(e),o(e),i(e)})}),`performCall`);Pp.push(a),Ip().catch(i)}),`render`),zp={startOnLoad:!0,mermaidAPI:Tp,parse:Lp,render:Rp,init:Ap,run:Dp,registerExternalDiagrams:jp,registerLayoutLoaders:Wt,initialize:kp,parseError:void 0,contentLoaded:Mp,setParseErrorHandler:Np,detectType:wt,registerIconPacks:Ht,getRegisteredDiagramsMetadata:H(()=>Object.keys(St).map(e=>({id:e})),`getRegisteredDiagramsMetadata`)},Bp=zp,Vp=$e(e=>Be(I(async()=>(Bp.initialize({securityLevel:`loose`,startOnLoad:!1}),await Bp.render(`mermaid_${O(e)}`,e)))));function Hp(e){let t=(0,qc.c)(17),n;t[0]===e.children?n=t[1]:(n=Vp(e.children),t[0]=e.children,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={includeFailure:!0},t[2]=r):r=t[2];let i=Ue(n,r);if(Le(i)){let n;t[3]===e.className?n=t[4]:(n=F(`border-border bg-muted/30 text-destructive border px-2 py-2 whitespace-pre-wrap`,e.className),t[3]=e.className,t[4]=n);let r;t[5]===i.cause?r=t[6]:(r=d(ie(i.cause)),t[5]=i.cause,t[6]=r);let a;return t[7]!==n||t[8]!==r?(a=(0,J.jsx)(`pre`,{className:n,children:r}),t[7]=n,t[8]=r,t[9]=a):a=t[9],a}let a;t[10]===i.value.svg?a=t[11]:(a={__html:i.value.svg},t[10]=i.value.svg,t[11]=a);let o;t[12]===e.className?o=t[13]:(o=F(`bg-muted/30 overflow-hidden p-4 [&_svg]:mx-auto [&_svg]:h-auto [&_svg]:max-w-full`,e.className),t[12]=e.className,t[13]=o);let s;return t[14]!==a||t[15]!==o?(s=(0,J.jsx)(`div`,{dangerouslySetInnerHTML:a,className:o}),t[14]=a,t[15]=o,t[16]=s):s=t[16],s}var Up=new Cu({async:!1,breaks:!0,gfm:!0});function Wp(e){let t=(0,qc.c)(7),n;t[0]===e.className?n=t[1]:(n=F(`markdown text-wrap wrap-break-word select-text`,e.className),t[0]=e.className,t[1]=n);let r;t[2]===e.children?r=t[3]:(r=A(Up.lexer(e.children),Gp),t[2]=e.children,t[3]=r);let i;return t[4]!==n||t[5]!==r?(i=(0,J.jsx)(`div`,{className:n,children:r}),t[4]=n,t[5]=r,t[6]=i):i=t[6],i}function Gp(e,t){if(e.type!==`html`)return e.type===`code`?e.lang===`mermaid`?(0,J.jsx)(Hp,{className:`border-border border`,children:e.text},t):(0,J.jsx)(Tu,{className:`border-border border`,lang:le(e.lang)?e.lang:void 0,children:e.text},t):(0,J.jsx)(`div`,{dangerouslySetInnerHTML:{__html:Up.parse(e.raw)}},t)}var Kp=`
162
+ `;return r+jt(n)},`createCssStyles`),Km=H((e,t)=>Yf(Wf(`${e}{${t}}`),Zf([H(function(t,n,r,i){if(t.type===`rule`&&Array.isArray(t.props)){if(t.parent&&t.parent.type===`@keyframes`)return;t.props=t.props.map(t=>t.startsWith(e)?t:`${e} ${t}`)}else t.type.startsWith(`@`)&&([`@media`,`@supports`,`@layer`,`@scope`,`@container`,`@starting-style`,`@keyframes`].includes(t.type)||(V.warn(`Removing unsupported at-rule ${t.type} from CSS`),t.type=sf))},`addNamespace`),Xf])),`compileCSS`),qm=H((e,t,n,r)=>Km(r,Tt(t,Gm(e,n),{...e.themeVariables,theme:e.theme,look:e.look},r)),`createUserStyles`),Jm=H((e=``,t,n)=>{let r=e;return!n&&!t&&(r=r.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,`marker-end="url(#`)),r=zt(r),r=r.replace(/<br>/g,`<br/>`),r},`cleanUpSvgCode`),Ym=H((e=``,t)=>`<iframe style="width:${Pm};height:${t?.viewBox?.baseVal?.height?t.viewBox.baseVal.height+`px`:Fm};${Im}" src="data:text/html;charset=UTF-8;base64,${Em(`<body style="${Lm}">${e}</body>`)}" sandbox="${Rm}">
163
+ ${zm}
164
+ </iframe>`,`putIntoIFrame`),Xm=H((e,t,n,r,i)=>{let a=e.append(`div`);a.attr(`id`,n),r&&a.attr(`style`,r);let o=a.append(`svg`).attr(`id`,t).attr(`width`,`100%`).attr(`xmlns`,jm);return i&&o.attr(`xmlns:xlink`,i),o.append(`g`),e},`appendDivSvgG`);function Zm(e,t){return e.append(`iframe`).attr(`id`,t).attr(`style`,`width: 100%; height: 100%;`).attr(`sandbox`,``)}H(Zm,`sandboxedIframe`);var Qm=H((e,t,n,r)=>{e.getElementById(t)?.remove(),e.getElementById(n)?.remove(),e.getElementById(r)?.remove()},`removeExistingElements`),$m=H(async function(e,t,n){fm();let r=Hm(t);t=r.code;let i=Ot();V.debug(i),t.length>(i?.maxTextSize??Dm)&&(t=Om);let a=`#${e}`,o=`i`+e,s=`#`+o,c=`d`+e,l=`#`+c,u=H(()=>{let e=ft(f?s:l).node();e&&`remove`in e&&e.remove()},`removeTempElements`),d=ft(document.body),f=i.securityLevel===km,p=i.securityLevel===Am,m=i.fontFamily;n===void 0?(Qm(document,e,c,o),f?(d=ft(Zm(ft(document.body),o).nodes()[0].contentDocument.body),d.node().style.margin=`0`):d=ft(`body`),Xm(d,e,c)):(n&&(n.innerHTML=``),f?(d=ft(Zm(ft(n),o).nodes()[0].contentDocument.body),d.node().style.margin=`0`):d=ft(n),Xm(d,e,c,`font-family: ${m}`,Mm));let h,g;try{h=await _m.fromText(t,{title:r.title})}catch(e){if(i.suppressErrorRendering)throw u(),e;h=await _m.fromText(`error`),g=e}let _=d.select(l).node(),v=h.type,y=_.firstChild,b=y.firstChild,x=h.renderer.getClasses?.(t,h),S=qm(i,v,x,a),C=document.createElement(`style`);C.innerHTML=S,y.insertBefore(C,b);try{await h.renderer.draw(t,e,`11.15.0`,h)}catch(n){throw i.suppressErrorRendering?u():Np.draw(t,e,`11.15.0`),n}let w=d.select(`${l} svg`),T=h.db.getAccTitle?.(),E=h.db.getAccDescription?.();nh(v,w,T,E),d.select(`[id="${e}"]`).selectAll(`foreignobject > *`).attr(`xmlns`,Nm);let D=d.select(l).node().innerHTML;if(V.debug(`config.arrowMarkerAbsolute`,i.arrowMarkerAbsolute),D=Jm(D,f,At(i.arrowMarkerAbsolute)),f){let e=d.select(l+` svg`).node();D=Ym(D,e)}else p||(D=pt.sanitize(D,{ADD_TAGS:Bm,ADD_ATTR:Vm,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(ym(),g)throw g;return u(),{diagramType:v,svg:D,bindFunctions:h.db.bindFunctions}},`render`);function eh(e={}){let t=It({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||={},t.themeVariables.fontFamily=t.fontFamily),Ct(t),t?.theme&&t.theme in Et?t.themeVariables=Et[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=Et.default.getThemeVariables(t.themeVariables)),dt((typeof t==`object`?Ft(t):ht()).logLevel),fm()}H(eh,`initialize`);var th=H((e,t={})=>{let{code:n}=Tm(e);return _m.fromText(n,t)},`getDiagramFromText`);function nh(e,t,n,r){hm(t,e),gm(t,n,r,t.attr(`id`))}H(nh,`addA11yInfo`);var rh=Object.freeze({render:$m,parse:Um,getDiagramFromText:th,initialize:eh,getConfig:Ot,setConfig:wt,getSiteConfig:ht,updateSiteConfig:bt,reset:H(()=>{gt()},`reset`),globalReset:H(()=>{gt(Rt)},`globalReset`),defaultConfig:Rt});dt(Ot().logLevel),gt(Ot());var ih=H((e,t,n)=>{V.warn(e),Vt(e)?(n&&n(e.str,e.hash),t.push({...e,message:e.str,error:e})):(n&&n(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},`handleError`),ah=H(async function(e={querySelector:`.mermaid`}){try{await oh(e)}catch(t){if(Vt(t)&&V.error(t.str),_h.parseError&&_h.parseError(t),!e.suppressErrors)throw V.error(`Use the suppressErrors option to suppress these errors`),t}},`run`),oh=H(async function({postRenderCallback:e,querySelector:t,nodes:n}={querySelector:`.mermaid`}){let r=rh.getConfig();V.debug(`${e?``:`No `}Callback function found`);let i;if(n)i=n;else if(t)i=document.querySelectorAll(t);else throw Error(`Nodes and querySelector are both undefined`);V.debug(`Found ${i.length} diagrams`),r?.startOnLoad!==void 0&&(V.debug(`Start On Load: `+r?.startOnLoad),rh.updateSiteConfig({startOnLoad:r?.startOnLoad}));let a=new Ht.InitIDGenerator(r.deterministicIds,r.deterministicIDSeed),o,s=[];for(let t of Array.from(i)){if(V.info(`Rendering diagram: `+t.id),t.getAttribute(`data-processed`))continue;t.setAttribute(`data-processed`,`true`);let n=`mermaid-${a.next()}`;o=t.innerHTML,o=$t(Ht.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,`<br/>`);let r=Ht.detectInit(o);r&&V.debug(`Detected early reinit: `,r);try{let{svg:r,bindFunctions:i}=await gh(n,o,t);t.innerHTML=r,e&&await e(n),i&&i(t)}catch(e){ih(e,s,_h.parseError)}}if(s.length>0)throw s[0]},`runThrowsErrors`),sh=H(function(e){rh.initialize(e)},`initialize`),ch=H(async function(e,t,n){V.warn(`mermaid.init is deprecated. Please use run instead.`),e&&sh(e);let r={postRenderCallback:n,querySelector:`.mermaid`};typeof t==`string`?r.querySelector=t:t&&(t instanceof HTMLElement?r.nodes=[t]:r.nodes=t),await ah(r)},`init`),lh=H(async(e,{lazyLoad:t=!0}={})=>{fm(),yt(...e),t===!1&&await pm()},`registerExternalDiagrams`),uh=H(function(){if(_h.startOnLoad){let{startOnLoad:e}=rh.getConfig();e&&_h.run().catch(e=>V.error(`Mermaid failed to initialize`,e))}},`contentLoaded`);typeof document<`u`&&window.addEventListener(`load`,uh,!1);var dh=H(function(e){_h.parseError=e},`setParseErrorHandler`),fh=[],ph=!1,mh=H(async()=>{if(!ph){for(ph=!0;fh.length>0;){let e=fh.shift();if(e)try{await e()}catch(e){V.error(`Error executing queue`,e)}}ph=!1}},`executeQueue`),hh=H(async(e,t)=>new Promise((n,r)=>{let i=H(()=>new Promise((i,a)=>{rh.parse(e,t).then(e=>{i(e),n(e)},e=>{V.error(`Error parsing`,e),_h.parseError?.(e),a(e),r(e)})}),`performCall`);fh.push(i),mh().catch(r)}),`parse`),gh=H((e,t,n)=>new Promise((r,i)=>{let a=H(()=>new Promise((a,o)=>{rh.render(e,t,n).then(e=>{a(e),r(e)},e=>{V.error(`Error parsing`,e),_h.parseError?.(e),o(e),i(e)})}),`performCall`);fh.push(a),mh().catch(i)}),`render`),_h={startOnLoad:!0,mermaidAPI:rh,parse:hh,render:gh,init:ch,run:ah,registerExternalDiagrams:lh,registerLayoutLoaders:en,initialize:sh,parseError:void 0,contentLoaded:uh,setParseErrorHandler:dh,detectType:Pt,registerIconPacks:Qt,getRegisteredDiagramsMetadata:H(()=>Object.keys(Mt).map(e=>({id:e})),`getRegisteredDiagramsMetadata`)},vh=_h,yh=Ze(e=>qe(N(async()=>(vh.initialize({securityLevel:`strict`,startOnLoad:!1}),await vh.render(`mermaid_${oe(e)}`,e)))));function bh(e){let t=(0,rl.c)(19),n;t[0]===e.children?n=t[1]:(n=yh(e.children),t[0]=e.children,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={includeFailure:!0},t[2]=r):r=t[2];let i=rt(n,r);if(lt(i)){let n;t[3]===e.className?n=t[4]:(n=a(`border-border bg-muted/30 text-destructive border px-2 py-2 whitespace-pre-wrap`,e.className),t[3]=e.className,t[4]=n);let r;t[5]===i.cause?r=t[6]:(r=f(c(i.cause)),t[5]=i.cause,t[6]=r);let o;return t[7]!==n||t[8]!==r?(o=(0,q.jsx)(`pre`,{className:n,children:r}),t[7]=n,t[8]=r,t[9]=o):o=t[9],o}let o;t[10]===i.value.svg?o=t[11]:(o=Tu.sanitize(i.value.svg),t[10]=i.value.svg,t[11]=o);let s;t[12]===o?s=t[13]:(s={__html:o},t[12]=o,t[13]=s);let l;t[14]===e.className?l=t[15]:(l=a(`bg-muted/30 overflow-hidden p-4 [&_svg]:mx-auto [&_svg]:h-auto [&_svg]:max-w-full`,e.className),t[14]=e.className,t[15]=l);let u;return t[16]!==s||t[17]!==l?(u=(0,q.jsx)(`div`,{dangerouslySetInnerHTML:s,className:l}),t[16]=s,t[17]=l,t[18]=u):u=t[18],u}var xh=new tf({async:!1,breaks:!0,gfm:!0});function Sh(e){let t=(0,rl.c)(7),n;t[0]===e.className?n=t[1]:(n=a(`markdown text-wrap wrap-break-word select-text`,e.className),t[0]=e.className,t[1]=n);let r;t[2]===e.children?r=t[3]:(r=pe(xh.lexer(e.children),Ch),t[2]=e.children,t[3]=r);let i;return t[4]!==n||t[5]!==r?(i=(0,q.jsx)(`div`,{className:n,children:r}),t[4]=n,t[5]=r,t[6]=i):i=t[6],i}function Ch(e,t){return o(b(e),T({type:`html`},wh),T({lang:`mermaid`,type:`code`},n=>(0,q.jsx)(bh,{className:`border-border border`,children:n.text},`${e.type}:${t}:${n.text}`)),T({type:`code`},n=>(0,q.jsx)(rf,{className:`border-border border`,lang:ie(n.lang)?n.lang:void 0,children:n.text},`${e.type}:${t}:${n.lang??``}:${n.text}`)),g(e=>(0,q.jsx)(`div`,{dangerouslySetInnerHTML:{__html:Tu.sanitize(xh.parse(e.raw,{async:!1}))}},`${e.type}:${t}:${e.raw}`)))}function wh(){return null}var Th=`
163
165
  :host,
164
166
  pre {
165
167
  --diffs-bg: var(--background) !important;
@@ -215,7 +217,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
215
217
  background-color: var(--muted) !important;
216
218
  color: var(--muted-foreground) !important;
217
219
  }
218
- `;function qp(e,t){return e.filePath===t.filePath&&e.lineNumber===t.lineNumber&&e.side===`deletions`==(t.side===`deletions`)}function Jp(e){let t=e.side===`deletions`?`deleted`:`line`;return`# Review comments\n\n## ${e.filePath}\n\n${t}:${e.lineNumber}: ${e.body}`}function Yp(e,t){let n=[...e.querySelector(`diffs-container`)?.shadowRoot?.querySelectorAll(`[data-line][data-line-type]`)??[]].find(e=>{let n=e.getBoundingClientRect();return t>=n.top&&t<=n.bottom});if(!n)return;let r=n.dataset.line;if(!(P(r)||C(r)))return{clientY:t,lineNumber:r,offsetWithinLine:t-n.getBoundingClientRect().top,scrollTop:e.scrollTop}}function Xp(e,t,n){let r=e.querySelector(`diffs-container`)?.shadowRoot?.querySelector(n===`diff`?`[data-line="${CSS.escape(t.lineNumber)}"]:not([data-line-type="change-deletion"])`:`[data-line="${CSS.escape(t.lineNumber)}"]`);return r instanceof HTMLElement?(e.scrollTo({behavior:`instant`,top:e.scrollTop+r.getBoundingClientRect().top-(t.clientY-t.offsetWithinLine)}),!0):(e.scrollTo({behavior:`instant`,top:t.scrollTop}),!0)}function Zp(e){let t=(0,qc.c)(50),n=(0,W.useRef)(null),r;t[0]===e.comment.body?r=t[1]:(r=C(e.comment.body),t[0]=e.comment.body,t[1]=r);let[i,a]=(0,W.useState)(r),[o,s]=(0,W.useState)(e.comment.body),c,l;t[2]===i?(c=t[3],l=t[4]):(c=()=>{i&&n.current?.focus()},l=[i],t[2]=i,t[3]=c,t[4]=l),(0,W.useEffect)(c,l);let u;t[5]===e.comment?u=t[6]:(u=async function(){await navigator.clipboard.writeText(Jp(e.comment))},t[5]=e.comment,t[6]=u);let f=u,p;t[7]!==o||t[8]!==e?(p=function(){if(C(d(o))){if(e.isDraft===!0){e.onCloseDraft?.();return}e.onResolveComment?.({...e.comment,body:o}),a(!1),e.onCloseDraft?.();return}e.onSaveComment?.({...e.comment,body:d(o)}),a(!1),e.onCloseDraft?.()},t[7]=o,t[8]=e,t[9]=p):p=t[9];let m=p,h;t[10]===e.comment.source?h=t[11]:(h=(0,J.jsx)(`div`,{className:`border-border bg-background text-muted-foreground inline-flex shrink-0 border p-1`,children:e.comment.source===`github`?(0,J.jsx)(Jc,{className:`size-3 shrink-0`}):(0,J.jsx)(Jt,{className:`size-3 shrink-0`})}),t[10]=e.comment.source,t[11]=h);let g=h;if(i){let r;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(r=e=>{s(e.currentTarget.value)},t[12]=r):r=t[12];let i;t[13]!==e||t[14]!==m?(i=t=>{t.key===`Escape`&&(t.preventDefault(),e.isDraft===!0?e.onCloseDraft?.():a(!1)),t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),m())},t[13]=e,t[14]=m,t[15]=i):i=t[15];let c;t[16]!==o||t[17]!==i?(c=(0,J.jsx)(`div`,{className:`min-w-0`,children:(0,J.jsx)(`textarea`,{ref:n,value:o,placeholder:`Add comment`,className:`font-inherit block min-h-16 w-full resize-y border-0 bg-transparent p-0 text-inherit outline-none`,onChange:r,onClick:Qp,onKeyDown:i})}),t[16]=o,t[17]=i,t[18]=c):c=t[18];let l;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,J.jsx)(`div`,{}),t[19]=l):l=t[19];let u;return t[20]!==g||t[21]!==c?(u=(0,J.jsxs)(`div`,{className:`border-border/70 bg-muted/70 text-foreground box-border grid w-full max-w-full grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-2 border-y px-2 py-2`,children:[g,c,l]}),t[20]=g,t[21]=c,t[22]=u):u=t[22],u}if(e.comment.resolved===!0){let n;t[23]===e.comment.body?n=t[24]:(n=(0,J.jsx)(`span`,{className:`decoration-muted-foreground/60 min-w-0 truncate line-through`,children:e.comment.body}),t[23]=e.comment.body,t[24]=n);let r;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsx)(`div`,{}),t[25]=r):r=t[25];let i;return t[26]!==g||t[27]!==n?(i=(0,J.jsxs)(`div`,{className:`text-muted-foreground bg-muted/70 border-border/60 box-border grid w-full max-w-full grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 border-y px-2 py-1 opacity-75`,children:[g,n,r]}),t[26]=g,t[27]=n,t[28]=i):i=t[28],i}let _;t[29]===e.comment.source?_=t[30]:(_=t=>{t.stopPropagation(),e.comment.source!==`github`&&a(!0)},t[29]=e.comment.source,t[30]=_);let v;t[31]===e.comment.body?v=t[32]:(v=(0,J.jsx)(Wp,{className:`text-inherit`,children:e.comment.body}),t[31]=e.comment.body,t[32]=v);let y;t[33]!==_||t[34]!==v?(y=(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 bg-transparent p-0 text-left`,onClick:_,children:v}),t[33]=_,t[34]=v,t[35]=y):y=t[35];let b;t[36]===f?b=t[37]:(b=e=>{e.stopPropagation(),f()},t[36]=f,t[37]=b);let x;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,J.jsx)(Kt,{className:`size-3`}),t[38]=x):x=t[38];let w;t[39]===b?w=t[40]:(w=(0,J.jsx)(`button`,{type:`button`,className:`hover:bg-muted hover:text-foreground p-1`,"aria-label":`Copy comment`,title:`Copy comment`,onClick:b,children:x}),t[39]=b,t[40]=w);let T;t[41]===e?T=t[42]:(T=e.onResolveComment&&(0,J.jsx)(`button`,{type:`button`,className:`border-border hover:bg-muted hover:text-foreground border-l p-1`,"aria-label":`Resolve comment`,title:`Resolve comment`,disabled:e.comment.resolving,onClick:t=>{t.stopPropagation(),e.onResolveComment?.(e.comment)},children:e.comment.resolving===!0?(0,J.jsx)(S,{className:`size-3`}):(0,J.jsx)(Me,{className:`size-3`})}),t[41]=e,t[42]=T);let E;t[43]!==w||t[44]!==T?(E=(0,J.jsxs)(`div`,{className:`border-border bg-background text-muted-foreground inline-flex shrink-0 border text-xs`,children:[w,T]}),t[43]=w,t[44]=T,t[45]=E):E=t[45];let D;return t[46]!==g||t[47]!==E||t[48]!==y?(D=(0,J.jsxs)(`div`,{className:`border-border/70 bg-muted/70 text-foreground box-border grid w-full max-w-full grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-2 border-y px-2 py-2`,children:[g,y,E]}),t[46]=g,t[47]=E,t[48]=y,t[49]=D):D=t[49],D}function Qp(e){e.stopPropagation()}function $p(e){let t=(0,qc.c)(27),n=(0,W.useRef)(null),r=(0,W.useRef)(null),i=(0,W.useRef)(null),[a,s]=(0,W.useState)(),c=`${e.filePath}\u0000${e.patch}`,l;t[0]===c?l=t[1]:(l=()=>({key:c,mode:`diff`}),t[0]=c,t[1]=l);let[u,d]=(0,W.useState)(l),f=u.key===c?u.mode:`diff`,p,m;t[2]!==e.filePath||t[3]!==e.patch?(p=be(e.filePath),m=$r(Qr(e.patch),p),t[2]=e.filePath,t[3]=e.patch,t[4]=p,t[5]=m):(p=t[4],m=t[5]);let h=m,g=e.comments??[],_=a?o(g,a):g,v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>{n.current?.focus()},t[6]=v):v=t[6];let y;t[7]!==f||t[8]!==e.filePath||t[9]!==e.patch?(y=[f,e.filePath,e.patch],t[7]=f,t[8]=e.filePath,t[9]=e.patch,t[10]=y):y=t[10],(0,W.useEffect)(v,y);let b;t[11]===f?b=t[12]:(b=()=>{let e=n.current,t=i.current;R(e)||R(t)||Xp(e,t,f)&&(i.current=null)},t[11]=f,t[12]=b);let x;t[13]!==f||t[14]!==e.fileContent?(x=[f,e.fileContent],t[13]=f,t[14]=e.fileContent,t[15]=x):x=t[15],(0,W.useLayoutEffect)(b,x);let S;t[16]===c?S=t[17]:(S=function(){let e=n.current;if(R(e))return;let t=e.getBoundingClientRect();i.current=Yp(e,R(r.current)?t.top+t.height/2:Math.min(Math.max(r.current,t.top),t.bottom))??null,d(e=>({key:c,mode:e.key===c&&e.mode===`file`?`diff`:`file`}))},t[16]=c,t[17]=S);let C=S,w;t[18]===C?w=t[19]:(w=e=>{e.preventDefault(),C()},t[18]=C,t[19]=w);let T;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(T={preventDefault:!1,target:n},t[20]=T):T=t[20],Qn(`Tab`,w,T);let E=function(t){e.onSaveComment&&(a&&qp(a,{filePath:e.filePath,lineNumber:t.lineNumber,side:t.side})||a||ue(g,n=>qp(n,{filePath:e.filePath,lineNumber:t.lineNumber,side:t.side}))||s({body:``,filePath:e.filePath,lineNumber:t.lineNumber,side:t.side===`deletions`?t.side:void 0}))},D,O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{r.current=e.clientY},O=e=>{r.current=e.clientY,e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLButtonElement||e.currentTarget.focus()},t[21]=D,t[22]=O):(D=t[21],O=t[22]);let k=f===`diff`?(0,J.jsx)(Kc,{fileDiff:h,options:{diffIndicators:`bars`,diffStyle:`unified`,disableBackground:!1,disableFileHeader:!0,disableLineNumbers:!1,lineDiffType:`word-alt`,onLineNumberClick:e=>{E({lineNumber:e.lineNumber,side:e.annotationSide})},overflow:`scroll`,theme:Te,themeType:`system`,unsafeCSS:Kp},lineAnnotations:A(_,nm),renderAnnotation:t=>(0,J.jsx)(Zp,{comment:t.metadata,isDraft:a&&qp(t.metadata,a),onSaveComment:e.onSaveComment,onResolveComment:e.onResolveComment,onCloseDraft:()=>{s(void 0)}})},e.patch):(0,J.jsx)(Gs,{file:{contents:e.fileContent??``,lang:p,name:e.filePath},options:{disableFileHeader:!0,disableLineNumbers:!1,onLineNumberClick:e=>{E({lineNumber:e.lineNumber})},overflow:`scroll`,theme:Te,themeType:`system`,unsafeCSS:Kp},lineAnnotations:A(fe(_,tm),em),renderAnnotation:t=>(0,J.jsx)(Zp,{comment:t.metadata,isDraft:a&&qp(t.metadata,a),onSaveComment:e.onSaveComment,onResolveComment:e.onResolveComment,onCloseDraft:()=>{s(void 0)}})},e.filePath),j;return t[23]!==D||t[24]!==O||t[25]!==k?(j=(0,J.jsx)(`section`,{ref:n,tabIndex:-1,"aria-label":`Diff viewer`,className:`bg-background block h-full min-h-0 w-full overflow-auto rounded-none outline-none select-text`,onPointerMoveCapture:D,onPointerDownCapture:O,children:k}),t[23]=D,t[24]=O,t[25]=k,t[26]=j):j=t[26],j}function em(e){return{lineNumber:e.lineNumber,metadata:e}}function tm(e){return e.side!==`deletions`}function nm(e){return{lineNumber:e.lineNumber,metadata:e,side:e.side??`additions`}}var rm=$e(e=>z.runtime.atom(L(z,c(t=>t(`review.metadata`,{cwd:e})),Ve)));function im(e){return e._tag===`commit`?`commit\u0000${e.hash}`:e._tag}function am(e,t=``){return e===`commit`?{_tag:`commit`,hash:t}:e===`local`?{_tag:`local`}:e===`branch`?{_tag:`branch`}:{_tag:`changes`}}var om=$e(e=>{let t=e.split(`\0`),n=t[0]??``,r=am(t[1]??`changes`,t[2]??``);return z.runtime.atom(L(z,c(e=>e(`review.diffs`,{cwd:n,target:r})),Ve))}),sm=$e(e=>z.runtime.atom(L(z,c(t=>t(`review.state`,{cwd:e})),Ve))),cm=new Xe({comments:y(),marks:y()}),lm=$e(e=>ze(sm(e),e=>e._tag===`Success`?e.value:cm)),um=$e(()=>He(Be(()=>({generatingMessage:!1,publishing:!1})))),dm=$e(e=>Ye(um(e),{fn:z.runtime.fn()(oe(`DiffPage.generatePublishMessage`)(function*(){return yield*(yield*z)(`publish.message.generate`,{cwd:e})})),reducer:e=>({...e,generatingMessage:!0})})),fm=$e(e=>Ye(um(e),{fn:z.runtime.fn()(oe(`DiffPage.approvePublish`)(function*(t){return yield*(yield*z)(`publish.approve`,{cwd:e,message:t})})),reducer:e=>({...e,publishing:!0})})),pm=$e(()=>He(Be(()=>({resolvingAll:!1,resolvingKeys:new Set})))),mm=$e(e=>Ye(pm(e),{fn:z.runtime.fn()(oe(`DiffPage.resolveComment`)(function*(t){yield*(yield*z)(`review.comments.resolve`,{cwd:e,filePath:t.comment.filePath,lineNumber:t.comment.lineNumber,side:t.comment.side,threadId:t.comment.threadId})})),reducer:(e,t)=>({resolvingAll:e.resolvingAll,resolvingKeys:new Set([...e.resolvingKeys,t.key])})})),hm=$e(e=>Ye(pm(e),{fn:z.runtime.fn()(oe(`DiffPage.resolveComments`)(function*(t){let n=yield*z;yield*L(t,w((e,t)=>e.comment.threadId!==void 0&&e.comment.threadId===t.comment.threadId),N(t=>n(`review.comments.resolve`,{cwd:e,filePath:t.comment.filePath,lineNumber:t.comment.lineNumber,side:t.comment.side,threadId:t.comment.threadId})))})),reducer:(e,t)=>({resolvingAll:!0,resolvingKeys:new Set([...e.resolvingKeys,...A(t,e=>e.key)])})}));function gm(e){return L(e,i(f(),(e,t)=>b(e,t.filePath,e=>de(o(ne(e,()=>y()),t)))),e=>p(e),A(e=>({comments:e[1],filePath:e[0]})))}async function _m(e){try{await navigator.clipboard.writeText(L(e,A(Jp),_(`
220
+ `;function Eh(e,t){return e.filePath===t.filePath&&e.lineNumber===t.lineNumber&&e.side===`deletions`==(t.side===`deletions`)}function Dh(e){let t=e.side===`deletions`?`deleted`:`line`;return`# Review comments\n\n## ${e.filePath}\n\n${t}:${e.lineNumber}: ${e.body}`}function Oh(e,t){let n=o(M(e.querySelector(`diffs-container`)?.shadowRoot?.querySelectorAll(`[data-line][data-line-type]`)??[]),ne(e=>{let n=e.getBoundingClientRect();return t>=n.top&&t<=n.bottom}),ue);if(n&&!(_e(n.dataset.line)||x(n.dataset.line)))return{clientY:t,lineNumber:n.dataset.line,offsetWithinLine:t-n.getBoundingClientRect().top,scrollTop:e.scrollTop}}function kh(e,t,n){let r=e.querySelector(`diffs-container`)?.shadowRoot?.querySelector(n===`diff`?`[data-line="${CSS.escape(t.lineNumber)}"]:not([data-line-type="change-deletion"])`:`[data-line="${CSS.escape(t.lineNumber)}"]`);return r instanceof HTMLElement?(e.scrollTo({behavior:`instant`,top:e.scrollTop+r.getBoundingClientRect().top-(t.clientY-t.offsetWithinLine)}),!0):(e.scrollTo({behavior:`instant`,top:t.scrollTop}),!0)}function Ah(e){let t=(0,rl.c)(47),n=(0,U.useRef)(null),r;t[0]===e.comment.body?r=t[1]:(r=()=>x(e.comment.body),t[0]=e.comment.body,t[1]=r);let[i,a]=(0,U.useState)(r),o;t[2]===e?o=t[3]:(o=function(){let t=n.current?.value??e.comment.body;if(x(f(t))){if(e.isDraft===!0){e.onCloseDraft?.();return}e.onResolveComment?.({...e.comment,body:t}),a(!1),e.onCloseDraft?.();return}e.onSaveComment?.({...e.comment,body:f(t)}),a(!1),e.onCloseDraft?.()},t[2]=e,t[3]=o);let s=o;if(i){let r;t[4]===e.comment.source?r=t[5]:(r=(0,q.jsx)(`div`,{className:`border-border bg-background text-muted-foreground inline-flex shrink-0 border p-1`,children:e.comment.source===`github`?(0,q.jsx)(il,{className:`size-3 shrink-0`}):(0,q.jsx)(an,{className:`size-3 shrink-0`})}),t[4]=e.comment.source,t[5]=r);let i;t[6]!==e||t[7]!==s?(i=t=>{t.key===`Escape`&&(t.preventDefault(),e.isDraft===!0?e.onCloseDraft?.():a(!1)),t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),s())},t[6]=e,t[7]=s,t[8]=i):i=t[8];let o;t[9]!==e.comment.body||t[10]!==i?(o=(0,q.jsx)(`div`,{className:`min-w-0`,children:(0,q.jsx)(`textarea`,{ref:n,autoFocus:!0,defaultValue:e.comment.body,placeholder:`Add comment`,className:`font-inherit block min-h-16 w-full resize-y border-0 bg-transparent p-0 text-inherit outline-none`,onClick:jh,onKeyDown:i})}),t[9]=e.comment.body,t[10]=i,t[11]=o):o=t[11];let c;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,q.jsx)(`div`,{}),t[12]=c):c=t[12];let l;return t[13]!==r||t[14]!==o?(l=(0,q.jsxs)(`div`,{className:`border-border/70 bg-muted/70 text-foreground box-border grid w-full max-w-full grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-2 border-y px-2 py-2`,children:[r,o,c]}),t[13]=r,t[14]=o,t[15]=l):l=t[15],l}if(e.comment.resolved===!0){let n;t[16]===e.comment.source?n=t[17]:(n=(0,q.jsx)(`div`,{className:`border-border bg-background text-muted-foreground inline-flex shrink-0 border p-1`,children:e.comment.source===`github`?(0,q.jsx)(il,{className:`size-3 shrink-0`}):(0,q.jsx)(an,{className:`size-3 shrink-0`})}),t[16]=e.comment.source,t[17]=n);let r;t[18]===e.comment.body?r=t[19]:(r=(0,q.jsx)(`span`,{className:`decoration-muted-foreground/60 min-w-0 truncate line-through`,children:e.comment.body}),t[18]=e.comment.body,t[19]=r);let i;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,q.jsx)(`div`,{}),t[20]=i):i=t[20];let a;return t[21]!==n||t[22]!==r?(a=(0,q.jsxs)(`div`,{className:`text-muted-foreground bg-muted/70 border-border/60 box-border grid w-full max-w-full grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 border-y px-2 py-1 opacity-75`,children:[n,r,i]}),t[21]=n,t[22]=r,t[23]=a):a=t[23],a}let c;t[24]===e.comment.source?c=t[25]:(c=(0,q.jsx)(`div`,{className:`border-border bg-background text-muted-foreground inline-flex shrink-0 border p-1`,children:e.comment.source===`github`?(0,q.jsx)(il,{className:`size-3 shrink-0`}):(0,q.jsx)(an,{className:`size-3 shrink-0`})}),t[24]=e.comment.source,t[25]=c);let l;t[26]===e.comment.source?l=t[27]:(l=t=>{t.stopPropagation(),e.comment.source!==`github`&&a(!0)},t[26]=e.comment.source,t[27]=l);let u;t[28]===e.comment.body?u=t[29]:(u=(0,q.jsx)(Sh,{className:`text-inherit`,children:e.comment.body}),t[28]=e.comment.body,t[29]=u);let d;t[30]!==l||t[31]!==u?(d=(0,q.jsx)(`button`,{type:`button`,className:`min-w-0 bg-transparent p-0 text-left`,onClick:l,children:u}),t[30]=l,t[31]=u,t[32]=d):d=t[32];let p;t[33]===e.comment?p=t[34]:(p=t=>{t.stopPropagation(),navigator.clipboard.writeText(Dh(e.comment))},t[33]=e.comment,t[34]=p);let m;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,q.jsx)(nn,{className:`size-3`}),t[35]=m):m=t[35];let h;t[36]===p?h=t[37]:(h=(0,q.jsx)(`button`,{type:`button`,className:`hover:bg-muted hover:text-foreground p-1`,"aria-label":`Copy comment`,title:`Copy comment`,onClick:p,children:m}),t[36]=p,t[37]=h);let g;t[38]===e?g=t[39]:(g=e.onResolveComment&&(0,q.jsx)(`button`,{type:`button`,className:`border-border hover:bg-muted hover:text-foreground border-l p-1`,"aria-label":`Resolve comment`,title:`Resolve comment`,disabled:e.comment.resolving,onClick:t=>{t.stopPropagation(),e.onResolveComment?.(e.comment)},children:e.comment.resolving===!0?(0,q.jsx)(F,{className:`size-3`}):(0,q.jsx)(ze,{className:`size-3`})}),t[38]=e,t[39]=g);let _;t[40]!==h||t[41]!==g?(_=(0,q.jsxs)(`div`,{className:`border-border bg-background text-muted-foreground inline-flex shrink-0 border text-xs`,children:[h,g]}),t[40]=h,t[41]=g,t[42]=_):_=t[42];let v;return t[43]!==_||t[44]!==c||t[45]!==d?(v=(0,q.jsxs)(`div`,{className:`border-border/70 bg-muted/70 text-foreground box-border grid w-full max-w-full grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-2 border-y px-2 py-2`,children:[c,d,_]}),t[43]=_,t[44]=c,t[45]=d,t[46]=v):v=t[46],v}function jh(e){e.stopPropagation()}function Mh(e){let t=(0,rl.c)(27),n=(0,U.useRef)(null),r=(0,U.useRef)(null),i=(0,U.useRef)(null),[a,o]=(0,U.useState)(),s=`${e.filePath}\u0000${e.patch}`,c;t[0]===s?c=t[1]:(c=()=>({key:s,mode:`diff`}),t[0]=s,t[1]=c);let[l,u]=(0,U.useState)(c),d=l.key===s?l.mode:`diff`,f,p;t[2]!==e.filePath||t[3]!==e.patch?(f=De(e.filePath),p=li(ci(e.patch),f),t[2]=e.filePath,t[3]=e.patch,t[4]=f,t[5]=p):(f=t[4],p=t[5]);let m=p,h=e.comments??[],g=a?ve(h,a):h,v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>{n.current?.focus()},t[6]=v):v=t[6];let y;t[7]!==d||t[8]!==e.filePath||t[9]!==e.patch?(y=[d,e.filePath,e.patch],t[7]=d,t[8]=e.filePath,t[9]=e.patch,t[10]=y):y=t[10],(0,U.useEffect)(v,y);let b;t[11]===d?b=t[12]:(b=()=>{P(n.current)||P(i.current)||kh(n.current,i.current,d)&&(i.current=null)},t[11]=d,t[12]=b);let x;t[13]!==d||t[14]!==e.fileContent?(x=[d,e.fileContent],t[13]=d,t[14]=e.fileContent,t[15]=x):x=t[15],(0,U.useLayoutEffect)(b,x);let S;t[16]===s?S=t[17]:(S=function(){if(P(n.current))return;let e=n.current.getBoundingClientRect(),t=P(r.current)?e.top+e.height/2:Math.min(Math.max(r.current,e.top),e.bottom);i.current=Oh(n.current,t)??null,u(e=>({key:s,mode:e.key===s&&e.mode===`file`?`diff`:`file`}))},t[16]=s,t[17]=S);let C=S,w;t[18]===C?w=t[19]:(w=e=>{e.preventDefault(),C()},t[18]=C,t[19]=w);let T;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(T={preventDefault:!1,target:n},t[20]=T):T=t[20],cr(`Tab`,w,T);let E=function(t){e.onSaveComment&&(a&&Eh(a,{filePath:e.filePath,lineNumber:t.lineNumber,side:t.side})||a||ae(h,n=>Eh(n,{filePath:e.filePath,lineNumber:t.lineNumber,side:t.side}))||o({body:``,filePath:e.filePath,lineNumber:t.lineNumber,side:t.side===`deletions`?t.side:void 0}))},D,O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{r.current=e.clientY},O=e=>{r.current=e.clientY,e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLButtonElement||e.currentTarget.focus()},t[21]=D,t[22]=O):(D=t[21],O=t[22]);let ee=d===`diff`?(0,q.jsx)(nl,{fileDiff:m,options:{diffIndicators:`bars`,diffStyle:`unified`,disableBackground:!1,disableFileHeader:!0,disableLineNumbers:!1,lineDiffType:`word-alt`,onLineNumberClick:e=>{E({lineNumber:e.lineNumber,side:e.annotationSide})},overflow:`scroll`,theme:Me,themeType:`system`,unsafeCSS:Th},lineAnnotations:pe(g,Fh),renderAnnotation:t=>(0,q.jsx)(Ah,{comment:t.metadata,isDraft:a&&Eh(t.metadata,a),onSaveComment:e.onSaveComment,onResolveComment:e.onResolveComment,onCloseDraft:()=>{o(void 0)}})},e.patch):(0,q.jsx)(tc,{file:{contents:e.fileContent??``,lang:f,name:e.filePath},options:{disableFileHeader:!0,disableLineNumbers:!1,onLineNumberClick:e=>{E({lineNumber:e.lineNumber})},overflow:`scroll`,theme:Me,themeType:`system`,unsafeCSS:Th},lineAnnotations:pe(_(g,Ph),Nh),renderAnnotation:t=>(0,q.jsx)(Ah,{comment:t.metadata,isDraft:a&&Eh(t.metadata,a),onSaveComment:e.onSaveComment,onResolveComment:e.onResolveComment,onCloseDraft:()=>{o(void 0)}})},e.filePath),k;return t[23]!==D||t[24]!==O||t[25]!==ee?(k=(0,q.jsx)(`section`,{ref:n,tabIndex:-1,"aria-label":`Diff viewer`,className:`bg-background block h-full min-h-0 w-full overflow-auto rounded-none outline-none select-text`,onPointerMoveCapture:D,onPointerDownCapture:O,children:ee}),t[23]=D,t[24]=O,t[25]=ee,t[26]=k):k=t[26],k}function Nh(e){return{lineNumber:e.lineNumber,metadata:e}}function Ph(e){return e.side!==`deletions`}function Fh(e){return{lineNumber:e.lineNumber,metadata:e,side:e.side??`additions`}}var Ih=Ze(e=>z.runtime.atom(o(z,d(t=>t(`review.metadata`,{cwd:e})),tt)));function Lh(e){return e._tag===`commit`?`commit\u0000${e.hash}`:e._tag}function Rh(e,t=``){return b(e).pipe(T(`commit`,()=>nt.make({hash:t})),T(`local`,()=>st.make({})),T(`branch`,()=>R.make({})),g(()=>ot.make({})))}var zh=Ze(e=>{let t=e.split(`\0`),n=t[0]??``,r=Rh(t[1]??`changes`,t[2]??``);return z.runtime.atom(o(z,d(e=>e(`review.diffs`,{cwd:n,target:r})),tt))}),Bh=Ze(e=>z.runtime.atom(o(z,d(t=>t(`review.state`,{cwd:e})),tt))),Vh=et.make({comments:v(),marks:v()}),Hh=Ze(e=>Je(Bh(e),e=>We(e)?e.value:Vh)),Uh=Ze(()=>Ye(qe(()=>({generatingMessage:!1,publishing:!1})))),Wh=Ze(e=>$e(Uh(e),{fn:z.runtime.fn()(ge(`DiffPage.generatePublishMessage`)(function*(t){return yield*(yield*z)(`publish.message.generate`,{cwd:e})})),reducer:e=>({...e,generatingMessage:!0})})),Gh=Ze(e=>$e(Uh(e),{fn:z.runtime.fn()(ge(`DiffPage.approvePublish`)(function*(t){return yield*(yield*z)(`publish.approve`,{cwd:e,message:t})})),reducer:e=>({...e,publishing:!0})})),Kh=Ze(()=>Ye(qe(()=>({resolving:l(),resolvingAll:!1})))),qh=Ze(e=>$e(Kh(e),{fn:z.runtime.fn()(ge(`DiffPage.resolveComment`)(function*(t){yield*(yield*z)(`review.comments.resolve`,{cwd:e,filePath:t.comment.filePath,lineNumber:t.comment.lineNumber,side:t.comment.side,threadId:t.comment.threadId})})),reducer:(e,t)=>({resolving:ye(e.resolving,ct.make(t.comment)),resolvingAll:e.resolvingAll})})),Jh=Ze(e=>$e(Kh(e),{fn:z.runtime.fn()(ge(`DiffPage.resolveComments`)(function*(t){let n=yield*z;yield*o(t,O((e,t)=>se(e.comment.threadId)&&e.comment.threadId===t.comment.threadId),u(t=>n(`review.comments.resolve`,{cwd:e,filePath:t.comment.filePath,lineNumber:t.comment.lineNumber,side:t.comment.side,threadId:t.comment.threadId})))})),reducer:(e,t)=>({resolving:o(t,I(e.resolving,(e,t)=>ye(e,ct.make(t.comment)))),resolvingAll:!0})}));function Yh(e){return o(e,I(j(),(e,t)=>y(e,t.filePath,o(p(e,t.filePath),de(()=>v()),ve(t)))),e=>M(e),pe(e=>({comments:e[1],filePath:e[0]})))}async function Xh(e){try{await navigator.clipboard.writeText(o(e,pe(Dh),he(`
219
221
 
220
- `)))}catch{je.error(`Failed to copy comments.`)}}function vm(){let e=(0,qc.c)(4),t=tt.useParams(),n;e[0]===t.worktree?n=e[1]:(n=Ze(t.worktree),e[0]=t.worktree,e[1]=n);let r=Ue(n);if(!r.value.activeWorktree)return;let i;return e[2]===r.value.activeWorktree.root?i=e[3]:(i=(0,J.jsx)(ym,{cwd:r.value.activeWorktree.root},r.value.activeWorktree.root),e[2]=r.value.activeWorktree.root,e[3]=i),i}function ym(e){let t=(0,qc.c)(134),n=tt.useNavigate(),r=tt.useSearch(),i;t[0]===e.cwd?i=t[1]:(i=rm(e.cwd),t[0]=e.cwd,t[1]=i);let a=Re(i),o;t[2]===e.cwd?o=t[3]:(o=lm(e.cwd),t[2]=e.cwd,t[3]=o);let c=Re(o),l=c.comments,u=(0,W.useState)(!1),d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d={_tag:`changes`},t[4]=d):d=t[4];let f=(0,W.useState)(d);if(Le(a))throw a.cause;let p;t[5]===a?p=t[6]:(p=Je(a),t[5]=a,t[6]=p);let m=p,h,g,_;if(t[7]!==r||t[8]!==a||t[9]!==m){g=m?a.value.localCommits:y(),h=m?a.value.branchCommits:y();let e=re(g,h),n;t[13]===r?n=t[14]:(n=e=>e.hash===r.commit,t[13]=r,t[14]=n),_=L(e,s(n),j),t[7]=r,t[8]=a,t[9]=m,t[10]=h,t[11]=g,t[12]=_}else h=t[10],g=t[11],_=t[12];let v=_,b;t[15]!==v||t[16]!==f?(b=v?{_tag:`commit`,hash:v.hash}:f[0],t[15]=v,t[16]=f,t[17]=b):b=t[17];let C=b,w=e.cwd,T;t[18]===C?T=t[19]:(T=im(C),t[18]=C,t[19]=T);let O=`${w}\u0000${T}`,M;t[20]===O?M=t[21]:(M=om(O),t[20]=O,t[21]=M);let N=M,P=(0,W.useState)(``),ie=Re(N),F=ie._tag===`Success`,I=F?ie.value:y(),oe=F&&!D(I),le=ae(P[0])&&ue(I,e=>e.filePath===P[0])?P[0]:``,R=(ae(le)?L(I,s(e=>e.filePath===le),j):void 0)??I[0],de=et(N),pe;t[22]===e.cwd?pe=t[23]:(pe=sm(e.cwd),t[22]=e.cwd,t[23]=pe);let me=et(pe),ge,_e;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ge=z.mutation(`review.comments.save`),_e={mode:`promise`},t[24]=ge,t[25]=_e):(ge=t[24],_e=t[25]);let ye=Ge(ge,_e),be;t[26]===e.cwd?be=t[27]:(be=mm(e.cwd),t[26]=e.cwd,t[27]=be);let xe;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(xe={mode:`promise`},t[28]=xe):xe=t[28];let Se=Ge(be,xe),Te;t[29]===e.cwd?Te=t[30]:(Te=hm(e.cwd),t[29]=e.cwd,t[30]=Te);let Ee;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(Ee={mode:`promise`},t[31]=Ee):Ee=t[31];let Oe=Ge(Te,Ee),ke;t[32]===e.cwd?ke=t[33]:(ke=pm(e.cwd),t[32]=e.cwd,t[33]=ke);let Ae=Re(ke),Ie,ze;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=z.mutation(`review.state.mark`),ze={mode:`promise`},t[34]=Ie,t[35]=ze):(Ie=t[34],ze=t[35]);let Be=Ge(Ie,ze),Ve,He;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=z.mutation(`review.state.unmark`),He={mode:`promise`},t[36]=Ve,t[37]=He):(Ve=t[36],He=t[37]);let Ue=Ge(Ve,He),Ye;t[38]===Ae?Ye=t[39]:(Ye=e=>({...e,resolved:e.resolved===!0,resolving:Ae.resolvingKeys.has(qe(e)),source:e.source??`local`}),t[38]=Ae,t[39]=Ye);let Xe=A(l,Ye),Ze=fe(Xe,wm),Qe=A(Ze,Cm),$e=gm(Ze),B=R?fe(Xe,e=>e.filePath===R.filePath):y(),nt=new Set(L(I,E(xm))),V=fe(c.marks,e=>nt.has(Ke(e))),H;t[40]!==e.cwd||t[41]!==Be?(H=async function(t){try{await Be({payload:{cwd:e.cwd,marks:t}})}catch{je.error(`Failed to mark file reviewed.`)}},t[40]=e.cwd,t[41]=Be,t[42]=H):H=t[42];let U=H,rt;t[43]!==e.cwd||t[44]!==Ue?(rt=async function(t){try{await Ue({payload:{cwd:e.cwd,marks:t}})}catch{je.error(`Failed to unmark file reviewed.`)}},t[43]=e.cwd,t[44]=Ue,t[45]=rt):rt=t[45];let it=rt,at;t[46]!==U||t[47]!==I||t[48]!==P?(at=function(e){P[1](e);let t=L(I,s(t=>t.filePath===e),te(We),ne(bm));D(t)||U(t)},t[46]=U,t[47]=I,t[48]=P,t[49]=at):at=t[49];let ot=at,st;t[50]!==n||t[51]!==P||t[52]!==f?(st=function(e){(0,W.startTransition)(()=>{n({search:e._tag===`commit`?{commit:e.hash}:{}})}),e._tag!==`commit`&&f[1](e),P[1](``)},t[50]=n,t[51]=P,t[52]=f,t[53]=st):st=t[53];let ct=st,lt;t[54]!==de||t[55]!==me?(lt=function(){de(),me()},t[54]=de,t[55]=me,t[56]=lt):lt=t[56];let ut=lt,dt;t[57]!==e.cwd||t[58]!==ye?(dt=async function(t){try{await ye({payload:{comment:t,cwd:e.cwd}})}catch{je.error(`Failed to save comment.`)}},t[57]=e.cwd,t[58]=ye,t[59]=dt):dt=t[59];let ft=dt,pt;t[60]!==me||t[61]!==Se?(pt=async function(e){try{await Se({comment:e,key:qe(e)}),e.source===`github`&&me()}catch{je.error(e.source===`github`?`Failed to resolve GitHub thread.`:`Failed to resolve comment.`)}},t[60]=me,t[61]=Se,t[62]=pt):pt=t[62];let mt=pt,ht;t[63]!==me||t[64]!==Oe?(ht=async function(e){try{await Oe(e),me()}catch{je.error(`Failed to resolve comment.`)}},t[63]=me,t[64]=Oe,t[65]=ht):ht=t[65];let gt=ht,_t;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(_t={key:`?`,shift:!0},t[66]=_t):_t=t[66];let vt;t[67]===u?vt=t[68]:(vt=()=>{u[1](!0)},t[67]=u,t[68]=vt),Qn(_t,vt);let yt;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(yt=(0,J.jsx)(he,{children:(0,J.jsx)(we,{children:`Shortcuts`})}),t[69]=yt):yt=t[69];let bt;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,J.jsxs)(Ce,{children:[yt,(0,J.jsx)(`div`,{className:`grid gap-2`,children:(0,J.jsxs)(`div`,{className:`grid grid-cols-[96px_minmax(0,1fr)] gap-3`,children:[(0,J.jsx)(`kbd`,{className:`border px-1.5 py-0.5 text-center`,children:`?`}),(0,J.jsx)(`span`,{children:`Show shortcuts`})]})})]}),t[70]=bt):bt=t[70];let xt;t[71]!==u[0]||t[72]!==u[1]?(xt=(0,J.jsx)(De,{open:u[0],onOpenChange:u[1],children:bt}),t[71]=u[0],t[72]=u[1],t[73]=xt):xt=t[73];let St=Pe,Ct=e.cwd,wt=m&&a.value.dirty,Tt=!m,Et=m?a.value.prUrl:void 0,Dt=m&&a.value.unpushedCommits,Ot;t[74]===g?Ot=t[75]:(Ot=k(g),t[74]=g,t[75]=Ot);let kt=m?a.value.upstream:void 0,At;t[76]!==oe||t[77]!==e.cwd||t[78]!==ut||t[79]!==wt||t[80]!==Tt||t[81]!==Et||t[82]!==Dt||t[83]!==Ot||t[84]!==kt?(At=(0,J.jsx)(Tm,{cwd:Ct,dirty:wt,hasReviewableChanges:oe,loading:Tt,prUrl:Et,refreshReview:ut,unpushedCommits:Dt,unpushedCount:Ot,upstream:kt}),t[76]=oe,t[77]=e.cwd,t[78]=ut,t[79]=wt,t[80]=Tt,t[81]=Et,t[82]=Dt,t[83]=Ot,t[84]=kt,t[85]=At):At=t[85];let jt;t[86]!==U||t[87]!==ot||t[88]!==F||t[89]!==I||t[90]!==R||t[91]!==it||t[92]!==V?(jt=(0,J.jsx)(Ne,{defaultSize:`55%`,minSize:`15%`,children:(0,J.jsx)(`div`,{className:`h-full min-h-0`,children:F?(0,J.jsx)(km,{diffs:I,marks:V,markReviewed:e=>{U(e)},unmarkReviewed:e=>{it(e)},selectedEntry:R,openReviewEntry:ot}):(0,J.jsx)(`div`,{className:`flex h-full min-h-0`,children:(0,J.jsx)(ce,{})})})}),t[86]=U,t[87]=ot,t[88]=F,t[89]=I,t[90]=R,t[91]=it,t[92]=V,t[93]=jt):jt=t[93];let Mt;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(Mt=(0,J.jsx)(Fe,{}),t[94]=Mt):Mt=t[94];let Nt=!m,Pt;t[95]===ct?Pt=t[96]:(Pt=e=>{ct({_tag:`commit`,hash:e.hash})},t[95]=ct,t[96]=Pt);let Ft;t[97]!==h||t[98]!==g||t[99]!==C||t[100]!==ct||t[101]!==Nt||t[102]!==Pt?(Ft=(0,J.jsx)(Ne,{defaultSize:`45%`,minSize:`15%`,children:(0,J.jsx)(`div`,{className:`h-full min-h-0`,children:(0,J.jsx)(Em,{branchCommits:h,loading:Nt,localCommits:g,selected:C,selectCommit:Pt,selectScope:ct})})}),t[97]=h,t[98]=g,t[99]=C,t[100]=ct,t[101]=Nt,t[102]=Pt,t[103]=Ft):Ft=t[103];let It;t[104]!==jt||t[105]!==Ft?(It=(0,J.jsxs)(Pe,{orientation:`vertical`,className:`min-h-0 flex-1`,children:[jt,Mt,Ft]}),t[104]=jt,t[105]=Ft,t[106]=It):It=t[106];let Lt;t[107]!==At||t[108]!==It?(Lt=(0,J.jsx)(Ne,{defaultSize:`34%`,minSize:`24%`,maxSize:`46%`,children:(0,J.jsxs)(`div`,{className:`flex h-full flex-col border-r`,children:[At,It]})}),t[107]=At,t[108]=It,t[109]=Lt):Lt=t[109];let Rt;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=(0,J.jsx)(Fe,{}),t[110]=Rt):Rt=t[110];let zt=Ne,Bt;t[111]===F?Bt=t[112]:(Bt=!F&&(0,J.jsx)(`div`,{className:`flex h-full min-h-0`,children:(0,J.jsx)(ce,{})}),t[111]=F,t[112]=Bt);let Vt;t[113]!==F||t[114]!==I?(Vt=F&&D(I)&&(0,J.jsx)(`div`,{className:`text-muted-foreground flex h-full items-center justify-center text-sm`,children:`No changed files.`}),t[113]=F,t[114]=I,t[115]=Vt):Vt=t[115];let Ht=F&&R&&(0,J.jsx)(`div`,{className:`h-full min-h-0 min-w-0`,children:(0,J.jsx)($p,{filePath:R.filePath,fileContent:R.fileContent,patch:R.patch,comments:B,onSaveComment:e=>{ft({body:e.body,filePath:e.filePath,lineNumber:e.lineNumber,resolved:!1,side:e.side})},onResolveComment:e=>{mt({...e,resolved:e.resolved===!0,source:e.source??`local`})}})}),Ut;t[116]!==Bt||t[117]!==Vt||t[118]!==Ht?(Ut=(0,J.jsxs)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:[Bt,Vt,Ht]}),t[116]=Bt,t[117]=Vt,t[118]=Ht,t[119]=Ut):Ut=t[119];let Wt=!D(Ze)&&(0,J.jsxs)(`footer`,{className:`grid min-h-8 grid-cols-[minmax(0,1fr)_auto] items-center gap-2 border-t px-2`,children:[(0,J.jsx)(`div`,{className:`flex min-w-0 items-center gap-1 overflow-hidden`,children:A($e,e=>(0,J.jsxs)(ee,{type:`button`,variant:`outline`,size:`xs`,"aria-label":`Open ${e.filePath}`,title:e.filePath,onClick:()=>{ot(e.filePath)},children:[(0,J.jsx)(ve,{filePath:e.filePath}),(0,J.jsx)(`span`,{className:`max-w-32 truncate`,children:L(x(`/`)(e.filePath),se,ne(()=>e.filePath))})]},e.filePath))}),(0,J.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-1`,children:[(0,J.jsx)(ee,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Copy all comments`,title:`Copy all comments`,disabled:D(Ze),onClick:()=>{_m(Ze)},children:(0,J.jsx)(Kt,{})}),(0,J.jsx)(ee,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Resolve all comments`,title:`Resolve all comments`,disabled:Ae.resolvingAll?!0:D(Qe),onClick:()=>{gt(Qe)},children:Ae.resolvingAll?(0,J.jsx)(S,{className:`size-2.5 border opacity-60`}):(0,J.jsx)(Me,{})})]})]}),Gt;t[120]!==Ut||t[121]!==Wt?(Gt=(0,J.jsxs)(`div`,{className:`bg-background flex h-full min-w-0 flex-col overflow-hidden`,children:[Ut,Wt]}),t[120]=Ut,t[121]=Wt,t[122]=Gt):Gt=t[122];let qt;t[123]!==zt||t[124]!==Gt?(qt=(0,J.jsx)(zt,{defaultSize:`66%`,minSize:`54%`,children:Gt}),t[123]=zt,t[124]=Gt,t[125]=qt):qt=t[125];let Jt;t[126]!==St||t[127]!==Lt||t[128]!==Rt||t[129]!==qt?(Jt=(0,J.jsxs)(St,{orientation:`horizontal`,children:[Lt,Rt,qt]}),t[126]=St,t[127]=Lt,t[128]=Rt,t[129]=qt,t[130]=Jt):Jt=t[130];let Yt;return t[131]!==xt||t[132]!==Jt?(Yt=(0,J.jsxs)(J.Fragment,{children:[xt,Jt]}),t[131]=xt,t[132]=Jt,t[133]=Yt):Yt=t[133],Yt}function bm(){return y()}function xm(e){return A(e.segments,Sm)}function Sm(e){return Ke({filePath:e.filePath,fingerprint:e.fingerprint})}function Cm(e){return{comment:e,key:qe(e)}}function wm(e){return!e.resolved}function Tm(e){let t=(0,qc.c)(78),n=(0,W.useState)(``),r;t[0]===e.cwd?r=t[1]:(r=um(e.cwd),t[0]=e.cwd,t[1]=r);let i=Re(r),o;t[2]===e.cwd?o=t[3]:(o=dm(e.cwd),t[2]=e.cwd,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={mode:`promise`},t[4]=s):s=t[4];let c=Ge(o,s),l;t[5]===e.cwd?l=t[6]:(l=fm(e.cwd),t[5]=e.cwd,t[6]=l);let f;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f={mode:`promise`},t[7]=f):f=t[7];let p=Ge(l,f),m,h,g,v,y,b,w;if(t[8]!==i.generatingMessage||t[9]!==i.publishing||t[10]!==n[0]||t[11]!==e.dirty||t[12]!==e.hasReviewableChanges||t[13]!==e.loading||t[14]!==e.unpushedCommits){w=L(n[0],d);let r=e.dirty&&C(w);g=e.loading||i.publishing||(e.dirty?!e.hasReviewableChanges:!e.unpushedCommits)||r,m=e.loading||i.generatingMessage||i.publishing||!e.dirty||!e.hasReviewableChanges;let a=`No changes`;e.loading?a=`Loading`:e.dirty&&(a=`Generate commit message`);let o=x(/\r?\n/)(w),s=d(o[0]);h=L(u(o,1),_(`
221
- `),d),v=a,ae(s)&&(v=s),i.generatingMessage&&(v=`Generating commit message`),y=C(s)||i.generatingMessage,b=ae(h)&&!i.generatingMessage,t[8]=i.generatingMessage,t[9]=i.publishing,t[10]=n[0],t[11]=e.dirty,t[12]=e.hasReviewableChanges,t[13]=e.loading,t[14]=e.unpushedCommits,t[15]=m,t[16]=h,t[17]=g,t[18]=v,t[19]=y,t[20]=b,t[21]=w}else m=t[15],h=t[16],g=t[17],v=t[18],y=t[19],b=t[20],w=t[21];let T=b,E;t[22]!==p||t[23]!==n||t[24]!==e||t[25]!==g||t[26]!==w?(E=async function(){if(!g)try{await p(w),n[1](``),e.refreshReview()}catch(e){let t=e;je.error(a(t))}},t[22]=p,t[23]=n,t[24]=e,t[25]=g,t[26]=w,t[27]=E):E=t[27];let D=E,O;t[28]!==n||t[29]!==m||t[30]!==c?(O=async function(){if(!m)try{n[1](await c(null))}catch(e){let t=e;je.error(a(t))}},t[28]=n,t[29]=m,t[30]=c,t[31]=O):O=t[31];let k=O,A;t[32]!==e.unpushedCommits||t[33]!==e.unpushedCount||t[34]!==e.upstream?(A=e.upstream!==void 0&&(e.upstream.ahead>0||e.upstream.behind>0)?(0,J.jsxs)(`span`,{className:`text-muted-foreground px-0.5 text-xs`,title:`${e.upstream.ahead} ahead, ${e.upstream.behind} behind upstream`,children:[`↑`,e.upstream.ahead,` ↓`,e.upstream.behind]}):e.unpushedCommits&&(0,J.jsxs)(`span`,{className:`text-muted-foreground px-0.5 text-xs`,title:e.unpushedCount>0?`${e.unpushedCount} ${e.unpushedCount===1?`commit`:`commits`} to push`:`Unpushed commits`,children:[`↑`,e.unpushedCount>0?e.unpushedCount:``]}),t[32]=e.unpushedCommits,t[33]=e.unpushedCount,t[34]=e.upstream,t[35]=A):A=t[35];let j;t[36]===k?j=t[37]:(j=()=>{k()},t[36]=k,t[37]=j);let te;t[38]===i.generatingMessage?te=t[39]:(te=i.generatingMessage?(0,J.jsx)(S,{className:`size-2.5 border opacity-60`}):(0,J.jsx)(Gt,{}),t[38]=i.generatingMessage,t[39]=te);let M;t[40]!==m||t[41]!==te||t[42]!==j?(M=(0,J.jsx)(ee,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`size-4`,"aria-label":`Generate commit message`,title:`Generate commit message`,disabled:m,onClick:j,children:te}),t[40]=m,t[41]=te,t[42]=j,t[43]=M):M=t[43];let N;t[44]===i.publishing?N=t[45]:(N=i.publishing?(0,J.jsx)(S,{className:`size-2.5 border opacity-60`}):(0,J.jsx)(Xt,{}),t[44]=i.publishing,t[45]=N);let ne;t[46]!==g||t[47]!==N?(ne=(0,J.jsx)(ee,{type:`submit`,variant:`ghost`,size:`icon-xs`,className:`size-4`,"aria-label":`Publish`,title:`Commit, push, and open a draft PR`,disabled:g,children:N}),t[46]=g,t[47]=N,t[48]=ne):ne=t[48];let P;t[49]!==e.loading||t[50]!==e.prUrl?(P=e.loading?(0,J.jsx)(`span`,{className:`text-muted-foreground flex size-4 items-center justify-center`,children:(0,J.jsx)(S,{className:`size-2.5 border opacity-60`})}):ae(e.prUrl??``)&&(0,J.jsx)(ee,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`size-4`,"aria-label":`Open pull request`,title:`Open pull request`,onClick:()=>{window.open(e.prUrl,`_blank`,`noopener,noreferrer`)},children:(0,J.jsx)(Ie,{})}),t[49]=e.loading,t[50]=e.prUrl,t[51]=P):P=t[51];let re;t[52]!==M||t[53]!==ne||t[54]!==P||t[55]!==A?(re=(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[A,M,ne,P]}),t[52]=M,t[53]=ne,t[54]=P,t[55]=A,t[56]=re):re=t[56];let ie=re,I;t[57]===D?I=t[58]:(I=e=>{e.preventDefault(),D()},t[57]=D,t[58]=I);let oe=v,se=y&&`text-muted-foreground`,ce;t[59]===se?ce=t[60]:(ce=F(`min-w-0 flex-1 truncate px-2 py-1.5`,se),t[59]=se,t[60]=ce);let le;t[61]!==v||t[62]!==ce?(le=(0,J.jsx)(`span`,{title:oe,className:ce,children:v}),t[61]=v,t[62]=ce,t[63]=le):le=t[63];let ue;t[64]===ie?ue=t[65]:(ue=(0,J.jsx)(`div`,{className:`border-input flex shrink-0 items-center border-l px-1.5`,children:ie}),t[64]=ie,t[65]=ue);let R;t[66]!==le||t[67]!==ue?(R=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-stretch`,children:[le,ue]}),t[66]=le,t[67]=ue,t[68]=R):R=t[68];let de;t[69]!==h||t[70]!==T?(de=T&&(0,J.jsx)(`div`,{className:`bg-muted/30 text-muted-foreground border-t px-2 py-1.5`,children:(0,J.jsx)(`div`,{className:`max-h-32 overflow-y-auto`,children:(0,J.jsx)(`span`,{className:`whitespace-pre-wrap`,children:h})})}),t[69]=h,t[70]=T,t[71]=de):de=t[71];let fe;t[72]!==R||t[73]!==de?(fe=(0,J.jsxs)(`div`,{className:`border-input min-w-0 border font-mono text-xs leading-4 select-text`,children:[R,de]}),t[72]=R,t[73]=de,t[74]=fe):fe=t[74];let pe;return t[75]!==I||t[76]!==fe?(pe=(0,J.jsx)(`form`,{className:`border-b p-2`,onSubmit:I,children:fe}),t[75]=I,t[76]=fe,t[77]=pe):pe=t[77],pe}function Em(e){let t=(0,qc.c)(31),n;t[0]===e.localCommits?n=t[1]:(n=D(e.localCommits),t[0]=e.localCommits,t[1]=n);let r=!n,i;t[2]===e.branchCommits?i=t[3]:(i=D(e.branchCommits),t[2]=e.branchCommits,t[3]=i);let a=!i;if(e.loading){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center`,children:(0,J.jsx)(S,{className:`text-muted-foreground size-4 border opacity-60`})}),t[4]=e):e=t[4],e}let o;t[5]===e?o=t[6]:(o=function(t,n,r){let i=e.selected._tag===t._tag;return(0,J.jsx)(`li`,{className:`w-full min-w-0`,children:(0,J.jsxs)(`button`,{type:`button`,"aria-current":i?`page`:void 0,onClick:()=>{e.selectScope(t)},className:F(`text-secondary-foreground hover:bg-accent hover:text-accent-foreground bg-secondary grid h-6 w-full min-w-0 grid-cols-[minmax(0,1fr)_5rem] items-center gap-2 px-3 text-left`,i&&`bg-primary/15 text-primary`),children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),(0,J.jsx)(`span`,{className:`min-w-0 truncate text-right opacity-70`,children:r})]})})},t[5]=e,t[6]=o);let s=o,c;t[7]===e?c=t[8]:(c=function(t){let n=e.selected._tag===`commit`&&e.selected.hash===t.hash;return(0,J.jsx)(`li`,{className:`w-full min-w-0`,children:(0,J.jsxs)(`button`,{type:`button`,"aria-current":n?`page`:void 0,onClick:()=>{e.selectCommit(t)},className:F(`text-muted-foreground hover:bg-muted hover:text-foreground grid h-6 w-full min-w-0 grid-cols-[minmax(0,1fr)_5rem] items-center gap-2 px-3 text-left`,n&&`bg-primary/15 text-primary`),children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,J.jsx)(`span`,{children:t.subject})}),(0,J.jsx)(`span`,{className:`text-muted-foreground min-w-0 truncate text-right`,children:t.shortHash})]})},t.hash)},t[7]=e,t[8]=c);let l=c,u;t[9]===s?u=t[10]:(u=s({_tag:`changes`},`Changes`,`worktree`),t[9]=s,t[10]=u);let d;t[11]!==e.localCommits||t[12]!==s||t[13]!==r?(d=r&&s({_tag:`local`},`Local`,`${k(e.localCommits)}`),t[11]=e.localCommits,t[12]=s,t[13]=r,t[14]=d):d=t[14];let f;t[15]!==e.localCommits||t[16]!==l?(f=A(e.localCommits,l),t[15]=e.localCommits,t[16]=l,t[17]=f):f=t[17];let p;t[18]!==e.branchCommits||t[19]!==s||t[20]!==a?(p=a&&s({_tag:`branch`},`Branch`,`${k(e.branchCommits)}`),t[18]=e.branchCommits,t[19]=s,t[20]=a,t[21]=p):p=t[21];let m;t[22]!==e.branchCommits||t[23]!==l?(m=A(e.branchCommits,l),t[22]=e.branchCommits,t[23]=l,t[24]=m):m=t[24];let h;return t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m?(h=(0,J.jsx)(`div`,{className:`flex h-full min-h-0 flex-col`,children:(0,J.jsxs)(`ul`,{className:`min-h-0 flex-1 overflow-y-auto py-1`,children:[u,d,f,p,m]})}),t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h):h=t[30],h}function Dm(e){let t={children:y(),name:``,path:``,type:`directory`};for(let n of e){let e=n.filePath.split(`/`),r=t;for(let t of h(e,1)){let e=r.path?`${r.path}/${t}`:t,n=L(r.children,s(e=>e.name===t),j);if(n?.type===`directory`)r=n;else{let n={children:y(),name:t,path:e,type:`directory`};r.children.push(n),r=n}}r.children.push({diff:n,name:e.at(-1)??n.filePath,path:n.filePath,type:`file`})}return L(t.children,A(e=>e.type===`directory`?Om(e):e))}function Om(e){let t=e.children[0];return k(e.children)===1&&t?.type===`directory`?Om({children:t.children,name:`${e.name}/${t.name}`,path:t.path,type:`directory`}):e}function km(e){let t=(0,qc.c)(18),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=new Set,t[0]=n):n=t[0];let r=(0,W.useState)(n),a,o,s,c,l;if(t[1]!==r||t[2]!==e){let n=Dm(e.diffs),u=L(e.diffs,i(f(),jm)),d=new Set(A(e.marks,Ke)),p;t[8]===r?p=t[9]:(p=function(e){r[1](t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[8]=r,t[9]=p);let m=p;function h(t){if(t.type===`directory`){let e=r[0].has(t.path);return(0,J.jsxs)(`li`,{className:`w-full min-w-0`,children:[(0,J.jsx)(_e,{icon:(0,J.jsx)(qt,{}),onClick:()=>{m(t.path)},actions:(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:k(t.children)}),children:t.name}),!e&&(0,J.jsx)(`ul`,{className:`border-border/70 ml-[19px] flex flex-col border-l pl-2`,children:A(t.children,h)})]},t.path)}let n=L(u,g(t.diff.filePath),ne(Am)),i=Qe(n,d);return(0,J.jsx)(`li`,{className:`w-full min-w-0`,children:(0,J.jsx)(_e,{selected:e.selectedEntry?.filePath===t.diff.filePath,icon:(0,J.jsx)(ve,{filePath:t.diff.filePath,className:`size-3`}),actions:(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(Mm,{state:i,onClick:t=>{t.stopPropagation(),!D(n)&&(i===`checked`?e.unmarkReviewed(n):e.markReviewed(n))}}),(0,J.jsx)(Nm,{status:t.diff.status})]}),onClick:()=>{e.openReviewEntry(t.diff.filePath)},children:t.name})},t.path)}o=Ee,l=`h-full overflow-y-auto px-0 py-1`,a=xe,s=`min-h-0 flex-1 [&>ul]:min-h-0 [&>ul]:flex-1`,c=D(e.diffs)?(0,J.jsx)(`li`,{className:`text-muted-foreground flex flex-1 items-center justify-center px-2 py-2`,children:`No changed files.`}):A(n,h),t[1]=r,t[2]=e,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];let u;t[10]!==a||t[11]!==s||t[12]!==c?(u=(0,J.jsx)(a,{className:s,children:c}),t[10]=a,t[11]=s,t[12]=c,t[13]=u):u=t[13];let d;return t[14]!==o||t[15]!==l||t[16]!==u?(d=(0,J.jsx)(o,{className:l,children:u}),t[14]=o,t[15]=l,t[16]=u,t[17]=d):d=t[17],d}function Am(){return y()}function jm(e,t){return T(e,t.filePath,We(t))}function Mm(e){let t=(0,qc.c)(12),n=e.state===`indeterminate`?`mixed`:e.state===`checked`,r=e.state!==`unchecked`&&`border-primary bg-primary`,i;t[0]===r?i=t[1]:(i=F(`border-input text-primary-foreground flex size-3 shrink-0 items-center justify-center border`,r),t[0]=r,t[1]=i);let a;t[2]===e.state?a=t[3]:(a=e.state===`checked`&&(0,J.jsx)(pe,{className:`size-2.5`}),t[2]=e.state,t[3]=a);let o;t[4]===e.state?o=t[5]:(o=e.state===`indeterminate`&&(0,J.jsx)(Yt,{className:`size-2.5`}),t[4]=e.state,t[5]=o);let s;return t[6]!==e.onClick||t[7]!==n||t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,J.jsxs)(`button`,{type:`button`,"aria-checked":n,className:i,role:`checkbox`,onClick:e.onClick,children:[a,o]}),t[6]=e.onClick,t[7]=n,t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function Nm(e){return L(m(e.status),v(`added`,()=>(0,J.jsx)(`span`,{className:`text-emerald-600 dark:text-emerald-400`,children:`A`})),v(`deleted`,()=>(0,J.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:`D`})),v(`renamed`,()=>(0,J.jsx)(`span`,{className:`text-sky-600 dark:text-sky-400`,children:`R`})),l(()=>(0,J.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400`,children:`M`})))}export{vm as component};
222
+ `)))}catch{Re.error(`Failed to copy comments.`)}}function Zh(){let e=(0,rl.c)(4),t=ut.useParams(),n;e[0]===t.worktree?n=e[1]:(n=at(t.worktree),e[0]=t.worktree,e[1]=n);let r=rt(n);if(!r.value.activeWorktree)return;let i;return e[2]===r.value.activeWorktree.root?i=e[3]:(i=(0,q.jsx)(Qh,{cwd:r.value.activeWorktree.root},r.value.activeWorktree.root),e[2]=r.value.activeWorktree.root,e[3]=i),i}function Qh(e){let t=(0,rl.c)(134),n=ut.useNavigate(),r=ut.useSearch(),a;t[0]===e.cwd?a=t[1]:(a=Ih(e.cwd),t[0]=e.cwd,t[1]=a);let c=Xe(a),l;t[2]===e.cwd?l=t[3]:(l=Hh(e.cwd),t[2]=e.cwd,t[3]=l);let u=Xe(l),d=(0,U.useState)(!1),f=(0,U.useState)(ng);if(lt(c))throw c.cause;let p;t[4]===c?p=t[5]:(p=We(c),t[4]=c,t[5]=p);let g=p,y,b,x;if(t[6]!==r||t[7]!==f||t[8]!==c||t[9]!==g){b=g?c.value.localCommits:v(),y=g?c.value.branchCommits:v();let e=s(b,y),n;t[13]===r?n=t[14]:(n=e=>e.hash===r.commit,t[13]=r,t[14]=n);let i=o(e,ne(n),ue);x=i?nt.make({hash:i.hash}):f[0],t[6]=r,t[7]=f,t[8]=c,t[9]=g,t[10]=y,t[11]=b,t[12]=x}else y=t[10],b=t[11],x=t[12];let S=x,C=e.cwd,T;t[15]===S?T=t[16]:(T=Lh(S),t[15]=S,t[16]=T);let D=`${C}\u0000${T}`,O;t[17]===D?O=t[18]:(O=zh(D),t[17]=D,t[18]=O);let ee=O,A=(0,U.useState)(``),j=Xe(ee),M=We(j)?j.value:v(),N=E(A[0])&&ae(M,e=>e.filePath===A[0])?A[0]:``,P=(E(N)?o(M,ne(e=>e.filePath===N),ue):void 0)??M[0],ie=Qe(ee),oe;t[19]===e.cwd?oe=t[20]:(oe=Bh(e.cwd),t[19]=e.cwd,t[20]=oe);let se=Qe(oe),le,I;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(I=z.mutation(`review.comments.save`),le={mode:`promise`},t[21]=le,t[22]=I):(le=t[21],I=t[22]);let L=it(I,le),he;t[23]===e.cwd?he=t[24]:(he=qh(e.cwd),t[23]=e.cwd,t[24]=he);let ge;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ge={mode:`promise`},t[25]=ge):ge=t[25];let _e=it(he,ge),ve;t[26]===e.cwd?ve=t[27]:(ve=Jh(e.cwd),t[26]=e.cwd,t[27]=ve);let ye;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ye={mode:`promise`},t[28]=ye):ye=t[28];let be=it(ve,ye),xe;t[29]===e.cwd?xe=t[30]:(xe=Kh(e.cwd),t[29]=e.cwd,t[30]=xe);let Ce=Xe(xe),we,Ee;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(we=z.mutation(`review.state.mark`),Ee={mode:`promise`},t[31]=we,t[32]=Ee):(we=t[31],Ee=t[32]);let De=it(we,Ee),Oe,ke;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=z.mutation(`review.state.unmark`),ke={mode:`promise`},t[33]=Oe,t[34]=ke):(Oe=t[33],ke=t[34]);let Me=it(Oe,ke),Ne;t[35]===Ce?Ne=t[36]:(Ne=e=>({...e,resolved:e.resolved===!0,resolving:h(Ce.resolving,e),source:e.source??`local`}),t[35]=Ce,t[36]=Ne);let Fe=pe(u.comments,Ne),Ie=_(Fe,tg),Le=pe(Ie,eg),Ue=Yh(Ie),Ge=P?_(Fe,e=>e.filePath===P.filePath):v(),qe=o(M,te(Ke),k),Je=_(u.marks,e=>h(qe,e)),Ye;t[37]!==e.cwd||t[38]!==De?(Ye=async function(t){try{await De({payload:{cwd:e.cwd,marks:t}})}catch{Re.error(`Failed to mark file reviewed.`)}},t[37]=e.cwd,t[38]=De,t[39]=Ye):Ye=t[39];let Ze=Ye,$e;t[40]!==e.cwd||t[41]!==Me?($e=async function(t){try{await Me({payload:{cwd:e.cwd,marks:t}})}catch{Re.error(`Failed to unmark file reviewed.`)}},t[40]=e.cwd,t[41]=Me,t[42]=$e):$e=t[42];let et=$e,tt;t[43]!==Ze||t[44]!==M||t[45]!==A?(tt=function(e){A[1](e);let t=o(M,ne(t=>t.filePath===e),w(Ke),de($h));i(t)||Ze(t)},t[43]=Ze,t[44]=M,t[45]=A,t[46]=tt):tt=t[46];let R=tt,rt;t[47]!==n||t[48]!==A||t[49]!==f?(rt=function(e){(0,U.startTransition)(()=>{n({search:e._tag===`commit`?{commit:e.hash}:{}})}),e._tag!==`commit`&&f[1](e),A[1](``)},t[47]=n,t[48]=A,t[49]=f,t[50]=rt):rt=t[50];let at=rt,ot;t[51]!==ie||t[52]!==se?(ot=function(){ie(),se()},t[51]=ie,t[52]=se,t[53]=ot):ot=t[53];let st=ot,ct;t[54]!==e.cwd||t[55]!==L?(ct=async function(t){try{await L({payload:{comment:t,cwd:e.cwd}})}catch{Re.error(`Failed to save comment.`)}},t[54]=e.cwd,t[55]=L,t[56]=ct):ct=t[56];let B=ct,dt;t[57]!==se||t[58]!==_e?(dt=async function(e){try{await _e({comment:e}),e.source===`github`&&se()}catch{Re.error(e.source===`github`?`Failed to resolve GitHub thread.`:`Failed to resolve comment.`)}},t[57]=se,t[58]=_e,t[59]=dt):dt=t[59];let V=dt,H;t[60]!==se||t[61]!==be?(H=async function(e){try{await be(e),se()}catch{Re.error(`Failed to resolve comment.`)}},t[60]=se,t[61]=be,t[62]=H):H=t[62];let ft=H,pt;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(pt={key:`?`,shift:!0},t[63]=pt):pt=t[63];let mt;t[64]===d?mt=t[65]:(mt=()=>{d[1](!0)},t[64]=d,t[65]=mt),cr(pt,mt);let ht;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ht=(0,q.jsx)(Se,{children:(0,q.jsx)(je,{children:`Shortcuts`})}),t[66]=ht):ht=t[66];let gt;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,q.jsxs)(Ae,{children:[ht,(0,q.jsx)(`div`,{className:`grid gap-2`,children:(0,q.jsxs)(`div`,{className:`grid grid-cols-[96px_minmax(0,1fr)] gap-3`,children:[(0,q.jsx)(`kbd`,{className:`border px-1.5 py-0.5 text-center`,children:`?`}),(0,q.jsx)(`span`,{children:`Show shortcuts`})]})})]}),t[67]=gt):gt=t[67];let _t;t[68]!==d[0]||t[69]!==d[1]?(_t=(0,q.jsx)(Pe,{open:d[0],onOpenChange:d[1],children:gt}),t[68]=d[0],t[69]=d[1],t[70]=_t):_t=t[70];let vt=Ve,yt=e.cwd,bt=g&&c.value.dirty,xt;t[71]!==j||t[72]!==M?(xt=We(j)&&!i(M),t[71]=j,t[72]=M,t[73]=xt):xt=t[73];let St=!g,Ct=g?c.value.prUrl:void 0,wt=g&&c.value.unpushedCommits,Tt;t[74]===b?Tt=t[75]:(Tt=ce(b),t[74]=b,t[75]=Tt);let Et=g?c.value.upstream:void 0,Dt;t[76]!==e.cwd||t[77]!==st||t[78]!==bt||t[79]!==xt||t[80]!==St||t[81]!==Ct||t[82]!==wt||t[83]!==Tt||t[84]!==Et?(Dt=(0,q.jsx)(rg,{cwd:yt,dirty:bt,hasReviewableChanges:xt,loading:St,prUrl:Ct,refreshReview:st,unpushedCommits:wt,unpushedCount:Tt,upstream:Et}),t[76]=e.cwd,t[77]=st,t[78]=bt,t[79]=xt,t[80]=St,t[81]=Ct,t[82]=wt,t[83]=Tt,t[84]=Et,t[85]=Dt):Dt=t[85];let Ot;t[86]!==Ze||t[87]!==R||t[88]!==j||t[89]!==M||t[90]!==P||t[91]!==et||t[92]!==Je?(Ot=(0,q.jsx)(Be,{defaultSize:`55%`,minSize:`15%`,children:(0,q.jsx)(`div`,{className:`h-full min-h-0`,children:We(j)?(0,q.jsx)(mg,{diffs:M,marks:Je,markReviewed:e=>{Ze(e)},unmarkReviewed:e=>{et(e)},selectedEntry:P,openReviewEntry:R}):(0,q.jsx)(`div`,{className:`flex h-full min-h-0`,children:(0,q.jsx)(me,{})})})}),t[86]=Ze,t[87]=R,t[88]=j,t[89]=M,t[90]=P,t[91]=et,t[92]=Je,t[93]=Ot):Ot=t[93];let kt;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(kt=(0,q.jsx)(He,{}),t[94]=kt):kt=t[94];let At=!g,jt;t[95]===at?jt=t[96]:(jt=e=>{at(nt.make({hash:e.hash}))},t[95]=at,t[96]=jt);let Mt;t[97]!==y||t[98]!==b||t[99]!==S||t[100]!==at||t[101]!==At||t[102]!==jt?(Mt=(0,q.jsx)(Be,{defaultSize:`45%`,minSize:`15%`,children:(0,q.jsx)(`div`,{className:`h-full min-h-0`,children:(0,q.jsx)(ug,{branchCommits:y,loading:At,localCommits:b,selected:S,selectCommit:jt,selectScope:at})})}),t[97]=y,t[98]=b,t[99]=S,t[100]=at,t[101]=At,t[102]=jt,t[103]=Mt):Mt=t[103];let Nt;t[104]!==Ot||t[105]!==Mt?(Nt=(0,q.jsxs)(Ve,{orientation:`vertical`,className:`min-h-0 flex-1`,children:[Ot,kt,Mt]}),t[104]=Ot,t[105]=Mt,t[106]=Nt):Nt=t[106];let Pt;t[107]!==Dt||t[108]!==Nt?(Pt=(0,q.jsx)(Be,{defaultSize:`34%`,minSize:`24%`,maxSize:`46%`,children:(0,q.jsxs)(`div`,{className:`flex h-full flex-col border-r`,children:[Dt,Nt]})}),t[107]=Dt,t[108]=Nt,t[109]=Pt):Pt=t[109];let Ft;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(Ft=(0,q.jsx)(He,{}),t[110]=Ft):Ft=t[110];let It=Be,Lt;t[111]===j?Lt=t[112]:(Lt=!We(j)&&(0,q.jsx)(`div`,{className:`flex h-full min-h-0`,children:(0,q.jsx)(me,{})}),t[111]=j,t[112]=Lt);let Rt;t[113]!==j||t[114]!==M?(Rt=We(j)&&i(M)&&(0,q.jsx)(`div`,{className:`text-muted-foreground flex h-full items-center justify-center text-sm`,children:`No changed files.`}),t[113]=j,t[114]=M,t[115]=Rt):Rt=t[115];let zt=We(j)&&P&&(0,q.jsx)(`div`,{className:`h-full min-h-0 min-w-0`,children:(0,q.jsx)(Mh,{filePath:P.filePath,fileContent:P.fileContent,patch:P.patch,comments:Ge,onSaveComment:e=>{B({body:e.body,filePath:e.filePath,lineNumber:e.lineNumber,resolved:!1,side:e.side})},onResolveComment:e=>{V({...e,resolved:e.resolved===!0,source:e.source??`local`})}})}),Bt;t[116]!==Lt||t[117]!==Rt||t[118]!==zt?(Bt=(0,q.jsxs)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:[Lt,Rt,zt]}),t[116]=Lt,t[117]=Rt,t[118]=zt,t[119]=Bt):Bt=t[119];let Vt=!i(Ie)&&(0,q.jsxs)(`footer`,{className:`grid min-h-8 grid-cols-[minmax(0,1fr)_auto] items-center gap-2 border-t px-2`,children:[(0,q.jsx)(`div`,{className:`flex min-w-0 items-center gap-1 overflow-hidden`,children:pe(Ue,e=>(0,q.jsxs)(re,{type:`button`,variant:`outline`,size:`xs`,"aria-label":`Open ${e.filePath}`,title:e.filePath,onClick:()=>{R(e.filePath)},children:[(0,q.jsx)(Te,{filePath:e.filePath}),(0,q.jsx)(`span`,{className:`max-w-32 truncate`,children:o(m(`/`)(e.filePath),fe,de(()=>e.filePath))})]},e.filePath))}),(0,q.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-1`,children:[(0,q.jsx)(re,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Copy all comments`,title:`Copy all comments`,disabled:i(Ie),onClick:()=>{Xh(Ie)},children:(0,q.jsx)(nn,{})}),(0,q.jsx)(re,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Resolve all comments`,title:`Resolve all comments`,disabled:Ce.resolvingAll?!0:i(Le),onClick:()=>{ft(Le)},children:Ce.resolvingAll?(0,q.jsx)(F,{className:`size-2.5 border opacity-60`}):(0,q.jsx)(ze,{})})]})]}),Ht;t[120]!==Bt||t[121]!==Vt?(Ht=(0,q.jsxs)(`div`,{className:`bg-background flex h-full min-w-0 flex-col overflow-hidden`,children:[Bt,Vt]}),t[120]=Bt,t[121]=Vt,t[122]=Ht):Ht=t[122];let Ut;t[123]!==It||t[124]!==Ht?(Ut=(0,q.jsx)(It,{defaultSize:`66%`,minSize:`54%`,children:Ht}),t[123]=It,t[124]=Ht,t[125]=Ut):Ut=t[125];let Wt;t[126]!==vt||t[127]!==Pt||t[128]!==Ft||t[129]!==Ut?(Wt=(0,q.jsxs)(vt,{orientation:`horizontal`,children:[Pt,Ft,Ut]}),t[126]=vt,t[127]=Pt,t[128]=Ft,t[129]=Ut,t[130]=Wt):Wt=t[130];let Gt;return t[131]!==_t||t[132]!==Wt?(Gt=(0,q.jsxs)(q.Fragment,{children:[_t,Wt]}),t[131]=_t,t[132]=Wt,t[133]=Gt):Gt=t[133],Gt}function $h(){return v()}function eg(e){return{comment:e}}function tg(e){return!e.resolved}function ng(){return ot.make({})}function rg(e){let t=(0,rl.c)(54),n=(0,U.useState)(``),r;t[0]===e.cwd?r=t[1]:(r=Uh(e.cwd),t[0]=e.cwd,t[1]=r);let i=Xe(r),s;t[2]===e.cwd?s=t[3]:(s=Wh(e.cwd),t[2]=e.cwd,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c={mode:`promise`},t[4]=c):c=t[4];let l=it(s,c),u;t[5]===e.cwd?u=t[6]:(u=Gh(e.cwd),t[5]=e.cwd,t[6]=u);let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d={mode:`promise`},t[7]=d):d=t[7];let p=it(u,d),h,_,v,y,S;if(t[8]!==i.generatingMessage||t[9]!==i.publishing||t[10]!==p||t[11]!==n||t[12]!==l||t[13]!==e){let r=o(n[0],f),s=b({dirty:e.dirty,loading:e.loading}).pipe(T({loading:!0},lg),T({dirty:!0},cg),g(sg)),c=m(/\r?\n/)(r),u=f(c[0]),d=o(A(c,1),he(`
223
+ `),f),O=b({generating:i.generatingMessage,hasSubject:E(u)}).pipe(T({generating:!0},og),T({hasSubject:!0},()=>u),g(()=>s)),ee=async function(){if(!(e.loading||i.publishing||(e.dirty?!e.hasReviewableChanges:!e.unpushedCommits)||e.dirty&&x(r)))try{await p(r),n[1](``),e.refreshReview()}catch(e){let t=e;Re.error(le(t))}},k;t[19]!==i.generatingMessage||t[20]!==i.publishing||t[21]!==n||t[22]!==l||t[23]!==e.dirty||t[24]!==e.hasReviewableChanges||t[25]!==e.loading?(k=async function(){if(!(e.loading||i.generatingMessage||i.publishing||!e.dirty||!e.hasReviewableChanges))try{n[1](await l(null))}catch(e){let t=e;Re.error(le(t))}},t[19]=i.generatingMessage,t[20]=i.publishing,t[21]=n,t[22]=l,t[23]=e.dirty,t[24]=e.hasReviewableChanges,t[25]=e.loading,t[26]=k):k=t[26];let j=k,te;t[27]!==e.unpushedCommits||t[28]!==e.unpushedCount||t[29]!==e.upstream?(te=se(e.upstream)&&(e.upstream.ahead>0||e.upstream.behind>0)?(0,q.jsxs)(`span`,{className:`text-muted-foreground px-0.5 text-xs`,title:`${e.upstream.ahead} ahead, ${e.upstream.behind} behind upstream`,children:[`↑`,e.upstream.ahead,` ↓`,e.upstream.behind]}):e.unpushedCommits&&(0,q.jsxs)(`span`,{className:`text-muted-foreground px-0.5 text-xs`,title:e.unpushedCount>0?`${e.unpushedCount} ${e.unpushedCount===1?`commit`:`commits`} to push`:`Unpushed commits`,children:[`↑`,e.unpushedCount>0?e.unpushedCount:``]}),t[27]=e.unpushedCommits,t[28]=e.unpushedCount,t[29]=e.upstream,t[30]=te):te=t[30];let ne=e.loading||i.generatingMessage||i.publishing||!e.dirty||!e.hasReviewableChanges,M;t[31]===j?M=t[32]:(M=()=>{j()},t[31]=j,t[32]=M);let N;t[33]===i.generatingMessage?N=t[34]:(N=i.generatingMessage?(0,q.jsx)(F,{className:`size-2.5 border opacity-60`}):(0,q.jsx)(tn,{}),t[33]=i.generatingMessage,t[34]=N);let P;t[35]!==ne||t[36]!==M||t[37]!==N?(P=(0,q.jsx)(re,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`size-4`,"aria-label":`Generate commit message`,title:`Generate commit message`,disabled:ne,onClick:M,children:N}),t[35]=ne,t[36]=M,t[37]=N,t[38]=P):P=t[38];let ie;t[39]===i.publishing?ie=t[40]:(ie=i.publishing?(0,q.jsx)(F,{className:`size-2.5 border opacity-60`}):(0,q.jsx)(sn,{}),t[39]=i.publishing,t[40]=ie);let ae;t[41]!==e.loading||t[42]!==e.prUrl?(ae=e.loading?(0,q.jsx)(`span`,{className:`text-muted-foreground flex size-4 items-center justify-center`,children:(0,q.jsx)(F,{className:`size-2.5 border opacity-60`})}):E(e.prUrl??``)&&(0,q.jsx)(`a`,{className:a(L({size:`icon-xs`,variant:`ghost`}),`size-4`),href:o(URL.parse(e.prUrl??``),C,D(ag),w(ig),ue),target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open pull request`,title:`Open pull request`,children:(0,q.jsx)(Ue,{})}),t[41]=e.loading,t[42]=e.prUrl,t[43]=ae):ae=t[43];let oe=(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[te,P,(0,q.jsx)(re,{type:`submit`,variant:`ghost`,size:`icon-xs`,className:`size-4`,"aria-label":`Publish`,title:`Commit, push, and open a draft PR`,disabled:e.loading||i.publishing||(e.dirty?!e.hasReviewableChanges:!e.unpushedCommits)||e.dirty&&x(r),children:ie}),ae]});y=`border-b p-2`,S=e=>{e.preventDefault(),ee()},h=`border-input min-w-0 border font-mono text-xs leading-4 select-text`;let ce;t[44]===oe?ce=t[45]:(ce=(0,q.jsx)(`div`,{className:`border-input flex shrink-0 items-center border-l px-1.5`,children:oe}),t[44]=oe,t[45]=ce),_=(0,q.jsxs)(`div`,{className:`flex min-w-0 items-stretch`,children:[(0,q.jsx)(`span`,{title:O,className:a(`min-w-0 flex-1 truncate px-2 py-1.5`,(x(u)||i.generatingMessage)&&`text-muted-foreground`),children:O}),ce]}),v=E(d)&&!i.generatingMessage&&(0,q.jsx)(`div`,{className:`bg-muted/30 text-muted-foreground border-t px-2 py-1.5`,children:(0,q.jsx)(`div`,{className:`max-h-32 overflow-y-auto`,children:(0,q.jsx)(`span`,{className:`whitespace-pre-wrap`,children:d})})}),t[8]=i.generatingMessage,t[9]=i.publishing,t[10]=p,t[11]=n,t[12]=l,t[13]=e,t[14]=h,t[15]=_,t[16]=v,t[17]=y,t[18]=S}else h=t[14],_=t[15],v=t[16],y=t[17],S=t[18];let O;t[46]!==h||t[47]!==_||t[48]!==v?(O=(0,q.jsxs)(`div`,{className:h,children:[_,v]}),t[46]=h,t[47]=_,t[48]=v,t[49]=O):O=t[49];let ee;return t[50]!==O||t[51]!==y||t[52]!==S?(ee=(0,q.jsx)(`form`,{className:y,onSubmit:S,children:O}),t[50]=O,t[51]=y,t[52]=S,t[53]=ee):ee=t[53],ee}function ig(e){return e.href}function ag(e){return e.protocol===`https:`&&e.hostname===`github.com`}function og(){return`Generating commit message`}function sg(){return`No changes`}function cg(){return`Generate commit message`}function lg(){return`Loading`}function ug(e){let t=(0,rl.c)(28);if(e.loading){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center`,children:(0,q.jsx)(F,{className:`text-muted-foreground size-4 border opacity-60`})}),t[0]=e):e=t[0],e}let n;t[1]===e?n=t[2]:(n=function(t){return(0,q.jsx)(`li`,{className:`w-full min-w-0`,children:(0,q.jsxs)(`button`,{type:`button`,"aria-current":e.selected._tag===`commit`&&e.selected.hash===t.hash?`page`:void 0,onClick:()=>{e.selectCommit(t)},className:a(`text-muted-foreground hover:bg-muted hover:text-foreground grid h-6 w-full min-w-0 grid-cols-[minmax(0,1fr)_5rem] items-center gap-2 px-3 text-left`,e.selected._tag===`commit`&&e.selected.hash===t.hash&&`bg-primary/15 text-primary`),children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,q.jsx)(`span`,{children:t.subject})}),(0,q.jsx)(`span`,{className:`text-muted-foreground min-w-0 truncate text-right`,children:t.shortHash})]})},t.hash)},t[1]=e,t[2]=n);let r=n,o=e.selected,s=e.selectScope,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=ot.make({}),t[3]=c):c=t[3];let l;t[4]!==e.selectScope||t[5]!==e.selected||t[6]!==c?(l=(0,q.jsx)(dg,{detail:`worktree`,label:`Changes`,selected:o,selectScope:s,target:c}),t[4]=e.selectScope,t[5]=e.selected,t[6]=c,t[7]=l):l=t[7];let u;t[8]!==e.localCommits||t[9]!==e.selectScope||t[10]!==e.selected?(u=!i(e.localCommits)&&(0,q.jsx)(dg,{detail:`${ce(e.localCommits)}`,label:`Local`,selected:e.selected,selectScope:e.selectScope,target:st.make({})}),t[8]=e.localCommits,t[9]=e.selectScope,t[10]=e.selected,t[11]=u):u=t[11];let d;t[12]!==e.localCommits||t[13]!==r?(d=pe(e.localCommits,r),t[12]=e.localCommits,t[13]=r,t[14]=d):d=t[14];let f;t[15]!==e.branchCommits||t[16]!==e.selectScope||t[17]!==e.selected?(f=!i(e.branchCommits)&&(0,q.jsx)(dg,{detail:`${ce(e.branchCommits)}`,label:`Branch`,selected:e.selected,selectScope:e.selectScope,target:R.make({})}),t[15]=e.branchCommits,t[16]=e.selectScope,t[17]=e.selected,t[18]=f):f=t[18];let p;t[19]!==e.branchCommits||t[20]!==r?(p=pe(e.branchCommits,r),t[19]=e.branchCommits,t[20]=r,t[21]=p):p=t[21];let m;return t[22]!==l||t[23]!==u||t[24]!==d||t[25]!==f||t[26]!==p?(m=(0,q.jsx)(`div`,{className:`flex h-full min-h-0 flex-col`,children:(0,q.jsxs)(`ul`,{className:`min-h-0 flex-1 overflow-y-auto py-1`,children:[l,u,d,f,p]})}),t[22]=l,t[23]=u,t[24]=d,t[25]=f,t[26]=p,t[27]=m):m=t[27],m}function dg(e){let t=(0,rl.c)(14),n=e.selected._tag===e.target._tag?`page`:void 0,r;t[0]===e?r=t[1]:(r=()=>{e.selectScope(e.target)},t[0]=e,t[1]=r);let i=e.selected._tag===e.target._tag&&`bg-primary/15 text-primary`,o;t[2]===i?o=t[3]:(o=a(`text-secondary-foreground hover:bg-accent hover:text-accent-foreground bg-secondary grid h-6 w-full min-w-0 grid-cols-[minmax(0,1fr)_5rem] items-center gap-2 px-3 text-left`,i),t[2]=i,t[3]=o);let s;t[4]===e.label?s=t[5]:(s=(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),t[4]=e.label,t[5]=s);let c;t[6]===e.detail?c=t[7]:(c=(0,q.jsx)(`span`,{className:`min-w-0 truncate text-right opacity-70`,children:e.detail}),t[6]=e.detail,t[7]=c);let l;return t[8]!==n||t[9]!==r||t[10]!==o||t[11]!==s||t[12]!==c?(l=(0,q.jsx)(`li`,{className:`w-full min-w-0`,children:(0,q.jsxs)(`button`,{type:`button`,"aria-current":n,onClick:r,className:o,children:[s,c]})}),t[8]=n,t[9]=r,t[10]=o,t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function fg(e){let t={children:v(),name:``,path:``,type:`directory`};function n(e,t,r){if(_e(t[0])){e.children.push({diff:r,name:r.filePath,path:r.filePath,type:`file`});return}if(ce(t)===1){e.children.push({diff:r,name:t[0],path:r.filePath,type:`file`});return}let i=e.path?`${e.path}/${t[0]}`:t[0],a=o(e.children,ne(e=>e.name===t[0]),ue);if(a?.type===`directory`){n(a,A(t,1),r);return}let s={children:v(),name:t[0],path:i,type:`directory`};e.children.push(s),n(s,A(t,1),r)}for(let r of e)n(t,m(`/`)(r.filePath),r);return o(t.children,pe(e=>e.type===`directory`?pg(e):e))}function pg(e){let t=e.children[0];return ce(e.children)===1&&t?.type===`directory`?pg({children:t.children,name:`${e.name}/${t.name}`,path:t.path,type:`directory`}):e}function mg(e){let t=(0,rl.c)(15),n=(0,U.useState)(_g),r,a,s,c,l;if(t[0]!==n||t[1]!==e){let u=fg(e.diffs),d=o(e.diffs,I(j(),gg)),f=k(e.marks);function m(t){if(t.type===`directory`)return(0,q.jsxs)(`li`,{className:`w-full min-w-0`,children:[(0,q.jsx)(we,{icon:(0,q.jsx)(rn,{}),onClick:()=>{n[1](e=>h(e,t.path)?ee(e,t.path):ye(e,t.path))},actions:(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:ce(t.children)}),children:t.name}),!h(n[0],t.path)&&(0,q.jsx)(`ul`,{className:`border-border/70 ml-[19px] flex flex-col border-l pl-2`,children:pe(t.children,m)})]},t.path);let r=o(d,p(t.diff.filePath),de(hg)),a=Ge(r,f);return(0,q.jsx)(`li`,{className:`w-full min-w-0`,children:(0,q.jsx)(we,{selected:e.selectedEntry?.filePath===t.diff.filePath,icon:(0,q.jsx)(Te,{filePath:t.diff.filePath,className:`size-3`}),actions:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(vg,{state:a,onClick:t=>{t.stopPropagation(),!i(r)&&(a===`checked`?e.unmarkReviewed(r):e.markReviewed(r))}}),(0,q.jsx)(yg,{status:t.diff.status})]}),onClick:()=>{e.openReviewEntry(t.diff.filePath)},children:t.name})},t.path)}a=Ne,l=`h-full overflow-y-auto px-0 py-1`,r=Oe,s=`min-h-0 flex-1 [&>ul]:min-h-0 [&>ul]:flex-1`,c=i(e.diffs)?(0,q.jsx)(`li`,{className:`text-muted-foreground flex flex-1 items-center justify-center px-2 py-2`,children:`No changed files.`}):pe(u,m),t[0]=n,t[1]=e,t[2]=r,t[3]=a,t[4]=s,t[5]=c,t[6]=l}else r=t[2],a=t[3],s=t[4],c=t[5],l=t[6];let u;t[7]!==r||t[8]!==s||t[9]!==c?(u=(0,q.jsx)(r,{className:s,children:c}),t[7]=r,t[8]=s,t[9]=c,t[10]=u):u=t[10];let d;return t[11]!==a||t[12]!==l||t[13]!==u?(d=(0,q.jsx)(a,{className:l,children:u}),t[11]=a,t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function hg(){return v()}function gg(e,t){return y(e,t.filePath,Ke(t))}function _g(){return l()}function vg(e){let t=(0,rl.c)(12),n=e.state===`indeterminate`?`mixed`:e.state===`checked`,r=e.state!==`unchecked`&&`border-primary bg-primary`,i;t[0]===r?i=t[1]:(i=a(`border-input text-primary-foreground flex size-3 shrink-0 items-center justify-center border`,r),t[0]=r,t[1]=i);let o;t[2]===e.state?o=t[3]:(o=e.state===`checked`&&(0,q.jsx)(be,{className:`size-2.5`}),t[2]=e.state,t[3]=o);let s;t[4]===e.state?s=t[5]:(s=e.state===`indeterminate`&&(0,q.jsx)(on,{className:`size-2.5`}),t[4]=e.state,t[5]=s);let c;return t[6]!==e.onClick||t[7]!==n||t[8]!==i||t[9]!==o||t[10]!==s?(c=(0,q.jsxs)(`button`,{type:`button`,"aria-checked":n,className:i,role:`checkbox`,onClick:e.onClick,children:[o,s]}),t[6]=e.onClick,t[7]=n,t[8]=i,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function yg(e){return o(b(e.status),T(`added`,()=>(0,q.jsx)(`span`,{className:`text-emerald-600 dark:text-emerald-400`,children:`A`})),T(`deleted`,()=>(0,q.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:`D`})),T(`renamed`,()=>(0,q.jsx)(`span`,{className:`text-sky-600 dark:text-sky-400`,children:`R`})),g(()=>(0,q.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400`,children:`M`})))}export{Zh as component};