@deslop/workbench 0.0.401 → 0.0.410

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-DcE0yHBZ.mjs → anthropic-messages--JAnb97W.mjs} +38 -51
  2. package/dist/{azure-openai-responses-ecGypQVA.mjs → azure-openai-responses-g-awH_uA.mjs} +9 -16
  3. package/dist/client/assets/{-workbench-terminal-Af-sz4R6.js → -workbench-terminal-Ne3Ca_Zm.js} +8 -8
  4. package/dist/client/assets/agent-YDhqENQr.js +1 -0
  5. package/dist/client/assets/agent-YvOEbSL4.js +2 -0
  6. package/dist/client/assets/{dialog-CTIcy8Vy.js → dialog-O3wBc7X2.js} +2 -2
  7. package/dist/client/assets/diff-BcPEyFnc.js +223 -0
  8. package/dist/client/assets/diff-CZdOESVK.js +2 -0
  9. package/dist/client/assets/{external-link-BxixiKaa.js → external-link-D8TqDHgo.js} +1 -1
  10. package/dist/client/assets/fallbacks-BYPj1x-T.js +16 -0
  11. package/dist/client/assets/index-DFD32fIK.css +2 -0
  12. package/dist/client/assets/index-k88N8viu.js +10 -0
  13. package/dist/client/assets/{input-DW9ssWUO.js → input-BHj016ES.js} +1 -1
  14. package/dist/client/assets/portless-DbuqdEMA.js +2 -0
  15. package/dist/client/assets/portless-rPZ2tatn.js +1 -0
  16. package/dist/client/assets/{resizable-CZjAW7-J.js → resizable-BlkgaK6V.js} +1 -1
  17. package/dist/client/assets/route-DKK79z62.js +2 -0
  18. package/dist/client/assets/route-DOc4X-Ya.js +45 -0
  19. package/dist/client/assets/{run-CeqkWWtZ.js → run-DVOYYIUX.js} +1 -1
  20. package/dist/client/assets/run-gggwaxnT.js +2 -0
  21. package/dist/client/assets/{sonner-BKURESHO.js → sonner-Bnl1Iat_.js} +1 -1
  22. package/dist/client/assets/state-Cxz4BVk7.js +2 -0
  23. package/dist/client/assets/terminal-Brvez29s.js +2 -0
  24. package/dist/client/assets/{terminal-CcfbU9tU.js → terminal-CYX_Ixg-.js} +1 -1
  25. package/dist/client/assets/{triangle-alert-DLHVemGQ.js → triangle-alert-Ceg_3GX9.js} +1 -1
  26. package/dist/client/index.html +11 -11
  27. package/dist/github-copilot-headers-BB6z1RAk.mjs +23 -0
  28. package/dist/{google-Jzn1v4-q.mjs → google-generative-ai-r4Wb8Eaq.mjs} +15 -20
  29. package/dist/{google-shared-DNNqX1gf.mjs → google-shared-DN1OvwJM.mjs} +4 -4
  30. package/dist/{google-vertex-z0Cbw7eq.mjs → google-vertex-Clcq7cAd.mjs} +15 -20
  31. package/dist/{hash-CScAQ-b_.mjs → hash-wSEYO-QF.mjs} +1 -1
  32. package/dist/headers-SFoLwUHv.mjs +15 -0
  33. package/dist/{mistral-CxEIkz4y.mjs → mistral-conversations-Bnpuiv3e.mjs} +12 -19
  34. package/dist/{openai-codex-responses-7ZUsVcbT.mjs → openai-codex-responses-4Te8RbRb.mjs} +62 -46
  35. package/dist/{openai-completions-CaGFVr3X.mjs → openai-completions-B4nInzTS.mjs} +69 -96
  36. package/dist/{openai-responses-Vjw8-3qm.mjs → openai-responses-GeDULmTh.mjs} +28 -31
  37. package/dist/{openai-responses-shared-DtEshy-7.mjs → openai-responses-shared-CG93Thoy.mjs} +37 -32
  38. package/dist/{openrouter-CZ-H_QwG.mjs → openrouter-images-CgbIytYQ.mjs} +7 -14
  39. package/dist/{sanitize-unicode-BbVojtka.mjs → sanitize-unicode-Ga8nHda1.mjs} +1 -1
  40. package/dist/server.js +32269 -28959
  41. package/dist/{transform-messages-CLmkH5Gu.mjs → transform-messages-D9fZ7fnU.mjs} +2 -2
  42. package/package.json +3 -2
  43. package/dist/client/assets/agent-BnkD1Glf.js +0 -2
  44. package/dist/client/assets/agent-DQPX2IZb.js +0 -1
  45. package/dist/client/assets/diff-MiGOu0DY.js +0 -2
  46. package/dist/client/assets/diff-_Gk9o1mg.js +0 -223
  47. package/dist/client/assets/fallbacks-D21cBTdH.js +0 -16
  48. package/dist/client/assets/index-B2S_w1d1.css +0 -2
  49. package/dist/client/assets/index-DW7dKhgZ.js +0 -10
  50. package/dist/client/assets/portless-3KC81g42.js +0 -2
  51. package/dist/client/assets/portless-CxovsEbp.js +0 -1
  52. package/dist/client/assets/route-DwWgYFyk.js +0 -2
  53. package/dist/client/assets/route-te6-VkZE.js +0 -45
  54. package/dist/client/assets/run-B-qmimXV.js +0 -2
  55. package/dist/client/assets/state-a4d_PikB.js +0 -2
  56. package/dist/client/assets/terminal-BHNxWKc6.js +0 -2
  57. package/dist/github-copilot-headers-P0xZolzq.mjs +0 -39
  58. package/dist/headers-oksLmLNC.mjs +0 -9
@@ -1,223 +0,0 @@
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,Ao as a,Ba as o,Bt as s,Eo as c,Fo as l,Ga as u,Gt as d,Ht as f,In as p,Kr as m,Kt as h,L as g,M as _,Mo as v,Ps as y,Qa as b,R as x,Rr as S,Sn as C,Ss as w,Ur as T,Ut as E,Va as D,Vi as O,Vt as k,Wa as A,Wt as ee,Xa as te,Ya as ne,Za as re,_s as ie,a as j,ao as ae,eo as oe,fo as se,fs as ce,js as M,k as le,ko as ue,no as de,o as fe,qa as N,qt as pe,r as P,ro as me,so as F,uo as he,vr as ge,vs as _e,wn as ve,xs as ye,z as I,zr as be}from"./fallbacks-D21cBTdH.js";import{S as xe,_ as Se,a as Ce,b as we,c as Te,d as Ee,g as De,h as Oe,l as ke,m as Ae,n as je,o as Me,p as Ne,s as Pe,t as Fe,v as Ie,x as Le,y as Re}from"./dialog-CTIcy8Vy.js";import{n as ze,r as Be}from"./sonner-BKURESHO.js";import{n as Ve,r as He,t as Ue}from"./resizable-CZjAW7-J.js";import{t as We}from"./external-link-BxixiKaa.js";import{B as Ge,D as Ke,E as qe,F as Je,I as Ye,L as Xe,M as Ze,N as L,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-a4d_PikB.js";import{t as B}from"./preload-helper-CjdClQve.js";import{t as ut}from"./diff-MiGOu0DY.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=y(`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=y(`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=y(`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=y(`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=y(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),sn=y(`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
- `||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: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
- `)?e.slice(0,-2):e.endsWith(`
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=we(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
- `||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 da(e){for(let t of Array.isArray(e)?e:[e])if(!(t===`text`||t===`ansi`)&&!Le.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(!Ie.has(t))return!1;return!0}function ma(e){return Re.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)?De():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 we(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 we(t?J({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await Se(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
- <symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
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
- </symbol>
20
- <symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
21
- <path d="M8 0c4.42 0 8 3.58 8 8a8.01 8.01 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27s-1.36.09-2 .27c-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8"/>
22
- </symbol>
23
- <symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
24
- <path d="M1.47 4.47a.75.75 0 0 1 1.06 0L8 9.94l5.47-5.47a.75.75 0 1 1 1.06 1.06l-6 6a.75.75 0 0 1-1.06 0l-6-6a.75.75 0 0 1 0-1.06"/>
25
- </symbol>
26
- <symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
27
- <path d="M4.47 2.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1-1.06 1.06L5 3.81 2.28 6.53a.75.75 0 0 1-1.06-1.06zM1.22 9.47a.75.75 0 0 1 1.06 0L5 12.19l2.72-2.72a.75.75 0 0 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 0 1 0-1.06"/>
28
- </symbol>
29
- <symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
30
- <path d="M14 0H8.5v16H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2m-1.5 6.5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0"/><path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h5.5V0zm.5 7.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1" opacity=".3"/>
31
- </symbol>
32
- <symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
33
- <path fill-rule="evenodd" d="M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8.5h16zm-8-4a.5.5 0 0 0-.5.5v1h-1a.5.5 0 0 0 0 1h1v1a.5.5 0 0 0 1 0v-1h1a.5.5 0 0 0 0-1h-1v-1A.5.5 0 0 0 8 10" clip-rule="evenodd"/><path fill-rule="evenodd" d="M14 0a2 2 0 0 1 2 2v5.5H0V2a2 2 0 0 1 2-2zM6.5 3.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z" clip-rule="evenodd" opacity=".4"/>
34
- </symbol>
35
- <symbol id="diffs-icon-expand" viewBox="0 0 16 16">
36
- <path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06"/>
37
- </symbol>
38
- <symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
39
- <path d="M11.47 9.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06L8 12.94zM7.526 1.418a.75.75 0 0 1 1.004.052l4 4a.75.75 0 1 1-1.06 1.06L8 3.06 4.53 6.53a.75.75 0 1 1-1.06-1.06l4-4z"/>
40
- </symbol>
41
- <symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
42
- <path d="M10.75 0c.199 0 .39.08.53.22l3.5 3.5c.14.14.22.331.22.53v9A2.75 2.75 0 0 1 12.25 16h-8.5A2.75 2.75 0 0 1 1 13.25V2.75A2.75 2.75 0 0 1 3.75 0zm-7 1.5c-.69 0-1.25.56-1.25 1.25v10.5c0 .69.56 1.25 1.25 1.25h8.5c.69 0 1.25-.56 1.25-1.25V5h-1.25A2.25 2.25 0 0 1 10 2.75V1.5z"/><path d="M7.248 6.19a.75.75 0 0 1 .063 1.058L5.753 9l1.558 1.752a.75.75 0 0 1-1.122.996l-2-2.25a.75.75 0 0 1 0-.996l2-2.25a.75.75 0 0 1 1.06-.063M8.69 7.248a.75.75 0 1 1 1.12-.996l2 2.25a.75.75 0 0 1 0 .996l-2 2.25a.75.75 0 1 1-1.12-.996L10.245 9z"/>
43
- </symbol>
44
- <symbol id="diffs-icon-plus" viewBox="0 0 16 16">
45
- <path d="M8 3a.75.75 0 0 1 .75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5A.75.75 0 0 1 8 3"/>
46
- </symbol>
47
- <symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
48
- <path d="M8 4a.75.75 0 0 1 .75.75v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5A.75.75 0 0 1 8 4"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 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.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
49
- </symbol>
50
- <symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
51
- <path d="M4 8a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5A.75.75 0 0 1 4 8"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 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.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/>
52
- </symbol>
53
- <symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
54
- <path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 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.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.75 4.296a.75.75 0 0 0-1.5 0V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2zM5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5z"/>
55
- </symbol>
56
- <symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
57
- <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.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.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m11.53-2.47a.75.75 0 0 0-1.06-1.06l-6 6a.75.75 0 1 0 1.06 1.06z"/>
58
- </symbol>
59
- <symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
60
- <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.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.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m8 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6"/>
61
- </symbol>
62
- <symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
63
- <path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 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.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.495 4.695a.75.75 0 0 0-.05 1.06L10.486 8l-2.041 2.246a.75.75 0 0 0 1.11 1.008l2.5-2.75a.75.75 0 0 0 0-1.008l-2.5-2.75a.75.75 0 0 0-1.06-.051m-4 0a.75.75 0 0 0-.05 1.06l2.044 2.248-1.796 1.995a.75.75 0 0 0 1.114 1.004l2.25-2.5a.75.75 0 0 0-.002-1.007l-2.5-2.75a.75.75 0 0 0-1.06-.05"/>
64
- </symbol>
65
- <symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
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
- </symbol>
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
- @layer unsafe {
70
- ${e}
71
- }`}function Co(e,t=`system`,n){return`${bo}
72
- @layer rendered {
73
- :host {${t===`system`?``:`
74
- color-scheme: ${t};`}
75
- ${vo(n)}
76
- ${e}
77
- }
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??we(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,k,A;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),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 ee=Math.round(k-x/2),te=Math.max(0,Math.ceil(l/o)-x),ne=Math.max(0,Math.min(ee,te)),re=ne*o,ie=ee<0?b+ee*o:b,j=w[ne]??0,ae=re===0?0:p+j,oe=ne+ie/o,se=oe<w.length?h-w[oe]:h-(E-t-m);return{startingLine:re,totalLines:ie,bufferBefore:ae,bufferAfter:Math.max(0,se)}}};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
- `||t===`\r
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
- `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
82
- `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
83
- `)&&(e=e.slice(0,-1)),t.endsWith(`
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
- `)}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
- `)+`
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
- `),n=e.split(`
91
- `).map(e=>e+`
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)?De():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 Se(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 we(this.renderFullAST(e,t))}renderPartialHTML(e,t){return we(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??we(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),k=D?.renderedLineIndex??0,A,ee,te;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 _=k%s===0,v=Math.floor(k/s);if(_&&(T[v]=O-(t+g+h),te!=null)){if(te<=0)return!0;te--}let y=this.getLineHeight(l===`split`?f:p,m);return O>n-y&&O<r&&(A??=v),ee==null&&O+y>E&&(ee=v),te==null&&O>=r&&_&&(te=w),k++,O+=y,o>0&&(O+=os({type:u,metrics:this.metrics})?.totalHeight??0),!1}}),A==null)if(b)A=0,ee=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:d-p-m};ee??=A;let ne=Math.round(ee-C/2),re=Math.max(0,Math.ceil(f/s)-C),ie=Math.max(0,Math.min(ne,re)),j=ie*s,ae=ne<0?S+ne*s:S,oe=T[ie]??0,se=j===0?0:h+oe,ce=ie+ae/s,M=ce<T.length?_-T[ce]:_-(O-t-g);return{startingLine:j,totalLines:ae,bufferBefore:se,bufferAfter:Math.max(0,M)}}};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--}},k=function(){return w||=(C=xu(u,i),!0),C},A=n,ee=A.implementation,te=A.createNodeIterator,ne=A.createDocumentFragment,re=A.getElementsByTagName,ie=r.importNode,j=Su();t.isSupported=typeof dl==`function`&&typeof g==`function`&&ee&&ee.createHTMLDocument!==void 0;let ae=au,oe=ou,se=su,ce=cu,M=lu,le=du,ue=fu,de=mu,fe=uu,N=null,pe=X({},[...Jl,...Yl,...Xl,...Ql,...eu]),P=null,me=X({},[...tu,...nu,...ru,...iu]),F=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}})),he=null,ge=null,_e=Object.seal(vl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ve=!0,ye=!0,I=!1,be=!0,xe=!1,Se=!0,Ce=!1,we=!1,Te=null,Ee=null,De=!1,Oe=!1,ke=!1,Ae=!1,je=!0,Me=!1,Ne=`user-content-`,Pe=!0,Fe=!1,Ie={},Le=null,Re=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(`.`)),ze=null,Be=X({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ve=null,He=X({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ue=`http://www.w3.org/1998/Math/MathML`,We=`http://www.w3.org/2000/svg`,Ge=`http://www.w3.org/1999/xhtml`,Ke=Ge,qe=!1,Je=null,Ye=X({},[Ue,We,Ge],kl),Xe=gl([`mi`,`mo`,`mn`,`ms`,`mtext`]),Ze=X({},Xe),L=gl([`annotation-xml`]),Qe=X({},L),$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,N=Cu(e,`ALLOWED_TAGS`,pe,{transform:R}),P=Cu(e,`ALLOWED_ATTR`,me,{transform:R}),Je=Cu(e,`ALLOWED_NAMESPACES`,Ye,{transform:kl}),Ve=Cu(e,`ADD_URI_SAFE_ATTR`,He,{transform:R,base:He}),ze=Cu(e,`ADD_DATA_URI_TAGS`,Be,{transform:R,base:Be}),Le=Cu(e,`FORBID_CONTENTS`,Re,{transform:R}),he=Cu(e,`FORBID_TAGS`,Wl({}),{transform:R}),ge=Cu(e,`FORBID_ATTR`,Wl({}),{transform:R}),Ie=Rl(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Wl(e.USE_PROFILES):e.USE_PROFILES:!1,ve=e.ALLOW_ARIA_ATTR!==!1,ye=e.ALLOW_DATA_ATTR!==!1,I=e.ALLOW_UNKNOWN_PROTOCOLS||!1,be=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,xe=e.SAFE_FOR_TEMPLATES||!1,Se=e.SAFE_FOR_XML!==!1,Ce=e.WHOLE_DOCUMENT||!1,Oe=e.RETURN_DOM||!1,ke=e.RETURN_DOM_FRAGMENT||!1,Ae=e.RETURN_TRUSTED_TYPE||!1,De=e.FORCE_BODY||!1,je=e.SANITIZE_DOM!==!1,Me=e.SANITIZE_NAMED_PROPS||!1,Pe=e.KEEP_CONTENT!==!1,Fe=e.IN_PLACE||!1,fe=ql(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:uu,Ke=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ge,Ze=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({},Xe),Qe=Rl(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?Wl(e.HTML_INTEGRATION_POINTS):X({},L);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(F=vl(null),Rl(t,`tagNameCheck`)&&it(t.tagNameCheck)&&(F.tagNameCheck=t.tagNameCheck),Rl(t,`attributeNameCheck`)&&it(t.attributeNameCheck)&&(F.attributeNameCheck=t.attributeNameCheck),Rl(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(F.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),_l(F),xe&&(ye=!1),ke&&(Oe=!0),Ie&&(N=X({},eu),P=vl(null),Ie.html===!0&&(X(N,Jl),X(P,tu)),Ie.svg===!0&&(X(N,Yl),X(P,nu),X(P,iu)),Ie.svgFilters===!0&&(X(N,Xl),X(P,nu),X(P,iu)),Ie.mathMl===!0&&(X(N,Ql),X(P,ru),X(P,iu))),_e.tagCheck=null,_e.attributeCheck=null,Rl(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?_e.tagCheck=e.ADD_TAGS:Dl(e.ADD_TAGS)&&(N===pe&&(N=Wl(N)),X(N,e.ADD_TAGS,R))),Rl(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?_e.attributeCheck=e.ADD_ATTR:Dl(e.ADD_ATTR)&&(P===me&&(P=Wl(P)),X(P,e.ADD_ATTR,R))),Rl(e,`ADD_URI_SAFE_ATTR`)&&Dl(e.ADD_URI_SAFE_ATTR)&&X(Ve,e.ADD_URI_SAFE_ATTR,R),Rl(e,`FORBID_CONTENTS`)&&Dl(e.FORBID_CONTENTS)&&(Le===Re&&(Le=Wl(Le)),X(Le,e.FORBID_CONTENTS,R)),Rl(e,`ADD_FORBID_CONTENTS`)&&Dl(e.ADD_FORBID_CONTENTS)&&(Le===Re&&(Le=Wl(Le)),X(Le,e.ADD_FORBID_CONTENTS,R)),Pe&&(N[`#text`]=!0),Ce&&X(N,[`html`,`head`,`body`]),N.table&&(X(N,[`tbody`]),delete he.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=k()),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===Ge?e===`svg`:t.namespaceURI===Ue?e===`svg`&&(n===`annotation-xml`||Ze[n]):!!at[e]},ct=function(e,t,n){return t.namespaceURI===Ge?e===`math`:t.namespaceURI===We?e===`math`&&Qe[n]:!!ot[e]},lt=function(e,t,n){return t.namespaceURI===We&&!Qe[n]||t.namespaceURI===Ue&&!Ze[n]?!1:!ot[e]&&($e[e]||!at[e])},B=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Ke,tagName:`template`});let n=Ol(e.tagName),r=Ol(t.tagName);return Je[e.namespaceURI]?e.namespaceURI===We?st(n,t,r):e.namespaceURI===Ue?ct(n,t,r):e.namespaceURI===Ge?lt(n,t,r):!!(et===`application/xhtml+xml`&&Je[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(Oe||ke)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`||P[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(De)e=`<remove></remove>`+e;else{let t=Al(e,/^[\r\n\t ]+/);r=t&&t[0]}et===`application/xhtml+xml`&&Ke===Ge&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?D(e):e;if(Ke===Ge)try{t=new l().parseFromString(i,et)}catch{}if(!t||!t.documentElement){t=ee.createDocument(Ke,`template`,null);try{t.documentElement.innerHTML=qe?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ke===Ge?re.call(t,Ce?`html`:`body`)[0]:Ce?t.documentElement:a},mt=function(e){return te.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,ae,` `),e=jl(e,oe,` `),e=jl(e,se,` `),e},gt=function(e){e.normalize();let t=te.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!!(Se&&e.hasChildNodes()&&!yt(e.firstElementChild)&&Bl(hu,e.textContent)&&Bl(hu,e.innerHTML)||Se&&e.namespaceURI===Ge&&t===`style`&&yt(e.firstElementChild)||e.nodeType===yu.processingInstruction||Se&&e.nodeType===yu.comment&&Bl(gu,e.data))},St=function(e,t){if(!he[t]&&Et(t)&&(F.tagNameCheck instanceof RegExp&&Bl(F.tagNameCheck,t)||F.tagNameCheck instanceof Function&&F.tagNameCheck(t)))return!1;if(Pe&&!Le[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=Fe?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return ut(e),!0},Ct=function(e){if(bt(j.beforeSanitizeElements,e,null),_t(e))return ut(e),!0;let n=R(b?b(e):e.nodeName);if(bt(j.uponSanitizeElement,e,{tagName:n,allowedTags:N}),xt(e,n))return ut(e),!0;if(he[n]||!(_e.tagCheck instanceof Function&&_e.tagCheck(n))&&!N[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(xe&&e.nodeType===yu.text){let n=ht(e.textContent);e.textContent!==n&&(Tl(t.removed,{element:e.cloneNode()}),e.textContent=n)}return bt(j.afterSanitizeElements,e,null),!1},wt=function(e,t,r){if(ge[t]||je&&(t===`id`||t===`name`)&&(r in n||r in rt))return!1;let i=P[t]||_e.attributeCheck instanceof Function&&_e.attributeCheck(t,e);if(!(ye&&Bl(ce,t))&&!(ve&&Bl(M,t))){if(!i){if(!(Et(e)&&(F.tagNameCheck instanceof RegExp&&Bl(F.tagNameCheck,e)||F.tagNameCheck instanceof Function&&F.tagNameCheck(e))&&(F.attributeNameCheck instanceof RegExp&&Bl(F.attributeNameCheck,t)||F.attributeNameCheck instanceof Function&&F.attributeNameCheck(t,e))||t===`is`&&F.allowCustomizedBuiltInElements&&(F.tagNameCheck instanceof RegExp&&Bl(F.tagNameCheck,r)||F.tagNameCheck instanceof Function&&F.tagNameCheck(r))))return!1}else if(!Ve[t]&&!Bl(fe,jl(r,ue,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Ml(r,`data:`)===0&&ze[e])&&!(I&&!Bl(le,jl(r,ue,``)))&&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(de,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(j.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||_t(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:P,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(j.uponSanitizeAttribute,e,n),d=n.attrValue,Me&&(l===`id`||l===`name`)&&Ml(d,Ne)!==0&&(V(o,e),d=Ne+d),Se&&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(!be&&Bl(vu,d)){V(o,e);continue}if(xe&&(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(j.afterSanitizeAttributes,e,null)},At=function(e){let t=null,n=mt(e);for(bt(j.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(bt(j.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(j.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(qe=!e,qe&&(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;we?(N=Te,P=Ee):z(n),(j.uponSanitizeElement.length>0||j.uponSanitizeAttribute.length>0)&&(N=Wl(N)),j.uponSanitizeAttribute.length>0&&(P=Wl(P)),t.removed=[];let c=Fe&&typeof e!=`string`&&yt(e);if(c){let t=b?b(e):e.nodeName;if(typeof t==`string`){let e=R(t);if(!N[e]||he[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(!Oe&&!xe&&!Ce&&e.indexOf(`<`)===-1)return x&&Ae?D(e):e;if(i=pt(e),!i)return Oe?null:Ae?S:``}i&&De&&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)}),xe&&gt(e),e;if(Oe){if(xe&&gt(i),ke)for(s=ne.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(P.shadowroot||P.shadowrootmode)&&(s=ie.call(r,s,!0)),s}let u=Ce?i.outerHTML:i.innerHTML;return Ce&&N[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Bl(pu,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
94
- `+u),xe&&(u=ht(u)),x&&Ae?D(u):u},t.setConfig=function(){z(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),we=!0,Te=N,Ee=P},t.clearConfig=function(){nt=null,we=!1,Te=null,Ee=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(j,e)&&Tl(j[e],t)},t.removeHook=function(e,t){if(Rl(j,e)){if(t!==void 0){let n=Cl(j[e],t);return n===-1?void 0:El(j[e],n,1)[0]}return wl(j[e])}},t.removeHooks=function(e){Rl(j,e)&&(j[e]=[])},t.removeAllHooks=function(){j=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(`
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(`
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],`
102
- `).split(`
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(`
104
- `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
105
- $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
106
- ${s}`:s,r=r?`${r}
107
- ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
108
- `+e.join(`
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+`
110
- `+e.join(`
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(`
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(`
113
- `,1)[0],t[1].length),l=e.split(`
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+`
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(`
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+=`
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+=`
118
- `+l}u=!l.trim(),r+=p+`
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],`
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)===`
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+=`
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(`
127
- `)?``:`
128
- `)+i.raw,n.text+=`
129
- `+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
130
- `)?``:`
131
- `)+i.raw,n.text+=`
132
- `+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
133
- `)?``:`
134
- `)+i.raw,r.text+=`
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(`
136
- `)?``:`
137
- `)+i.raw,n.text+=`
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>
141
- `}blockquote({tokens:e}){return`<blockquote>
142
- ${this.parser.parse(e)}</blockquote>
143
- `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
144
- `}hr(e){return`<hr>
145
- `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
146
- `+r+`</`+i+`>
147
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
148
- `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
149
- `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
150
- <thead>
151
- `+t+`</thead>
152
- `+r+`</table>
153
- `}tablerow({text:e}){return`<tr>
154
- ${e}</tr>
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}>
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(Ae(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 a;t[5]===e.className?a=t[6]:(a=i(`bg-muted/30 overflow-hidden select-text [&_*]:select-text`,e.className),t[5]=e.className,t[6]=a);let o;return t[7]!==r||t[8]!==a?(o=(0,q.jsx)(`div`,{"data-code-block":!0,dangerouslySetInnerHTML:r,className:a}),t[7]=r,t[8]=a,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)+`
161
- `}else r+=`${e.themeCSS}
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=L(e=>Je(ge(async()=>(vh.initialize({securityLevel:`strict`,startOnLoad:!1}),await vh.render(`mermaid_${ce(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 a=rt(n,r);if(lt(a)){let n;t[3]===e.className?n=t[4]:(n=i(`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]===a.cause?r=t[6]:(r=m(O(a.cause)),t[5]=a.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]===a.value.svg?o=t[11]:(o=Tu.sanitize(a.value.svg),t[10]=a.value.svg,t[11]=o);let s;t[12]===o?s=t[13]:(s={__html:o},t[12]=o,t[13]=s);let c;t[14]===e.className?c=t[15]:(c=i(`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]=c);let l;return t[16]!==s||t[17]!==c?(l=(0,q.jsx)(`div`,{dangerouslySetInnerHTML:s,className:c}),t[16]=s,t[17]=c,t[18]=l):l=t[18],l}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=i(`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=F(xh.lexer(e.children),Ch),t[2]=e.children,t[3]=r);let a;return t[4]!==n||t[5]!==r?(a=(0,q.jsx)(`div`,{className:n,children:r}),t[4]=n,t[5]=r,t[6]=a):a=t[6],a}function Ch(e,t){return M(x(e),I({type:`html`},wh),I({lang:`mermaid`,type:`code`},n=>(0,q.jsx)(bh,{className:`border-border border`,children:n.text},`${e.type}:${t}:${n.text}`)),I({type:`code`},n=>(0,q.jsx)(rf,{className:`border-border border`,lang:ye(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=`
165
- :host,
166
- pre {
167
- --diffs-bg: var(--background) !important;
168
- --diffs-bg-buffer-override: var(--background) !important;
169
- --diffs-bg-context-override: var(--background) !important;
170
- --diffs-bg-hover-override: color-mix(in oklab, var(--muted) 70%, transparent) !important;
171
- --diffs-bg-separator-override: var(--muted) !important;
172
- --diffs-fg: var(--foreground) !important;
173
- --diffs-fg-number-override: var(--muted-foreground) !important;
174
- font-family: 'JetBrainsMono Nerd Font Mono', 'JetBrains Mono Variable', monospace !important;
175
- font-size: inherit !important;
176
- letter-spacing: 0 !important;
177
- line-height: inherit !important;
178
- user-select: text !important;
179
- }
180
-
181
- pre {
182
- background-color: transparent !important;
183
- }
184
-
185
- *,
186
- ::before,
187
- ::after {
188
- border-radius: 0 !important;
189
- user-select: text !important;
190
- }
191
-
192
- [data-diff],
193
- [data-file],
194
- [data-separator],
195
- [data-line],
196
- [data-line] *,
197
- [data-line-annotation],
198
- [data-annotation-content] {
199
- border-radius: 0 !important;
200
- }
201
-
202
- [data-diff] [data-line][data-line-type='context'],
203
- [data-diff] [data-line][data-line-type='context-expanded'],
204
- [data-file] [data-line] {
205
- background-color: var(--background) !important;
206
- color: var(--foreground) !important;
207
- }
208
-
209
- [data-diff] [data-column-number][data-line-type='context'],
210
- [data-diff] [data-column-number][data-line-type='context-expanded'],
211
- [data-file] [data-column-number] {
212
- background-color: var(--background) !important;
213
- color: var(--muted-foreground) !important;
214
- }
215
-
216
- [data-separator] {
217
- background-color: var(--muted) !important;
218
- color: var(--muted-foreground) !important;
219
- }
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=M(b(e.querySelector(`diffs-container`)?.shadowRoot?.querySelectorAll(`[data-line][data-line-type]`)??[]),te(e=>{let n=e.getBoundingClientRect();return t>=n.top&&t<=n.bottom}),v);if(n&&!(w(n.dataset.line)||S(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)(50),n=(0,U.useRef)(null),r;t[0]===e.comment.body?r=t[1]:(r=()=>S(e.comment.body),t[0]=e.comment.body,t[1]=r);let[i,a]=(0,U.useState)(r),o,s;t[2]===i?(o=t[3],s=t[4]):(o=()=>{if(!i)return;let e=window.requestAnimationFrame(()=>{n.current?.focus()});return()=>{window.cancelAnimationFrame(e)}},s=[i],t[2]=i,t[3]=o,t[4]=s),(0,U.useEffect)(o,s);let c;t[5]===e?c=t[6]:(c=function(){let t=n.current?.value??e.comment.body;if(S(m(t))){if(e.isDraft===!0){e.onCloseDraft?.();return}e.onResolveComment?.({...e.comment,body:t}),a(!1),e.onCloseDraft?.();return}e.onSaveComment?.({...e.comment,body:m(t)}),a(!1),e.onCloseDraft?.()},t[5]=e,t[6]=c);let l=c;if(i){let r;t[7]===e.comment.source?r=t[8]:(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[7]=e.comment.source,t[8]=r);let i;t[9]!==e||t[10]!==l?(i=t=>{t.key===`Escape`&&(t.preventDefault(),e.isDraft===!0?e.onCloseDraft?.():a(!1)),t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),l())},t[9]=e,t[10]=l,t[11]=i):i=t[11];let o;t[12]!==e.comment.body||t[13]!==i?(o=(0,q.jsx)(`div`,{className:`min-w-0`,children:(0,q.jsx)(`textarea`,{ref:n,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[12]=e.comment.body,t[13]=i,t[14]=o):o=t[14];let s;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,q.jsx)(`div`,{}),t[15]=s):s=t[15];let c;return t[16]!==r||t[17]!==o?(c=(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,s]}),t[16]=r,t[17]=o,t[18]=c):c=t[18],c}if(e.comment.resolved===!0){let n;t[19]===e.comment.source?n=t[20]:(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[19]=e.comment.source,t[20]=n);let r;t[21]===e.comment.body?r=t[22]:(r=(0,q.jsx)(`span`,{className:`decoration-muted-foreground/60 min-w-0 truncate line-through`,children:e.comment.body}),t[21]=e.comment.body,t[22]=r);let i;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,q.jsx)(`div`,{}),t[23]=i):i=t[23];let a;return t[24]!==n||t[25]!==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[24]=n,t[25]=r,t[26]=a):a=t[26],a}let u;t[27]===e.comment.source?u=t[28]:(u=(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[27]=e.comment.source,t[28]=u);let d;t[29]===e.comment.source?d=t[30]:(d=t=>{t.stopPropagation(),e.comment.source!==`github`&&a(!0)},t[29]=e.comment.source,t[30]=d);let f;t[31]===e.comment.body?f=t[32]:(f=(0,q.jsx)(Sh,{className:`text-inherit`,children:e.comment.body}),t[31]=e.comment.body,t[32]=f);let p;t[33]!==d||t[34]!==f?(p=(0,q.jsx)(`button`,{type:`button`,className:`min-w-0 bg-transparent p-0 text-left`,onClick:d,children:f}),t[33]=d,t[34]=f,t[35]=p):p=t[35];let h;t[36]===e.comment?h=t[37]:(h=t=>{t.stopPropagation(),navigator.clipboard.writeText(Dh(e.comment))},t[36]=e.comment,t[37]=h);let g;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,q.jsx)(nn,{className:`size-3`}),t[38]=g):g=t[38];let _;t[39]===h?_=t[40]:(_=(0,q.jsx)(`button`,{type:`button`,className:`hover:bg-muted hover:text-foreground p-1`,"aria-label":`Copy comment`,title:`Copy comment`,onClick:h,children:g}),t[39]=h,t[40]=_);let v;t[41]===e?v=t[42]:(v=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)(le,{className:`size-3`}):(0,q.jsx)(Be,{className:`size-3`})}),t[41]=e,t[42]=v);let y;t[43]!==_||t[44]!==v?(y=(0,q.jsxs)(`div`,{className:`border-border bg-background text-muted-foreground inline-flex shrink-0 border text-xs`,children:[_,v]}),t[43]=_,t[44]=v,t[45]=y):y=t[45];let b;return t[46]!==y||t[47]!==u||t[48]!==p?(b=(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:[u,p,y]}),t[46]=y,t[47]=u,t[48]=p,t[49]=b):b=t[49],b}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,s]=(0,U.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,U.useState)(l),f=u.key===c?u.mode:`diff`,p,m;t[2]!==e.filePath||t[3]!==e.patch?(p=Oe(e.filePath),m=li(ci(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,U.useEffect)(v,y);let b;t[11]===f?b=t[12]:(b=()=>{_e(n.current)||_e(i.current)||kh(n.current,i.current,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,U.useLayoutEffect)(b,x);let S;t[16]===c?S=t[17]:(S=function(){if(_e(n.current))return;let e=n.current.getBoundingClientRect(),t=_e(r.current)?e.top+e.height/2:Math.min(Math.max(r.current,e.top),e.bottom);i.current=Oh(n.current,t)??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],cr(`Tab`,w,T);let E=function(t){e.onSaveComment&&(a&&Eh(a,{filePath:e.filePath,lineNumber:t.lineNumber,side:t.side})||a||se(g,n=>Eh(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,q.jsx)(nl,{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:Ne,themeType:`system`,unsafeCSS:Th},lineAnnotations:F(_,Fh),renderAnnotation:t=>(0,q.jsx)(Ah,{comment:t.metadata,isDraft:a&&Eh(t.metadata,a),onSaveComment:e.onSaveComment,onResolveComment:e.onResolveComment,onCloseDraft:()=>{s(void 0)}})},e.patch):(0,q.jsx)(tc,{file:{contents:e.fileContent??``,lang:p,name:e.filePath},options:{disableFileHeader:!0,disableLineNumbers:!1,onLineNumberClick:e=>{E({lineNumber:e.lineNumber})},overflow:`scroll`,theme:Ne,themeType:`system`,unsafeCSS:Th},lineAnnotations:F(ne(_,Ph),Nh),renderAnnotation:t=>(0,q.jsx)(Ah,{comment:t.metadata,isDraft:a&&Eh(t.metadata,a),onSaveComment:e.onSaveComment,onResolveComment:e.onResolveComment,onCloseDraft:()=>{s(void 0)}})},e.filePath),A;return t[23]!==D||t[24]!==O||t[25]!==k?(A=(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:k}),t[23]=D,t[24]=O,t[25]=k,t[26]=A):A=t[26],A}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=L(e=>z.runtime.atom(M(z,p(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 x(e).pipe(I(`commit`,()=>nt.make({hash:t})),I(`local`,()=>st.make({})),I(`branch`,()=>R.make({})),g(()=>ot.make({})))}var zh=L(e=>{let t=e.split(`\0`),n=t[0]??``,r=Rh(t[1]??`changes`,t[2]??``);return z.runtime.atom(M(z,p(e=>e(`review.diffs`,{cwd:n,target:r})),tt))}),Bh=L(e=>z.runtime.atom(M(z,p(t=>t(`review.state`,{cwd:e})),tt))),Vh=et.make({comments:N(),marks:N()}),Hh=L(e=>Ye(Bh(e),e=>Ge(e)?e.value:Vh)),Uh=L(()=>Xe(Je(()=>({generatingMessage:!1,publishing:!1})))),Wh=L(e=>$e(Uh(e),{fn:z.runtime.fn()(C(`DiffPage.generatePublishMessage`)(function*(t){return yield*(yield*z)(`publish.message.generate`,{cwd:e})})),reducer:e=>({...e,generatingMessage:!0})})),Gh=L(e=>$e(Uh(e),{fn:z.runtime.fn()(C(`DiffPage.approvePublish`)(function*(t){return yield*(yield*z)(`publish.approve`,{cwd:e,message:t})})),reducer:e=>({...e,publishing:!0})})),Kh=L(()=>Xe(Je(()=>({resolving:k(),resolvingAll:!1})))),qh=L(e=>$e(Kh(e),{fn:z.runtime.fn()(C(`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:s(e.resolving,ct.make(t.comment)),resolvingAll:e.resolvingAll})})),Jh=L(e=>$e(Kh(e),{fn:z.runtime.fn()(C(`DiffPage.resolveComments`)(function*(t){let n=yield*z;yield*M(t,A((e,t)=>ie(e.comment.threadId)&&e.comment.threadId===t.comment.threadId),ve(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:M(t,he(e.resolving,(e,t)=>s(e,ct.make(t.comment)))),resolvingAll:!0})}));function Yh(e){return M(e,he(d(),(e,t)=>pe(e,t.filePath,M(h(e,t.filePath),a(()=>N()),o(t)))),e=>b(e),F(e=>({comments:e[1],filePath:e[0]})))}async function Xh(e){try{await navigator.clipboard.writeText(M(e,F(Dh),de(`
221
-
222
- `)))}catch{ze.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(),i;t[0]===e.cwd?i=t[1]:(i=Ih(e.cwd),t[0]=e.cwd,t[1]=i);let o=Ze(i),s;t[2]===e.cwd?s=t[3]:(s=Hh(e.cwd),t[2]=e.cwd,t[3]=s);let c=Ze(s),u=(0,U.useState)(!1),d=(0,U.useState)(ng);if(lt(o))throw o.cause;let p;t[4]===o?p=t[5]:(p=Ge(o),t[4]=o,t[5]=p);let m=p,h,g,_;if(t[6]!==r||t[7]!==d||t[8]!==o||t[9]!==m){g=m?o.value.localCommits:N(),h=m?o.value.branchCommits:N();let e=D(g,h),n;t[13]===r?n=t[14]:(n=e=>e.hash===r.commit,t[13]=r,t[14]=n);let i=M(e,te(n),v);_=i?nt.make({hash:i.hash}):d[0],t[6]=r,t[7]=d,t[8]=o,t[9]=m,t[10]=h,t[11]=g,t[12]=_}else h=t[10],g=t[11],_=t[12];let y=_,b=e.cwd,x;t[15]===y?x=t[16]:(x=Lh(y),t[15]=y,t[16]=x);let S=`${b}\u0000${x}`,C;t[17]===S?C=t[18]:(C=zh(S),t[17]=S,t[18]=C);let w=C,O=(0,U.useState)(``),k=Ze(w),A=Ge(k)?k.value:N(),ee=be(O[0])&&se(A,e=>e.filePath===O[0])?O[0]:``,ie=(be(ee)?M(A,te(e=>e.filePath===ee),v):void 0)??A[0],ce=Qe(w),ue;t[19]===e.cwd?ue=t[20]:(ue=Bh(e.cwd),t[19]=e.cwd,t[20]=ue);let de=Qe(ue),fe,pe;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(pe=z.mutation(`review.comments.save`),fe={mode:`promise`},t[21]=fe,t[22]=pe):(fe=t[21],pe=t[22]);let he=it(pe,fe),ge;t[23]===e.cwd?ge=t[24]:(ge=qh(e.cwd),t[23]=e.cwd,t[24]=ge);let _e;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(_e={mode:`promise`},t[25]=_e):_e=t[25];let ve=it(ge,_e),ye;t[26]===e.cwd?ye=t[27]:(ye=Jh(e.cwd),t[26]=e.cwd,t[27]=ye);let I;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(I={mode:`promise`},t[28]=I):I=t[28];let xe=it(ye,I),Se;t[29]===e.cwd?Se=t[30]:(Se=Kh(e.cwd),t[29]=e.cwd,t[30]=Se);let we=Ze(Se),Te,De;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(Te=z.mutation(`review.state.mark`),De={mode:`promise`},t[31]=Te,t[32]=De):(Te=t[31],De=t[32]);let Oe=it(Te,De),ke,Ae;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ke=z.mutation(`review.state.unmark`),Ae={mode:`promise`},t[33]=ke,t[34]=Ae):(ke=t[33],Ae=t[34]);let Ne=it(ke,Ae),Pe;t[35]===we?Pe=t[36]:(Pe=e=>({...e,resolved:e.resolved===!0,resolving:E(we.resolving,e),source:e.source??`local`}),t[35]=we,t[36]=Pe);let Ie=F(c.comments,Pe),Le=ne(Ie,tg),Re=F(Le,eg),We=Yh(Le),Ke=ie?ne(Ie,e=>e.filePath===ie.filePath):N(),Je=M(A,re(qe),f),Ye=ne(c.marks,e=>E(Je,e)),Xe;t[37]!==e.cwd||t[38]!==Oe?(Xe=async function(t){try{await Oe({payload:{cwd:e.cwd,marks:t}})}catch{ze.error(`Failed to mark file reviewed.`)}},t[37]=e.cwd,t[38]=Oe,t[39]=Xe):Xe=t[39];let L=Xe,$e;t[40]!==e.cwd||t[41]!==Ne?($e=async function(t){try{await Ne({payload:{cwd:e.cwd,marks:t}})}catch{ze.error(`Failed to unmark file reviewed.`)}},t[40]=e.cwd,t[41]=Ne,t[42]=$e):$e=t[42];let et=$e,tt;t[43]!==L||t[44]!==A||t[45]!==O?(tt=function(e){O[1](e);let t=M(A,te(t=>t.filePath===e),l(qe),a($h));oe(t)||L(t)},t[43]=L,t[44]=A,t[45]=O,t[46]=tt):tt=t[46];let R=tt,rt;t[47]!==n||t[48]!==O||t[49]!==d?(rt=function(e){(0,U.startTransition)(()=>{n({search:e._tag===`commit`?{commit:e.hash}:{}})}),e._tag!==`commit`&&d[1](e),O[1](``)},t[47]=n,t[48]=O,t[49]=d,t[50]=rt):rt=t[50];let at=rt,ot;t[51]!==ce||t[52]!==de?(ot=function(){ce(),de()},t[51]=ce,t[52]=de,t[53]=ot):ot=t[53];let st=ot,ct;t[54]!==e.cwd||t[55]!==he?(ct=async function(t){try{await he({payload:{comment:t,cwd:e.cwd}})}catch{ze.error(`Failed to save comment.`)}},t[54]=e.cwd,t[55]=he,t[56]=ct):ct=t[56];let B=ct,dt;t[57]!==de||t[58]!==ve?(dt=async function(e){try{await ve({comment:e}),e.source===`github`&&de()}catch{ze.error(e.source===`github`?`Failed to resolve GitHub thread.`:`Failed to resolve comment.`)}},t[57]=de,t[58]=ve,t[59]=dt):dt=t[59];let V=dt,H;t[60]!==de||t[61]!==xe?(H=async function(e){try{await xe(e),de()}catch{ze.error(`Failed to resolve comment.`)}},t[60]=de,t[61]=xe,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]===u?mt=t[65]:(mt=()=>{u[1](!0)},t[64]=u,t[65]=mt),cr(pt,mt);let ht;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ht=(0,q.jsx)(Ce,{children:(0,q.jsx)(Me,{children:`Shortcuts`})}),t[66]=ht):ht=t[66];let gt;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,q.jsxs)(je,{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]!==u[0]||t[69]!==u[1]?(_t=(0,q.jsx)(Fe,{open:u[0],onOpenChange:u[1],children:gt}),t[68]=u[0],t[69]=u[1],t[70]=_t):_t=t[70];let vt=He,yt=e.cwd,bt=m&&o.value.dirty,xt;t[71]!==k||t[72]!==A?(xt=Ge(k)&&!oe(A),t[71]=k,t[72]=A,t[73]=xt):xt=t[73];let St=!m,Ct=m?o.value.prUrl:void 0,wt=m&&o.value.unpushedCommits,Tt;t[74]===g?Tt=t[75]:(Tt=ae(g),t[74]=g,t[75]=Tt);let Et=m?o.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]!==L||t[87]!==R||t[88]!==k||t[89]!==A||t[90]!==ie||t[91]!==et||t[92]!==Ye?(Ot=(0,q.jsx)(Ve,{defaultSize:`55%`,minSize:`15%`,children:(0,q.jsx)(`div`,{className:`h-full min-h-0`,children:Ge(k)?(0,q.jsx)(mg,{diffs:A,marks:Ye,markReviewed:e=>{L(e)},unmarkReviewed:e=>{et(e)},selectedEntry:ie,openReviewEntry:R}):(0,q.jsx)(`div`,{className:`flex h-full min-h-0`,children:(0,q.jsx)(P,{})})})}),t[86]=L,t[87]=R,t[88]=k,t[89]=A,t[90]=ie,t[91]=et,t[92]=Ye,t[93]=Ot):Ot=t[93];let kt;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(kt=(0,q.jsx)(Ue,{}),t[94]=kt):kt=t[94];let At=!m,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]!==h||t[98]!==g||t[99]!==y||t[100]!==at||t[101]!==At||t[102]!==jt?(Mt=(0,q.jsx)(Ve,{defaultSize:`45%`,minSize:`15%`,children:(0,q.jsx)(`div`,{className:`h-full min-h-0`,children:(0,q.jsx)(ug,{branchCommits:h,loading:At,localCommits:g,selected:y,selectCommit:jt,selectScope:at})})}),t[97]=h,t[98]=g,t[99]=y,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)(He,{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)(Ve,{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)(Ue,{}),t[110]=Ft):Ft=t[110];let It=Ve,Lt;t[111]===k?Lt=t[112]:(Lt=!Ge(k)&&(0,q.jsx)(`div`,{className:`flex h-full min-h-0`,children:(0,q.jsx)(P,{})}),t[111]=k,t[112]=Lt);let Rt;t[113]!==k||t[114]!==A?(Rt=Ge(k)&&oe(A)&&(0,q.jsx)(`div`,{className:`text-muted-foreground flex h-full items-center justify-center text-sm`,children:`No changed files.`}),t[113]=k,t[114]=A,t[115]=Rt):Rt=t[115];let zt=Ge(k)&&ie&&(0,q.jsx)(`div`,{className:`h-full min-h-0 min-w-0`,children:(0,q.jsx)(Mh,{filePath:ie.filePath,fileContent:ie.fileContent,patch:ie.patch,comments:Ke,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=!oe(Le)&&(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:F(We,e=>(0,q.jsxs)(j,{type:`button`,variant:`outline`,size:`xs`,"aria-label":`Open ${e.filePath}`,title:e.filePath,onClick:()=>{R(e.filePath)},children:[(0,q.jsx)(Ee,{filePath:e.filePath}),(0,q.jsx)(`span`,{className:`max-w-32 truncate`,children:M(T(`/`)(e.filePath),me,a(()=>e.filePath))})]},e.filePath))}),(0,q.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-1`,children:[(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Copy all comments`,title:`Copy all comments`,disabled:oe(Le),onClick:()=>{Xh(Le)},children:(0,q.jsx)(nn,{})}),(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Resolve all comments`,title:`Resolve all comments`,disabled:we.resolvingAll?!0:oe(Re),onClick:()=>{ft(Re)},children:we.resolvingAll?(0,q.jsx)(le,{className:`size-2.5 border opacity-60`}):(0,q.jsx)(Be,{})})]})]}),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 N()}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 a=Ze(r),o;t[2]===e.cwd?o=t[3]:(o=Wh(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 d=it(o,s),f;t[5]===e.cwd?f=t[6]:(f=Gh(e.cwd),t[5]=e.cwd,t[6]=f);let p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p={mode:`promise`},t[7]=p):p=t[7];let h=it(f,p),y,b,C,w,E;if(t[8]!==a.generatingMessage||t[9]!==a.publishing||t[10]!==h||t[11]!==n||t[12]!==d||t[13]!==e){let r=M(n[0],m),o=x({dirty:e.dirty,loading:e.loading}).pipe(I({loading:!0},lg),I({dirty:!0},cg),g(sg)),s=T(/\r?\n/)(r),f=m(s[0]),p=M(u(s,1),de(`
223
- `),m),D=x({generating:a.generatingMessage,hasSubject:be(f)}).pipe(I({generating:!0},og),I({hasSubject:!0},()=>f),g(()=>o)),O=async function(){if(!(e.loading||a.publishing||(e.dirty?!e.hasReviewableChanges:!e.unpushedCommits)||e.dirty&&S(r)))try{await h(r),n[1](``),e.refreshReview()}catch(e){let t=e;ze.error(_(t))}},k;t[19]!==a.generatingMessage||t[20]!==a.publishing||t[21]!==n||t[22]!==d||t[23]!==e.dirty||t[24]!==e.hasReviewableChanges||t[25]!==e.loading?(k=async function(){if(!(e.loading||a.generatingMessage||a.publishing||!e.dirty||!e.hasReviewableChanges))try{n[1](await d(null))}catch(e){let t=e;ze.error(_(t))}},t[19]=a.generatingMessage,t[20]=a.publishing,t[21]=n,t[22]=d,t[23]=e.dirty,t[24]=e.hasReviewableChanges,t[25]=e.loading,t[26]=k):k=t[26];let A=k,ee;t[27]!==e.unpushedCommits||t[28]!==e.unpushedCount||t[29]!==e.upstream?(ee=ie(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]=ee):ee=t[30];let te=e.loading||a.generatingMessage||a.publishing||!e.dirty||!e.hasReviewableChanges,ne;t[31]===A?ne=t[32]:(ne=()=>{A()},t[31]=A,t[32]=ne);let re;t[33]===a.generatingMessage?re=t[34]:(re=a.generatingMessage?(0,q.jsx)(le,{className:`size-2.5 border opacity-60`}):(0,q.jsx)(tn,{}),t[33]=a.generatingMessage,t[34]=re);let ae;t[35]!==te||t[36]!==ne||t[37]!==re?(ae=(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`size-4`,"aria-label":`Generate commit message`,title:`Generate commit message`,disabled:te,onClick:ne,children:re}),t[35]=te,t[36]=ne,t[37]=re,t[38]=ae):ae=t[38];let oe;t[39]===a.publishing?oe=t[40]:(oe=a.publishing?(0,q.jsx)(le,{className:`size-2.5 border opacity-60`}):(0,q.jsx)(sn,{}),t[39]=a.publishing,t[40]=oe);let se;t[41]!==e.loading||t[42]!==e.prUrl?(se=e.loading?(0,q.jsx)(`span`,{className:`text-muted-foreground flex size-4 items-center justify-center`,children:(0,q.jsx)(le,{className:`size-2.5 border opacity-60`})}):be(e.prUrl??``)&&(0,q.jsx)(`a`,{className:i(fe({size:`icon-xs`,variant:`ghost`}),`size-4`),href:M(URL.parse(e.prUrl??``),ue,c(ag),l(ig),v),target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open pull request`,title:`Open pull request`,children:(0,q.jsx)(We,{})}),t[41]=e.loading,t[42]=e.prUrl,t[43]=se):se=t[43];let ce=(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[ee,ae,(0,q.jsx)(j,{type:`submit`,variant:`ghost`,size:`icon-xs`,className:`size-4`,"aria-label":`Publish`,title:`Commit, push, and open a draft PR`,disabled:e.loading||a.publishing||(e.dirty?!e.hasReviewableChanges:!e.unpushedCommits)||e.dirty&&S(r),children:oe}),se]});w=`border-b p-2`,E=e=>{e.preventDefault(),O()},y=`border-input min-w-0 border font-mono text-xs leading-4 select-text`;let N;t[44]===ce?N=t[45]:(N=(0,q.jsx)(`div`,{className:`border-input flex shrink-0 items-center border-l px-1.5`,children:ce}),t[44]=ce,t[45]=N),b=(0,q.jsxs)(`div`,{className:`flex min-w-0 items-stretch`,children:[(0,q.jsx)(`span`,{title:D,className:i(`min-w-0 flex-1 truncate px-2 py-1.5`,(S(f)||a.generatingMessage)&&`text-muted-foreground`),children:D}),N]}),C=be(p)&&!a.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:p})})}),t[8]=a.generatingMessage,t[9]=a.publishing,t[10]=h,t[11]=n,t[12]=d,t[13]=e,t[14]=y,t[15]=b,t[16]=C,t[17]=w,t[18]=E}else y=t[14],b=t[15],C=t[16],w=t[17],E=t[18];let D;t[46]!==y||t[47]!==b||t[48]!==C?(D=(0,q.jsxs)(`div`,{className:y,children:[b,C]}),t[46]=y,t[47]=b,t[48]=C,t[49]=D):D=t[49];let O;return t[50]!==D||t[51]!==w||t[52]!==E?(O=(0,q.jsx)(`form`,{className:w,onSubmit:E,children:D}),t[50]=D,t[51]=w,t[52]=E,t[53]=O):O=t[53],O}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)(le,{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:i(`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,a=e.selected,o=e.selectScope,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=ot.make({}),t[3]=s):s=t[3];let c;t[4]!==e.selectScope||t[5]!==e.selected||t[6]!==s?(c=(0,q.jsx)(dg,{detail:`worktree`,label:`Changes`,selected:a,selectScope:o,target:s}),t[4]=e.selectScope,t[5]=e.selected,t[6]=s,t[7]=c):c=t[7];let l;t[8]!==e.localCommits||t[9]!==e.selectScope||t[10]!==e.selected?(l=!oe(e.localCommits)&&(0,q.jsx)(dg,{detail:`${ae(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]=l):l=t[11];let u;t[12]!==e.localCommits||t[13]!==r?(u=F(e.localCommits,r),t[12]=e.localCommits,t[13]=r,t[14]=u):u=t[14];let d;t[15]!==e.branchCommits||t[16]!==e.selectScope||t[17]!==e.selected?(d=!oe(e.branchCommits)&&(0,q.jsx)(dg,{detail:`${ae(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]=d):d=t[18];let f;t[19]!==e.branchCommits||t[20]!==r?(f=F(e.branchCommits,r),t[19]=e.branchCommits,t[20]=r,t[21]=f):f=t[21];let p;return t[22]!==c||t[23]!==l||t[24]!==u||t[25]!==d||t[26]!==f?(p=(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:[c,l,u,d,f]})}),t[22]=c,t[23]=l,t[24]=u,t[25]=d,t[26]=f,t[27]=p):p=t[27],p}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 a=e.selected._tag===e.target._tag&&`bg-primary/15 text-primary`,o;t[2]===a?o=t[3]:(o=i(`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`,a),t[2]=a,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:N(),name:``,path:``,type:`directory`};function n(e,t,r){if(w(t[0])){e.children.push({diff:r,name:r.filePath,path:r.filePath,type:`file`});return}if(ae(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=M(e.children,te(e=>e.name===t[0]),v);if(a?.type===`directory`){n(a,u(t,1),r);return}let o={children:N(),name:t[0],path:i,type:`directory`};e.children.push(o),n(o,u(t,1),r)}for(let r of e)n(t,T(`/`)(r.filePath),r);return M(t.children,F(e=>e.type===`directory`?pg(e):e))}function pg(e){let t=e.children[0];return ae(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,i,o,c,l;if(t[0]!==n||t[1]!==e){let u=fg(e.diffs),p=M(e.diffs,he(d(),gg)),m=f(e.marks);function g(t){if(t.type===`directory`)return(0,q.jsxs)(`li`,{className:`w-full min-w-0`,children:[(0,q.jsx)(Te,{icon:(0,q.jsx)(rn,{}),onClick:()=>{n[1](e=>E(e,t.path)?ee(e,t.path):s(e,t.path))},actions:(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:ae(t.children)}),children:t.name}),!E(n[0],t.path)&&(0,q.jsx)(`ul`,{className:`border-border/70 ml-[19px] flex flex-col border-l pl-2`,children:F(t.children,g)})]},t.path);let r=M(p,h(t.diff.filePath),a(hg)),i=Ke(r,m);return(0,q.jsx)(`li`,{className:`w-full min-w-0`,children:(0,q.jsx)(Te,{selected:e.selectedEntry?.filePath===t.diff.filePath,icon:(0,q.jsx)(Ee,{filePath:t.diff.filePath,className:`size-3`}),actions:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(vg,{state:i,onClick:t=>{t.stopPropagation(),!oe(r)&&(i===`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)}i=Pe,l=`h-full overflow-y-auto px-0 py-1`,r=ke,o=`min-h-0 flex-1 [&>ul]:min-h-0 [&>ul]:flex-1`,c=oe(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.`}):F(u,g),t[0]=n,t[1]=e,t[2]=r,t[3]=i,t[4]=o,t[5]=c,t[6]=l}else r=t[2],i=t[3],o=t[4],c=t[5],l=t[6];let u;t[7]!==r||t[8]!==o||t[9]!==c?(u=(0,q.jsx)(r,{className:o,children:c}),t[7]=r,t[8]=o,t[9]=c,t[10]=u):u=t[10];let p;return t[11]!==i||t[12]!==l||t[13]!==u?(p=(0,q.jsx)(i,{className:l,children:u}),t[11]=i,t[12]=l,t[13]=u,t[14]=p):p=t[14],p}function hg(){return N()}function gg(e,t){return pe(e,t.filePath,qe(t))}function _g(){return k()}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`,a;t[0]===r?a=t[1]:(a=i(`border-input text-primary-foreground flex size-3 shrink-0 items-center justify-center border`,r),t[0]=r,t[1]=a);let o;t[2]===e.state?o=t[3]:(o=e.state===`checked`&&(0,q.jsx)(xe,{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]!==a||t[9]!==o||t[10]!==s?(c=(0,q.jsxs)(`button`,{type:`button`,"aria-checked":n,className:a,role:`checkbox`,onClick:e.onClick,children:[o,s]}),t[6]=e.onClick,t[7]=n,t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function yg(e){return M(x(e.status),I(`added`,()=>(0,q.jsx)(`span`,{className:`text-emerald-600 dark:text-emerald-400`,children:`A`})),I(`deleted`,()=>(0,q.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:`D`})),I(`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};