@deslop/workbench 0.0.407 → 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.
- package/dist/client/assets/{-workbench-terminal-C3m5o50g.js → -workbench-terminal-Ne3Ca_Zm.js} +8 -8
- package/dist/client/assets/{agent-DWi_bAGy.js → agent-YDhqENQr.js} +1 -1
- package/dist/client/assets/agent-YvOEbSL4.js +2 -0
- package/dist/client/assets/{dialog-CpMhdP-y.js → dialog-O3wBc7X2.js} +2 -2
- package/dist/client/assets/diff-BcPEyFnc.js +223 -0
- package/dist/client/assets/diff-CZdOESVK.js +2 -0
- package/dist/client/assets/{external-link-Bw3Ptvfw.js → external-link-D8TqDHgo.js} +1 -1
- package/dist/client/assets/{fallbacks-f8E4aL2c.js → fallbacks-BYPj1x-T.js} +11 -11
- package/dist/client/assets/index-DFD32fIK.css +2 -0
- package/dist/client/assets/index-k88N8viu.js +10 -0
- package/dist/client/assets/{input-BVvU6Eiy.js → input-BHj016ES.js} +1 -1
- package/dist/client/assets/portless-DbuqdEMA.js +2 -0
- package/dist/client/assets/portless-rPZ2tatn.js +1 -0
- package/dist/client/assets/{resizable-CYsJ6Kg2.js → resizable-BlkgaK6V.js} +1 -1
- package/dist/client/assets/route-DKK79z62.js +2 -0
- package/dist/client/assets/route-DOc4X-Ya.js +45 -0
- package/dist/client/assets/{run-C8QYJmux.js → run-DVOYYIUX.js} +1 -1
- package/dist/client/assets/run-gggwaxnT.js +2 -0
- package/dist/client/assets/{sonner-CrB5PaMX.js → sonner-Bnl1Iat_.js} +1 -1
- package/dist/client/assets/state-Cxz4BVk7.js +2 -0
- package/dist/client/assets/terminal-Brvez29s.js +2 -0
- package/dist/client/assets/{terminal-Dj-VWVHI.js → terminal-CYX_Ixg-.js} +1 -1
- package/dist/client/assets/{triangle-alert-llGGn6BK.js → triangle-alert-Ceg_3GX9.js} +1 -1
- package/dist/client/index.html +11 -11
- package/dist/server.js +718 -784
- package/package.json +1 -1
- package/dist/client/assets/agent-BXm8Dnfe.js +0 -2
- package/dist/client/assets/diff-BDdajfz3.js +0 -2
- package/dist/client/assets/diff-mRZ3PeyD.js +0 -223
- package/dist/client/assets/index-D53pFEJY.js +0 -10
- package/dist/client/assets/index-YmJ_EbaF.css +0 -2
- package/dist/client/assets/portless-BYTEgoik.js +0 -1
- package/dist/client/assets/portless-Cke08ZHX.js +0 -2
- package/dist/client/assets/route-BzHtbTaZ.js +0 -2
- package/dist/client/assets/route-DD4r__Zm.js +0 -45
- package/dist/client/assets/run-CW5YhyWI.js +0 -2
- package/dist/client/assets/state-CvX-YRlC.js +0 -2
- package/dist/client/assets/terminal-DJzGIrES.js +0 -2
|
@@ -0,0 +1,223 @@
|
|
|
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,Cs as c,Do as l,Fs as u,Ga as d,Gt as f,Ht as p,In as m,Io as h,Kr as g,Kt as _,L as v,Ms as y,No as b,Qa as x,R as S,Rr as C,Sn as w,Ss as T,Ur as E,Ut as D,Va as O,Vi as k,Vt as A,Wt as j,Xa as M,Ya as ee,Za as te,a as ne,ao as N,eo as P,fo as re,go as ie,j as ae,jo as oe,k as se,no as ce,o as le,ps as ue,qa as F,qt as de,r as I,ro as fe,so as L,uo as R,vr as pe,vs as z,ys as me,z as B,zr as he}from"./fallbacks-BYPj1x-T.js";import{S as ge,_ as V,a as _e,b as ve,c as ye,d as be,g as xe,h as Se,l as Ce,m as we,n as Te,o as Ee,p as De,s as Oe,t as ke,v as Ae,x as je,y as Me}from"./dialog-O3wBc7X2.js";import{n as Ne,r as Pe}from"./sonner-Bnl1Iat_.js";import{n as Fe,r as Ie,t as Le}from"./resizable-BlkgaK6V.js";import{t as Re}from"./external-link-D8TqDHgo.js";import{A as ze,B as Be,C as Ve,D as He,H as Ue,I as We,L as Ge,M as Ke,N as qe,O as Je,P as Ye,R as Xe,S as Ze,V as H,b as Qe,h as U,k as $e,r as et,v as tt,x as nt,y as rt,z as it}from"./state-Cxz4BVk7.js";import{t as W}from"./preload-helper-CjdClQve.js";import{t as at}from"./diff-CZdOESVK.js";import{_ as ot,g as G,h as K,p as st}from"./src-DzxfdEt6.js";import{$ as ct,C as lt,E as ut,I as dt,L as ft,N as pt,P as mt,Q as ht,S as gt,T as _t,V as vt,W as yt,X as bt,Z as xt,_ as St,b as Ct,c as wt,g as Tt,l as Et,m as Dt,n as Ot,p as kt,q as At,r as jt,t as Mt,u as Nt}from"./chunk-CSCIHK7Q-DoGVP1BZ.js";import{a as Pt,b as Ft,f as It,g as Lt,h as Rt,i as zt,o as Bt,v as Vt,x as Ht,y as Ut}from"./chunk-5ZQYHXKU-DbN9DSns.js";import{t as Wt}from"./chunk-WU5MYG2G-CtG2KJlt.js";import{n as Gt,t as Kt}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 Jt}from"./chunk-O5CBEL6O-D1fDxsSH.js";import"./chunk-3OPIFGDE-BlIdNnu8.js";import"./chunk-KSCS5N6A-dbmnxO_p.js";import{n as Yt}from"./chunk-LZXEDZCA-BdVT_AWc.js";var Xt=u(`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`}]]),Zt=u(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Qt=u(`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`}]]),$t=u(`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`}]]),en=u(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),tn=u(`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`}]]),q=e(n(),1),nn=(0,q.createContext)(null);function rn(){return(0,q.useContext)(nn)?.defaultOptions??{}}function an(e){return typeof e==`object`&&!!e&&`current`in e}function on(){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 sn=[`Control`,`Alt`,`Shift`,`Meta`];new Set(sn);var cn={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 ln(e,t=on()){return e===`Mod`?t===`mac`?`Meta`:`Control`:e}var un=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``)),dn=new Set([`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`]),fn=new Set([`F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7`,`F8`,`F9`,`F10`,`F11`,`F12`]),pn=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),mn=new Set([`Enter`,`Escape`,`Space`,`Tab`,`Backspace`,`Delete`]),hn=new Set([`/`,`[`,`]`,`\\`,`=`,`-`,`,`,`.`,`;`,"`"]),gn={Backquote:"`",Backslash:`\\`,BracketLeft:`[`,BracketRight:`]`,Comma:`,`,Equal:`=`,Minus:`-`,Period:`.`,Semicolon:`;`,Slash:`/`};new Set([...un,...dn,...fn,...pn,...mn,...hn]);var _n={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 vn(e){return/^\p{Letter}$/u.test(e)}function yn(e){if(!e)return``;if(e in _n)return _n[e];if(vn(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 bn(e,t=on()){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=yn(a);else{let e=cn[a]??cn[a.toLowerCase()];if(e){let n=ln(e,t);r.add(n)}else n.length===1&&(i=yn(a))}}return!i&&n.length>0&&(i=yn(n[n.length-1].trim())),{key:i,ctrl:r.has(`Control`),shift:r.has(`Shift`),alt:r.has(`Alt`),meta:r.has(`Meta`),modifiers:sn.filter(e=>r.has(e))}}function xn(e,t=on()){let n=e.ctrl??!1,r=e.shift??!1,i=e.alt??!1,a=e.meta??!1;e.mod&&(ln(`Mod`,t)===`Control`?n=!0:a=!0);let o=sn.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 Sn(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 sn)e.modifiers.includes(t)&&r.push(t);return r.push(yn(e.key)),r.join(`+`)}function Cn(e,t=on()){return Sn(bn(e,t),t)}function wn(e,t=on()){return Sn(e,t)}function Tn(e,t=on()){return typeof e==`string`?Cn(e,t):wn(xn(e,t),t)}function En(e){let t=[];for(let n of sn)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join(`+`)}function Dn(e,t,n=on()){let r=typeof t==`string`?bn(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;let i=yn(e.key),a=r.key;if(i!==`Dead`&&i.length===1&&a.length===1){if(i.toUpperCase()===a.toUpperCase())return!0;if(vn(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 gn?gn[e.code]===a:!1}return i===a}var On={preventDefault:!0,stopPropagation:!0,eventType:`keydown`,enabled:!0,ignoreInputs:!0,conflictBehavior:`warn`};function kn(e){return!(e.ctrl||e.meta||e.key===`Escape`)}function An(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 jn(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 Mn(e,t,n){let r=jn(t);return r&&An(r)&&r!==n||e.composedPath().some(e=>An(e)&&e!==n)?!0:An(e.target)&&e.target!==n}function Nn(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 Pn(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 J=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 Fn({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&(J.RecursedCheck|J.Recursed|J.Dirty|J.Pending)?a&(J.RecursedCheck|J.Recursed)?a&J.RecursedCheck?!(a&(J.Dirty|J.Pending))&&c(e,i)?(i.flags=a|(J.Recursed|J.Pending),a&=J.Mutable):a=J.None:i.flags=a&~J.Recursed|J.Pending:a=J.None:i.flags=a|J.Pending,a&J.Watching&&t(i),a&J.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&J.Dirty)a=!0;else if((c&(J.Mutable|J.Dirty))===(J.Mutable|J.Dirty)){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&(J.Mutable|J.Pending))===(J.Mutable|J.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&=~J.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&(J.Pending|J.Dirty))===J.Pending&&(n.flags=r|J.Dirty,(r&(J.Watching|J.RecursedCheck))===J.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 In(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 Ln=[],Rn=0,{link:zn,unlink:Bn,propagate:Vn,checkDirty:Hn,shallowPropagate:Un}=Fn({update(e){return e._update()},notify(e){Ln[Gn++]=e,e.flags&=~J.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=J.Mutable|J.Dirty,Jn(e))}}),Wn=0,Gn=0,Kn,qn=0;function Jn(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Bn(n,e)}function Yn(){if(!(qn>0)){for(;Wn<Gn;){let e=Ln[Wn];Ln[Wn++]=void 0,e.notify()}Wn=0,Gn=0}}function Xn(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?J.None:J.Mutable,get(){return Kn!==void 0&&zn(i,Kn,Rn),i._snapshot},subscribe(e){let t=In(e),n={current:!1},r=Zn(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Kn,o=t?.compare??Object.is;if(n)Kn=i,++Rn,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=J.Mutable|J.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{Kn=a,n&&(i.flags&=~J.RecursedCheck),Jn(i)}}};return n?(i.flags=J.Mutable|J.Dirty,i.get=function(){let e=i.flags;if(e&J.Dirty||e&J.Pending&&Hn(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Un(e)}}else e&J.Pending&&(i.flags=e&~J.Pending);return Kn!==void 0&&zn(i,Kn,Rn),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Vn(e),Un(e),Yn())}},i}function Zn(e){let t=()=>{let t=Kn;Kn=n,++Rn,n.depsTail=void 0,n.flags=J.Watching|J.RecursedCheck;try{return e()}finally{Kn=t,n.flags&=~J.RecursedCheck,Jn(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:J.Watching|J.RecursedCheck,notify(){let e=this.flags;e&J.Dirty||e&J.Pending&&Hn(this.deps,this)?t():this.flags=J.Watching},stop(){this.flags=J.None,this.depsTail=void 0,Jn(this)}};return t(),n}var Qn=class{constructor(e,t){this.atom=Xn(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(In(e))}},$n=0;function er(){return`hotkey_${++$n}`}var tr=class e{static#e=null;#t;#n=new Map;#r=new Map;constructor(){this.registrations=new Qn(new Map),this.#t=on()}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:er(),unregister:()=>{},get callback(){return e},set callback(t){e=t},setOptions:()=>{},get isActive(){return!1}}}let r=er(),i=n.platform??this.#t,a=typeof e==`string`?bn(e,i):xn(e,i),o=typeof e==`string`?e:En(a),s=n.target??document,c=n.conflictBehavior??`warn`,l=this.#d(o,s);l&&Pn(l.id,o,c,e=>this.#i(e));let u=n.ignoreInputs??kn(a),d={id:r,hotkey:o,parsedHotkey:a,callback:t,options:{...On,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&&Nn(e,t)&&r.options.enabled&&!(r.options.ignoreInputs!==!1&&Mn(e,t,r.target)))if(n===`keydown`){if(r.options.eventType!==`keydown`)continue;Dn(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`&&Dn(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=yn(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 nr(){return tr.getInstance()}function rr(e,t,n={}){let r={...rn().hotkey,...n},i=nr(),a=(0,q.useRef)(null),o=(0,q.useRef)(t),s=(0,q.useRef)(r),c=(0,q.useRef)(i);o.current=t,s.current=r,c.current=i;let l=(0,q.useRef)(null),u=(0,q.useRef)(null),d=Tn(e,r.platform??on()),{target:f,...p}=r;(0,q.useEffect)(()=>{let e=an(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 ir=`diffs-container`;(()=>{try{return!1}catch{return!1}})();var ar=/(?=^From [a-f0-9]+ .+$)/m,or=/(?=^diff --git)/gm,sr=/(?<=\n)/,cr=/^(---|\+\+\+)\s+([^\t\r\n]+)/,lr=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,ur=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,dr=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,fr=`header-prefix`,pr=`header-metadata`,mr=`header-custom`,hr={dark:`pierre-dark`,light:`pierre-light`},gr=`data-theme-css`,_r=`data-unsafe-css`,vr=`data-diffs-scrollbar-measure`,yr=`--diffs-scrollbar-gutter-measured`,br=1e5,xr={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8};({...xr});var Sr=Object.freeze({fromStart:0,fromEnd:0}),Cr={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},wr={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function Tr(e){return e.replace(/\n$|\r\n$/,``)}var Er=new TextEncoder,Dr=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Or=/[\uD800-\uDFFF]/,kr=1024,Ar=new Uint8Array(kr);function jr(){Ar.length!==kr&&(Ar=new Uint8Array(kr))}function Mr(e){if(e.length===0)return e;if(Or.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Ar.length<t&&(Ar=new Uint8Array(t));let{written:n}=Er.encodeInto(e,Ar);return Dr.decode(Ar.subarray(0,n))}function Nr(e,t,n){try{return Pr(e,t,n)}finally{jr()}}function Pr(e,t,n=!1){let r=Qr(e),i=r?Vr(e):Hr(e),a,o=[];for(let e of i){if(r&&!or.test(e)){if(a==null)a=Mr(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}else if(!r&&!Ur(e)){if(a==null)a=Mr(e);else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let i=Ir(e,{cacheKey:t==null?void 0:`${t}-${o.length}`,isGitDiff:r,throwOnError:n});i!=null&&o.push(i)}return{patchMetadata:a,files:o}}function Fr(e,t){try{return Ir(e,t)}finally{jr()}}function Ir(e,{cacheKey:t,isGitDiff:n=or.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=$r(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=Br(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=Yr(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?zr(i.contents):[],deletionLines:!l&&r!=null&&i!=null?zr(r.contents):[],cacheKey:ti(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(ur),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=Mr(r.trim()),n!==r&&(c.prevName=Mr(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?lr:cr):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=Mr(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=Mr(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=Mr(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=Mr(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=Mr(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=Mr(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(dr)??[];t!=null&&(c.prevObjectId=Mr(t)),n!=null&&(c.newObjectId=Mr(n)),r!=null&&(c.mode=Mr(r))}e.startsWith(`rename from `)&&(c.prevName=Mr(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=Mr(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:ti(p.hunkContext),hunkSpecs:Mr(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&&qr(t)&&!Jr(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=ni(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=ri(t);(g==null||g.type!==`change`)&&(g=ii(`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=ri(t);(g==null||g.type!==`change`)&&(g=ii(`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=ri(t);(g==null||g.type!==`context`)&&(g=ii(`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]=Tr(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=Tr(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 Lr(e,t,n=!1){let r=[],i=Rr(e)?e.split(ar):[e];for(let e of i)try{r.push(Nr(e,t==null?void 0:`${t}-${r.length}`,n))}catch(e){if(n)throw e;console.error(e)}return r}function Rr(e){return e.startsWith(`From `)||e.includes(`
|
|
5
|
+
From `)}function zr(e){let t=Br(e);for(let e=0;e<t.length;e++)t[e]=Mr(t[e]);return t}function Br(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 Vr(e){return $r(e,`diff --git`)}function Hr(e){if(e.length===0)return[``];let t=[],n=0,r=0,i=0,a=0,o=!1;for(;r<e.length;){let s=Kr(e,r);if(i<=0&&a<=0){if(Wr(e,r)){r>n&&t.push(e.slice(n,r)),n=r,o=!0,r=Kr(e,s);continue}if(o&&e.startsWith(`@@ -`,r)){let t=Yr(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 Ur(e){return Wr(e,0)}function Wr(e,t){let n=Kr(e,t);return Gr(e,t,`---`)&&Gr(e,n,`+++`)}function Gr(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 Kr(e,t){let n=e.indexOf(`
|
|
8
|
+
`,t);return n===-1?e.length:n+1}function qr(e){let t=e[0];return t===`+`||t===`-`||t===` `}function Jr(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 Yr(e){if(!e.startsWith(`@@ -`))return;let t=4,n=Xr(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=Xr(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=Xr(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=Xr(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=Zr(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function Xr(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 Zr(e){return e.endsWith(`\r
|
|
10
|
+
`)?e.slice(0,-2):e.endsWith(`
|
|
11
|
+
`)?e.slice(0,-1):e}function Qr(e){return e.startsWith(`diff --git`)||e.includes(`
|
|
12
|
+
diff --git`)}function $r(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:ei(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=ei(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function ei(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function ti(e){return e==null?e:Mr(e)}function ni(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function ri(e){let t=e.slice(1);return Mr(t===``?`
|
|
13
|
+
`:t)}function ii(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 ai(e){let t=Lr(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 oi(e,t){return{...e,lang:t}}function si(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}var ci={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},li={display:`contents`};function ui(){return null}var Y=t();function di({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,Y.jsxs)(Y.Fragment,{children:[c==null?(0,Y.jsxs)(Y.Fragment,{children:[l!=null&&(0,Y.jsx)(`div`,{slot:`header-prefix`,children:l}),u!=null&&(0,Y.jsx)(`div`,{slot:`header-metadata`,children:u})]}):(0,Y.jsx)(`div`,{slot:mr,children:c}),i!=null&&a?.map((e,t)=>(0,Y.jsx)(`div`,{slot:si(e),children:i(e)},t)),o!=null&&(0,Y.jsx)(`div`,{slot:`gutter-utility-slot`,style:ci,children:o(s)})]})}function fi(e,t){return typeof window>`u`&&t!=null?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,Y.jsx)(Y.Fragment,{children:e})}function pi(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 mi(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function hi(e,t){let n=e?.theme??hr,r=t?.theme??hr,i=gi(e),a=gi(t);return mi(n,r)&&pi(e,t,[`theme`,`parseDiffOptions`])&&pi(i,a)}function gi(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}function _i(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function vi(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function yi(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function bi(e){return{type:`text`,value:e}}function X({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function xi({name:e,width:t=16,height:n=16,properties:r}){return X({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[X({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function Si(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 Ci(e){return X({tagName:`div`,properties:{"data-gutter":``},children:e})}function wi(e,t,n,r={}){return X({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[X({tagName:`span`,properties:{"data-line-number-content":``},children:[bi(`${t}`)]})]})}function Ti(e,t,n){return X({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 Ei(){return X({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[xi({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}var Di=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||vi(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&&Wi(e.composedPath())||(Gi(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||(Gi(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(Gi(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){Gi(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();Gi(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);Gi(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=Mi(i)&&this.hoveredLine?.lineElement===i.lineElement;ji(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),ji(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Mi(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(Pi(i)&&p!=null){p(i);break}if(Ni(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Mi(i))break;ji(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,Gi(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})()),Gi(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),Gi(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();Wi(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(yi(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=ve(Ei());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);Ai(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(Li(t));if(Ai(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(Ai(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(Ai(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&&Wi(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=Li(e);if(t&&Wi(n))return;let r=Ri(e);return r==null?this.pathFromAnnotationSlot(e):Li(r)}pathFromAnnotationSlot(e){let t=Bi(zi(e));if(t==null)return;let n=this.targetForSelectionPoint(t);return n==null?void 0:Li(n.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=Vi(t)?t:Vi(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)}vi(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);Fi(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=Ui(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=Ui(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:Ii(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:Ii(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:Hi(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:Hi(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 Oi({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:ki({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 ki({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 Ai(e){return e!=null&&`kind`in e&&e.kind===`line`}function ji(e){return e!=null&&`kind`in e&&e.kind===`token`}function Mi(e){return Ai(e)||ji(e)}function Ni(e){return`type`in e&&e.type===`line-info`}function Pi(e){return`kind`in e&&e.kind===`merge-conflict-action`}function Fi(e){return e===`current`||e===`incoming`||e===`both`}function Ii(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Li(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Ri(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 zi(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 Bi(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 Vi(e){return e!=null&&typeof e.elementFromPoint==`function`}function Hi(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function Ui(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 Wi(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 Gi(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 Ki=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`?Yi(t):Xi(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:qi(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:Ji(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 qi(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function Ji(e){return Math.max(Math.ceil(e),0)}function Yi(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 Xi(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 Zi(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Qi(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 $i=new Map,ea={"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 ta(e){if($i.has(e))return $i.get(e)??`text`;if(ea[e]!=null)return ea[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if($i.has(t[1]))return $i.get(t[1])??`text`;if(ea[t[1]]!=null)return ea[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return $i.has(n)?$i.get(n)??`text`:ea[n]??`text`}function na(e){return(e.lang??ta(e.name))===`text`}var ra=`-1,-1`;function ia(e){return e?.some(e=>e.lineNumber===0)??!1}function aa(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function oa(e){return e.startingLine===0&&e.totalLines>0}function sa({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 ca(e){for(let t of Array.isArray(e)?e:[e])if(!(t===`text`||t===`ansi`)&&!je.has(t))return!1;return!0}function la(e=hr){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}function ua(e){for(let t of la(e))if(!Ae.has(t))return!1;return!0}function da(e){return Me.hasResolvedThemes(e)}function fa(e,t){return mi(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function pa(e){return X({tagName:`div`,children:[X({tagName:`div`,children:e.annotations?.map(e=>X({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function ma(e,t){return X({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function ha(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 ga({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 X({tagName:`div`,children:[t===`custom`?X({tagName:`slot`,properties:{name:mr}}):_a({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[va(r)]],properties:i})}function _a({name:e,prevName:t,iconType:n}){let r=[X({tagName:`slot`,properties:{name:fr}}),xi({name:ha(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(X({tagName:`div`,children:[X({tagName:`bdi`,children:[bi(t)]})],properties:{"data-prev-name":``}})),r.push(xi({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(X({tagName:`div`,children:[X({tagName:`bdi`,children:[bi(e)]})],properties:{"data-title":``}})),X({tagName:`div`,children:r,properties:{"data-header-content":``}})}function va(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(X({tagName:`span`,children:[bi(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(X({tagName:`span`,children:[bi(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(X({tagName:`slot`,properties:{name:pr}})),X({tagName:`div`,children:t,properties:{"data-metadata":``}})}function ya(e){return X({tagName:`pre`,properties:ba(e)})}function ba({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 xa(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:la(t),preferredHighlighter:n}}function Sa(e){return e===``?[]:e.split(sr)}function Ca(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(bi(`
|
|
16
|
+
`)),e}var wa=Symbol(`no-token`),Ta=Symbol(`multiple-tokens`);function Ea(e){let t=Da(e);if(t!=null)return t;let n=wa,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`){ka(e,a);for(let t of e.children)Oa(t)}else Oa(e);r.push(e),i=[],a=void 0;return}for(let e of i)Oa(e);r.push(X({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==wa){if(e===Ta){n=Ta;return}if(n===wa){n=e;return}n!==e&&(n=Ta)}};for(let t of e.children){let e=t.type===`element`?Ea(t):wa;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 Da(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function Oa(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)Oa(t)}}function ka(e,t){e.properties[`data-char`]=t}function Aa(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+ja(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 ja(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 Ma(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=Si(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&Ea(a),i.push(Ca(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(Pa,Na),{state:n,transformers:r,toClass:Na}}var Na=Aa({classPrefix:`hl-`}),Pa={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 Fa(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var Ia=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,La=/^0(?:\.0+)?%?$/;function Ra(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 za(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 Ba(e){if(e==null)return null;let t=za(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 Va(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||Ia.test(t))return!0;let n=Ra(t);return n!=null&&La.test(n)}function Ha(e,t,n){if(t==null||n==null)return!1;let r=Ba(e),i=Ba(t),a=Ba(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var Ua=new WeakMap;function Wa(e){let t=Ua.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;Ga(r,`editor.background`,i),Ga(r,`editor.foreground`,a),Ga(r,`sideBar.background`,o),Ga(r,`sideBar.foreground`,s),Ga(r,`input.background`,n[`input.background`]??o),Ga(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),Ga(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),Ga(r,`gitDecoration.addedResourceForeground`,Ka(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),Ga(r,`gitDecoration.modifiedResourceForeground`,Ka(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),Ga(r,`gitDecoration.deletedResourceForeground`,Ka(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(Va(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(Va(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(qa(l,o)||Ha(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return Ua.set(e,u),u}function Ga(e,t,n){n!=null&&n!==``&&(e[t]=n)}function Ka(...e){for(let t of e)if(t!=null&&t!==``)return t}function qa(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function Ja({theme:e=hr,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=Wa(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${Fa(`global`)}fg:${a.fg};`,r+=`${Fa(`global`)}bg:${a.bg};`,r+=Ya(i,n)}else{let n=t.getTheme(e.dark),i=Wa(n);r+=`${Fa(`global`)}dark:${i.fg};`,r+=`${Fa(`global`)}dark-bg:${i.bg};`,r+=Ya(n,`dark`),n=t.getTheme(e.light),i=Wa(n),r+=`${Fa(`global`)}light:${i.fg};`,r+=`${Fa(`global`)}light-bg:${i.bg};`,r+=Ya(n,`light`)}return r}function Ya(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${Fa(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${Fa(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${Fa(`global`)}${t}modified-color:${a};`),n}function Xa(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 Za={forcePlainText:!1};function Qa(e,t,{theme:n=hr,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,startingLine:o,totalLines:s,lines:c}=Za){a?(o??=0,s??=1/0):(o=0,s=1/0);let l=o>0||s<1/0,{state:u,transformers:d}=Ma(i),f=a?`text`:e.lang??ta(e.name),p=typeof n==`string`?t.getTheme(n).type:void 0,m=Ja({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:Fa(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:d,defaultColor:!1,cssVariablePrefix:Fa(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},g=Xa(t.codeToHast(l?$a(c??Sa(e.contents),o,s):Tr(e.contents),h)),_=l?Array(o):g;return l&&_.push(...g),{code:_,themeStyles:m,baseThemeType:p}}function $a(e,t,n){let r=``;return sa({lines:e,startingLine:t,totalLines:n,callback({content:e}){r+=e}}),r}function eo(e){return e.useTokenTransformer===!0||e.onTokenClick!=null||e.onTokenEnter!=null||e.onTokenLeave!=null}var to=-1,no=class{__id=`file-renderer:${++to}`;highlighter;renderCache;computedLang=`text`;lineAnnotations={};lineCache;constructor(e={theme:hr},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=ua(e.theme??hr)?xe():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=ro(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!fa(t,r.options)&&(r=void 0),this.renderCache??={file:e,options:t,highlighted:!n&&!na(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??ta(e.name),this.initializeHighlighter())}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getFileRenderOptions();let{theme:e=hr,tokenizeMaxLineLength:t=1e3}=this.options;return{theme:e,useTokenTransformer:eo(this.options),tokenizeMaxLineLength:t}})(),{renderCache:n}=this;return n?.result==null||!Zi(e,n.file)||!fa(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getOrCreateLineCache(e){if(e.cacheKey==null)return this.lineCache=void 0,Sa(e.contents);let{lineCache:t}=this;return(t==null||t.cacheKey!==e.cacheKey)&&(t={cacheKey:e.cacheKey,lines:Sa(e.contents)}),this.lineCache=t,t.lines}renderFile(e=this.renderCache?.file,t=Cr){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||na(e)||ro(a.length,this.getTokenizeMaxLength()),c=!Zi(e,this.renderCache.file),l=!Qi(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??ta(e.name);let t=this.highlighter!=null&&ua(n.theme),i=this.highlighter!=null&&ca(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=Cr){let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=ro(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??ta(e.name);let n=this.highlighter!=null&&da(la(this.options.theme)),r=t||this.highlighter!=null&&ca(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:Qa(e,t,r,{forcePlainText:n}),options:r}}processFileResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{disableFileHeader:a=!1}=this.options,o=[],s=Ci(),c=this.getOrCreateLineCache(e),l=0,u=oa(t)?aa(this.lineAnnotations):void 0;return u!=null&&(s.children.push(Ti(`context`,`annotation`,1)),o.push(pa({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:u.map(e=>si(e))})),l++),sa({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(wi(`context`,r,`${t}`)),o.push(i),l++;let e=this.lineAnnotations[r];e!=null&&(s.children.push(Ti(`context`,`annotation`,1)),o.push(pa({type:`annotation`,hunkIndex:0,lineIndex:r,annotations:e.map(e=>si(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 ga({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return ve(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(X({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=Ci();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,ma(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return ve(t?X({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await V(xa(this.computedLang,this.options)),this.highlighter}onHighlightSuccess(e,t,n,r=!0){if(this.renderCache==null)return;let i=!Zi(e,this.renderCache.file)||!this.renderCache.highlighted||!fa(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||!fa(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Zi(e,n.file)&&fa(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 ya({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function ro(e,t){return e>t}var io=`<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 ao(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function oo(e,t){return e==null||t==null?e===t:co(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 so={};function co(e=so,t=so){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 lo(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function uo(){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 fo(){let e=document.createElement(`style`);return e.setAttribute(_r,``),e}var po;function mo(e){if(po!=null)return po;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(vr,`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),po=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),po}function ho(e){return`${yr}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var go=`@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;`,_o=`@layer base, theme, rendered, unsafe;`,vo=RegExp(`${So(yr)}\\s*:\\s*[^;]+;`);function yo(e){return`${_o}
|
|
69
|
+
@layer unsafe {
|
|
70
|
+
${e}
|
|
71
|
+
}`}function bo(e,t=`system`,n){return`${_o}
|
|
72
|
+
@layer rendered {
|
|
73
|
+
:host {${t===`system`?``:`
|
|
74
|
+
color-scheme: ${t};`}
|
|
75
|
+
${ho(n)}
|
|
76
|
+
${e}
|
|
77
|
+
}
|
|
78
|
+
}`}function xo(e,t){let n=ho(t);return e.replace(vo,n)}function So(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Co(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 wo({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 To({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=Eo(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function Eo(){let e=document.createElement(`style`);return e.setAttribute(gr,``),e}function Do(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function Oo(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(go)),t.adoptedStyleSheets=[e]}connectedCallback(){mo(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(ir,t)}var ko=[],Ao=-1,jo=class{static LoadedCustomComponent=!0;__id=`file:${++Ao}`;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:hr},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new no(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new Ki,this.interactionManager=new Di(`file`,Oi(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(Oi(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&&!mi(this.appliedThemeCSS.theme,this.options.theme??hr)}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),Mo(this.pre,i,this.options.collapsed)||No(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),Do(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(Co(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?ko: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=!Zi(this.file,e);if(!c&&!n&&Qi(u,this.renderRange)&&!m&&!p&&!f)return this.applyCachedThemeState(l);this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.file=e,this.fileRenderer.setOptions(Co(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,wr);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||na(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}-${si(r)}`,a=this.annotationCache.get(i);if(a==null||!ao(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:lo(si(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=uo();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??=fo(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=yo(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??hr,s=typeof o==`string`?o:{...o},c=mo(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=To({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:bo(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=xo(this.themeCSSStyle.textContent??``,mo(e)))}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e),this.code=wo({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??ve(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,mr,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,fr,e),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,pr,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:_i(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):_i(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=io;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};oo(i,this.appliedPreAttributes)||(Oo(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 Mo(e,t,n=!1){return!n&&e==null&&t!=null}function No(e,t,n=!1){return e==null&&t!=null&&!n}function Po(e){return{...xr,...e}}function Fo(e,t){let n=Io(e,t);return t?n:e.diffHeaderHeight+n}function Io(e,t){return e.paddingTop??(t?e.spacing:0)}function Lo(e){return e.paddingBottom??e.spacing}function Ro(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}var zo=5e3,Bo=-1;function Vo(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 Ho=class extends jo{__id=`virtualized-file:${++Bo}`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0};isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=xr,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){!t&&pi(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=!hi(t,e),r=Vo(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=ia(this.lineAnnotations);if(this.renderRange!=null&&r&&oa(this.renderRange)){let t=Uo(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=Wo(this.getOrCreateLineCache(this.file)),i=Fo(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=Wo(this.getOrCreateLineCache(this.file));if(i<0)return;let a=Fo(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=Fo(this.metrics,r),l=Lo(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:sa({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%zo===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=Fo(this.metrics,i),f=l>0?Lo(this.metrics):0,{fileAnnotationHeight:p}=this.cache,m=d+p,h=Math.max(0,u-d-p-f),g=ia(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(sa({lines:c,startingLine:T?.lineIndex??0,callback:({lineIndex:e})=>{let i=D%o===0,a=Math.floor(D/o);if(i&&(w[a]=E-(t+m),A!=null)){if(A<=0)return!0;A--}let s=this.getLineHeight(e,!1);return E>n-s&&E<r&&(O??=a),E+s>S&&(k??=a),A==null&&E>=r&&i&&(A=C),D++,E+=s,!1}}),O==null)if(v)O=0,k=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:u-d-f};k??=O;let j=Math.round(k-x/2),M=Math.max(0,Math.ceil(l/o)-x),ee=Math.max(0,Math.min(j,M)),te=ee*o,ne=j<0?b+j*o:b,N=w[ee]??0,P=te===0?0:p+N,re=ee+ne/o,ie=re<w.length?h-w[re]:h-(E-t-m);return{startingLine:te,totalLines:ne,bufferBefore:P,bufferAfter:Math.max(0,ie)}}};function Uo(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===ra&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}function Wo(e){let t=e.at(-1);return t==null||t===``||t===`
|
|
79
|
+
`||t===`\r
|
|
80
|
+
`||t===`\r`?e.length-2:e.length-1}function Go(e){let t=(0,q.useRef)(e);return(0,q.useInsertionEffect)(()=>void(t.current=e)),(0,q.useCallback)((...e)=>t.current(...e),[])}function Ko(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}function qo(e,t){return mi(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Jo(e){let t=e.lang??ta(e.name),n=e.lang??(e.prevName==null?`text`:ta(e.prevName));return t===`text`&&n===`text`}function Yo({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 Xo({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 Zo({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=Xo({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 Qo({type:e,metrics:t}){return t.hunkSeparatorHeight??Ro(e)}function $o({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function es({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 ts(e){return e!==`simple`&&e!==`metadata`}function ns({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!es({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=Qo({type:e,metrics:t}),a=$o({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function rs({type:e,metrics:t}){if(!ts(e))return;let n=Qo({type:e,metrics:t}),r=$o({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function is({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=as({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=Yo({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),s=n===c.finalHunkIndex?Zo({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(cs(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,cs(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(cs(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=ls(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(us({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(cs(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 as({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=os({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 os({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=Yo({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?Zo({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 ss(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 cs(e,t,n,r,i,a){let[o,s]=ss(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 ls(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 us({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 ds=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}},fs=new class extends ds{};function ps(e,t,n){return fs.diff(e,t,n)}function ms(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 hs(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 gs(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 _s(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 vs(e,t){return gs(e,t,``)}function ys(e,t){return _s(e,t,``)}function bs(e,t){return t.slice(0,xs(e,t))}function xs(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 Ss(e){let t;for(t=e.length-1;t>=0&&e[t].match(/\s/);t--);return e.substring(t+1)}function Cs(e){let t=e.match(/^\s*/);return t?t[0]:``}var ws=`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}`,Ts=RegExp(`[${ws}]+|\\s+|[^${ws}]`,`ug`);new class extends ds{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(Ts)||[];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)&&Es(n,i,r,e),n=e,r=null,i=null)}),(r||i)&&Es(n,i,r,null),e}};function Es(e,t,n,r){if(t&&n){let i=Cs(t.value),a=Ss(t.value),o=Cs(n.value),s=Ss(n.value);if(e){let r=ms(i,o);e.value=_s(e.value,o,r),t.value=vs(t.value,r),n.value=vs(n.value,r)}if(r){let e=hs(a,s);r.value=gs(r.value,s,e),t.value=ys(t.value,e),n.value=ys(n.value,e)}}else if(n){if(e){let e=Cs(n.value);n.value=n.value.substring(e.length)}if(r){let e=Cs(r.value);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Cs(r.value),i=Cs(t.value),a=Ss(t.value),o=ms(n,i);t.value=vs(t.value,o);let s=hs(vs(n,o),a);t.value=ys(t.value,s),r.value=gs(r.value,n,s),e.value=_s(e.value,n,n.slice(0,n.length-s.length))}else if(r){let e=Cs(r.value),n=bs(Ss(t.value),e);t.value=ys(t.value,n)}else if(e){let n=bs(Ss(e.value),Cs(t.value));t.value=vs(t.value,n)}}var Ds=new class extends ds{tokenize(e){let t=RegExp(`(\\r?\\n)|[${ws}]+|[^\\S\\n\\r]+|[^${ws}]`,`ug`);return e.match(t)||[]}};function Os(e,t,n){return Ds.diff(e,t,n)}var ks=new class extends ds{constructor(){super(...arguments),this.tokenize=js}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 As(e,t,n){return ks.diff(e,t,n)}function js(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 Ms(e){return e==`.`||e==`!`||e==`?`}new class extends ds{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(Ms(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 ds{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends ds{constructor(){super(...arguments),this.tokenize=js}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(Ns(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 Ns(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]=Ns(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]=Ns(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends ds{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};var Ps={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Fs(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;As(n,r,Object.assign(Object.assign({},s),{callback:t=>{e(l(t))}}))}else return l(As(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||Rs(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 Is(e,t){if(t||=Ps,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=>Is(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 Ls(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Fs(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Is(e,o.headerOptions):void 0)}}))}else{let s=Fs(e,t,n,r,i,a,o);return s?Is(s,o?.headerOptions):void 0}}function Rs(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 zs({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 Bs({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 Vs={forcePlainText:!1};function Hs(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=Vs){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=Ja({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)??Ws();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)}is({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&&Us({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}=Gs({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 Us({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=Tr(e),t=Tr(t),e.length>s||t.length>s))return;let c=o===`char`?ps(e,t):Os(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?(Bs({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),Bs({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?Bs({item:e,arr:l,enableJoin:d,isLastItem:t}):Bs({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(zs({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(zs({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function Ws(){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 Gs({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c=hr,...l}}){let u=s??ta(e.name),d=s??ta(t.name),{state:f,transformers:p}=Ma(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Fa(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Fa(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,Xa(i.codeToHast(Tr(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,Xa(i.codeToHast(Tr(t.contents),m)))}}var Ks=(0,q.createContext)(void 0),qs=(0,q.createContext)(void 0);function Js(){return(0,q.useContext)(qs)}var Ys=typeof window>`u`?q.useEffect:q.useLayoutEffect;function Xs({file:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,metrics:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c}){let l=Js(),u=r!==void 0,d=(0,q.useContext)(Ks),f=(0,q.useRef)(null),p=Go(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 jo(Zs({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c?void 0:d,!0):f.current=new Ho(Zs({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 Ys(()=>{if(f.current==null)return;let i=Zs({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),a=!hi(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,q.useCallback)(()=>f.current?.getHoveredLine(),[])}}function Zs({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return!t&&!r&&!n?e:{...e,controlledSelection:t,renderCustomHeader:n?ui:e?.renderCustomHeader,renderGutterUtility:r?ui:e?.renderGutterUtility}}function Qs({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}=Xs({file:e,options:r,metrics:i,lineAnnotations:t,selectedLines:n,prerenderedHTML:d,hasGutterRenderUtility:f!=null,hasCustomHeader:c!=null,disableWorkerPool:p});return(0,Y.jsx)(ir,{ref:m,className:a,style:o,children:fi(di({file:e,renderAnnotation:s,renderCustomHeader:c,renderHeaderPrefix:l,renderHeaderMetadata:u,renderGutterUtility:f,lineAnnotations:t,getHoveredLine:h}),d)})}function $s({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function ec(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:tc(n,e.startContentIndex)}}function tc(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 nc({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,Y.jsxs)(Y.Fragment,{children:[d==null?(0,Y.jsxs)(Y.Fragment,{children:[f!=null&&(0,Y.jsx)(`div`,{slot:`header-prefix`,children:f}),p!=null&&(0,Y.jsx)(`div`,{slot:`header-metadata`,children:p})]}):(0,Y.jsx)(`div`,{slot:mr,children:d}),a!=null&&c?.map((e,t)=>(0,Y.jsx)(`div`,{slot:si(e),children:a(e)},t)),t!=null&&s!=null&&u!=null&&t.map(t=>{if(t==null)return;let n=rc(t,e);return(0,Y.jsx)(`div`,{slot:n,style:li,children:s(t,u)},n)}),o!=null&&(0,Y.jsx)(`div`,{slot:`gutter-utility-slot`,style:ci,children:o(l)})]})}function rc(e,t){let n=ec(e,t);return n==null?void 0:$s({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}function ic(e,t,n,r=!1){let i=Fr(Ls(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 ac=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 oc(e){return X({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function sc(e){return X({tagName:`div`,children:[X({tagName:`span`,children:[bi(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function cc(e){return X({tagName:`div`,children:[xi({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 lc({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(X({tagName:`div`,children:[bi(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(cc(`up`)),s++),o||(e.push(cc(`down`)),s++)):(e.push(cc(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(X({tagName:`div`,children:[X({tagName:`span`,children:[bi(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(X({tagName:`div`,children:[bi(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(X({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(X({tagName:`slot`,properties:{name:i}})),X({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 uc(e,t){return`hunk-separator-${e}-${t}`}function dc(e){let t=e.at(-1);return t==null?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function fc(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}var pc=-1,mc=class{__id=`diff-hunks-renderer:${++pc}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;constructor(e={theme:hr},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=ua(e.theme??hr)?xe():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)??Sr}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=>pa(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=hr,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=br,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 V(xa(this.computedLang,this.options)),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=Sc(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!qo(t,r.options)&&(r=void 0),this.renderCache??={diff:e,highlighted:!n&&!Jo(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??ta(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:eo(this.options),tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!Ko(e,n.diff)||!qo(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=Cr){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||Jo(e)||Sc(e,this.getTokenizeMaxLength()),l=!Ko(e,this.renderCache.diff),u=!Qi(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,fc(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??ta(e.name);let t=this.highlighter!=null&&ua(i.theme),n=this.highlighter!=null&&ca(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=Cr){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 ya({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=Sc(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??ta(e.name);let n=this.highlighter!=null&&ua(this.options.theme??hr),r=t||this.highlighter!=null&&ca(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:Hs(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||!qo(this.renderCache.options,n)||!Ko(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||!qo(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Ko(e,n.diff)&&qo(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:Ci(),deletionsGutterAST:Ci(),additionsGutterAST:Ci(),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=Xo({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`,Ti(void 0,`buffer`,this.size)),f?.push(oc(this.size))):(v.pushToGutter(`deletions`,Ti(void 0,`buffer`,this.size)),p?.push(oc(this.size))),this.size=0,this.side=void 0}}},x=(e,t,n,r,i)=>{v.pushToGutter(e,wi(t,n,r,i))};function S(e){b.flush(),a===`unified`?bc(`unified`,e,v):(bc(`deletions`,e,v),bc(`additions`,e,v))}this.pushFileLevelAnnotations(e,a,t,v),is({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&&_c(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=xc(r,u.contentProperties)):i=xc(i,u.contentProperties),yc({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&&_c(n.after,v)}else{let n=this.getSplitInjectedRowsForLine?.(p);n?.before!=null&&vc(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=xc(r,a.contentProperties);x(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=xc(i,u.contentProperties);x(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}yc({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...m,createAnnotationElement:e=>this.createAnnotationElement(e),context:v}),n?.after!=null&&vc(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(sc(e)),v.pushToGutter(`unified`,Ti(e,`metadata`,1))):(v.deletionsContentAST.push(sc(e)),v.pushToGutter(`deletions`,Ti(e,`metadata`,1)),T||(v.pushToGutter(`additions`,Ti(void 0,`buffer`,1)),v.additionsContentAST.push(oc(1))))}if(T){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(v.unifiedContentAST.push(sc(e)),v.pushToGutter(`unified`,Ti(e,`metadata`,1))):(v.additionsContentAST.push(sc(e)),v.pushToGutter(`additions`,Ti(e,`metadata`,1)),w||(v.pushToGutter(`deletions`,Ti(void 0,`buffer`,1)),v.deletionsContentAST.push(oc(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(dc(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=Ci(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,ma(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(X({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(X({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(X({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return ve(this.renderFullAST(e,t))}renderPartialHTML(e,t){return ve(t==null?e:X({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(!oa(n))return;let i=e.type===`new`?[]:hc(aa(this.deletionAnnotations)),a=e.type===`deleted`?[]:hc(aa(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){yc({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}yc({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(si(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(si(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 ga({fileOrDiff:e,mode:t,stickyHeader:n})}};function hc(e){return e?.map(e=>si(e))??[]}function gc(e){return`${e} unmodified line${e>1?`s`:``}`}function _c(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function vc(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 yc({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`,Ti(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`,Ti(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`,Ti(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function bc(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,lc({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(lc({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,lc({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(lc({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=uc(e,t),d=r>c.expansionLineCount,f=s?t:void 0;c.pushToGutter(e,lc({type:c.hunkSeparators,content:gc(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(lc({type:c.hunkSeparators,content:gc(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 xc(e,t){return e==null||e.type!==`element`||t==null?e:{...e,properties:{...e.properties,...t}}}function Sc(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Cc(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function wc(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 Tc(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 Ec=-1,Dc=class{static LoadedCustomComponent=!0;__id=`file-diff:${++Ec}`;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:hr},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Ki,this.scrollSyncManager=new ac,this.interactionManager=new Di(`diff`,Oi(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 Tc(e)}createHunksRenderer(e){return new mc(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(Oi(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&&!mi(this.appliedThemeCSS.theme,this.options.theme??hr)}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),Ac(this.pre,Oc({fileDiff:s,oldFile:a,newFile:o}),this.options.collapsed)||jc(this.headerElement,kc({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),Do(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?ic(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&&(!Zi(e,this.deletionFile)||!Zi(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&&Qi(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=ic(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,wr);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||Jo(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||!wc(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}-${si(r)}`,a=this.annotationCache.get(i);if(a==null||!Cc(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:lo(si(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=uo();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:_i(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):_i(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=io;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??ve(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,mr,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,fr,s),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,pr,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??=fo(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=yo(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??hr,s=typeof o==`string`?o:{...o},c=mo(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=To({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:bo(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=xo(this.themeCSSStyle.textContent??``,mo(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=wo({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=wo({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=wo({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=Mc(t[0]),i=Mc(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};oo(u,this.appliedPreAttributes)||(Oo(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 Oc({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function kc({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function Ac(e,t,n=!1){return!n&&e==null&&t}function jc(e,t,n=!1){return e==null&&t&&!n}function Mc(e){if(!(e==null||e.type!==`element`))return e.children??[]}function Nc({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o}){let s=Fo(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=Yo({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=ns({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=Pc(i);s+=f.split*t.lineHeight,c+=f.unified*t.lineHeight;let p=n===u?Zo({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=rs({type:r,metrics:t})?.totalHeight??0;s+=e,c+=e}}}if(e.hunks.length>0){let e=Lo(t);s+=e,c+=e}return{splitHeight:s,unifiedHeight:c}}function Pc(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 Fc(e,t)}function Fc(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 Ic=5e3,Lc=-1,Rc=class extends Dc{__id=`little-virtualized-file-diff:${++Lc}`;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=Po(n)}setMetrics(e,t=!1){let n=Po(e);!t&&pi(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||!ia(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=!hi(t,e),r=n&&Kc(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:qc(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&&oa(this.renderRange)){let t=zc(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=Yc(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=!Ko(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=Po(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=Fo(this.metrics,r),d=this.getLayoutCheckpointBeforeLineIndex(l),f=d?.top??u+this.cache.fileAnnotationHeight;if(a)return{top:u,height:0};let p;return is({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=ns({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=rs({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??Fo(this.metrics,t)+this.cache.fileAnnotationHeight,l;return is({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=ns({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=rs({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=Fo(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}=Nc({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?ic(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 Jc(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=Bc(this.cache.heightDeltas),c=Fo(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=Uc(a);for(;u<o;){let e=u-a,r=c+(e>0?n:0)+e*this.metrics.lineHeight+Wc(i,e)*this.metrics.lineHeight+Vc(s,t,t+e);this.cache.checkpoints.push({renderedLineIndex:u,lineIndex:t+e,top:r}),u+=Ic}c+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Vc(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=Yo({isPartial:this.fileDiff.isPartial,rangeSize:t.collapsedBefore,expandedHunks:o,hunkIndex:e,collapsedContextThreshold:n}),c=s.collapsedLines>0?ns({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?Zo({fileDiff:this.fileDiff,hunkIndex:e,expandedHunks:o,collapsedContextThreshold:n,errorPrefix:`VirtualizedFileDiff`}):void 0,f=d!=null&&d.collapsedLines>0?rs({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:Gc({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}=Yo({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=Zo({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=Fo(this.metrics,i),m=e.hunks.length>0?Lo(this.metrics):0,{fileAnnotationHeight:h}=this.cache,g=p+h,_=Math.max(0,d-p-h-m),v=this.hasFileAnnotations(e),y=t+p,b=h>0&&v&&y<r&&y+h>n;if(t<n-d||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:d-p-m};if(f<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(),f=this.cache.totalLines>0?this.cache.totalLines:f;let x=Math.ceil(Math.max(r-n,0)/c),S=Math.ceil(x/s)*s+s,C=S/s,w=C,T=[],E=(n+r)/2,D=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-S*c*2),s),O=t+(D?.top??g),k=D?.renderedLineIndex??0,A,j,M;if(is({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?ns({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),M!=null)){if(M<=0)return!0;M--}let y=this.getLineHeight(l===`split`?f:p,m);return O>n-y&&O<r&&(A??=v),j==null&&O+y>E&&(j=v),M==null&&O>=r&&_&&(M=w),k++,O+=y,o>0&&(O+=rs({type:u,metrics:this.metrics})?.totalHeight??0),!1}}),A==null)if(b)A=0,j=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:d-p-m};j??=A;let ee=Math.round(j-C/2),te=Math.max(0,Math.ceil(f/s)-C),ne=Math.max(0,Math.min(ee,te)),N=ne*s,P=ee<0?S+ee*s:S,re=T[ne]??0,ie=N===0?0:h+re,ae=ne+P/s,oe=ae<T.length?_-T[ae]:_-(O-t-g);return{startingLine:N,totalLines:P,bufferBefore:ie,bufferAfter:Math.max(0,oe)}}};function zc(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===ra&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function Bc(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 Vc({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=Hc(e,n);return(t[Hc(e,r)]??0)-(t[i]??0)}function Hc(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 Uc(e){return Math.ceil(e/Ic)*Ic}function Wc(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Gc({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 Kc(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 qc(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 Jc(e){return typeof e==`function`?`custom`:e??`line-info`}function Yc(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}var Xc=typeof window>`u`?q.useEffect:q.useLayoutEffect;function Zc({fileDiff:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,metrics:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c}){let l=Js(),u=r!==void 0,d=(0,q.useContext)(Ks),f=(0,q.useRef)(null),p=Go(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 Dc(Qc({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c?void 0:d,!0):f.current=new Rc(Qc({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 Xc(()=>{let{current:i}=f;if(i==null)return;let a=Qc({controlledSelection:u,hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c=!hi(i.options,a);i.setOptions(a),i.render({forceRender:c,fileDiff:e,lineAnnotations:n}),r!==void 0&&i.setSelectedLines(r)}),{ref:p,getHoveredLine:(0,q.useCallback)(()=>f.current?.getHoveredLine(),[])}}function Qc({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return!t&&!r&&!n?e:{...e,controlledSelection:t,renderCustomHeader:n?ui:e?.renderCustomHeader,renderGutterUtility:r?ui:e?.renderGutterUtility}}function $c({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}=Zc({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:s,hasGutterRenderUtility:f!=null,hasCustomHeader:l!=null,disableWorkerPool:p});return(0,Y.jsx)(ir,{ref:m,className:a,style:o,children:fi(nc({fileDiff:e,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderMetadata:d,renderAnnotation:c,renderGutterUtility:f,lineAnnotations:r,getHoveredLine:h}),s)})}var el=r(),tl=e=>{let t=(0,el.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.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,Y.jsx)(`svg`,{...e,viewBox:`0 0 1024 1024`,fill:`none`,children:n}),t[1]=e,t[2]=r),r};function nl(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 rl(e){if(Array.isArray(e))return e}function il(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 al(){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 ol(e,t){return rl(e)||il(e,t)||sl(e,t)||al()}function sl(e,t){if(e){if(typeof e==`string`)return nl(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)?nl(e,t):void 0}}var cl=Object.entries,ll=Object.setPrototypeOf,ul=Object.isFrozen,dl=Object.getPrototypeOf,fl=Object.getOwnPropertyDescriptor,pl=Object.freeze,ml=Object.seal,hl=Object.create,gl=typeof Reflect<`u`&&Reflect,_l=gl.apply,vl=gl.construct;pl||=function(e){return e},ml||=function(e){return e},_l||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},vl||=function(e){return new e(...[...arguments].slice(1))};var yl=zl(Array.prototype.forEach),bl=zl(Array.prototype.lastIndexOf),xl=zl(Array.prototype.pop),Sl=zl(Array.prototype.push),Cl=zl(Array.prototype.splice),wl=Array.isArray,Tl=zl(String.prototype.toLowerCase),El=zl(String.prototype.toString),Dl=zl(String.prototype.match),Ol=zl(String.prototype.replace),kl=zl(String.prototype.indexOf),Al=zl(String.prototype.trim),jl=zl(Number.prototype.toString),Ml=zl(Boolean.prototype.toString),Nl=typeof BigInt>`u`?null:zl(BigInt.prototype.toString),Pl=typeof Symbol>`u`?null:zl(Symbol.prototype.toString),Fl=zl(Object.prototype.hasOwnProperty),Il=zl(Object.prototype.toString),Ll=zl(RegExp.prototype.test),Rl=Bl(TypeError);function zl(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return _l(e,t,n)}}function Bl(e){return function(){return vl(e,[...arguments])}}function Z(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Tl;if(ll&&ll(e,null),!wl(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(ul(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Vl(e){for(let t=0;t<e.length;t++)Fl(e,t)||(e[t]=null);return e}function Hl(e){let t=hl(null);for(let r of cl(e)){var n=ol(r,2);let i=n[0],a=n[1];Fl(e,i)&&(wl(a)?t[i]=Vl(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=Hl(a):t[i]=a)}return t}function Ul(e){switch(typeof e){case`string`:return e;case`number`:return jl(e);case`boolean`:return Ml(e);case`bigint`:return Nl?Nl(e):`0`;case`symbol`:return Pl?Pl(e):`Symbol()`;case`undefined`:return Il(e);case`function`:case`object`:{if(e===null)return Il(e);let t=e,n=Wl(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Il(e)}return Il(e)}default:return Il(e)}}function Wl(e,t){for(;e!==null;){let n=fl(e,t);if(n){if(n.get)return zl(n.get);if(typeof n.value==`function`)return zl(n.value)}e=dl(e)}function n(){return null}return n}function Gl(e){try{return Ll(e,``),!0}catch{return!1}}var Kl=pl(`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(`.`)),ql=pl(`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(`.`)),Jl=pl([`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`]),Yl=pl([`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`]),Xl=pl(`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(`.`)),Zl=pl([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Ql=pl([`#text`]),$l=pl(`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(`.`)),eu=pl(`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(`.`)),tu=pl(`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(`.`)),nu=pl([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),ru=ml(/{{[\w\W]*|^[\w\W]*}}/g),iu=ml(/<%[\w\W]*|^[\w\W]*%>/g),au=ml(/\${[\w\W]*/g),ou=ml(/^data-[\-\w.\u00B7-\uFFFF]+$/),su=ml(/^aria-[\-\w]+$/),cu=ml(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),lu=ml(/^(?:\w+script|data):/i),uu=ml(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),du=ml(/^html$/i),fu=ml(/^[a-z][.\w]*(-[.\w]+)+$/i),pu=ml(/<[/\w!]/g),mu=ml(/<[/\w]/g),hu=ml(/<\/no(script|embed|frames)/i),gu=ml(/\/>/i),_u={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},vu=function(){return typeof window>`u`?null:window},yu=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}},bu=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},xu=function(e,t,n,r){return Fl(e,t)&&wl(e[t])?Z(r.base?Hl(r.base):{},e[t],r.transform):n};function Su(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:vu(),t=e=>Su(e);if(t.version=`3.4.11`,t.removed=[],!e||!e.document||e.document.nodeType!==_u.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=Wl(d,`cloneNode`),p=Wl(d,`remove`),m=Wl(d,`nextSibling`),h=Wl(d,`childNodes`),g=Wl(d,`parentNode`),_=Wl(d,`shadowRoot`),v=Wl(d,`attributes`),y=o&&o.prototype?Wl(o.prototype,`nodeType`):null,b=o&&o.prototype?Wl(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 Rl(`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=yu(u,i),!0),C},A=n,j=A.implementation,M=A.createNodeIterator,ee=A.createDocumentFragment,te=A.getElementsByTagName,ne=r.importNode,N=bu();t.isSupported=typeof cl==`function`&&typeof g==`function`&&j&&j.createHTMLDocument!==void 0;let P=ru,re=iu,ie=au,ae=ou,oe=su,se=lu,ce=uu,le=fu,ue=cu,F=null,de=Z({},[...Kl,...ql,...Jl,...Xl,...Ql]),I=null,fe=Z({},[...$l,...eu,...tu,...nu]),L=Object.seal(hl(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}})),R=null,pe=null,z=Object.seal(hl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),me=!0,B=!0,he=!1,ge=!0,V=!1,_e=!0,ve=!1,ye=!1,be=null,xe=null,Se=!1,Ce=!1,we=!1,Te=!1,Ee=!0,De=!1,Oe=`user-content-`,ke=!0,Ae=!1,je={},Me=null,Ne=Z({},`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(`.`)),Pe=null,Fe=Z({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ie=null,Le=Z({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Re=`http://www.w3.org/1998/Math/MathML`,ze=`http://www.w3.org/2000/svg`,Be=`http://www.w3.org/1999/xhtml`,Ve=Be,He=!1,Ue=null,We=Z({},[Re,ze,Be],El),Ge=pl([`mi`,`mo`,`mn`,`ms`,`mtext`]),Ke=Z({},Ge),qe=pl([`annotation-xml`]),Je=Z({},qe),Ye=Z({},[`title`,`style`,`font`,`a`,`script`]),Xe=null,Ze=[`application/xhtml+xml`,`text/html`],H=null,Qe=null,U=n.createElement(`form`),$e=function(e){return e instanceof RegExp||e instanceof Function},et=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Qe&&Qe===e)return;(!e||typeof e!=`object`)&&(e={}),e=Hl(e),Xe=Ze.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,H=Xe===`application/xhtml+xml`?El:Tl,F=xu(e,`ALLOWED_TAGS`,de,{transform:H}),I=xu(e,`ALLOWED_ATTR`,fe,{transform:H}),Ue=xu(e,`ALLOWED_NAMESPACES`,We,{transform:El}),Ie=xu(e,`ADD_URI_SAFE_ATTR`,Le,{transform:H,base:Le}),Pe=xu(e,`ADD_DATA_URI_TAGS`,Fe,{transform:H,base:Fe}),Me=xu(e,`FORBID_CONTENTS`,Ne,{transform:H}),R=xu(e,`FORBID_TAGS`,Hl({}),{transform:H}),pe=xu(e,`FORBID_ATTR`,Hl({}),{transform:H}),je=Fl(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Hl(e.USE_PROFILES):e.USE_PROFILES:!1,me=e.ALLOW_ARIA_ATTR!==!1,B=e.ALLOW_DATA_ATTR!==!1,he=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ge=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,V=e.SAFE_FOR_TEMPLATES||!1,_e=e.SAFE_FOR_XML!==!1,ve=e.WHOLE_DOCUMENT||!1,Ce=e.RETURN_DOM||!1,we=e.RETURN_DOM_FRAGMENT||!1,Te=e.RETURN_TRUSTED_TYPE||!1,Se=e.FORCE_BODY||!1,Ee=e.SANITIZE_DOM!==!1,De=e.SANITIZE_NAMED_PROPS||!1,ke=e.KEEP_CONTENT!==!1,Ae=e.IN_PLACE||!1,ue=Gl(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:cu,Ve=typeof e.NAMESPACE==`string`?e.NAMESPACE:Be,Ke=Fl(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?Hl(e.MATHML_TEXT_INTEGRATION_POINTS):Z({},Ge),Je=Fl(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?Hl(e.HTML_INTEGRATION_POINTS):Z({},qe);let t=Fl(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?Hl(e.CUSTOM_ELEMENT_HANDLING):hl(null);if(L=hl(null),Fl(t,`tagNameCheck`)&&$e(t.tagNameCheck)&&(L.tagNameCheck=t.tagNameCheck),Fl(t,`attributeNameCheck`)&&$e(t.attributeNameCheck)&&(L.attributeNameCheck=t.attributeNameCheck),Fl(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(L.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),ml(L),V&&(B=!1),we&&(Ce=!0),je&&(F=Z({},Ql),I=hl(null),je.html===!0&&(Z(F,Kl),Z(I,$l)),je.svg===!0&&(Z(F,ql),Z(I,eu),Z(I,nu)),je.svgFilters===!0&&(Z(F,Jl),Z(I,eu),Z(I,nu)),je.mathMl===!0&&(Z(F,Xl),Z(I,tu),Z(I,nu))),z.tagCheck=null,z.attributeCheck=null,Fl(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?z.tagCheck=e.ADD_TAGS:wl(e.ADD_TAGS)&&(F===de&&(F=Hl(F)),Z(F,e.ADD_TAGS,H))),Fl(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?z.attributeCheck=e.ADD_ATTR:wl(e.ADD_ATTR)&&(I===fe&&(I=Hl(I)),Z(I,e.ADD_ATTR,H))),Fl(e,`ADD_URI_SAFE_ATTR`)&&wl(e.ADD_URI_SAFE_ATTR)&&Z(Ie,e.ADD_URI_SAFE_ATTR,H),Fl(e,`FORBID_CONTENTS`)&&wl(e.FORBID_CONTENTS)&&(Me===Ne&&(Me=Hl(Me)),Z(Me,e.FORBID_CONTENTS,H)),Fl(e,`ADD_FORBID_CONTENTS`)&&wl(e.ADD_FORBID_CONTENTS)&&(Me===Ne&&(Me=Hl(Me)),Z(Me,e.ADD_FORBID_CONTENTS,H)),ke&&(F[`#text`]=!0),ve&&Z(F,[`html`,`head`,`body`]),F.table&&(Z(F,[`tbody`]),delete R.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Rl(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Rl(`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(``)));pl&&pl(e),Qe=e},tt=Z({},[...ql,...Jl,...Yl]),nt=Z({},[...Xl,...Zl]),rt=function(e,t,n){return t.namespaceURI===Be?e===`svg`:t.namespaceURI===Re?e===`svg`&&(n===`annotation-xml`||Ke[n]):!!tt[e]},it=function(e,t,n){return t.namespaceURI===Be?e===`math`:t.namespaceURI===ze?e===`math`&&Je[n]:!!nt[e]},W=function(e,t,n){return t.namespaceURI===ze&&!Je[n]||t.namespaceURI===Re&&!Ke[n]?!1:!nt[e]&&(Ye[e]||!tt[e])},at=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Ve,tagName:`template`});let n=Tl(e.tagName),r=Tl(t.tagName);return Ue[e.namespaceURI]?e.namespaceURI===ze?rt(n,t,r):e.namespaceURI===Re?it(n,t,r):e.namespaceURI===Be?W(n,t,r):!!(Xe===`application/xhtml+xml`&&Ue[e.namespaceURI]):!1},ot=function(e){Sl(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw Rl(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},G=function(e){let t=h(e);if(t){let e=[];yl(t,t=>{Sl(e,t)}),yl(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{}}},K=function(e,n){try{Sl(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{Sl(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(Ce||we)try{ot(n)}catch{}else try{n.setAttribute(e,``)}catch{}},st=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||I[H(i)]))try{e.removeAttribute(i)}catch{}}},ct=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===_u.element&&st(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},lt=function(e){let t=null,r=null;if(Se)e=`<remove></remove>`+e;else{let t=Dl(e,/^[\r\n\t ]+/);r=t&&t[0]}Xe===`application/xhtml+xml`&&Ve===Be&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?D(e):e;if(Ve===Be)try{t=new l().parseFromString(i,Xe)}catch{}if(!t||!t.documentElement){t=j.createDocument(Ve,`template`,null);try{t.documentElement.innerHTML=He?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ve===Be?te.call(t,ve?`html`:`body`)[0]:ve?t.documentElement:a},ut=function(e){return M.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},dt=function(e){return e=Ol(e,P,` `),e=Ol(e,re,` `),e=Ol(e,ie,` `),e},ft=function(e){e.normalize();let t=M.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=dt(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&yl(r,e=>{mt(e.content)&&ft(e.content)})},pt=function(e){let t=b?b(e):null;return typeof t!=`string`||H(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)},mt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===_u.documentFragment}catch{return!1}},ht=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function gt(e,n,r){e.length!==0&&yl(e,e=>{e.call(t,n,r,Qe)})}let _t=function(e,t){return!!(_e&&e.hasChildNodes()&&!ht(e.firstElementChild)&&Ll(pu,e.textContent)&&Ll(pu,e.innerHTML)||_e&&e.namespaceURI===Be&&t===`style`&&ht(e.firstElementChild)||e.nodeType===_u.processingInstruction||_e&&e.nodeType===_u.comment&&Ll(mu,e.data))},vt=function(e,t){if(!R[t]&&St(t)&&(L.tagNameCheck instanceof RegExp&&Ll(L.tagNameCheck,t)||L.tagNameCheck instanceof Function&&L.tagNameCheck(t)))return!1;if(ke&&!Me[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=Ae?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return ot(e),!0},yt=function(e){if(gt(N.beforeSanitizeElements,e,null),pt(e))return ot(e),!0;let n=H(b?b(e):e.nodeName);if(gt(N.uponSanitizeElement,e,{tagName:n,allowedTags:F}),_t(e,n))return ot(e),!0;if(R[n]||!(z.tagCheck instanceof Function&&z.tagCheck(n))&&!F[n])return vt(e,n);if((y?y(e):e.nodeType)===_u.element&&!at(e)||(n===`noscript`||n===`noembed`||n===`noframes`)&&Ll(hu,e.innerHTML))return ot(e),!0;if(V&&e.nodeType===_u.text){let n=dt(e.textContent);e.textContent!==n&&(Sl(t.removed,{element:e.cloneNode()}),e.textContent=n)}return gt(N.afterSanitizeElements,e,null),!1},bt=function(e,t,r){if(pe[t]||Ee&&(t===`id`||t===`name`)&&(r in n||r in U))return!1;let i=I[t]||z.attributeCheck instanceof Function&&z.attributeCheck(t,e);if(!(B&&Ll(ae,t))&&!(me&&Ll(oe,t))){if(!i){if(!(St(e)&&(L.tagNameCheck instanceof RegExp&&Ll(L.tagNameCheck,e)||L.tagNameCheck instanceof Function&&L.tagNameCheck(e))&&(L.attributeNameCheck instanceof RegExp&&Ll(L.attributeNameCheck,t)||L.attributeNameCheck instanceof Function&&L.attributeNameCheck(t,e))||t===`is`&&L.allowCustomizedBuiltInElements&&(L.tagNameCheck instanceof RegExp&&Ll(L.tagNameCheck,r)||L.tagNameCheck instanceof Function&&L.tagNameCheck(r))))return!1}else if(!Ie[t]&&!Ll(ue,Ol(r,ce,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&kl(r,`data:`)===0&&Pe[e])&&!(he&&!Ll(se,Ol(r,ce,``)))&&r)return!1}return!0},xt=Z({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),St=function(e){return!xt[Tl(e)]&&Ll(le,e)},Ct=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},wt=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),pt(e)?ot(e):xl(t.removed)}catch{K(n,e)}},Tt=function(e){gt(N.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||pt(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:I,forceKeepAttr:void 0},r=t.length,i=H(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=H(o),u=c,d=o===`value`?u:Al(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,gt(N.uponSanitizeAttribute,e,n),d=n.attrValue,De&&(l===`id`||l===`name`)&&kl(d,Oe)!==0&&(K(o,e),d=Oe+d),_e&&Ll(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){K(o,e);continue}if(l===`attributename`&&Dl(d,`href`)){K(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){K(o,e);continue}if(!ge&&Ll(gu,d)){K(o,e);continue}if(V&&(d=dt(d)),!bt(i,l,d)){K(o,e);continue}d=Ct(i,l,s,d),d!==u&&wt(e,o,s,d)}}gt(N.afterSanitizeAttributes,e,null)},Et=function(e){let t=null,n=ut(e);for(gt(N.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(gt(N.uponSanitizeShadowNode,t,null),yt(t),Tt(t),mt(t.content)&&Et(t.content),(y?y(t):t.nodeType)===_u.element){let e=_(t);mt(e)&&(Dt(e),Et(e))}gt(N.afterSanitizeShadowDOM,e,null)},Dt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Et(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===_u.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`&&H(e)===`template`){let e=n.content;mt(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);mt(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(He=!e,He&&(e=`<!-->`),typeof e!=`string`&&!ht(e)&&(e=Ul(e),typeof e!=`string`))throw Rl(`dirty is not a string, aborting`);if(!t.isSupported)return e;ye?(F=be,I=xe):et(n),(N.uponSanitizeElement.length>0||N.uponSanitizeAttribute.length>0)&&(F=Hl(F)),N.uponSanitizeAttribute.length>0&&(I=Hl(I)),t.removed=[];let c=Ae&&typeof e!=`string`&&ht(e);if(c){let t=b?b(e):e.nodeName;if(typeof t==`string`){let e=H(t);if(!F[e]||R[e])throw Rl(`root node is forbidden and cannot be sanitized in-place`)}if(pt(e))throw Rl(`root node is clobbered and cannot be sanitized in-place`);try{Dt(e)}catch(t){throw G(e),t}}else if(ht(e))i=lt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===_u.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Dt(a);else{if(!Ce&&!V&&!ve&&e.indexOf(`<`)===-1)return x&&Te?D(e):e;if(i=lt(e),!i)return Ce?null:Te?S:``}i&&Se&&ot(i.firstChild);let l=ut(c?e:i);try{for(;o=l.nextNode();)yt(o),Tt(o),mt(o.content)&&Et(o.content)}catch(t){throw c&&G(e),t}if(c)return yl(t.removed,e=>{e.element&&ct(e.element)}),V&&ft(e),e;if(Ce){if(V&&ft(i),we)for(s=ee.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(I.shadowroot||I.shadowrootmode)&&(s=ne.call(r,s,!0)),s}let u=ve?i.outerHTML:i.innerHTML;return ve&&F[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Ll(du,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
94
|
+
`+u),V&&(u=dt(u)),x&&Te?D(u):u},t.setConfig=function(){et(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),ye=!0,be=F,xe=I},t.clearConfig=function(){Qe=null,ye=!1,be=null,xe=null,x=C,S=``},t.isValidAttribute=function(e,t,n){return Qe||et({}),bt(H(e),H(t),n)},t.addHook=function(e,t){typeof t==`function`&&Fl(N,e)&&Sl(N[e],t)},t.removeHook=function(e,t){if(Fl(N,e)){if(t!==void 0){let n=bl(N[e],t);return n===-1?void 0:Cl(N[e],n,1)[0]}return xl(N[e])}},t.removeHooks=function(e){Fl(N,e)&&(N[e]=[])},t.removeAllHooks=function(){N=bu()},t}var Cu=Su();function wu(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Tu=wu();function Eu(e){Tu=e}var Du={exec:()=>null};function Ou(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 Q(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(Au.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var ku=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),Au={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:Ou(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Ou(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Ou(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Ou(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Ou(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:Ou(e=>RegExp(`^ {0,${e}}>`))},ju=/^(?:[ \t]*(?:\n|$))+/,Mu=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Nu=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Pu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Fu=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Iu=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Lu=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ru=Q(Lu).replace(/bull/g,Iu).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(),zu=Q(Lu).replace(/bull/g,Iu).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(),Bu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Vu=/^[^\n]+/,Hu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Uu=Q(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Hu).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Wu=Q(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Iu).getRegex(),Gu=`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`,Ku=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,qu=Q(`^ {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`,Ku).replace(`tag`,Gu).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ju=Q(Bu).replace(`hr`,Pu).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`,Gu).getRegex(),Yu={blockquote:Q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Ju).getRegex(),code:Mu,def:Uu,fences:Nu,heading:Fu,hr:Pu,html:qu,lheading:Ru,list:Wu,newline:ju,paragraph:Ju,table:Du,text:Vu},Xu=Q(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Pu).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`,Gu).getRegex(),Zu={...Yu,lheading:zu,table:Xu,paragraph:Q(Bu).replace(`hr`,Pu).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Xu).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`,Gu).getRegex()},Qu={...Yu,html:Q(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Ku).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:Du,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Q(Bu).replace(`hr`,Pu).replace(`heading`,` *#{1,6} *[^
|
|
95
|
+
]`).replace(`lheading`,Ru).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},$u=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ed=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,td=/^( {2,}|\\)\n(?!\s*$)/,nd=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,rd=/[\p{P}\p{S}]/u,id=/[\s\p{P}\p{S}]/u,ad=/[^\s\p{P}\p{S}]/u,od=Q(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,id).getRegex(),sd=/(?!~)[\p{P}\p{S}]/u,cd=/(?!~)[\s\p{P}\p{S}]/u,ld=/(?:[^\s\p{P}\p{S}]|~)/u,ud=Q(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,ku?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),dd=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,fd=Q(dd,`u`).replace(/punct/g,rd).getRegex(),pd=Q(dd,`u`).replace(/punct/g,sd).getRegex(),md=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,hd=Q(md,`gu`).replace(/notPunctSpace/g,ad).replace(/punctSpace/g,id).replace(/punct/g,rd).getRegex(),gd=Q(md,`gu`).replace(/notPunctSpace/g,ld).replace(/punctSpace/g,cd).replace(/punct/g,sd).getRegex(),_d=Q(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,ad).replace(/punctSpace/g,id).replace(/punct/g,rd).getRegex(),vd=Q(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,rd).getRegex(),yd=Q(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,ad).replace(/punctSpace/g,id).replace(/punct/g,rd).getRegex(),bd=Q(/\\(punct)/,`gu`).replace(/punct/g,rd).getRegex(),xd=Q(/^<(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(),Sd=Q(Ku).replace(`(?:-->|$)`,`-->`).getRegex(),Cd=Q(`^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`,Sd).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),wd=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Td=Q(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,wd).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ed=Q(/^!?\[(label)\]\[(ref)\]/).replace(`label`,wd).replace(`ref`,Hu).getRegex(),Dd=Q(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Hu).getRegex(),Od=Q(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Ed).replace(`nolink`,Dd).getRegex(),kd=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ad={_backpedal:Du,anyPunctuation:bd,autolink:xd,blockSkip:ud,br:td,code:ed,del:Du,delLDelim:Du,delRDelim:Du,emStrongLDelim:fd,emStrongRDelimAst:hd,emStrongRDelimUnd:_d,escape:$u,link:Td,nolink:Dd,punctuation:od,reflink:Ed,reflinkSearch:Od,tag:Cd,text:nd,url:Du},jd={...Ad,link:Q(/^!?\[(label)\]\((.*?)\)/).replace(`label`,wd).getRegex(),reflink:Q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,wd).getRegex()},Md={...Ad,emStrongRDelimAst:gd,emStrongLDelim:pd,delLDelim:vd,delRDelim:yd,url:Q(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,kd).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:Q(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,kd).getRegex()},Nd={...Md,br:Q(td).replace(`{2,}`,`*`).getRegex(),text:Q(Md.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Pd={normal:Yu,gfm:Zu,pedantic:Qu},Fd={normal:Ad,gfm:Md,breaks:Nd,pedantic:jd},Id={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Ld=e=>Id[e];function Rd(e,t){if(t){if(Au.escapeTest.test(e))return e.replace(Au.escapeReplace,Ld)}else if(Au.escapeTestNoEncode.test(e))return e.replace(Au.escapeReplaceNoEncode,Ld);return e}function zd(e){try{e=encodeURI(e).replace(Au.percentDecode,`%`)}catch{return null}return e}function Bd(e,t){let n=e.replace(Au.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Au.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(Au.slashPipe,`|`);return n}function Vd(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 Hd(e){let t=e.split(`
|
|
96
|
+
`),n=t.length-1;for(;n>=0&&Au.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
97
|
+
`)}function Ud(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 Wd(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 Gd(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 Kd(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 qd=class{options;rules;lexer;constructor(e){this.options=e||Tu}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]:Hd(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=Kd(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=Vd(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Vd(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:Vd(t[0],`
|
|
101
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Vd(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=Wd(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=Hd(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:Vd(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=Bd(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:Vd(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(Bd(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:Vd(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=Vd(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Ud(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)),Gd(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 Gd(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}}}},Jd=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Tu,this.options.tokenizer=this.options.tokenizer||new qd,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:Au,block:Pd.normal,inline:Fd.normal};this.options.pedantic?(t.block=Pd.pedantic,t.inline=Fd.pedantic):this.options.gfm&&(t.block=Pd.gfm,this.options.breaks?t.inline=Fd.breaks:t.inline=Fd.gfm),this.tokenizer.rules=t}static get rules(){return{block:Pd,inline:Fd}}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(Au.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(Au.tabCharGlobal,` `).replace(Au.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)}},Yd=class{options;parser;constructor(e){this.options=e||Tu}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Au.notSpaceStart)?.[0],i=e.replace(Au.endingNewline,``)+`
|
|
139
|
+
`;return r?`<pre><code class="language-`+Rd(r)+`">`+(n?i:Rd(i,!0))+`</code></pre>
|
|
140
|
+
`:`<pre><code>`+(n?i:Rd(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>${Rd(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=zd(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Rd(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=zd(e);if(i===null)return Rd(n);e=i;let a=`<img src="${e}" alt="${Rd(n)}"`;return t&&(a+=` title="${Rd(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Rd(e.text)}},Xd=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}},Zd=class e{options;renderer;textRenderer;constructor(e){this.options=e||Tu,this.options.renderer=this.options.renderer||new Yd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Xd}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}},Qd=class{options;block;constructor(e){this.options=e||Tu}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?Jd.lex:Jd.lexInline}provideParser(e=this.block){return e?Zd.parse:Zd.parseInline}},$d=class{defaults=wu();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Zd;Renderer=Yd;TextRenderer=Xd;Lexer=Jd;Tokenizer=qd;Hooks=Qd;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 Yd(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 qd(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 Qd;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];Qd.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Qd.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 Jd.lex(e,t??this.defaults)}parser(e,t){return Zd.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?Jd.lex:Jd.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?Zd.parse:Zd.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?Jd.lex:Jd.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?Zd.parse:Zd.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>`+Rd(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},ef=new $d;function $(e,t){return ef.parse(e,t)}$.options=$.setOptions=function(e){return ef.setOptions(e),$.defaults=ef.defaults,Eu($.defaults),$},$.getDefaults=wu,$.defaults=Tu,$.use=function(...e){return ef.use(...e),$.defaults=ef.defaults,Eu($.defaults),$},$.walkTokens=function(e,t){return ef.walkTokens(e,t)},$.parseInline=ef.parseInline,$.Parser=Zd,$.parser=Zd.parse,$.Renderer=Yd,$.TextRenderer=Xd,$.Lexer=Jd,$.lexer=Jd.lex,$.Tokenizer=qd,$.Hooks=Qd,$.parse=$,$.options,$.setOptions,$.use,$.walkTokens,$.parseInline,Zd.parse,Jd.lex;function tf(e){let t=(0,el.c)(10),n;t[0]!==e.children||t[1]!==e.lang?(n=Cu.sanitize(we(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,Y.jsx)(`div`,{"data-code-block":!0,dangerouslySetInnerHTML:r,className:a}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function nf(e){let t=e?.constructor;return e===(typeof t==`function`?t.prototype:Object.prototype)}function rf(e){if(e==null)return!0;if(Vt(e))return typeof e.splice!=`function`&&typeof e!=`string`&&!Ft(e)&&!Ht(e)&&!Ut(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 nf(e)?t.filter(e=>e!==`constructor`).length===0:t.length===0}return!0}var af=`comm`,of=`rule`,sf=`decl`,cf=`@import`,lf=`@namespace`,uf=`@keyframes`,df=`@layer`,ff=Math.abs,pf=String.fromCharCode;function mf(e){return e.trim()}function hf(e,t,n){return e.replace(t,n)}function gf(e,t){return e.charCodeAt(t)|0}function _f(e,t,n){return e.slice(t,n)}function vf(e){return e.length}function yf(e){return e.length}function bf(e,t){return t.push(e),e}var xf=1,Sf=1,Cf=0,wf=0,Tf=0,Ef=``;function Df(e,t,n,r,i,a,o,s){return{value:e,root:t,parent:n,type:r,props:i,children:a,line:xf,column:Sf,length:o,return:``,siblings:s}}function Of(){return Tf}function kf(){return Tf=wf>0?gf(Ef,--wf):0,Sf--,Tf===10&&(Sf=1,xf--),Tf}function Af(){return Tf=wf<Cf?gf(Ef,wf++):0,Sf++,Tf===10&&(Sf=1,xf++),Tf}function jf(){return gf(Ef,wf)}function Mf(){return wf}function Nf(e,t){return _f(Ef,e,t)}function Pf(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 Ff(e){return xf=Sf=1,Cf=vf(Ef=e),wf=0,[]}function If(e){return Ef=``,e}function Lf(e){return mf(Nf(wf-1,Bf(e===91?e+2:e===40?e+1:e)))}function Rf(e){for(;(Tf=jf())&&Tf<33;)Af();return Pf(e)>2||Pf(Tf)>3?``:` `}function zf(e,t){for(;--t&&Af()&&!(Tf<48||Tf>102||Tf>57&&Tf<65||Tf>70&&Tf<97););return Nf(e,Mf()+(t<6&&jf()==32&&Af()==32))}function Bf(e){for(;Af();)switch(Tf){case e:return wf;case 34:case 39:e!==34&&e!==39&&Bf(Tf);break;case 40:e===41&&Bf(e);break;case 92:Af();break}return wf}function Vf(e,t){for(;Af()&&e+Tf!==57&&!(e+Tf===84&&jf()===47););return`/*`+Nf(t,wf-1)+`*`+pf(e===47?e:Af())}function Hf(e){for(;!Pf(jf());)Af();return Nf(e,wf)}function Uf(e){return If(Wf(``,null,null,null,[``],e=Ff(e),0,[0],e))}function Wf(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=Af()){case 40:m!=108&&gf(w,d-1)==58?(v++,w+=`(`):w+=Lf(y);break;case 41:v--,w+=`)`;break;case 34:case 39:case 91:w+=Lf(y);break;case 9:case 10:case 13:case 32:if(v>0){w+=pf(y);break}w+=Rf(m);break;case 92:w+=zf(Mf()-1,7);continue;case 47:switch(jf()){case 42:case 47:bf(Kf(Vf(Af(),Mf()),t,n,c),c),(Pf(m||1)==5||Pf(jf()||1)==5)&&vf(w)&&_f(w,-1,void 0)!==` `&&(w+=` `);break;default:w+=`/`}break;case 123*h:s[l++]=vf(w)*_;case 125*h:case 59:case 0:if(v>0&&y){w+=pf(y);break}switch(y){case 0:case 125:g=0;case 59+u:_==-1&&(w=hf(w,/\f/g,``)),p>0&&(vf(w)-d||h===0)&&bf(p>32?qf(w+`;`,r,n,d-1,c):qf(hf(w,` `,``)+`;`,r,n,d-2,c),c);break;case 59:w+=`;`;default:if(bf(C=Gf(w,t,n,l,u,i,s,b,x=[],S=[],d,a),a),y===123)if(u===0)Wf(w,t,C,C,x,a,d,s,S);else{switch(f){case 99:if(gf(w,3)===110)break;case 108:if(gf(w,2)===97)break;default:u=0;case 100:case 109:case 115:}u?Wf(e,C,C,r&&bf(Gf(e,C,C,0,0,i,s,b,i,x=[],d,S),S),i,S,d,s,r?x:S):Wf(w,C,C,C,[``],S,0,s,S)}}l=u=p=0,h=_=1,b=w=``,d=o;break;case 58:d=1+vf(w),p=m;default:if(h<1){if(y==123)--h;else if(y==125&&h++==0&&kf()==125)continue}switch(w+=pf(y),y*h){case 38:_=u>0?1:(w+=`\f`,-1);break;case 44:if(v>0)break;s[l++]=(vf(w)-1)*_,_=1;break;case 64:jf()===45&&(w+=Lf(Af())),f=jf(),u=d=vf(b=w+=Hf(Mf())),y++;break;case 45:m===45&&vf(w)==2&&(h=0)}}return a}function Gf(e,t,n,r,i,a,o,s,c,l,u,d){for(var f=i-1,p=i===0?a:[``],m=yf(p),h=0,g=0,_=0;h<r;++h)for(var v=0,y=_f(e,f+1,f=ff(g=o[h])),b=e;v<m;++v)(b=mf(g>0?p[v]+` `+y:hf(y,/&\f/g,p[v])))&&(c[_++]=b);return Df(e,t,n,i===0?of:s,c,l,u,d)}function Kf(e,t,n,r){return Df(e,t,n,af,pf(Of()),_f(e,2,-2),0,r)}function qf(e,t,n,r,i){return Df(e,t,n,sf,_f(e,0,r),_f(e,r+1,-1),r,i)}function Jf(e,t){for(var n=``,r=0;r<e.length;r++)n+=t(e[r],r,e,t)||``;return n}function Yf(e,t,n,r){switch(e.type){case df:if(e.children.length)break;case cf:case lf:case sf:return e.return=e.return||e.value;case af:return``;case uf:return e.return=e.value+`{`+Jf(e.children,r)+`}`;case of:if(!vf(e.value=e.props.join(`,`)))return``}return vf(n=Jf(e.children,r))?e.return=e.value+`{`+n+`}`:``}function Xf(e){var t=yf(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 Zf=`c4`,Qf={id:Zf,detector:K(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:Zf,diagram:e}},`loader`)},$f=`flowchart`,ep={id:$f,detector:K((e,t)=>t?.flowchart?.defaultRenderer===`dagre-wrapper`||t?.flowchart?.defaultRenderer===`elk`?!1:/^\s*graph/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:$f,diagram:e}},`loader`)},tp=`flowchart-v2`,np={id:tp,detector:K((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:K(async()=>{let{diagram:e}=await W(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:tp,diagram:e}},`loader`)},rp=`er`,ip={id:rp,detector:K(e=>/^\s*erDiagram/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:rp,diagram:e}},`loader`)},ap=`gitGraph`,op={id:ap,detector:K(e=>/^\s*gitGraph/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:ap,diagram:e}},`loader`)},sp=`gantt`,cp={id:sp,detector:K(e=>/^\s*gantt/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:sp,diagram:e}},`loader`)},lp=`info`,up={id:lp,detector:K(e=>/^\s*info/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:lp,diagram:e}},`loader`)},dp=`pie`,fp={id:dp,detector:K(e=>/^\s*pie/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:dp,diagram:e}},`loader`)},pp=`quadrantChart`,mp={id:pp,detector:K(e=>/^\s*quadrantChart/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:pp,diagram:e}},`loader`)},hp=`xychart`,gp={id:hp,detector:K(e=>/^\s*xychart(-beta)?/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:hp,diagram:e}},`loader`)},_p=`requirement`,vp={id:_p,detector:K(e=>/^\s*requirement(Diagram)?/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:_p,diagram:e}},`loader`)},yp=`sequence`,bp={id:yp,detector:K(e=>/^\s*sequenceDiagram/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:yp,diagram:e}},`loader`)},xp=`class`,Sp={id:xp,detector:K((e,t)=>t?.class?.defaultRenderer===`dagre-wrapper`?!1:/^\s*classDiagram/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:xp,diagram:e}},`loader`)},Cp=`classDiagram`,wp={id:Cp,detector:K((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer===`dagre-wrapper`?!0:/^\s*classDiagram-v2/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:Cp,diagram:e}},`loader`)},Tp=`state`,Ep={id:Tp,detector:K((e,t)=>t?.state?.defaultRenderer===`dagre-wrapper`?!1:/^\s*stateDiagram/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:Tp,diagram:e}},`loader`)},Dp=`stateDiagram`,Op={id:Dp,detector:K((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer===`dagre-wrapper`),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:Dp,diagram:e}},`loader`)},kp=`journey`,Ap={id:kp,detector:K(e=>/^\s*journey/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:kp,diagram:e}},`loader`)},jp={draw:K((e,t,n)=>{G.debug(`rendering svg for syntax error
|
|
158
|
+
`);let r=Wt(t),i=r.append(`g`);r.attr(`viewBox`,`0 0 2412 512`),wt(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`)},Mp=jp,Np={db:{},renderer:jp,parser:{parse:K(()=>{},`parse`)}},Pp=`flowchart-elk`,Fp={id:Pp,detector:K((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer===`elk`?(t.layout=`elk`,!0):!1,`detector`),loader:K(async()=>{let{diagram:e}=await W(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:Pp,diagram:e}},`loader`)},Ip=`timeline`,Lp={id:Ip,detector:K(e=>/^\s*timeline/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:Ip,diagram:e}},`loader`)},Rp=`mindmap`,zp={id:Rp,detector:K(e=>/^\s*mindmap/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:Rp,diagram:e}},`loader`)},Bp=`kanban`,Vp={id:Bp,detector:K(e=>/^\s*kanban/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:Bp,diagram:e}},`loader`)},Hp=`sankey`,Up={id:Hp,detector:K(e=>/^\s*sankey(-beta)?/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(async()=>{let{diagram:e}=await import(`./sankeyDiagram-5OEKKPKP-cs1kWOqp.js`);return{diagram:e}},__vite__mapDeps([66,1,2,3,4,48,44]));return{id:Hp,diagram:e}},`loader`)},Wp=`packet`,Gp={id:Wp,detector:K(e=>/^\s*packet(-beta)?/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:Wp,diagram:e}},`loader`)},Kp=`radar`,qp={id:Kp,detector:K(e=>/^\s*radar-beta/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:Kp,diagram:e}},`loader`)},Jp=`block`,Yp={id:Jp,detector:K(e=>/^\s*block(-beta)?/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:Jp,diagram:e}},`loader`)},Xp=`treeView`,Zp={id:Xp,detector:K(e=>/^\s*treeView-beta/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:Xp,diagram:e}},`loader`)},Qp=`architecture`,$p={id:Qp,detector:K(e=>/^\s*architecture/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:Qp,diagram:e}},`loader`)},em=`eventmodeling`,tm={id:em,detector:K(e=>/^\s*eventmodeling/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:em,diagram:e}},`loader`)},nm=`ishikawa`,rm={id:nm,detector:K(e=>/^\s*ishikawa(-beta)?\b/i.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:nm,diagram:e}},`loader`)},im=`venn`,am={id:im,detector:K(e=>/^\s*venn-beta/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:im,diagram:e}},`loader`)},om=`treemap`,sm={id:om,detector:K(e=>/^\s*treemap/.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:om,diagram:e}},`loader`)},cm=`wardley-beta`,lm={id:cm,detector:K(e=>/^\s*wardley-beta/i.test(e),`detector`),loader:K(async()=>{let{diagram:e}=await W(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:cm,diagram:e}},`loader`)},um=!1,dm=K(()=>{um||(um=!0,pt(`error`,Np,e=>e.toLowerCase().trim()===`error`),pt(`---`,{db:{clear:K(()=>{},`clear`)},styles:{},renderer:{draw:K(()=>{},`draw`)},parser:{parse:K(()=>{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:K(()=>null,`init`)},e=>e.toLowerCase().trimStart().startsWith(`---`)),mt(Fp,zp,$p),mt(Qf,Vp,wp,Sp,ip,cp,up,fp,vp,bp,np,ep,Lp,op,Op,Ep,Ap,mp,Up,Gp,gp,Yp,tm,Zp,qp,rm,sm,am,lm))},`addDiagrams`),fm=K(async()=>{G.debug(`Loading registered diagrams`);let e=(await Promise.allSettled(Object.entries(Dt).map(async([e,{detector:t,loader:n}])=>{if(n)try{gt(e)}catch{try{let{diagram:e,id:r}=await n();pt(r,e,t)}catch(t){throw G.error(`Failed to load external diagram with key ${e}. Removing from detectors.`),delete Dt[e],t}}}))).filter(e=>e.status===`rejected`);if(e.length>0){G.error(`Failed to load ${e.length} external diagrams`);for(let t of e)G.error(t);throw Error(`Failed to load ${e.length} external diagrams`)}},`loadRegisteredDiagrams`),pm=`graphics-document document`;function mm(e,t){e.attr(`role`,pm),t!==``&&e.attr(`aria-roledescription`,t)}K(mm,`setA11yDiagramInfo`);function hm(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)}}}K(hm,`addSVGa11yTitleDescription`);var gm=class e{constructor(e,t,n,r,i){this.type=e,this.text=t,this.db=n,this.parser=r,this.renderer=i}static{K(this,`Diagram`)}static async fromText(t,n={}){let r=Ct(),i=kt(t,r);t=Bt(t)+`
|
|
159
|
+
`;try{gt(i)}catch{let e=lt(i);if(!e)throw new Mt(`Diagram ${i} not found.`);let{id:t,diagram:n}=await e();pt(t,n)}let{db:a,parser:o,renderer:s,init:c}=gt(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}},_m=[],vm=K(()=>{_m.forEach(e=>{e()}),_m=[]},`attachFunctions`),ym=K(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,``).trimStart(),`cleanupComments`);function bm(e){let t=e.match(St);if(!t)return{text:e,metadata:{}};let n=Gt(t[1],{schema:Kt})??{};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}}K(bm,`extractFrontMatter`);var xm=K(e=>e.replace(/\r\n?/g,`
|
|
160
|
+
`).replace(/<(\w+)([^>]*)>/g,(e,t,n)=>`<`+t+n.replace(/="([^"]*)"/g,`='$1'`)+`>`),`cleanupText`),Sm=K(e=>{let{text:t,metadata:n}=bm(e),{displayMode:r,title:i,config:a={}}=n;return r&&(a.gantt||={},a.gantt.displayMode=r),{title:i,config:a,text:t}},`processFrontmatter`),Cm=K(e=>{let t=Lt.detectInit(e)??{},n=Lt.detectDirective(e,`wrap`);return Array.isArray(n)?t.wrap=n.some(({type:e})=>e===`wrap`):n?.type===`wrap`&&(t.wrap=!0),{text:Rt(e),directive:t}},`processDirectives`);function wm(e){let t=Sm(xm(e)),n=Cm(t.text),r=zt(t.config,n.directive);return e=ym(n.text),{code:e,title:t.title,config:r}}K(wm,`preprocessDiagram`);function Tm(e){let t=new TextEncoder().encode(e),n=Array.from(t,e=>String.fromCodePoint(e)).join(``);return btoa(n)}K(Tm,`toBase64`);var Em=5e4,Dm=`graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa`,Om=`sandbox`,km=`loose`,Am=`http://www.w3.org/2000/svg`,jm=`http://www.w3.org/1999/xlink`,Mm=`http://www.w3.org/1999/xhtml`,Nm=`100%`,Pm=`100%`,Fm=`border:0;margin:0;`,Im=`margin:0`,Lm=`allow-top-navigation-by-user-activation allow-popups`,Rm=`The "iframe" tag is not supported by your browser.`,zm=[`foreignobject`],Bm=[`dominant-baseline`];function Vm(e){let t=wm(e);return dt(),Ot(t.config??{}),t}K(Vm,`processAndSetConfigs`);async function Hm(e,t){dm();try{let{code:t,config:n}=Vm(e);return{diagramType:(await eh(t)).type,config:n}}catch(e){if(t?.suppressErrors)return!1;throw e}}K(Hm,`parse`);var Um=K((e,t,n=[])=>`.${e} ${t} ${ft(`{ ${n.join(` !important; `)} !important; }`)}`,`cssImportantStyles`),Wm=K((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=_t(e)?[`> *`,`span`]:[`rect`,`polygon`,`ellipse`,`circle`,`path`];t.forEach(e=>{rf(e.styles)||r.forEach(t=>{n.insertRule(Um(e.id,t,e.styles),n.cssRules.length)}),rf(e.textStyles)||n.insertRule(Um(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=Et(t)+`
|
|
161
|
+
`}else r+=`${e.themeCSS}
|
|
162
|
+
`;return r+Et(n)},`createCssStyles`),Gm=K((e,t)=>Jf(Uf(`${e}{${t}}`),Xf([K(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)||(G.warn(`Removing unsupported at-rule ${t.type} from CSS`),t.type=af))},`addNamespace`),Yf])),`compileCSS`),Km=K((e,t,n,r)=>Gm(r,bt(t,Wm(e,n),{...e.themeVariables,theme:e.theme,look:e.look},r)),`createUserStyles`),qm=K((e=``,t,n)=>{let r=e;return!n&&!t&&(r=r.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,`marker-end="url(#`)),r=Pt(r),r=r.replace(/<br>/g,`<br/>`),r},`cleanUpSvgCode`),Jm=K((e=``,t)=>`<iframe style="width:${Nm};height:${t?.viewBox?.baseVal?.height?t.viewBox.baseVal.height+`px`:Pm};${Fm}" src="data:text/html;charset=UTF-8;base64,${Tm(`<body style="${Im}">${e}</body>`)}" sandbox="${Lm}">
|
|
163
|
+
${Rm}
|
|
164
|
+
</iframe>`,`putIntoIFrame`),Ym=K((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`,Am);return i&&o.attr(`xmlns:xlink`,i),o.append(`g`),e},`appendDivSvgG`);function Xm(e,t){return e.append(`iframe`).attr(`id`,t).attr(`style`,`width: 100%; height: 100%;`).attr(`sandbox`,``)}K(Xm,`sandboxedIframe`);var Zm=K((e,t,n,r)=>{e.getElementById(t)?.remove(),e.getElementById(n)?.remove(),e.getElementById(r)?.remove()},`removeExistingElements`),Qm=K(async function(e,t,n){dm();let r=Vm(t);t=r.code;let i=Ct();G.debug(i),t.length>(i?.maxTextSize??Em)&&(t=Dm);let a=`#${e}`,o=`i`+e,s=`#`+o,c=`d`+e,l=`#`+c,u=K(()=>{let e=st(f?s:l).node();e&&`remove`in e&&e.remove()},`removeTempElements`),d=st(document.body),f=i.securityLevel===Om,p=i.securityLevel===km,m=i.fontFamily;n===void 0?(Zm(document,e,c,o),f?(d=st(Xm(st(document.body),o).nodes()[0].contentDocument.body),d.node().style.margin=`0`):d=st(`body`),Ym(d,e,c)):(n&&(n.innerHTML=``),f?(d=st(Xm(st(n),o).nodes()[0].contentDocument.body),d.node().style.margin=`0`):d=st(n),Ym(d,e,c,`font-family: ${m}`,jm));let h,g;try{h=await gm.fromText(t,{title:r.title})}catch(e){if(i.suppressErrorRendering)throw u(),e;h=await gm.fromText(`error`),g=e}let _=d.select(l).node(),v=h.type,y=_.firstChild,b=y.firstChild,x=h.renderer.getClasses?.(t,h),S=Km(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():Mp.draw(t,e,`11.15.0`),n}let w=d.select(`${l} svg`),T=h.db.getAccTitle?.(),E=h.db.getAccDescription?.();th(v,w,T,E),d.select(`[id="${e}"]`).selectAll(`foreignobject > *`).attr(`xmlns`,Mm);let D=d.select(l).node().innerHTML;if(G.debug(`config.arrowMarkerAbsolute`,i.arrowMarkerAbsolute),D=qm(D,f,Tt(i.arrowMarkerAbsolute)),f){let e=d.select(l+` svg`).node();D=Jm(D,e)}else p||(D=ct.sanitize(D,{ADD_TAGS:zm,ADD_ATTR:Bm,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(vm(),g)throw g;return u(),{diagramType:v,svg:D,bindFunctions:h.db.bindFunctions}},`render`);function $m(e={}){let t=jt({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||={},t.themeVariables.fontFamily=t.fontFamily),vt(t),t?.theme&&t.theme in xt?t.themeVariables=xt[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=xt.default.getThemeVariables(t.themeVariables)),ot((typeof t==`object`?At(t):ut()).logLevel),dm()}K($m,`initialize`);var eh=K((e,t={})=>{let{code:n}=wm(e);return gm.fromText(n,t)},`getDiagramFromText`);function th(e,t,n,r){mm(t,e),hm(t,n,r,t.attr(`id`))}K(th,`addA11yInfo`);var nh=Object.freeze({render:Qm,parse:Hm,getDiagramFromText:eh,initialize:$m,getConfig:Ct,setConfig:yt,getSiteConfig:ut,updateSiteConfig:ht,reset:K(()=>{dt()},`reset`),globalReset:K(()=>{dt(Nt)},`globalReset`),defaultConfig:Nt});ot(Ct().logLevel),dt(Ct());var rh=K((e,t,n)=>{G.warn(e),It(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`),ih=K(async function(e={querySelector:`.mermaid`}){try{await ah(e)}catch(t){if(It(t)&&G.error(t.str),gh.parseError&&gh.parseError(t),!e.suppressErrors)throw G.error(`Use the suppressErrors option to suppress these errors`),t}},`run`),ah=K(async function({postRenderCallback:e,querySelector:t,nodes:n}={querySelector:`.mermaid`}){let r=nh.getConfig();G.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`);G.debug(`Found ${i.length} diagrams`),r?.startOnLoad!==void 0&&(G.debug(`Start On Load: `+r?.startOnLoad),nh.updateSiteConfig({startOnLoad:r?.startOnLoad}));let a=new Lt.InitIDGenerator(r.deterministicIds,r.deterministicIDSeed),o,s=[];for(let t of Array.from(i)){if(G.info(`Rendering diagram: `+t.id),t.getAttribute(`data-processed`))continue;t.setAttribute(`data-processed`,`true`);let n=`mermaid-${a.next()}`;o=t.innerHTML,o=Jt(Lt.entityDecode(o)).trim().replace(/<br\s*\/?>/gi,`<br/>`);let r=Lt.detectInit(o);r&&G.debug(`Detected early reinit: `,r);try{let{svg:r,bindFunctions:i}=await hh(n,o,t);t.innerHTML=r,e&&await e(n),i&&i(t)}catch(e){rh(e,s,gh.parseError)}}if(s.length>0)throw s[0]},`runThrowsErrors`),oh=K(function(e){nh.initialize(e)},`initialize`),sh=K(async function(e,t,n){G.warn(`mermaid.init is deprecated. Please use run instead.`),e&&oh(e);let r={postRenderCallback:n,querySelector:`.mermaid`};typeof t==`string`?r.querySelector=t:t&&(t instanceof HTMLElement?r.nodes=[t]:r.nodes=t),await ih(r)},`init`),ch=K(async(e,{lazyLoad:t=!0}={})=>{dm(),mt(...e),t===!1&&await fm()},`registerExternalDiagrams`),lh=K(function(){if(gh.startOnLoad){let{startOnLoad:e}=nh.getConfig();e&&gh.run().catch(e=>G.error(`Mermaid failed to initialize`,e))}},`contentLoaded`);typeof document<`u`&&window.addEventListener(`load`,lh,!1);var uh=K(function(e){gh.parseError=e},`setParseErrorHandler`),dh=[],fh=!1,ph=K(async()=>{if(!fh){for(fh=!0;dh.length>0;){let e=dh.shift();if(e)try{await e()}catch(e){G.error(`Error executing queue`,e)}}fh=!1}},`executeQueue`),mh=K(async(e,t)=>new Promise((n,r)=>{let i=K(()=>new Promise((i,a)=>{nh.parse(e,t).then(e=>{i(e),n(e)},e=>{G.error(`Error parsing`,e),gh.parseError?.(e),a(e),r(e)})}),`performCall`);dh.push(i),ph().catch(r)}),`parse`),hh=K((e,t,n)=>new Promise((r,i)=>{let a=K(()=>new Promise((a,o)=>{nh.render(e,t,n).then(e=>{a(e),r(e)},e=>{G.error(`Error parsing`,e),gh.parseError?.(e),o(e),i(e)})}),`performCall`);dh.push(a),ph().catch(i)}),`render`),gh={startOnLoad:!0,mermaidAPI:nh,parse:mh,render:hh,init:sh,run:ih,registerExternalDiagrams:ch,registerLayoutLoaders:Yt,initialize:oh,parseError:void 0,contentLoaded:lh,setParseErrorHandler:uh,detectType:kt,registerIconPacks:qt,getRegisteredDiagramsMetadata:K(()=>Object.keys(Dt).map(e=>({id:e})),`getRegisteredDiagramsMetadata`)},_h=gh,vh=Ye(e=>We(pe(async()=>(_h.initialize({securityLevel:`strict`,startOnLoad:!1}),await _h.render(`mermaid_${ue(e)}`,e)))));function yh(e){let t=(0,el.c)(19),n;t[0]===e.children?n=t[1]:(n=vh(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=Ke(n,r);if(Be(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=g(k(a.cause)),t[5]=a.cause,t[6]=r);let o;return t[7]!==n||t[8]!==r?(o=(0,Y.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=Cu.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,Y.jsx)(`div`,{dangerouslySetInnerHTML:s,className:c}),t[16]=s,t[17]=c,t[18]=l):l=t[18],l}var bh=new $d({async:!1,breaks:!0,gfm:!0});function xh(e){let t=(0,el.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=L(bh.lexer(e.children),Sh),t[2]=e.children,t[3]=r);let a;return t[4]!==n||t[5]!==r?(a=(0,Y.jsx)(`div`,{className:n,children:r}),t[4]=n,t[5]=r,t[6]=a):a=t[6],a}function Sh(e,t){return y(S(e),B({type:`html`},Ch),B({lang:`mermaid`,type:`code`},n=>(0,Y.jsx)(yh,{className:`border-border border`,children:n.text},`${e.type}:${t}:${n.text}`)),B({type:`code`},n=>(0,Y.jsx)(tf,{className:`border-border border`,lang:T(n.lang)?n.lang:void 0,children:n.text},`${e.type}:${t}:${n.lang??``}:${n.text}`)),v(e=>(0,Y.jsx)(`div`,{dangerouslySetInnerHTML:{__html:Cu.sanitize(bh.parse(e.raw,{async:!1}))}},`${e.type}:${t}:${e.raw}`)))}function Ch(){return null}var wh=`
|
|
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 Th(e,t){return e.filePath===t.filePath&&e.lineNumber===t.lineNumber&&e.side===`deletions`==(t.side===`deletions`)}function Eh(e){let t=e.side===`deletions`?`deleted`:`line`;return`# Review comments\n\n## ${e.filePath}\n\n${t}:${e.lineNumber}: ${e.body}`}function Dh(e,t){let n=y(x(e.querySelector(`diffs-container`)?.shadowRoot?.querySelectorAll(`[data-line][data-line-type]`)??[]),M(e=>{let n=e.getBoundingClientRect();return t>=n.top&&t<=n.bottom}),b);if(n&&!(c(n.dataset.line)||C(n.dataset.line)))return{clientY:t,lineNumber:n.dataset.line,offsetWithinLine:t-n.getBoundingClientRect().top,scrollTop:e.scrollTop}}function Oh(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 kh(e){let t=(0,el.c)(42),n=(0,q.useRef)(null),r;t[0]===e.comment.body?r=t[1]:(r=()=>C(e.comment.body),t[0]=e.comment.body,t[1]=r);let[i,a]=(0,q.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,q.useEffect)(o,s);let c;t[5]===e?c=t[6]:(c=function(){let t=n.current?.value??e.comment.body;if(C(g(t))){if(e.isDraft===!0){e.onCloseDraft?.();return}e.onResolveComment?.({...e.comment,body:t}),a(!1),e.onCloseDraft?.();return}e.onSaveComment?.({...e.comment,body:g(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,Y.jsx)(`div`,{className:`border-border bg-background text-muted-foreground inline-flex shrink-0 border p-1`,children:e.comment.source===`github`?(0,Y.jsx)(tl,{className:`size-3 shrink-0`}):(0,Y.jsx)($t,{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,Y.jsx)(`div`,{className:`min-w-0`,children:(0,Y.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:Ah,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,Y.jsx)(`div`,{}),t[15]=s):s=t[15];let c;return t[16]!==r||t[17]!==o?(c=(0,Y.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}let u;t[19]===e.comment.source?u=t[20]:(u=(0,Y.jsx)(`div`,{className:`border-border bg-background text-muted-foreground inline-flex shrink-0 border p-1`,children:e.comment.source===`github`?(0,Y.jsx)(tl,{className:`size-3 shrink-0`}):(0,Y.jsx)($t,{className:`size-3 shrink-0`})}),t[19]=e.comment.source,t[20]=u);let d;t[21]===e.comment.source?d=t[22]:(d=t=>{t.stopPropagation(),e.comment.source!==`github`&&a(!0)},t[21]=e.comment.source,t[22]=d);let f;t[23]===e.comment.body?f=t[24]:(f=(0,Y.jsx)(xh,{className:`text-inherit`,children:e.comment.body}),t[23]=e.comment.body,t[24]=f);let p;t[25]!==d||t[26]!==f?(p=(0,Y.jsx)(`button`,{type:`button`,className:`min-w-0 bg-transparent p-0 text-left`,onClick:d,children:f}),t[25]=d,t[26]=f,t[27]=p):p=t[27];let m;t[28]===e.comment?m=t[29]:(m=t=>{t.stopPropagation(),navigator.clipboard.writeText(Eh(e.comment))},t[28]=e.comment,t[29]=m);let h;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Y.jsx)(Zt,{className:`size-3`}),t[30]=h):h=t[30];let _;t[31]===m?_=t[32]:(_=(0,Y.jsx)(`button`,{type:`button`,className:`hover:bg-muted hover:text-foreground p-1`,"aria-label":`Copy comment`,title:`Copy comment`,onClick:m,children:h}),t[31]=m,t[32]=_);let v;t[33]===e?v=t[34]:(v=e.onResolveComment&&(0,Y.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,Y.jsx)(se,{className:`size-3`}):(0,Y.jsx)(Pe,{className:`size-3`})}),t[33]=e,t[34]=v);let y;t[35]!==_||t[36]!==v?(y=(0,Y.jsxs)(`div`,{className:`border-border bg-background text-muted-foreground inline-flex shrink-0 border text-xs`,children:[_,v]}),t[35]=_,t[36]=v,t[37]=y):y=t[37];let b;return t[38]!==y||t[39]!==u||t[40]!==p?(b=(0,Y.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[38]=y,t[39]=u,t[40]=p,t[41]=b):b=t[41],b}function Ah(e){e.stopPropagation()}function jh(e){let t=(0,el.c)(31),n=(0,q.useRef)(null),r=(0,q.useRef)(null),i=(0,q.useRef)(null),[a,s]=(0,q.useState)(),l=T(e.patch)&&he(e.patch)?e.patch:void 0,u=T(e.fileContent)?e.fileContent:void 0,d=`${e.filePath}\u0000${l??``}\u0000${T(u)?`file`:`pending`}`,f;t[0]!==d||t[1]!==l?(f=()=>({key:d,mode:T(l)?`diff`:`file`}),t[0]=d,t[1]=l,t[2]=f):f=t[2];let[p,m]=(0,q.useState)(f),h=T(l)?`diff`:`file`,g=p.key===d?p.mode:h,_;t[3]!==u||t[4]!==l||t[5]!==g?(_=function(){return g===`diff`&&c(l)?`file`:g===`file`&&c(u)&&T(l)?`diff`:g}(),t[3]=u,t[4]=l,t[5]=g,t[6]=_):_=t[6];let y=_,b=Se(e.filePath),x=T(l)?oi(ai(l),b):void 0,C=e.comments??[],w=a?o(C,a):C,E;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>{n.current?.focus()},t[7]=E):E=t[7];let D;t[8]!==y||t[9]!==e.fileContent||t[10]!==e.filePath||t[11]!==e.patch?(D=[y,e.filePath,e.patch,e.fileContent],t[8]=y,t[9]=e.fileContent,t[10]=e.filePath,t[11]=e.patch,t[12]=D):D=t[12],(0,q.useEffect)(E,D);let O;t[13]===y?O=t[14]:(O=()=>{me(n.current)||me(i.current)||Oh(n.current,i.current,y)&&(i.current=null)},t[13]=y,t[14]=O);let k;t[15]!==y||t[16]!==e.fileContent?(k=[y,e.fileContent],t[15]=y,t[16]=e.fileContent,t[17]=k):k=t[17],(0,q.useLayoutEffect)(O,k);let A;t[18]!==u||t[19]!==d||t[20]!==l?(A=function(){if(c(l)||c(u)||me(n.current))return;let e=n.current.getBoundingClientRect(),t=me(r.current)?e.top+e.height/2:Math.min(Math.max(r.current,e.top),e.bottom);i.current=Dh(n.current,t)??null,m(e=>({key:d,mode:e.key===d&&e.mode===`file`?`diff`:`file`}))},t[18]=u,t[19]=d,t[20]=l,t[21]=A):A=t[21];let j=A,M;t[22]!==u||t[23]!==l||t[24]!==j?(M=e=>{c(l)||c(u)||(e.preventDefault(),j())},t[22]=u,t[23]=l,t[24]=j,t[25]=M):M=t[25];let te;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(te={preventDefault:!1,target:n},t[26]=te):te=t[26],rr(`Tab`,M,te);let ne=function(t){e.onSaveComment&&(a&&Th(a,{filePath:e.filePath,lineNumber:t.lineNumber,side:t.side})||a||re(C,n=>Th(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}))},N=S({fileContent:u,fileDiff:x,mode:y,patch:l}).pipe(B(Lh,t=>(0,Y.jsx)($c,{fileDiff:t.fileDiff,options:{diffIndicators:`bars`,diffStyle:`unified`,disableBackground:!1,disableFileHeader:!0,disableLineNumbers:!1,lineDiffType:`word-alt`,onLineNumberClick:e=>{ne({lineNumber:e.lineNumber,side:e.annotationSide})},overflow:`scroll`,theme:De,themeType:`system`,unsafeCSS:wh},lineAnnotations:L(w,Ih),renderAnnotation:t=>(0,Y.jsx)(kh,{comment:t.metadata,isDraft:a&&Th(t.metadata,a),onSaveComment:e.onSaveComment,onResolveComment:e.onResolveComment,onCloseDraft:()=>{s(void 0)}})},t.patch)),B(Fh,t=>(0,Y.jsx)(Qs,{file:{contents:t.fileContent??``,lang:b,name:e.filePath},options:{disableFileHeader:!0,disableLineNumbers:!1,onLineNumberClick:e=>{ne({lineNumber:e.lineNumber})},overflow:`scroll`,theme:De,themeType:`system`,unsafeCSS:wh},lineAnnotations:L(ee(w,Ph),Nh),renderAnnotation:t=>(0,Y.jsx)(kh,{comment:t.metadata,isDraft:a&&Th(t.metadata,a),onSaveComment:e.onSaveComment,onResolveComment:e.onResolveComment,onCloseDraft:()=>{s(void 0)}})},e.filePath)),v(Mh)),P,ie;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ie=e=>{r.current=e.clientY},P=e=>{r.current=e.clientY,e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLButtonElement||e.currentTarget.focus()},t[27]=P,t[28]=ie):(P=t[27],ie=t[28]);let ae;return t[29]===N?ae=t[30]:(ae=(0,Y.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:ie,onPointerDownCapture:P,children:N}),t[29]=N,t[30]=ae),ae}function Mh(){return(0,Y.jsxs)(`div`,{className:`text-muted-foreground flex h-full items-center justify-center text-sm`,children:[(0,Y.jsx)(se,{className:`mr-2 size-3 border opacity-60`}),`Loading file`]})}function Nh(e){return{lineNumber:e.lineNumber,metadata:e}}function Ph(e){return e.side!==`deletions`}function Fh(e){return T(e.fileContent)||T(e.patch)}function Ih(e){return{lineNumber:e.lineNumber,metadata:e,side:e.side??`additions`}}function Lh(e){return e.mode===`diff`&&z(e.fileDiff)}var Rh=Ye(e=>U.runtime.atom(y(U,m(t=>t(`review.metadata`,{cwd:e})),Ue))),zh=Ye(e=>U.runtime.atom(y(U,m(t=>t(`publish.pullRequest`,{cwd:e})),Ue)));function Bh(e){return e._tag===`commit`?`commit\u0000${e.hash}`:e._tag}function Vh(e,t=``){return S(e).pipe(B(`commit`,()=>nt.make({hash:t})),B(`local`,()=>Ze.make({})),B(`branch`,()=>tt.make({})),v(()=>rt.make({})))}var Hh=Ye(e=>{let t=e.split(`\0`),n=t[0]??``,r=Vh(t[1]??`changes`,t[2]??``);return U.runtime.atom(y(U,m(e=>e(`review.diffs`,{cwd:n,target:r})),Ue))}),Uh=Ye(e=>U.runtime.atom(y(U,m(t=>t(`review.state`,{cwd:e})),Ue))),Wh=Ve.make({comments:F(),marks:F()}),Gh=Ye(e=>Ge(Uh(e),e=>H(e)?e.value:Wh)),Kh=Ye(()=>Xe(We(()=>({checkpointing:!1,generatingMessage:!1,publishing:!1})))),qh=Ye(e=>it(Kh(e),{fn:U.runtime.fn()(w(`DiffPage.generatePublishMessage`)(function*(t){return yield*(yield*U)(`publish.message.generate`,{cwd:e})})),reducer:e=>({...e,generatingMessage:!0})})),Jh=Ye(e=>it(Kh(e),{fn:U.runtime.fn()(w(`DiffPage.publish`)(function*(t){return yield*(yield*U)(`publish.publish`,{cwd:e,message:t})})),reducer:e=>({...e,publishing:!0})})),Yh=Ye(e=>it(Kh(e),{fn:U.runtime.fn()(w(`DiffPage.checkpoint`)(function*(t){return yield*(yield*U)(`publish.checkpoint`,{cwd:e})})),reducer:e=>({...e,checkpointing:!0})})),Xh=Ye(()=>Xe(We(()=>({resolving:A(),resolvingAll:!1})))),Zh=Ye(e=>it(Xh(e),{fn:U.runtime.fn()(w(`DiffPage.resolveComment`)(function*(t){yield*(yield*U)(`review.comments.resolve`,{comments:[t.comment],cwd:e})})),reducer:(e,t)=>({resolving:s(e.resolving,Qe.make(t.comment)),resolvingAll:e.resolvingAll})})),Qh=Ye(e=>it(Xh(e),{fn:U.runtime.fn()(w(`DiffPage.resolveComments`)(function*(t){yield*(yield*U)(`review.comments.resolve`,{comments:L(t,e=>e.comment),cwd:e})})),reducer:(e,t)=>({resolving:y(t,R(e.resolving,(e,t)=>s(e,Qe.make(t.comment)))),resolvingAll:!0})}));function $h(e){return y(e,R(f(),(e,t)=>de(e,t.filePath,y(_(e,t.filePath),oe(()=>F()),o(t)))),e=>x(e),L(e=>({comments:e[1],filePath:e[0]})))}async function eg(e){try{await navigator.clipboard.writeText(y(e,L(Eh),ce(`
|
|
221
|
+
|
|
222
|
+
`)))}catch{Ne.error(`Failed to copy comments.`)}}function tg(){let e=(0,el.c)(4),t=at.useParams(),n;e[0]===t.worktree?n=e[1]:(n=et(t.worktree),e[0]=t.worktree,e[1]=n);let r=Ke(n);if(!r.value.activeWorktree)return;let i;return e[2]===r.value.activeWorktree.root?i=e[3]:(i=(0,Y.jsx)(ng,{cwd:r.value.activeWorktree.root},r.value.activeWorktree.root),e[2]=r.value.activeWorktree.root,e[3]=i),i}function ng(e){let t=(0,el.c)(143),n=at.useNavigate(),r=at.useSearch(),i;t[0]===e.cwd?i=t[1]:(i=Rh(e.cwd),t[0]=e.cwd,t[1]=i);let a=qe(i),o;t[2]===e.cwd?o=t[3]:(o=zh(e.cwd),t[2]=e.cwd,t[3]=o);let s=qe(o),c;t[4]===e.cwd?c=t[5]:(c=Gh(e.cwd),t[4]=e.cwd,t[5]=c);let l=qe(c),u=(0,q.useState)(!1),d=(0,q.useState)(og);if(Be(a))throw a.cause;let f;t[6]===a?f=t[7]:(f=H(a),t[6]=a,t[7]=f);let m=f,g=m?a.value.localCommits:F(),_=m?a.value.branchCommits:F(),v=ie(g,ag),x=O(g,_),S;t[8]===r?S=t[9]:(S=e=>e.hash===r.commit,t[8]=r,t[9]=S);let C=y(x,M(S),b),w=C?nt.make({hash:C.hash}):d[0],T=`${e.cwd}\u0000${Bh(w)}`,k;t[10]===T?k=t[11]:(k=Hh(T),t[10]=T,t[11]=k);let A=k,j=e.cwd,ae;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(ae=Bh(rt.make({})),t[12]=ae):ae=t[12];let ce=`${j}\u0000${ae}`,le;t[13]===ce?le=t[14]:(le=Hh(ce),t[13]=ce,t[14]=le);let ue=le,de=(0,q.useState)(``),R=qe(A),pe=qe(ue),z=H(R)?R.value:F(),me;t[15]===pe?me=t[16]:(me=H(pe)?pe.value:F(),t[15]=pe,t[16]=me);let B=me,ge=he(de[0])&&re(z,e=>e.filePath===de[0])?de[0]:``,V=(he(ge)?y(z,M(e=>e.filePath===ge),b):void 0)??z[0],ve;t[17]===e.cwd?ve=t[18]:(ve=Rh(e.cwd),t[17]=e.cwd,t[18]=ve);let ye=$e(ve),xe=$e(A),Se=$e(ue),Ce;t[19]===e.cwd?Ce=t[20]:(Ce=Uh(e.cwd),t[19]=e.cwd,t[20]=Ce);let we=$e(Ce),De,Oe;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(De=U.mutation(`review.comments.save`),Oe={mode:`promise`},t[21]=De,t[22]=Oe):(De=t[21],Oe=t[22]);let Ae=ze(De,Oe),je;t[23]===e.cwd?je=t[24]:(je=Zh(e.cwd),t[23]=e.cwd,t[24]=je);let Me;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Me={mode:`promise`},t[25]=Me):Me=t[25];let Re=ze(je,Me),Ve;t[26]===e.cwd?Ve=t[27]:(Ve=Qh(e.cwd),t[26]=e.cwd,t[27]=Ve);let Ue;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Ue={mode:`promise`},t[28]=Ue):Ue=t[28];let We=ze(Ve,Ue),Ge;t[29]===e.cwd?Ge=t[30]:(Ge=Xh(e.cwd),t[29]=e.cwd,t[30]=Ge);let Ke=qe(Ge),Je,Ye;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(Je=U.mutation(`review.state.mark`),Ye={mode:`promise`},t[31]=Je,t[32]=Ye):(Je=t[31],Ye=t[32]);let Xe=ze(Je,Ye),Ze,Qe;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=U.mutation(`review.state.unmark`),Qe={mode:`promise`},t[33]=Ze,t[34]=Qe):(Ze=t[33],Qe=t[34]);let et=ze(Ze,Qe),tt;t[35]===Ke?tt=t[36]:(tt=e=>({...e,resolving:D(Ke.resolving,e)}),t[35]=Ke,t[36]=tt);let it=L(l.comments,tt),W=L(it,ig),ot=$h(it),G=V?ee(it,e=>e.filePath===V.filePath):F(),K=y(z,te(He),p),st=ee(l.marks,e=>D(K,e)),ct;t[37]!==e.cwd||t[38]!==Xe?(ct=async function(t){try{await Xe({payload:{cwd:e.cwd,marks:t}})}catch{Ne.error(`Failed to mark file reviewed.`)}},t[37]=e.cwd,t[38]=Xe,t[39]=ct):ct=t[39];let lt=ct,ut;t[40]!==e.cwd||t[41]!==et?(ut=async function(t){try{await et({payload:{cwd:e.cwd,marks:t}})}catch{Ne.error(`Failed to unmark file reviewed.`)}},t[40]=e.cwd,t[41]=et,t[42]=ut):ut=t[42];let dt=ut,ft;t[43]!==lt||t[44]!==z||t[45]!==de?(ft=function(e){de[1](e);let t=y(z,M(t=>t.filePath===e),h(He),oe(rg));P(t)||lt(t)},t[43]=lt,t[44]=z,t[45]=de,t[46]=ft):ft=t[46];let pt=ft,mt;t[47]!==n||t[48]!==de||t[49]!==d?(mt=function(e){(0,q.startTransition)(()=>{n({search:e._tag===`commit`?{commit:e.hash}:{}})}),e._tag!==`commit`&&d[1](e),de[1](``)},t[47]=n,t[48]=de,t[49]=d,t[50]=mt):mt=t[50];let ht=mt,gt;t[51]!==Se||t[52]!==xe||t[53]!==ye||t[54]!==we?(gt=function(){ye(),xe(),Se(),we()},t[51]=Se,t[52]=xe,t[53]=ye,t[54]=we,t[55]=gt):gt=t[55];let _t=gt,vt;t[56]!==e.cwd||t[57]!==Ae?(vt=async function(t){try{await Ae({payload:{comment:t,cwd:e.cwd}})}catch{Ne.error(`Failed to save comment.`)}},t[56]=e.cwd,t[57]=Ae,t[58]=vt):vt=t[58];let yt=vt,bt;t[59]!==we||t[60]!==Re?(bt=async function(e){try{await Re({comment:e}),e.source===`github`&&we()}catch{Ne.error(e.source===`github`?`Failed to resolve GitHub thread.`:`Failed to resolve comment.`)}},t[59]=we,t[60]=Re,t[61]=bt):bt=t[61];let xt=bt,St;t[62]!==we||t[63]!==We?(St=async function(e){try{await We(e),we()}catch{Ne.error(`Failed to resolve comment.`)}},t[62]=we,t[63]=We,t[64]=St):St=t[64];let Ct=St,wt;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(wt={key:`?`,shift:!0},t[65]=wt):wt=t[65];let Tt;t[66]===u?Tt=t[67]:(Tt=()=>{u[1](!0)},t[66]=u,t[67]=Tt),rr(wt,Tt);let Et;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Et=(0,Y.jsx)(_e,{children:(0,Y.jsx)(Ee,{children:`Shortcuts`})}),t[68]=Et):Et=t[68];let Dt;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=(0,Y.jsxs)(Te,{children:[Et,(0,Y.jsx)(`div`,{className:`grid gap-2`,children:(0,Y.jsxs)(`div`,{className:`grid grid-cols-[96px_minmax(0,1fr)] gap-3`,children:[(0,Y.jsx)(`kbd`,{className:`border px-1.5 py-0.5 text-center`,children:`?`}),(0,Y.jsx)(`span`,{children:`Show shortcuts`})]})})]}),t[69]=Dt):Dt=t[69];let Ot;t[70]!==u[0]||t[71]!==u[1]?(Ot=(0,Y.jsx)(ke,{open:u[0],onOpenChange:u[1],children:Dt}),t[70]=u[0],t[71]=u[1],t[72]=Ot):Ot=t[72];let kt=Ie,At=e.cwd,jt=m&&a.value.dirty,Mt;t[73]!==R||t[74]!==z?(Mt=H(R)&&!P(z),t[73]=R,t[74]=z,t[75]=Mt):Mt=t[75];let Nt;t[76]!==pe||t[77]!==B?(Nt=H(pe)&&!P(B),t[76]=pe,t[77]=B,t[78]=Nt):Nt=t[78];let Pt=!P(v),Ft=!m,It;t[79]===s?It=t[80]:(It=H(s)?s.value?.url:void 0,t[79]=s,t[80]=It);let Lt=m&&a.value.unpushedCommits,Rt;t[81]===g?Rt=t[82]:(Rt=N(g),t[81]=g,t[82]=Rt);let zt=m?a.value.upstream:void 0,Bt;t[83]!==e.cwd||t[84]!==_t||t[85]!==jt||t[86]!==Mt||t[87]!==Nt||t[88]!==Pt||t[89]!==Ft||t[90]!==It||t[91]!==Lt||t[92]!==Rt||t[93]!==zt?(Bt=(0,Y.jsx)(sg,{cwd:At,dirty:jt,hasReviewableChanges:Mt,hasReviewableWorktreeChanges:Nt,hasCheckpointCommits:Pt,loading:Ft,prUrl:It,refreshReview:_t,unpushedCommits:Lt,unpushedCount:Rt,upstream:zt}),t[83]=e.cwd,t[84]=_t,t[85]=jt,t[86]=Mt,t[87]=Nt,t[88]=Pt,t[89]=Ft,t[90]=It,t[91]=Lt,t[92]=Rt,t[93]=zt,t[94]=Bt):Bt=t[94];let Vt;t[95]!==lt||t[96]!==pt||t[97]!==R||t[98]!==z||t[99]!==V||t[100]!==dt||t[101]!==st?(Vt=(0,Y.jsx)(Fe,{defaultSize:`55%`,minSize:`15%`,children:(0,Y.jsx)(`div`,{className:`h-full min-h-0`,children:H(R)?(0,Y.jsx)(yg,{diffs:z,marks:st,markReviewed:e=>{lt(e)},unmarkReviewed:e=>{dt(e)},selectedEntry:V,openReviewEntry:pt}):(0,Y.jsx)(`div`,{className:`flex h-full min-h-0`,children:(0,Y.jsx)(I,{})})})}),t[95]=lt,t[96]=pt,t[97]=R,t[98]=z,t[99]=V,t[100]=dt,t[101]=st,t[102]=Vt):Vt=t[102];let Ht;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ht=(0,Y.jsx)(Le,{}),t[103]=Ht):Ht=t[103];let Ut=!m,Wt;t[104]===ht?Wt=t[105]:(Wt=e=>{ht(nt.make({hash:e.hash}))},t[104]=ht,t[105]=Wt);let Gt;t[106]!==_||t[107]!==g||t[108]!==w||t[109]!==ht||t[110]!==Ut||t[111]!==Wt?(Gt=(0,Y.jsx)(Fe,{defaultSize:`45%`,minSize:`15%`,children:(0,Y.jsx)(`div`,{className:`h-full min-h-0`,children:(0,Y.jsx)(hg,{branchCommits:_,loading:Ut,localCommits:g,selected:w,selectCommit:Wt,selectScope:ht})})}),t[106]=_,t[107]=g,t[108]=w,t[109]=ht,t[110]=Ut,t[111]=Wt,t[112]=Gt):Gt=t[112];let Kt;t[113]!==Vt||t[114]!==Gt?(Kt=(0,Y.jsxs)(Ie,{orientation:`vertical`,className:`min-h-0 flex-1`,children:[Vt,Ht,Gt]}),t[113]=Vt,t[114]=Gt,t[115]=Kt):Kt=t[115];let qt;t[116]!==Bt||t[117]!==Kt?(qt=(0,Y.jsx)(Fe,{defaultSize:`34%`,minSize:`24%`,maxSize:`46%`,children:(0,Y.jsxs)(`div`,{className:`flex h-full flex-col border-r`,children:[Bt,Kt]})}),t[116]=Bt,t[117]=Kt,t[118]=qt):qt=t[118];let Jt;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(Jt=(0,Y.jsx)(Le,{}),t[119]=Jt):Jt=t[119];let Yt=Fe,Xt;t[120]===R?Xt=t[121]:(Xt=!H(R)&&(0,Y.jsx)(`div`,{className:`flex h-full min-h-0`,children:(0,Y.jsx)(I,{})}),t[120]=R,t[121]=Xt);let Qt;t[122]!==R||t[123]!==z?(Qt=H(R)&&P(z)&&(0,Y.jsx)(`div`,{className:`text-muted-foreground flex h-full items-center justify-center text-sm`,children:`No changed files.`}),t[122]=R,t[123]=z,t[124]=Qt):Qt=t[124];let $t=H(R)&&V&&(0,Y.jsx)(`div`,{className:`h-full min-h-0 min-w-0`,children:(0,Y.jsx)(jh,{filePath:V.filePath,fileContent:V.fileContent,patch:V.patch,comments:G,onSaveComment:e=>{yt({body:e.body,filePath:e.filePath,lineNumber:e.lineNumber,side:e.side})},onResolveComment:e=>{xt({...e,source:e.source??`local`})}})}),en;t[125]!==Xt||t[126]!==Qt||t[127]!==$t?(en=(0,Y.jsxs)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:[Xt,Qt,$t]}),t[125]=Xt,t[126]=Qt,t[127]=$t,t[128]=en):en=t[128];let tn=!P(it)&&(0,Y.jsxs)(`footer`,{className:`grid min-h-8 grid-cols-[minmax(0,1fr)_auto] items-center gap-2 border-t px-2`,children:[(0,Y.jsx)(`div`,{className:`flex min-w-0 items-center gap-1 overflow-hidden`,children:L(ot,e=>(0,Y.jsxs)(ne,{type:`button`,variant:`outline`,size:`xs`,"aria-label":`Open ${e.filePath}`,title:e.filePath,onClick:()=>{pt(e.filePath)},children:[(0,Y.jsx)(be,{filePath:e.filePath}),(0,Y.jsx)(`span`,{className:`max-w-32 truncate`,children:y(E(`/`)(e.filePath),fe,oe(()=>e.filePath))})]},e.filePath))}),(0,Y.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-1`,children:[(0,Y.jsx)(ne,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Copy all comments`,title:`Copy all comments`,disabled:P(it),onClick:()=>{eg(it)},children:(0,Y.jsx)(Zt,{})}),(0,Y.jsx)(ne,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Resolve all comments`,title:`Resolve all comments`,disabled:Ke.resolvingAll?!0:P(W),onClick:()=>{Ct(W)},children:Ke.resolvingAll?(0,Y.jsx)(se,{className:`size-2.5 border opacity-60`}):(0,Y.jsx)(Pe,{})})]})]}),nn;t[129]!==en||t[130]!==tn?(nn=(0,Y.jsxs)(`div`,{className:`bg-background flex h-full min-w-0 flex-col overflow-hidden`,children:[en,tn]}),t[129]=en,t[130]=tn,t[131]=nn):nn=t[131];let rn;t[132]!==Yt||t[133]!==nn?(rn=(0,Y.jsx)(Yt,{defaultSize:`66%`,minSize:`54%`,children:nn}),t[132]=Yt,t[133]=nn,t[134]=rn):rn=t[134];let an;t[135]!==kt||t[136]!==qt||t[137]!==Jt||t[138]!==rn?(an=(0,Y.jsxs)(kt,{orientation:`horizontal`,children:[qt,Jt,rn]}),t[135]=kt,t[136]=qt,t[137]=Jt,t[138]=rn,t[139]=an):an=t[139];let on;return t[140]!==Ot||t[141]!==an?(on=(0,Y.jsxs)(Y.Fragment,{children:[Ot,an]}),t[140]=Ot,t[141]=an,t[142]=on):on=t[142],on}function rg(){return F()}function ig(e){return{comment:e}}function ag(e){return e.checkpoint}function og(){return rt.make({})}function sg(e){let t=(0,el.c)(98),n=(0,q.useState)(``),r;t[0]===e.cwd?r=t[1]:(r=Kh(e.cwd),t[0]=e.cwd,t[1]=r);let o=qe(r),s;t[2]===e.cwd?s=t[3]:(s=qh(e.cwd),t[2]=e.cwd,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c={mode:`promise`},t[4]=c):c=t[4];let u=ze(s,c),f;t[5]===e.cwd?f=t[6]:(f=Yh(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 m=ze(f,p),_;t[8]===e.cwd?_=t[9]:(_=Jh(e.cwd),t[8]=e.cwd,t[9]=_);let x;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(x={mode:`promise`},t[10]=x):x=t[10];let w=ze(_,x),T,D,O,k,A;if(t[11]!==o.checkpointing||t[12]!==o.generatingMessage||t[13]!==o.publishing||t[14]!==m||t[15]!==n||t[16]!==u||t[17]!==e||t[18]!==w){let r=y(n[0],g),s=S({checkpoints:e.hasCheckpointCommits,dirty:e.dirty,loading:e.loading}).pipe(B({loading:!0},mg),B({dirty:!0},pg),B({checkpoints:!0},fg),v(dg)),c=E(/\r?\n/)(r),f=g(c[0]),p=y(d(c,1),ce(`
|
|
223
|
+
`),g),_=S({generating:o.generatingMessage,hasSubject:he(f)}).pipe(B({generating:!0},ug),B({hasSubject:!0},()=>f),v(()=>s)),x;t[24]!==e.dirty||t[25]!==e.hasReviewableWorktreeChanges?(x=function(){return e.dirty&&e.hasReviewableWorktreeChanges},t[24]=e.dirty,t[25]=e.hasReviewableWorktreeChanges,t[26]=x):x=t[26];let j=x,M;t[27]!==e.dirty||t[28]!==e.hasCheckpointCommits?(M=function(){return!e.dirty&&e.hasCheckpointCommits},t[27]=e.dirty,t[28]=e.hasCheckpointCommits,t[29]=M):M=t[29];let ee=M,te;t[30]!==e.dirty||t[31]!==e.hasCheckpointCommits||t[32]!==e.unpushedCommits?(te=function(){return!e.dirty&&!e.hasCheckpointCommits&&e.unpushedCommits},t[30]=e.dirty,t[31]=e.hasCheckpointCommits,t[32]=e.unpushedCommits,t[33]=te):te=t[33];let N=te,P;t[34]!==ee||t[35]!==j?(P=function(){return j()||ee()},t[34]=ee,t[35]=j,t[36]=P):P=t[36];let re=P,ie;t[37]!==ee||t[38]!==j?(ie=function(){return j()||ee()},t[37]=ee,t[38]=j,t[39]=ie):ie=t[39];let oe=ie,ue;t[40]!==ee||t[41]!==j||t[42]!==N?(ue=function(){return j()||ee()||N()},t[40]=ee,t[41]=j,t[42]=N,t[43]=ue):ue=t[43];let F=ue,de=async function(){if(!(e.loading||o.publishing||o.checkpointing||!F()||re()&&C(r)))try{await w(r),n[1](``),e.refreshReview()}catch(e){let t=e;Ne.error(ae(t))}},I;t[44]!==o.checkpointing||t[45]!==o.generatingMessage||t[46]!==o.publishing||t[47]!==oe||t[48]!==n||t[49]!==u||t[50]!==e.loading?(I=async function(){if(!(e.loading||o.generatingMessage||o.publishing||o.checkpointing||!oe()))try{n[1](await u(null))}catch(e){let t=e;Ne.error(ae(t))}},t[44]=o.checkpointing,t[45]=o.generatingMessage,t[46]=o.publishing,t[47]=oe,t[48]=n,t[49]=u,t[50]=e.loading,t[51]=I):I=t[51];let fe=I,L;t[52]!==o.checkpointing||t[53]!==o.publishing||t[54]!==m||t[55]!==e?(L=async function(){if(!(e.loading||o.checkpointing||o.publishing||!e.dirty||!e.hasReviewableWorktreeChanges))try{await m(null),e.refreshReview()}catch(e){let t=e;Ne.error(ae(t))}},t[52]=o.checkpointing,t[53]=o.publishing,t[54]=m,t[55]=e,t[56]=L):L=t[56];let R=L,pe;t[57]!==e.unpushedCommits||t[58]!==e.unpushedCount||t[59]!==e.upstream?(pe=z(e.upstream)&&(e.upstream.ahead>0||e.upstream.behind>0)?(0,Y.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,Y.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[57]=e.unpushedCommits,t[58]=e.unpushedCount,t[59]=e.upstream,t[60]=pe):pe=t[60];let me;t[61]!==o.checkpointing||t[62]!==o.generatingMessage||t[63]!==o.publishing||t[64]!==oe||t[65]!==e.loading?(me=e.loading||o.generatingMessage||o.checkpointing||o.publishing||!oe(),t[61]=o.checkpointing,t[62]=o.generatingMessage,t[63]=o.publishing,t[64]=oe,t[65]=e.loading,t[66]=me):me=t[66];let ge;t[67]===fe?ge=t[68]:(ge=()=>{fe()},t[67]=fe,t[68]=ge);let V;t[69]===o.generatingMessage?V=t[70]:(V=o.generatingMessage?(0,Y.jsx)(se,{className:`size-2.5 border opacity-60`}):(0,Y.jsx)(Xt,{}),t[69]=o.generatingMessage,t[70]=V);let _e;t[71]!==me||t[72]!==ge||t[73]!==V?(_e=(0,Y.jsx)(ne,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`size-4`,"aria-label":`Generate commit message`,title:`Generate commit message`,disabled:me,onClick:ge,children:V}),t[71]=me,t[72]=ge,t[73]=V,t[74]=_e):_e=t[74];let ve=e.loading||o.checkpointing||o.publishing||!e.dirty||!e.hasReviewableWorktreeChanges,ye;t[75]===R?ye=t[76]:(ye=()=>{R()},t[75]=R,t[76]=ye);let be;t[77]===o.checkpointing?be=t[78]:(be=o.checkpointing?(0,Y.jsx)(se,{className:`size-2.5 border opacity-60`}):(0,Y.jsx)(Pe,{}),t[77]=o.checkpointing,t[78]=be);let xe;t[79]!==ve||t[80]!==ye||t[81]!==be?(xe=(0,Y.jsx)(ne,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`size-4`,"aria-label":`Checkpoint`,title:`Create checkpoint`,disabled:ve,onClick:ye,children:be}),t[79]=ve,t[80]=ye,t[81]=be,t[82]=xe):xe=t[82];let Se;t[83]===o.publishing?Se=t[84]:(Se=o.publishing?(0,Y.jsx)(se,{className:`size-2.5 border opacity-60`}):(0,Y.jsx)(tn,{}),t[83]=o.publishing,t[84]=Se);let Ce;t[85]!==e.loading||t[86]!==e.prUrl?(Ce=e.loading?(0,Y.jsx)(`span`,{className:`text-muted-foreground flex size-4 items-center justify-center`,children:(0,Y.jsx)(se,{className:`size-2.5 border opacity-60`})}):he(e.prUrl??``)&&(0,Y.jsx)(`a`,{className:i(le({size:`icon-xs`,variant:`ghost`}),`size-4`),href:y(URL.parse(e.prUrl??``),a,l(lg),h(cg),b),target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open pull request`,title:`Open pull request`,children:(0,Y.jsx)(Re,{})}),t[85]=e.loading,t[86]=e.prUrl,t[87]=Ce):Ce=t[87];let we=(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[pe,_e,xe,(0,Y.jsx)(ne,{type:`submit`,variant:`ghost`,size:`icon-xs`,className:`size-4`,"aria-label":`Publish`,title:`Commit, push, and open a draft PR`,disabled:e.loading||o.publishing||o.checkpointing||!F()||re()&&C(r),children:Se}),Ce]});T=`border-b p-2`,D=e=>{e.preventDefault(),de()},O=`border-input min-w-0 border font-mono text-xs leading-4 select-text`;let Te;t[88]===we?Te=t[89]:(Te=(0,Y.jsx)(`div`,{className:`border-input flex shrink-0 items-center border-l px-1.5`,children:we}),t[88]=we,t[89]=Te),k=(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-stretch`,children:[(0,Y.jsx)(`span`,{title:_,className:i(`min-w-0 flex-1 truncate px-2 py-1.5`,(C(f)||o.generatingMessage)&&`text-muted-foreground`),children:_}),Te]}),A=he(p)&&!o.generatingMessage&&(0,Y.jsx)(`div`,{className:`bg-muted/30 text-muted-foreground border-t px-2 py-1.5`,children:(0,Y.jsx)(`div`,{className:`max-h-32 overflow-y-auto`,children:(0,Y.jsx)(`span`,{className:`whitespace-pre-wrap`,children:p})})}),t[11]=o.checkpointing,t[12]=o.generatingMessage,t[13]=o.publishing,t[14]=m,t[15]=n,t[16]=u,t[17]=e,t[18]=w,t[19]=T,t[20]=D,t[21]=O,t[22]=k,t[23]=A}else T=t[19],D=t[20],O=t[21],k=t[22],A=t[23];let j;t[90]!==O||t[91]!==k||t[92]!==A?(j=(0,Y.jsxs)(`div`,{className:O,children:[k,A]}),t[90]=O,t[91]=k,t[92]=A,t[93]=j):j=t[93];let M;return t[94]!==T||t[95]!==D||t[96]!==j?(M=(0,Y.jsx)(`form`,{className:T,onSubmit:D,children:j}),t[94]=T,t[95]=D,t[96]=j,t[97]=M):M=t[97],M}function cg(e){return e.href}function lg(e){return e.protocol===`https:`&&e.hostname===`github.com`}function ug(){return`Generating commit message`}function dg(){return`No changes`}function fg(){return`Generate squash message`}function pg(){return`Generate commit message`}function mg(){return`Loading`}function hg(e){let t=(0,el.c)(28);if(e.loading){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center`,children:(0,Y.jsx)(se,{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,Y.jsx)(`li`,{className:`w-full min-w-0`,children:(0,Y.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,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Y.jsx)(`span`,{children:t.subject})}),(0,Y.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=rt.make({}),t[3]=s):s=t[3];let c;t[4]!==e.selectScope||t[5]!==e.selected||t[6]!==s?(c=(0,Y.jsx)(gg,{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=!P(e.localCommits)&&(0,Y.jsx)(gg,{detail:`${N(e.localCommits)}`,label:`Local`,selected:e.selected,selectScope:e.selectScope,target:Ze.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=L(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=!P(e.branchCommits)&&(0,Y.jsx)(gg,{detail:`${N(e.branchCommits)}`,label:`Branch`,selected:e.selected,selectScope:e.selectScope,target:tt.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=L(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,Y.jsx)(`div`,{className:`flex h-full min-h-0 flex-col`,children:(0,Y.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 gg(e){let t=(0,el.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,Y.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,Y.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,Y.jsx)(`li`,{className:`w-full min-w-0`,children:(0,Y.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 _g(e){let t={children:F(),name:``,path:``,type:`directory`};function n(e,t,r){if(c(t[0])){e.children.push({diff:r,name:r.filePath,path:r.filePath,type:`file`});return}if(N(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=y(e.children,M(e=>e.name===t[0]),b);if(a?.type===`directory`){n(a,d(t,1),r);return}let o={children:F(),name:t[0],path:i,type:`directory`};e.children.push(o),n(o,d(t,1),r)}for(let r of e)n(t,E(`/`)(r.filePath),r);return y(t.children,L(e=>e.type===`directory`?vg(e):e))}function vg(e){let t=e.children[0];return N(e.children)===1&&t?.type===`directory`?vg({children:t.children,name:`${e.name}/${t.name}`,path:t.path,type:`directory`}):e}function yg(e){let t=(0,el.c)(15),n=(0,q.useState)(Sg),r,i,a,o,c;if(t[0]!==n||t[1]!==e){let l=_g(e.diffs),u=y(e.diffs,R(f(),xg)),d=p(e.marks);function m(t){if(t.type===`directory`)return(0,Y.jsxs)(`li`,{className:`w-full min-w-0`,children:[(0,Y.jsx)(ye,{icon:(0,Y.jsx)(Qt,{}),onClick:()=>{n[1](e=>D(e,t.path)?j(e,t.path):s(e,t.path))},actions:(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:N(t.children)}),children:t.name}),!D(n[0],t.path)&&(0,Y.jsx)(`ul`,{className:`border-border/70 ml-[19px] flex flex-col border-l pl-2`,children:L(t.children,m)})]},t.path);let r=y(u,_(t.diff.filePath),oe(bg)),i=Je(r,d);return(0,Y.jsx)(`li`,{className:`w-full min-w-0`,children:(0,Y.jsx)(ye,{selected:e.selectedEntry?.filePath===t.diff.filePath,icon:(0,Y.jsx)(be,{filePath:t.diff.filePath,className:`size-3`}),actions:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Cg,{state:i,onClick:t=>{t.stopPropagation(),!P(r)&&(i===`checked`?e.unmarkReviewed(r):e.markReviewed(r))}}),(0,Y.jsx)(wg,{status:t.diff.status})]}),onClick:()=>{e.openReviewEntry(t.diff.filePath)},children:t.name})},t.path)}i=Oe,c=`h-full overflow-y-auto px-0 py-1`,r=Ce,a=`min-h-0 flex-1 [&>ul]:min-h-0 [&>ul]:flex-1`,o=P(e.diffs)?(0,Y.jsx)(`li`,{className:`text-muted-foreground flex flex-1 items-center justify-center px-2 py-2`,children:`No changed files.`}):L(l,m),t[0]=n,t[1]=e,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=c}else r=t[2],i=t[3],a=t[4],o=t[5],c=t[6];let l;t[7]!==r||t[8]!==a||t[9]!==o?(l=(0,Y.jsx)(r,{className:a,children:o}),t[7]=r,t[8]=a,t[9]=o,t[10]=l):l=t[10];let u;return t[11]!==i||t[12]!==c||t[13]!==l?(u=(0,Y.jsx)(i,{className:c,children:l}),t[11]=i,t[12]=c,t[13]=l,t[14]=u):u=t[14],u}function bg(){return F()}function xg(e,t){return de(e,t.filePath,He(t))}function Sg(){return A()}function Cg(e){let t=(0,el.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,Y.jsx)(ge,{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,Y.jsx)(en,{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,Y.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 wg(e){return y(S(e.status),B(`added`,()=>(0,Y.jsx)(`span`,{className:`text-emerald-600 dark:text-emerald-400`,children:`A`})),B(`deleted`,()=>(0,Y.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:`D`})),B(`renamed`,()=>(0,Y.jsx)(`span`,{className:`text-sky-600 dark:text-sky-400`,children:`R`})),v(()=>(0,Y.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400`,children:`M`})))}export{tg as component};
|