@qredence/fleet 0.7.1 → 0.7.2
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/CHANGELOG.md +6 -0
- package/dist/web/client/assets/{action-swap-roll-BfVrBOVd.js → action-swap-roll-Bek47h-E.js} +1 -1
- package/dist/web/client/assets/{alert-dialog-FCppNafx.js → alert-dialog-OoasP5iO.js} +1 -1
- package/dist/web/client/assets/{artifacts-panel-C69vz-oo.js → artifacts-panel-DVY0-7X0.js} +1 -1
- package/dist/web/client/assets/{badge-DOGhnsYk.js → badge-9wr3qUp1.js} +2 -2
- package/dist/web/client/assets/{button-BJyg7l5W.js → button-Bqms7ZKX.js} +1 -1
- package/dist/web/client/assets/{card-BScRdZNS.js → card-DPCbcrMK.js} +1 -1
- package/dist/web/client/assets/{chat-command-palette-wyZjTNa8.js → chat-command-palette-CXS5eTiy.js} +1 -1
- package/dist/web/client/assets/{citations-BhyqbxcZ.js → citations-C7USoVdz.js} +1 -1
- package/dist/web/client/assets/{command-Bo31U-UD.js → command-s2yLD3tA.js} +1 -1
- package/dist/web/client/assets/{create-project-dialog-SDyXTpl-.js → create-project-dialog-C99_Lyjg.js} +1 -1
- package/dist/web/client/assets/{dialog-DLIPvl1s.js → dialog-DuCD5hRq.js} +1 -1
- package/dist/web/client/assets/{ease-DKi-MOH5.js → ease-2gsl7ABx.js} +1 -1
- package/dist/web/client/assets/{fork-picker-dialog-BDleMADF.js → fork-picker-dialog--dV6TE-9.js} +1 -1
- package/dist/web/client/assets/globals-BXtzVIWE.css +2 -0
- package/dist/web/client/assets/{index-BARp0bjW.js → index-C2EkVtv5.js} +3 -3
- package/dist/web/client/assets/{input-Ce8yLnXY.js → input-DECT4vz2.js} +1 -1
- package/dist/web/client/assets/{input-group-BZLQiZOA.js → input-group-CZlz1ygA.js} +1 -1
- package/dist/web/client/assets/{ipython-tool-CuSGRhXl.js → ipython-tool-Bs6ESZe1.js} +1 -1
- package/dist/web/client/assets/{layout-constants-Bl6XCvhY.js → layout-constants-C4hoW3YP.js} +1 -1
- package/dist/web/client/assets/{markdown-yn-nhRzB.js → markdown-B2tpfUKu.js} +2 -2
- package/dist/web/client/assets/{markdown-code-DfJbKhL9.js → markdown-code-B5YUmtLX.js} +1 -1
- package/dist/web/client/assets/{message-queue-CiptKSb6.js → message-queue-BD2sIUTH.js} +1 -1
- package/dist/web/client/assets/{model-selector-list-BHQ-Q8b9.js → model-selector-list-zPZRE3JY.js} +1 -1
- package/dist/web/client/assets/{notify-BC0a76VJ.js → notify-mVA6z9Ly.js} +1 -1
- package/dist/web/client/assets/{openui-renderer-DrfHxs1t.js → openui-renderer-ByP8yQph.js} +1 -1
- package/dist/web/client/assets/{prompt-input-IwZOepG7.js → prompt-input-Bnl0HyL6.js} +1 -1
- package/dist/web/client/assets/{prompt-suggestions-BRFWFm5y.js → prompt-suggestions-DcgETXtw.js} +1 -1
- package/dist/web/client/assets/{provider-label-DNZOLldn.js → provider-label-COVNyoZo.js} +1 -1
- package/dist/web/client/assets/{repl-panel-UQN9UFG7.js → repl-panel-BoDNpJOe.js} +1 -1
- package/dist/web/client/assets/{resources-panel-kp_UjnpX.js → resources-panel-DD6iWOF3.js} +1 -1
- package/dist/web/client/assets/{right-panel-registry-CF7GLJrk.js → right-panel-registry-CIfLdAfS.js} +2 -2
- package/dist/web/client/assets/{routes-DCP1DP1g.js → routes-DO93P3Xm.js} +5 -5
- package/dist/web/client/assets/{select-COK0Kaq2.js → select-Dp15z1lf.js} +1 -1
- package/dist/web/client/assets/{session-reasoning-panel-DrTWp8d4.js → session-reasoning-panel-WMedZp__.js} +1 -1
- package/dist/web/client/assets/session-tool-renderer-BFC3-Md4.js +170 -0
- package/dist/web/client/assets/{session-tree-panel-deGRKAhX.js → session-tree-panel-CnHOsPzz.js} +1 -1
- package/dist/web/client/assets/{settings-dialog-BU1Tw0CQ.js → settings-dialog-BN138nzK.js} +1 -1
- package/dist/web/client/assets/{skeleton-D5Y9nBfp.js → skeleton-DNAr5ULI.js} +1 -1
- package/dist/web/client/assets/{skeleton-loaders-DOKGa7CW.js → skeleton-loaders-B28mF4tJ.js} +1 -1
- package/dist/web/client/assets/{spinner-C3sPnLdu.js → spinner-CSBXk3Lo.js} +1 -1
- package/dist/web/client/assets/{subagent-chat-panel-bVnkDkgs.js → subagent-chat-panel-DYKOKRPp.js} +1 -1
- package/dist/web/client/assets/subagent-transcript-BCUhqVvi.js +1 -0
- package/dist/web/client/assets/{subagent-utils-D7sXbLsS.js → subagent-utils-CM2qX9BG.js} +2 -2
- package/dist/web/client/assets/{subagents-panel-i5-12E1U.js → subagents-panel-CTvtU0Sh.js} +1 -1
- package/dist/web/client/assets/{surface-context-DWplCCcO.js → surface-context-VvasJf_6.js} +1 -1
- package/dist/web/client/assets/{surfaces-BULKVm-B.js → surfaces-m1vs5aMP.js} +1 -1
- package/dist/web/client/assets/{switch-DQETDDJT.js → switch-eqXIzePo.js} +1 -1
- package/dist/web/client/assets/{toast-BFeqSeaR.js → toast-DRDVljMF.js} +1 -1
- package/dist/web/client/assets/{tool-result-D7HtJ_yg.js → tool-result-DWUV8hEz.js} +1 -1
- package/dist/web/client/assets/{tool-timeline-B4ci1oJg.js → tool-timeline-4k2iSEky.js} +1 -1
- package/dist/web/client/assets/{use-reduced-motion-BgG7f9xw.js → use-reduced-motion-BzGFRmoG.js} +1 -1
- package/dist/web/client/assets/utils-CFDGLzf6.js +1 -0
- package/dist/web/client/assets/{workspace-panel-Clbmrdza.js → workspace-panel-BNeGABPi.js} +1 -1
- package/dist/web/client/assets/{workspace-path-nav-eVT0rYvv.js → workspace-path-nav-umvkE4ut.js} +2 -2
- package/dist/web/client/bundle-budget.json +5 -5
- package/dist/web/server/{_tanstack-start-manifest_v-CaT-3S-N-VAOGUHEJ.js → _tanstack-start-manifest_v-DTCFS0PG-ARV2V4FW.js} +26 -26
- package/dist/web/server/{artifacts-panel-BuAqeJzj-6DYYLKUW.js → artifacts-panel-Ct2R_4wM-DAPQMI57.js} +13 -13
- package/dist/web/server/{chat-command-palette-Ca8gXVi2-P6EOQ43G.js → chat-command-palette-ETZzg35Q-TAV74IAW.js} +8 -8
- package/dist/web/server/{chunk-5AYK2KDO.js → chunk-777VIBCH.js} +176 -176
- package/dist/web/server/{chunk-7VFULIHV.js → chunk-AAPVQJAD.js} +2 -2
- package/dist/web/server/{chunk-K4KN3QBT.js → chunk-BNB7T7P6.js} +2 -2
- package/dist/web/server/{chunk-E4YWFQX5.js → chunk-FFGFTGLQ.js} +415 -383
- package/dist/web/server/{chunk-GCDOYNXR.js → chunk-FL3FOWSC.js} +30 -30
- package/dist/web/server/{chunk-ITKXE2Q5.js → chunk-GS5F6X7H.js} +497 -234
- package/dist/web/server/{chunk-B7YWDA2F.js → chunk-INRE3X52.js} +2 -2
- package/dist/web/server/{chunk-35AFSKDX.js → chunk-JOCVZVZ3.js} +5 -5
- package/dist/web/server/{chunk-J4Y2Z3XM.js → chunk-JU7PCOE7.js} +4 -4
- package/dist/web/server/{chunk-UTV66W5H.js → chunk-KVW6XTN3.js} +14 -9
- package/dist/web/server/{chunk-NB3TVOGB.js → chunk-LECHJX4M.js} +483 -481
- package/dist/web/server/{chunk-JFAUSHBI.js → chunk-M6K66QBV.js} +6 -6
- package/dist/web/server/{chunk-COWE2EJ6.js → chunk-R7KUUFDW.js} +4 -4
- package/dist/web/server/chunk-SHNODG3C.js +18343 -0
- package/dist/web/server/{chunk-PXSOI3XF.js → chunk-SQXJ5TUB.js} +2 -2
- package/dist/web/server/{chunk-B5Y7XOIJ.js → chunk-TMQ3MT3D.js} +78 -17
- package/dist/web/server/{chunk-M7BTY55G.js → chunk-UWZYLMEH.js} +2 -2
- package/dist/web/server/{chunk-YIJ7D7G5.js → chunk-VTEYQNJE.js} +7 -7
- package/dist/web/server/{chunk-ABYOWAMD.js → chunk-X76RBZ37.js} +2 -2
- package/dist/web/server/{chunk-FPPKECLB.js → chunk-XMAAYUOT.js} +14 -14
- package/dist/web/server/{create-project-dialog-DCvdysey-IZUGGDAN.js → create-project-dialog-CqBmLTlA-X6HI6AYR.js} +9 -9
- package/dist/web/server/{dist-DVCLWOYT.js → dist-3UIQ7SZN.js} +2 -2
- package/dist/web/server/{dist-4A22NBTB.js → dist-ZPEDRNZ4.js} +2 -2
- package/dist/web/server/{fork-picker-dialog-QH00XmqX-6YLU5REF.js → fork-picker-dialog-PYNd9ozc-EA7BRLRR.js} +6 -6
- package/dist/web/server/{markdown-CShfYRVO-OKGCYPQK.js → markdown-CShfYRVO-22N5LNAN.js} +2 -2
- package/dist/web/server/{markdown-code-BDV_2b2T-VZGAECQB.js → markdown-code-BDV_2b2T-KUPHX52W.js} +2 -2
- package/dist/web/server/{message-queue-BzEFQR8k-2W53EW32.js → message-queue-DmSFAI5Y-XDZHJ2Z6.js} +6 -6
- package/dist/web/server/{model-selector-list-BjoXmw92-TEKBPB3E.js → model-selector-list-C-Y3p5UM-HTSWVVHP.js} +8 -8
- package/dist/web/server/{openui-renderer-CJ7Q2zZ_-FPXKZPSO.js → openui-renderer-C4B1EJxC-QDYQF5LD.js} +10 -10
- package/dist/web/server/{prompt-suggestions-EqAaAx6L-723M64XJ.js → prompt-suggestions-EqAaAx6L-B4KCWNZX.js} +1 -1
- package/dist/web/server/{repl-panel-DOyUyuQR-IMYO4FKX.js → repl-panel-DOyUyuQR-LRBDRMHW.js} +3 -3
- package/dist/web/server/{resources-panel-yVB4xF_K-OHFHXVU4.js → resources-panel-Bo-TmRON-O47AKGEQ.js} +7 -7
- package/dist/web/server/{router-UgU5vJxm-R33FGTXY.js → router-DtS2wXhd-I2SZV7YF.js} +5 -5
- package/dist/web/server/{routes-Cbbo-jh9-ZUPH4SJD.js → routes-DuSYlASY-U7C32ONE.js} +5 -5
- package/dist/web/server/server.js +3 -3
- package/dist/web/server/{session-reasoning-panel-C50VbaQ8-4YLMVVY6.js → session-reasoning-panel-BFcZs1pZ-KNHSU5GX.js} +7 -7
- package/dist/web/server/{session-tool-renderer-QcAkYD-V-6RXRKDH6.js → session-tool-renderer-TiFeeJEc-YUZPEEZ4.js} +9 -9
- package/dist/web/server/{session-tree-panel-CL49XSTK-4ZPK6AIV.js → session-tree-panel-CjsqVYLY-DGZBGY2E.js} +6 -6
- package/dist/web/server/{settings-dialog-DG9HEZeP-TWDRDGMN.js → settings-dialog-Bj5LrAE8-6BQRLUJT.js} +10 -10
- package/dist/web/server/{start-DEejK9Uj-FODAOTAO.js → start-cCC--AXu-BBMIT6OU.js} +1 -1
- package/dist/web/server/{subagent-chat-panel-Cg2CxshI-WWGFHTIF.js → subagent-chat-panel-DAS4Ne-1-TWIUXSQC.js} +12 -12
- package/dist/web/server/{subagents-panel-aC3Eo-MR-RNIPLCZQ.js → subagents-panel-C3CdUcqw-DFTJTPHA.js} +12 -12
- package/dist/web/server/{tool-timeline-C4dgQITK-CFWANSDL.js → tool-timeline-C4dgQITK-IWCLQLWG.js} +3 -3
- package/dist/web/server/{workspace-panel-DfdFkgHU-6HIOXRBX.js → workspace-panel-DNs0Ye2U-VFB6X5PK.js} +7 -7
- package/package.json +4 -4
- package/dist/web/client/assets/globals-DZbMyHfg.css +0 -2
- package/dist/web/client/assets/session-tool-renderer-Yu4G1165.js +0 -1389
- package/dist/web/client/assets/subagent-transcript-D_L-8PQi.js +0 -1
- package/dist/web/client/assets/utils-Dpy9ZFOr.js +0 -1
- package/dist/web/server/chunk-PHHC52CO.js +0 -38412
|
@@ -1,1389 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{t as n}from"./react-Cvdyeg_0.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{t as i}from"./utils-Dpy9ZFOr.js";import{c as a,d as o,n as s,o as c,r as l,s as u}from"./ease-DKi-MOH5.js";import{n as d,t as f}from"./use-reduced-motion-BgG7f9xw.js";import{t as p}from"./createLucideIcon-CQY2ECfR.js";import{i as m,n as h,r as g,t as _}from"./tool-result-D7HtJ_yg.js";import{a as v,i as y,o as b,r as x,s as S}from"./citations-BhyqbxcZ.js";import{t as C}from"./check-BTwIaCtI.js";import{t as w}from"./chevron-down-Bse1ggZM.js";import{t as T}from"./chevron-right-BPCB1mOg.js";import{n as E,t as D}from"./safe-external-url-BnEhm9A0.js";import{n as O,t as k}from"./file-text-cqOanUYv.js";import{t as A}from"./circle-check-DBhaebaM.js";import{a as j,n as M,r as N,t as ee}from"./action-swap-roll-BfVrBOVd.js";import{a as te,i as ne,n as re,r as ie,t as ae}from"./ipython-tool-CuSGRhXl.js";import{n as oe,r as se,t as ce}from"./sparkles-C4VQyMox.js";import{t as le}from"./eye-iNSvs0UA.js";import{t as ue}from"./git-branch-DZEh2mM2.js";import{t as de}from"./loader-circle-BmKYM_C4.js";import{t as fe}from"./rotate-ccw-DLkfsmG9.js";import{t as pe}from"./search-Cb6fFWew.js";import{t as me}from"./terminal-Ceucj7us.js";import{t as he}from"./wrench-BYnD147U.js";import{t as ge}from"./x-DEU6H3M-.js";import{t as P}from"./preload-helper-BZ1Pz5am.js";import{a as _e,i as ve,n as ye,o as be,r as xe,s as Se}from"./dist-QgsZ1U9l.js";import{n as Ce,r as we,t as Te}from"./collapsible-DsbKpD_Y.js";import{i as Ee,r as De}from"./workspace-path-nav-eVT0rYvv.js";import{n as Oe,t as ke}from"./range-BWOHiLNe.js";import{s as Ae}from"./surfaces-BULKVm-B.js";var je={name:`chevrons-down`,size:24,node:[[`path`,{d:`m7 6 5 5 5-5`,key:`1lc07p`}],[`path`,{d:`m7 13 5 5 5-5`,key:`1d48rs`}]]};je.node;var Me=p(je),Ne={name:`chevrons-up`,size:24,node:[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]};Ne.node;var Pe=p(Ne),Fe={name:`file-plus`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]};Fe.node;var Ie=p(Fe),Le={name:`folder-search`,size:24,node:[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]};Le.node;var Re=p(Le),F=t(n(),1),I=r(),ze={queued:`Waiting to generate`,generating:`Generating image`,refining:`Refining details`,complete:`Image ready`,error:`Generation failed`},Be={queued:{filter:`blur(4px) saturate(0.75)`,opacity:0,scale:1.02},generating:{filter:`blur(3px) saturate(0.85)`,opacity:0,scale:1.015},refining:{filter:`blur(1.5px) saturate(0.95)`,opacity:.62,scale:1.005},complete:{filter:`blur(0px) saturate(1)`,opacity:1,scale:1},error:{filter:`blur(2px) saturate(0.5)`,opacity:.28,scale:1}},Ve={queued:1,generating:1,refining:.48,complete:0,error:0},He=10,Ue=Math.PI*2;function We({status:e,reduce:t}){return e===`complete`?(0,I.jsx)(C,{"aria-hidden":`true`,className:`size-3.5`}):e===`error`?(0,I.jsx)(O,{"aria-hidden":`true`,className:`size-3.5`}):(0,I.jsxs)(o.span,{"aria-hidden":`true`,animate:t?void 0:{rotate:360},transition:{duration:2.4,ease:s,repeat:1/0},className:`grid size-3.5 grid-cols-2 place-items-center gap-0.5`,children:[(0,I.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current`}),(0,I.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current opacity-55`}),(0,I.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current opacity-55`}),(0,I.jsx)(`span`,{className:`size-1 rounded-[1px] bg-current`})]})}function Ge({interactive:e,reduce:t,status:n}){let r=y(),i=(0,F.useRef)(null);return(0,F.useEffect)(()=>{let n=i.current,a=n?.getContext(`2d`);if(!n||!a)return;let o=0,s=0,c=0,l=`currentColor`,u={x:0,y:0,targetX:0,targetY:0,inside:!1},d=e&&r&&!t,f=()=>{let e=n.getBoundingClientRect();s=e.width||n.clientWidth||208,c=e.height||n.clientHeight||208;let t=Math.min(window.devicePixelRatio||1,2);n.width=Math.round(s*t),n.height=Math.round(c*t),a.setTransform(t,0,0,t,0,0),l=window.getComputedStyle(n).color,u.x=s/2,u.y=c/2,u.targetX=u.x,u.targetY=u.y},p=e=>{a.clearRect(0,0,s,c),u.inside||(u.targetX=s/2+(t?0:Math.sin(e/1700)*s*.12),u.targetY=c/2+(t?0:Math.cos(e/2100)*c*.1));let n=t?1:u.inside?.16:.045;u.x+=(u.targetX-u.x)*n,u.y+=(u.targetY-u.y)*n;let r=Math.min(s,c)*.38,i=Math.ceil(s/He)+1,d=Math.ceil(c/He)+1,f=(s-(i-1)*He)/2,m=(c-(d-1)*He)/2;a.fillStyle=l;for(let e=0;e<d;e+=1)for(let t=0;t<i;t+=1){let n=f+t*He,i=m+e*He,o=n-u.x,s=i-u.y,c=Math.hypot(o,s),l=Math.max(0,1-c/r),d=l*l*(3-2*l),p=d*d*9,h=c>0?o/c:0,g=c>0?s/c:0,_=n+h*p,v=i+g*p,y=.65+d*.85;a.globalAlpha=.17+d*.72,a.beginPath(),a.arc(_,v,y,0,Ue),a.fill()}a.globalAlpha=1,t||(o=window.requestAnimationFrame(p))},m=e=>{if(!d)return;let t=n.getBoundingClientRect();u.inside=!0,u.targetX=e.clientX-t.left,u.targetY=e.clientY-t.top},h=()=>{u.inside=!1},g=typeof ResizeObserver>`u`?null:new ResizeObserver(f);return f(),g?.observe(n),n.addEventListener(`pointermove`,m,{passive:!0}),n.addEventListener(`pointerleave`,h),p(0),()=>{o&&window.cancelAnimationFrame(o),g?.disconnect(),n.removeEventListener(`pointermove`,m),n.removeEventListener(`pointerleave`,h)}},[r,e,t]),(0,I.jsx)(o.div,{"aria-hidden":`true`,initial:!1,animate:{opacity:Ve[n]},transition:{duration:t?0:.4,ease:l},className:`absolute inset-0 overflow-hidden bg-muted`,children:(0,I.jsx)(`canvas`,{ref:i,className:`absolute inset-0 size-full text-foreground`})})}function Ke({children:e,status:t=`generating`,label:n,prompt:r,resolution:a=`1024 × 1024`,aspectRatio:s=`1 / 1`,size:c=`compact`,interactive:p=!0,statusText:m,showStatus:h=!0,onRetry:g,className:_,mediaClassName:v,statusClassName:y}){let b=f()??!1,x=t===`queued`||t===`generating`||t===`refining`,S=Be[t],C=m??ze[t],w=n??(r?`${C}: ${r}`:C);return(0,I.jsx)(`div`,{"data-slot":`image-generation`,"data-state":t,"aria-busy":x,className:i(`w-full`,_),children:(0,I.jsxs)(`div`,{className:i(`w-full`,c===`compact`&&`mx-auto max-w-52`),children:[(0,I.jsxs)(`div`,{role:`img`,"aria-label":w,style:{aspectRatio:s},className:`relative isolate w-full overflow-hidden rounded-xl bg-muted`,children:[(0,I.jsx)(o.div,{"aria-hidden":!e||void 0,initial:!1,animate:b?{opacity:S.opacity}:{filter:S.filter,opacity:S.opacity,scale:S.scale},transition:b?{duration:0}:{duration:.4,ease:l},className:i(`absolute inset-0 [&>*]:size-full [&>*]:object-cover [&_img]:size-full [&_img]:object-cover`,v),children:e}),(0,I.jsx)(d,{initial:!1,children:x?(0,I.jsx)(o.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:b?0:.25,ease:l},className:`absolute inset-0`,children:(0,I.jsx)(Ge,{interactive:p,reduce:b,status:t})},`dither-field`):null}),a?(0,I.jsx)(`span`,{className:`absolute top-2 right-2 z-10 rounded-full bg-background/75 px-2 py-0.5 font-mono text-micro tabular-nums text-muted-foreground`,children:a}):null]}),(0,I.jsx)(d,{initial:!1,children:h||r?(0,I.jsxs)(o.div,{initial:!1,className:`mt-3 text-left`,children:[(0,I.jsxs)(`div`,{"aria-live":`polite`,className:i(h?`flex min-h-5 items-center gap-2`:`contents`,`text-sm font-medium text-foreground`,t===`error`&&`text-destructive`,y),children:[h?(0,I.jsx)(We,{status:t,reduce:b}):null,(0,I.jsx)(d,{mode:`popLayout`,initial:!1,children:h?(0,I.jsx)(o.span,{initial:!b&&{opacity:0,y:4},animate:{opacity:1,y:0},exit:b?void 0:{opacity:0,y:-4},transition:{duration:b?0:.15,ease:l},children:C},C):null})]}),r?(0,I.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[`“`,r,`”`]}):null]},`status-block`):null}),t===`error`&&g?(0,I.jsxs)(o.button,{type:`button`,onClick:g,whileTap:b?void 0:{scale:.96},transition:u,className:`mt-3 inline-flex min-h-10 items-center gap-2 rounded-full px-3 text-sm font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,I.jsx)(fe,{"aria-hidden":`true`,className:`size-4`}),`Try again`]}):null]})})}function qe({steps:e,activeIndex:t,className:n,...r}){let a=e.length,o=Oe(t,a),s=o>=a,c=ke(o,a);return(0,I.jsxs)(`div`,{"data-slot":`agent-plan`,className:i(`flex w-full max-w-sm flex-col gap-3`,n),...r,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsx)(`span`,{className:`text-body font-medium`,children:`Plan`}),(0,I.jsxs)(`span`,{className:i(Ae,`text-foreground/35 tabular-nums`),children:[o,` of `,a]})]}),(0,I.jsx)(`div`,{className:`bg-foreground/[0.06] h-[3px] w-full overflow-hidden rounded-full`,children:(0,I.jsx)(`span`,{className:`bg-foreground/80 block h-full rounded-full transition-[width] duration-500`,style:{width:`${c}%`}})}),(0,I.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:e.map((e,t)=>{let n=s||t<o,r=!s&&t===o;return(0,I.jsxs)(`li`,{className:`flex items-center gap-2.5 text-body`,children:[(0,I.jsx)(`span`,{className:`flex size-4 shrink-0 items-center justify-center`,children:n?(0,I.jsx)(C,{className:`text-foreground/35 size-3.5`}):r?(0,I.jsx)(de,{className:`text-foreground/90 size-3.5 animate-spin motion-reduce:animate-none`}):(0,I.jsx)(`span`,{"aria-hidden":!0,className:`bg-foreground/15 size-1.5 rounded-full`})}),(0,I.jsx)(`span`,{className:i(n&&`text-foreground/40`,r&&`text-foreground/90`,!n&&!r&&`text-foreground/35`),children:e})]},e)})})]})}function Je(e){if(e.length===0)return;let t=e.flatMap(e=>{let t=e.title.trim();return t?[t]:[]});if(t.length!==e.length)return;let n=0;for(;n<e.length&&e[n]?.status===`completed`;)n+=1;if(!e.slice(n+1).some(e=>e.status===`completed`))return{steps:t,activeIndex:n}}function Ye({presentation:e,className:t}){return(0,I.jsx)(qe,{steps:e.steps,activeIndex:e.activeIndex,"aria-label":`Plan progress: ${Math.min(e.activeIndex,e.steps.length)} of ${e.steps.length} steps completed`,className:t})}function Xe(e){return e===`in-progress`?`In progress`:e===`completed`?`Completed`:e===`cancelled`?`Cancelled`:`Pending`}function Ze({complete:e}){let t=f()??!1;return(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`relative grid size-6 shrink-0 place-items-center`,children:(0,I.jsx)(d,{initial:!1,mode:`popLayout`,children:e?(0,I.jsxs)(o.svg,{viewBox:`0 0 24 24`,initial:t?{opacity:1}:{opacity:0,scale:.72},animate:{opacity:1,scale:1},exit:{opacity:0},transition:t?{duration:0}:a,className:`absolute size-5.5 overflow-visible text-emerald-500`,children:[(0,I.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,fill:`currentColor`}),(0,I.jsx)(o.path,{d:`M7.5 12.25 10.5 15.25 16.75 8.75`,fill:`none`,stroke:`white`,strokeWidth:`2.25`,strokeLinecap:`round`,strokeLinejoin:`round`,initial:t?{pathLength:1}:{pathLength:0},animate:{pathLength:1},transition:t?{duration:0}:{duration:.24,ease:l}})]},`complete`):(0,I.jsx)(o.span,{initial:t?{opacity:1}:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:t?{opacity:0}:{opacity:0,scale:.72},transition:t?{duration:0}:a,className:`absolute grid place-items-center text-muted-foreground`,children:(0,I.jsx)(S,{className:`size-4`})},`todo`)})})}function Qe({status:e,progress:t}){let n=f()??!1,r=t===void 0?.68:Math.min(100,Math.max(0,t))/100;return(0,I.jsxs)(o.svg,{"aria-hidden":`true`,viewBox:`0 0 24 24`,initial:!1,className:i(`mx-0.5 size-5 shrink-0 overflow-visible text-muted-foreground`,e===`in-progress`&&`text-foreground`,e===`cancelled`&&`text-rose-600 dark:text-rose-400`),children:[(0,I.jsx)(o.circle,{cx:`12`,cy:`12`,r:`9`,fill:`currentColor`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:e===`pending`?`2 3`:void 0,strokeLinecap:`round`,initial:!1,animate:{fillOpacity:e===`completed`?.06:0},transition:n?{duration:0}:{duration:.18,ease:l},className:i(e===`in-progress`&&`opacity-20`)}),(0,I.jsx)(o.circle,{cx:`12`,cy:`12`,r:`9`,pathLength:`1`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,initial:!1,animate:{pathLength:e===`in-progress`?r:0,opacity:+(e===`in-progress`),rotate:e===`in-progress`&&t===void 0&&!n?360:-90},transition:e===`in-progress`&&t===void 0&&!n?{rotate:{duration:1.1,repeat:1/0,ease:`linear`}}:n?{duration:0}:c,style:{transformOrigin:`12px 12px`}}),(0,I.jsx)(o.path,{d:`M7.5 12.25 10.5 15.25 16.75 8.75`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,initial:!1,animate:{pathLength:+(e===`completed`),opacity:+(e===`completed`)},transition:n?{duration:0}:{duration:.24,ease:l}}),(0,I.jsx)(o.path,{d:`M8.5 8.5 15.5 15.5M15.5 8.5 8.5 15.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,initial:!1,animate:{pathLength:+(e===`cancelled`),opacity:+(e===`cancelled`)},transition:n?{duration:0}:{duration:.2,ease:l}})]})}function $e({items:e,title:t=`To-dos`,open:n,defaultOpen:r=!0,onOpenChange:s,collapseOnComplete:u=!0,maxHeight:p=248,className:m}){let h=f()??!1,g=(0,F.useId)(),_=`${g}-trigger`,v=`${g}-content`,y=(0,F.useRef)(null),b=(0,F.useRef)(!1),[x,S]=(0,F.useState)(r),C=n??x,T=e.filter(e=>e.status===`completed`).length,E=e.length>0&&T===e.length,D=e.length,O=(0,F.useCallback)(e=>{n===void 0&&S(e),s?.(e)},[s,n]);return(0,F.useEffect)(()=>{b.current&&!E&&O(!0),!b.current&&E&&u&&O(!1),b.current=E},[E,u,O]),(0,F.useLayoutEffect)(()=>{let e=y.current;if(!e||D===0)return;let t=requestAnimationFrame(()=>{e.scrollHeight<=e.clientHeight||(typeof e.scrollTo==`function`?e.scrollTo({top:e.scrollHeight,behavior:h?`auto`:`smooth`}):e.scrollTop=e.scrollHeight)});return()=>cancelAnimationFrame(t)},[D,h]),(0,I.jsxs)(`section`,{"aria-label":`Agent task list`,className:i(`w-full overflow-hidden rounded-2xl border border-border/70`,m),children:[(0,I.jsxs)(`button`,{id:_,type:`button`,"aria-expanded":C,"aria-controls":v,onClick:()=>O(!C),className:`group flex h-11 w-full items-center gap-2.5 rounded-2xl px-3.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,I.jsx)(Ze,{complete:E}),(0,I.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-foreground/90`,children:t}),(0,I.jsxs)(`span`,{className:i(`shrink-0 text-xs font-medium tabular-nums text-muted-foreground`,E&&`text-emerald-600 dark:text-emerald-400`),children:[(0,I.jsxs)(`span`,{className:`sr-only`,children:[T,` of `,e.length,` tasks completed`]}),(0,I.jsxs)(`span`,{"aria-hidden":`true`,className:`inline-flex`,children:[(0,I.jsx)(ee,{value:String(T),children:T}),(0,I.jsx)(`span`,{children:`/`}),(0,I.jsx)(`span`,{children:e.length})]})]}),(0,I.jsx)(o.span,{"aria-hidden":`true`,animate:{rotate:C?180:0},transition:h?{duration:0}:a,className:`text-muted-foreground/50 transition-colors group-hover:text-muted-foreground`,children:(0,I.jsx)(w,{className:`size-3.5`})})]}),(0,I.jsx)(M,{id:v,role:`region`,"aria-labelledby":_,open:C,children:(0,I.jsxs)(`div`,{ref:y,className:`scrollbar-hide overflow-y-auto px-2 pb-2`,style:{maxHeight:p},children:[(0,I.jsx)(`ol`,{"aria-live":E?`polite`:`off`,className:`space-y-0`,children:(0,I.jsx)(d,{initial:!1,mode:`popLayout`,children:e.map(e=>{let t=e.status??`pending`;return(0,I.jsxs)(o.li,{layout:`position`,initial:h?{opacity:1}:{opacity:0,y:6},animate:{opacity:1,y:0},exit:h?{opacity:0}:{opacity:0,y:-3},transition:h?{duration:0}:{opacity:{duration:.18,ease:l},y:c,layout:c},className:`flex min-h-9 items-center gap-2.5 rounded-xl px-1.5 py-1`,children:[(0,I.jsx)(Qe,{status:t,progress:e.progress}),(0,I.jsxs)(`span`,{className:`sr-only`,children:[Xe(t),`: `]}),(0,I.jsx)(`span`,{className:i(`min-w-0 flex-1 truncate text-sm leading-5`,t===`pending`&&`text-muted-foreground/65`,t===`in-progress`&&`text-foreground`,t===`completed`&&`text-muted-foreground/60`,t===`cancelled`&&`text-muted-foreground/55`),children:(0,I.jsxs)(`span`,{className:`relative inline-block max-w-full`,children:[e.title,(0,I.jsx)(o.span,{"aria-hidden":`true`,initial:!1,animate:{scaleX:+(t===`completed`),opacity:+(t===`completed`)},transition:h?{duration:0}:{duration:.28,ease:l,delay:.06},className:`absolute inset-x-0 top-1/2 h-px origin-left bg-current`})]})}),e.detail?(0,I.jsx)(`span`,{className:`shrink-0 text-sm text-muted-foreground/55`,children:e.detail}):null]},e.id)})})}),!e.length&&(0,I.jsx)(`p`,{className:`px-1.5 py-2 text-sm text-muted-foreground`,children:`No tasks yet`})]})})]})}function et(e){return e===`approving`?`Approving`:e===`approved`?`Approved`:e===`denied`?`Denied`:e===`running`?`Running`:e===`complete`?`Completed`:e===`error`?`Failed`:`Approval required`}function tt(e){return e===`pending`?`border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400`:e===`approving`||e===`running`?`border-primary/30 bg-primary/10 text-primary`:e===`approved`||e===`complete`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-rose-500/30 bg-rose-500/10 text-rose-600 dark:text-rose-400`}function nt({tool:e,title:t=`Allow this tool to run?`,description:n,parameters:r=[],status:s=`pending`,open:c,defaultOpen:p=!1,onOpenChange:m,onApprove:h,onAlwaysAllow:g,onDeny:_,className:v}){let y=f()??!1,b=`${(0,F.useId)()}-details`,x=(0,F.useRef)(s),[S,T]=(0,F.useState)(p),E=c??S,D=(0,F.useCallback)(e=>{c===void 0&&T(e),m?.(e)},[m,c]),k=s===`approving`||s===`running`,A=s===`pending`,j=s===`error`;return(0,F.useEffect)(()=>{x.current===`pending`&&s!==`pending`&&D(!1),x.current=s},[D,s]),(0,I.jsxs)(`div`,{"data-state":s,"aria-busy":k,className:i(`w-full overflow-hidden rounded-2xl border border-border/60 bg-muted/20 text-sm`,v),children:[(0,I.jsxs)(`div`,{className:`flex items-start gap-3 p-4`,children:[(0,I.jsx)(`span`,{"aria-hidden":`true`,className:i(`mt-0.5 grid size-8 shrink-0 place-items-center rounded-xl border border-border/60 bg-background text-muted-foreground`,j&&`text-destructive`),children:k?(0,I.jsx)(de,{className:i(`size-4`,!y&&`animate-spin`)}):j?(0,I.jsx)(O,{className:`size-4`}):s===`denied`?(0,I.jsx)(ge,{className:`size-4`}):s===`approved`||s===`complete`?(0,I.jsx)(C,{className:`size-4`}):(0,I.jsx)(oe,{className:`size-4`})}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`div`,{className:`font-medium text-foreground`,children:t}),(0,I.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-xs text-muted-foreground`,children:e})]}),(0,I.jsx)(`span`,{className:i(`shrink-0 rounded-full border px-2 py-0.5 text-caption font-medium transition-colors`,tt(s)),children:et(s)})]}),n?(0,I.jsx)(`p`,{className:`mt-2 leading-5 text-muted-foreground`,children:n}):null,r.length?(0,I.jsxs)(`button`,{type:`button`,"aria-expanded":E,"aria-controls":b,onClick:()=>D(!E),className:`mt-2 inline-flex items-center gap-1 rounded-md text-xs font-medium text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[`View details`,(0,I.jsx)(o.span,{"aria-hidden":`true`,animate:{rotate:E?180:0},transition:y?{duration:0}:a,children:(0,I.jsx)(w,{className:`size-3.5`})})]}):null]})]}),(0,I.jsx)(M,{id:b,open:E,children:(0,I.jsx)(`dl`,{className:`mx-4 mb-4 grid gap-2 rounded-xl border border-border/50 bg-background/70 p-3`,children:r.map(e=>(0,I.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,7rem)_minmax(0,1fr)] items-center gap-3 text-xs`,children:[(0,I.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,I.jsx)(`dd`,{className:`min-w-0 break-words font-mono text-foreground/85`,children:e.value})]},e.id))})}),(0,I.jsx)(d,{initial:!1,children:A?(0,I.jsxs)(o.div,{initial:y?{opacity:0}:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0},transition:{duration:y?.12:.22,ease:l},className:`flex flex-wrap items-center gap-2 border-t border-border/60 px-4 py-3`,children:[(0,I.jsx)(o.button,{type:`button`,onClick:h,whileTap:y?void 0:{scale:.97},transition:u,className:`rounded-xl bg-foreground px-3 py-1.5 text-xs font-medium text-background outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:`Allow once`}),g?(0,I.jsx)(o.button,{type:`button`,onClick:g,whileTap:y?void 0:{scale:.97},transition:u,className:`rounded-xl border border-border/60 bg-background px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,children:`Always allow`}):null,(0,I.jsx)(`button`,{type:`button`,onClick:_,className:`rounded-xl px-3 py-1.5 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:`Deny`})]}):null})]})}function rt(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function it(e){let t=rt(e);if(t)return t;if(typeof e==`string`)try{return rt(JSON.parse(e))}catch{return}}function L(e,...t){for(let n of t){let t=e?.[n];if(typeof t==`string`&&t.trim())return t}}function at(e,...t){for(let n of t){let t=e?.[n];if(typeof t==`number`&&Number.isFinite(t))return t;if(typeof t==`string`&&t.trim()){let e=Number(t);if(Number.isFinite(e))return e}}}function ot(e,...t){for(let n of t){let t=e?.[n];if(typeof t==`boolean`)return t}}function st(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function ct(e){return e.output!==void 0&&e.output!==null?e.output:e.result}function lt(e){let t=it(e),n=it(t?.details),r={...t??{},...n??{}},i=r.result,a=L(r,`stdout`,`standardOutput`,`standard_output`),o=L(r,`stderr`,`standardError`,`standard_error`),s=r.error??r.errorMessage??r.evalue,c=s===void 0?void 0:st(s),l=at(r,`durationMs`,`duration_ms`,`duration`),u=ot(r,`kernelRestarted`,`kernel_restarted`),d=new Set([`stdout`,`stderr`,`standardOutput`,`standard_output`,`standardError`,`standard_error`,`error`,`errorMessage`,`evalue`,`durationMs`,`duration_ms`,`duration`,`kernelRestarted`,`kernel_restarted`,`status`,`isError`]),f=Object.keys(r).some(e=>!d.has(e));return{record:t,details:n,stdout:a,stderr:o,result:i,error:c,durationMs:l,kernelRestarted:u,structured:!a&&!o&&!c&&(typeof i==`object`&&!!i||f)}}function ut(e,t){let n=[];if(e.stdout&&n.push({label:`stdout`,content:e.stdout,language:`text`}),e.stderr&&n.push({label:`stderr`,content:e.stderr,language:`text`}),e.result!==void 0&&n.push({label:`result`,content:st(e.result),language:typeof e.result==`object`&&e.result!==null?`json`:`text`}),e.error&&n.push({label:`error`,content:e.error,language:`text`}),n.length>0)return n;let r=e.details??e.record;if(r){let e={...r};if(delete e.details,delete e.isError,Object.keys(e).length>0)return[{label:`result`,content:st(e),language:`json`}]}let i=st(t);return i.trim()?[{label:`output`,content:i,language:`text`}]:[]}function dt(e,t){return ut(e,t).map(e=>`${e.label}\n${e.content}`).join(`
|
|
2
|
-
|
|
3
|
-
`)}function ft(e){return it(e.input)??it(e.args)}function pt(e,...t){for(let n of t){let t=e?.[n];if(Array.isArray(t))return t}}function mt(e,t){return L(t.details??t.record,`diff`,`patch`)??L(e,`diff`,`patch`)}function ht(e,t){return L(e,`path`,`filePath`,`filename`,`file`)??L(t.details??t.record,`path`,`filePath`,`filename`,`file`)??`workspace file`}function gt(e){return e.split(`
|
|
4
|
-
`).map((e,t)=>({id:`${t}-${e.slice(0,16)}`,type:e.startsWith(`+`)&&!e.startsWith(`+++`)?`added`:e.startsWith(`-`)&&!e.startsWith(`---`)?`removed`:`context`,content:e}))}function _t(e,t){let n=t.details??t.record,r=it(e?.plan)??it(n?.plan),i=pt(e,`todos`)??pt(r,`todos`,`items`)??pt(n,`todos`,`newTodos`,`items`);return i?i.flatMap((e,t)=>{let n=rt(e);if(!n)return[];let r=L(n,`content`,`title`,`text`,`label`);if(!r)return[];let i=L(n,`status`),a=i===`in_progress`||i===`in-progress`?`in-progress`:i===`completed`?`completed`:i===`cancelled`?`cancelled`:`pending`;return[{id:`${t}-${r}`,title:r,status:a}]}):[]}function vt(e){let t=pt(e.details??e.record,`results`,`sources`,`citations`);return t?t.flatMap((e,t)=>{let n=rt(e);if(!n)return[];let r=L(n,`title`,`name`,`snippet`);if(!r)return[];let i=L(n,`url`,`link`),a=i&&D(i)?i:void 0;return[{id:`${t}-${r}`,title:r,url:a,domain:L(n,`domain`,`source`)}]}):[]}function yt(e){return L(e.details??e.record,`url`,`imageUrl`,`image_url`)}function bt(e,t){return rt(e?.approval)??rt(t.details?.approval)??rt(t.record?.approval)}function xt(e){let t=typeof e.type==`string`?e.type:`Tool`;return t.startsWith(`tool-`)?t.slice(5):t}function St(e,t){let n=typeof e.state==`string`?e.state:void 0;return n===`output-error`||n===`error`?`error`:n===`output-available`||n===`complete`||n===`success`?`success`:n===`cancelled`||n===`canceled`||n===`aborted`||n===`interrupted`?`cancelled`:e.error===void 0?n===`input-streaming`||n===`streaming`?t===`streaming`?`running`:`cancelled`:e.output!==void 0||e.result!==void 0?`success`:t===`streaming`?`running`:`cancelled`:`error`}function Ct(e,t){return t||e.toLowerCase().includes(`json`)?`json`:e.toLowerCase().includes(`bash`)||e.toLowerCase().includes(`shell`)?`bash`:e.toLowerCase().includes(`python`)?`python`:`text`}function wt(e,t){if(!t)return;let n=e.toLowerCase();return n.includes(`bash`)||n.includes(`shell`)?`bash`:n.includes(`python`)?/^\s*%%bash(?:\s|$)/im.test(t)?`bash`:`python`:`text`}function Tt(e,t){if(!t)return;let n=e.toLowerCase();return n.includes(`ipython`)?`IPython`:n.includes(`bash`)||n.includes(`shell`)?`Bash`:n.includes(`python`)?`Python`:t===`json`?`JSON`:t===`text`?`Text`:t.toUpperCase()}var Et=new WeakMap;function Dt(e,t){if(e&&typeof e==`object`){let n=Et.get(e);if(n&&n.chatStatus===t)return n.value;let r=Ot(e,t);return Et.set(e,{chatStatus:t,value:r}),r}return Ot(e,t)}function Ot(e,t){let n=rt(e);if(!n)return;let r=xt(n),i=r.toLowerCase(),a=ft(n),o=ct(n),s=lt(o),c=St(n,t),l=L(a,`command`,`cmd`,`code`,`script`),u=wt(r,l),d=[];s.durationMs!==void 0&&d.push(`${s.durationMs}ms`),s.kernelRestarted&&d.push(`kernel restarted`);let f=mt(a,s),p=i.includes(`todo`)||i.includes(`plan`)?_t(a,s):[],m=i.includes(`search`)||i.includes(`web`)||i.includes(`source`)||i.includes(`citation`)?vt(s):[],h=i.includes(`image`)||i.includes(`generat`)?yt(s):void 0,g=bt(a,s),_=dt(s,o),v=!!_.trim(),y=typeof n.toolCallId==`string`&&n.toolCallId?n.toolCallId:`${r}-${JSON.stringify(a??{})}`,b;return p.length>0?b={kind:`todo`,title:i.includes(`plan`)?`Plan`:`Todo list`,items:p}:m.length>0?b={kind:`citations`,citations:m}:h?b={kind:`image`,url:h}:f&&(i.includes(`edit`)||i.includes(`write`)||i.includes(`patch`))?b={kind:`diff`,file:ht(a,s),lines:gt(f),copyText:f}:(l||v||g||d.length>0)&&(b={kind:`output`,content:_,language:Ct(r,s.structured),structured:s.structured,sections:ut(s,o),sourceCode:l,sourceLanguage:u,sourceLabel:Tt(r,u)}),{id:y,name:r,lowerName:i,status:c,input:a,output:o,outputSummary:s,command:l,metadata:d,approval:g,detail:b}}var kt=`__custom__`;function At(e){return String.fromCharCode(65+e)}function jt(e,t,n){if(!e||e.kind===`skip`)return{selectedIds:[],customText:``,textValue:``};if(t===`text`)return{selectedIds:[],customText:``,textValue:e.text??``};let r=new Set(e.selectedIds??[]),i=e.text??``;return n&&i.trim().length>0&&r.add(kt),{selectedIds:Array.from(r),customText:i,textValue:``}}function Mt({questions:e,questionIndex:t=1,totalQuestions:n,onPreviousQuestion:r,onNextQuestion:a,submitLabel:o=`Send`,nextLabel:s=`Next`,skipLabel:c=`Skip`,allowSkip:l=!0,initialAnswer:u,onSubmit:d,onSkip:f,className:p}){let m=n??e.length,h=Math.max(1,Math.min(t,m)),g=e[h-1],_=g?.allowCustom??!1,[v,y]=(0,F.useState)(()=>jt(u,g?.kind,_).selectedIds),[b,x]=(0,F.useState)(()=>jt(u,g?.kind,_).customText),[S,C]=(0,F.useState)(()=>jt(u,g?.kind,_).textValue),w=m>1&&(!!r||!!a),T=h>1,E=h<m,D=h>=m,O=(0,F.useMemo)(()=>new Set(v),[v]),k=D?o:s,A=(0,F.useMemo)(()=>{if(g?.kind===`text`)return S.trim().length>0;let e=v.filter(e=>e!==kt).length+ +(b.trim().length>0);if(g?.kind===`single`)return e===1;let t=g?.minSelections??1,n=g?.maxSelections;return e<t||typeof n==`number`&&e>n?!1:e>0},[g?.kind,g?.minSelections,g?.maxSelections,v,b,S]),j=e=>{y(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},M=e=>{y([e])},N=e=>{if(x(e),g){if(g.kind===`single`){y(e.trim().length>0?[kt]:[]);return}y(t=>{let n=t.includes(kt);return e.trim().length>0&&!n?[...t,kt]:e.trim().length===0&&n?t.filter(e=>e!==kt):t})}};return g?(0,I.jsxs)(`div`,{className:i(`flex flex-col gap-2 bg-background px-3 py-2`,p),children:[(0,I.jsx)(`div`,{className:`flex items-center justify-between gap-px`,"data-total-questions":m,children:(0,I.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,I.jsx)(`span`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded px-1 text-sm font-medium text-muted-foreground`,children:h}),(0,I.jsx)(`span`,{children:g.title})]})}),g.kind!==`text`&&(g.options?.length??0)>0&&(0,I.jsxs)(`div`,{className:`flex flex-col gap-px`,children:[g.options.map((e,t)=>{let n=e.id??e.value??e.label,r=O.has(n);return(0,I.jsxs)(`button`,{type:`button`,onClick:()=>{g.kind===`single`?(M(n),_&&x(``)):j(n)},className:`-mx-2 flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-secondary`,children:[(0,I.jsx)(`span`,{className:i(`inline-flex h-5 min-w-5 items-center justify-center rounded border px-1 text-sm font-medium`,r?`border-primary bg-primary text-primary-foreground`:`border-border bg-transparent text-muted-foreground`),children:At(t)}),(0,I.jsxs)(`span`,{className:`text-sm text-foreground`,children:[e.label,e.description&&(0,I.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,e.description]})]})]},n)}),_&&(0,I.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,I.jsx)(`span`,{className:i(`inline-flex h-5 min-w-5 items-center justify-center rounded border px-1 text-sm font-medium`,v.includes(kt)?`border-primary bg-primary text-primary-foreground`:`border-border bg-transparent text-muted-foreground`),children:At(g.options.length)}),(0,I.jsx)(`input`,{value:b,onChange:e=>N(e.target.value),placeholder:g.customPlaceholder??`Type your answer`,className:`h-7 w-full rounded-md border border-border bg-background px-2 text-base text-foreground md:text-sm`})]})]}),g.kind===`text`&&(0,I.jsx)(`textarea`,{value:S,onChange:e=>C(e.target.value),placeholder:g.placeholder??`Type your answer`,rows:3,className:`w-full resize-y rounded-md border border-border bg-background px-2 py-1.5 text-base text-foreground md:text-sm`}),(0,I.jsxs)(`div`,{className:i(`flex items-center gap-1.5`,w?`justify-between`:`justify-end`),children:[w&&(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[r&&(0,I.jsx)(`button`,{type:`button`,onClick:r,disabled:!T,className:`h-6 rounded px-2 text-sm text-muted-foreground hover:text-foreground disabled:opacity-60`,children:`Previous`}),a&&(0,I.jsx)(`button`,{type:`button`,onClick:a,disabled:!E,className:`h-6 rounded px-2 text-sm text-muted-foreground hover:text-foreground disabled:opacity-60`,children:`Next`})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[l&&(0,I.jsx)(`button`,{type:`button`,onClick:()=>{f?.(),d({kind:`skip`})},className:`h-6 rounded px-2 text-sm text-muted-foreground transition-[background-color,color,transform] duration-150 hover:bg-muted/50 hover:text-foreground active:scale-[0.98]`,children:c}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>{if(!A||!g)return;if(g.kind===`text`){d({kind:`text`,questionId:g.id,text:S.trim()});return}let e=v.filter(e=>e!==kt),t=b.trim()||void 0;d({kind:g.kind,questionId:g.id,selectedIds:e,text:t||void 0})},disabled:!A,className:`h-6 rounded bg-primary px-2.5 text-sm font-medium text-primary-foreground transition-[background-color,transform] duration-150 hover:bg-primary/90 active:scale-[0.98] disabled:opacity-60 disabled:hover:bg-primary disabled:active:scale-100`,children:k})]})]})]}):null}function Nt(e){if(e.kind===`skip`)return`Skipped`;if(e.kind===`text`)return e.text||`Answered`;let t=e.selectedIds?.length?e.selectedIds.join(`, `):``;return e.text?t?`${t} (${e.text})`:e.text:t||`Answered`}function Pt({part:e}){let[t,n]=(0,F.useState)(e.input?.questionIndex??1),r=e.input?.questions??[],i=e.input?.totalQuestions??r.length,a=typeof e.input?.questionIndex==`number`,o=a?e.input?.questionIndex??1:r.length>0?t:e.input?.questionIndex??1,s=Math.max(1,Math.min(o,i)),c=r[s-1],[l,u]=(0,F.useState)({}),[d,f]=(0,F.useState)(e.input?.questionIndex);e.input?.questionIndex!==d&&(f(e.input?.questionIndex),typeof e.input?.questionIndex==`number`&&n(e.input.questionIndex));let[p,m]=(0,F.useState)(e.toolCallId);e.toolCallId!==p&&(m(e.toolCallId),u({}),n(e.input?.questionIndex??1));let h=e.output?.answer,g=Object.keys(l).length,_=i===1?!!h||g>=1:i>0&&g>=i,y=i>1&&!_,b=s>1,x=s<i,S=(0,F.useMemo)(()=>!_||i<=1?[]:Array.from({length:i},(e,t)=>({index:t+1,answer:l[t+1]})),[_,l,i]),C=(0,F.useMemo)(()=>_?S.length>0?S.map(e=>`${e.index}: ${e.answer?Nt(e.answer):`Pending`}`).join(` • `):h?Nt(h):l[s]?Nt(l[s]):`Pending`:``,[_,S,h,l,s]);if(!c)return null;let T=()=>{b&&(e.input?.onPreviousQuestion?.(),a||n(e=>Math.max(1,e-1)))},D=()=>{x&&(e.input?.onNextQuestion?.(),a||n(e=>Math.min(i,e+1)))};return(0,I.jsxs)(`div`,{className:`overflow-hidden rounded-chat-tool border border-border bg-muted`,children:[(0,I.jsxs)(`div`,{className:`flex h-7 items-center justify-between border-b border-border px-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,I.jsx)(v,{className:`size-3.5`}),`Question`]}),y&&(0,I.jsxs)(`div`,{className:`inline-flex items-center gap-1`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:T,disabled:!b,className:`inline-flex size-5 items-center justify-center rounded-[4px] hover:bg-secondary disabled:opacity-40`,"aria-label":`Previous question`,children:(0,I.jsx)(E,{className:`size-3.5`})}),(0,I.jsxs)(`span`,{children:[s,` of `,i]}),(0,I.jsx)(`button`,{type:`button`,onClick:D,disabled:!x,className:`inline-flex size-5 items-center justify-center rounded-[4px] hover:bg-secondary disabled:opacity-40`,"aria-label":`Next question`,children:(0,I.jsx)(w,{className:`size-3.5`})})]})]}),_?(0,I.jsx)(`div`,{className:`bg-background px-3 py-2 text-xs text-muted-foreground`,children:C}):(0,I.jsx)(Mt,{questions:r,questionIndex:s,totalQuestions:i,initialAnswer:l[s],submitLabel:e.input?.submitLabel,nextLabel:e.input?.nextLabel,skipLabel:e.input?.skipLabel,allowSkip:e.input?.allowSkip,onSubmit:t=>{u(e=>({...e,[s]:t})),e.input?.onSubmitAnswer?.(t),s<i&&D()}},`${s}-${c.title}`)]})}function Ft(e){return e.split(`|`).map(e=>e.trim().split(/\s+/)[0]??``).filter(Boolean).slice(0,4).join(`, `)}function It({step:e,state:t,onComplete:n,approval:r}){te(t===`animating`,e.duration,n);let i=t===`animating`,a=e.bashCommand??e.toolDetail,o=Ft(a);return(0,I.jsxs)(`div`,{className:`overflow-hidden rounded-chat-tool border border-border bg-muted`,children:[(0,I.jsxs)(`div`,{className:`flex h-7 items-center justify-between pr-2 pl-2.5`,children:[(0,I.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5 overflow-hidden`,children:i?(0,I.jsxs)(ie,{as:`span`,duration:1.2,className:`m-0 inline-flex h-full items-center truncate text-xs leading-none`,children:[`Running command: `,o]}):(0,I.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[`Ran command: `,o]})}),i&&(0,I.jsx)(`svg`,{className:`h-3 w-3 shrink-0 animate-spin text-muted-foreground`,viewBox:`0 0 16 16`,fill:`none`,children:(0,I.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:`28`,strokeDashoffset:`7`,strokeLinecap:`round`})})]}),(0,I.jsxs)(`div`,{className:`overflow-hidden border-t border-border bg-background px-2.5 py-1.5 font-mono text-label leading-[16px]`,children:[(0,I.jsxs)(`div`,{className:`break-all`,children:[(0,I.jsx)(`span`,{className:`text-amber-600 select-none dark:text-amber-400`,children:`$ `}),(0,I.jsx)(`span`,{className:`text-foreground`,children:a})]}),!i&&e.bashOutput&&(0,I.jsx)(`div`,{className:`mt-1 max-h-[80px] overflow-hidden whitespace-pre-line text-muted-foreground`,children:e.bashOutput})]}),r&&(0,I.jsx)(ne,{isPending:i,...r})]})}var Lt=(0,F.memo)(function({part:e}){let t=e.input?.approval??e.args?.approval,{step:n,stepState:r}=re(e,`Bash`);return(0,I.jsx)(It,{step:n,state:r,onComplete:()=>{},approval:t})});function Rt(e){let t=(0,F.useRef)(e);return(0,F.useInsertionEffect)(()=>void(t.current=e)),(0,F.useCallback)((...e)=>t.current(...e),[])}var zt=(0,F.createContext)(void 0);function Bt(){return(0,F.useContext)(zt)}var Vt={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},Ht={display:`contents`};function Ut(){return null}var Wt=`diffs-container`,Gt=/(?=^diff --git)/gm,Kt=/(?<=\n)/,qt=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Jt=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Yt=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Xt=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Zt=`header-prefix`,Qt=`header-filename-suffix`,$t=`header-metadata`,en=`header-custom`,R={dark:`pierre-dark`,light:`pierre-light`},tn=`data-theme-css`,nn=`data-unsafe-css`,rn=`data-diffs-scrollbar-measure`,an=`--diffs-scrollbar-gutter-measured`,on=1e5,sn={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8};({...sn});var cn=Object.freeze({fromStart:0,fromEnd:0}),ln={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},un={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function dn(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function fn({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function z(e,t){return e-(t===0?0:1)}function B(e,t){return z(e,t)+t}function pn(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:mn(n,e.startContentIndex)}}function mn(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 hn({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,renderGutterUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d,getAnnotationSlotName:f=dn}){let p=n?.(e),m=r?.(e),h=i?.(e),g=a?.(e);return(0,I.jsxs)(I.Fragment,{children:[p==null?(0,I.jsxs)(I.Fragment,{children:[m!=null&&(0,I.jsx)(`div`,{slot:`header-prefix`,children:m}),h!=null&&(0,I.jsx)(`div`,{slot:`header-filename-suffix`,children:h}),g!=null&&(0,I.jsx)(`div`,{slot:`header-metadata`,children:g})]}):(0,I.jsx)(`div`,{slot:en,children:p}),o!=null&&l?.map((e,t)=>(0,I.jsx)(`div`,{slot:f(e),children:o(e)},t)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=gn(t,e);return(0,I.jsx)(`div`,{slot:n,style:Ht,children:c(t,d)},n)}),s!=null&&(0,I.jsx)(`div`,{slot:`gutter-utility-slot`,style:Vt,children:s(u)})]})}function gn(e,t){let n=pn(e,t);return n==null?void 0:fn({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}var _n=new Map,vn=new Map,yn=new Map,bn=new Set;function xn(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!bn.has(t))return!1;return!0}function Sn(e=R){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}var Cn=new Set;function wn(e){let t=[],n=new Set;for(let r of Tn(e.themes)){let e=On(r)?r.getThemes():[r];for(let r of e){if(n.has(r.name))throw Error(`Theme collection already contains theme "${r.name}"`);n.add(r.name),t.push(r)}}let r=Object.freeze([...t]),i=Object.freeze(r.filter(e=>e.colorScheme===`light`)),a=Object.freeze(r.filter(e=>e.colorScheme===`dark`)),o=new Map(r.map(e=>[e.name,e])),s=Object.freeze(r.map(e=>e.name)),c=Object.freeze(i.map(e=>e.name)),l=Object.freeze(a.map(e=>e.name));function u(e){if(e==null)return r;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?i:t===`dark`?a:r:r.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return o.get(e)},getThemes(e){return u(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?c:e?.colorScheme===`dark`?l:s:u(e).map(e=>e.name)},hasTheme(e){return o.has(e)},orderBy(e){return wn({themes:r.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],n=new Set;for(let r of e){if(n.has(r))throw Error(`Theme collection pick already includes theme "${r}"`);n.add(r);let e=o.get(r);if(e==null)throw Error(`Theme collection does not contain theme "${r}"`);t.push(e)}return wn({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function Tn(e){return En(e)?[e]:e}function En(e){return On(e)||Dn(e)}function Dn(e){return typeof e.name==`string`&&typeof e.load==`function`}function On(e){return typeof e.getThemes==`function`}function kn(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var An=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},jn=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},Mn=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function Nn(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new An(t);e.set(t,n)}function a(t,n){return!e.has(t)&&(e.set(t,n),!0)}function o(t){return e.has(t)}function s(i){let a=t.get(i);if(a!==void 0)return Promise.resolve(a);let o=n.get(i);if(o!==void 0)return o;let s=e.get(i);if(s===void 0)return Promise.reject(new jn(i));let c=r,l=s().then(e=>{let a=kn(e);return c===r&&t.set(i,a),n.get(i)===l&&n.delete(i),a}).catch(e=>{throw n.get(i)===l&&n.delete(i),e});return n.set(i,l),l}function c(e){return Promise.all(e.map(e=>s(e)))}function l(e,n){t.set(e,n)}function u(e){for(let[t,n]of e)l(t,n)}function d(e){return t.get(e)}function f(e){let n=[];for(let r of e){let e=t.get(r);if(e===void 0)throw new Mn(r);n.push(e)}return n}function p(e){return t.has(e)}function m(e){for(let n of e)if(!t.has(n))return!1;return!0}function h(e){let n=t.get(e);return n===void 0?s(e):n}function g(){r++,t.clear(),n.clear()}return{clearResolvedThemes:g,getResolvedOrResolveTheme:h,getResolvedTheme:d,getResolvedThemes:f,hasRegisteredTheme:o,hasResolvedTheme:p,hasResolvedThemes:m,registerTheme:i,registerThemeIfAbsent:a,resolveTheme:s,resolveThemes:c,seedResolvedTheme:l,seedResolvedThemes:u}}var Pn=Nn();function Fn(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=Pn.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,Pn.getResolvedTheme(n)??Pn.seedResolvedTheme(n,e);Cn.has(n)||(Cn.add(n),t.loadThemeSync(e))}}function In(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(bn.has(n.name))continue;let e=_n.get(n.name);e??(e=n,_n.set(n.name,e)),bn.add(e.name),t.loadLanguageSync(e.data)}}function Ln(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}async function Rn(e){if(Ln())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=vn.get(e);if(t!=null)return t;try{let t=yn.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(Se,e)&&(t=Se[e]),t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return _n.has(e)||_n.set(e,n),n});return vn.set(e,n),await n}finally{vn.delete(e)}}function zn(e){return _n.get(e)??Rn(e)}function Bn(e){for(let t of Sn(e))if(!Cn.has(t))return!1;return!0}function Vn({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:Hn(t)}}function Hn(e){return async()=>_e(kn(await e()))}var Un=`pierre`,Wn=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],Gn=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],Kn=[...Gn,...Wn],qn=new Set(Gn);function Jn(e){return qn.has(e)?`light`:`dark`}var Yn={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},Xn={"pierre-dark":()=>P(()=>import(`./pierre-dark-CpLgRqie.js`),[]),"pierre-dark-soft":()=>P(()=>import(`./pierre-dark-soft-kZQmAZld.js`),[]),"pierre-dark-vibrant":()=>P(()=>import(`./pierre-dark-vibrant-CpQYzh95.js`),[]),"pierre-dark-protanopia-deuteranopia":()=>P(()=>import(`./pierre-dark-protanopia-deuteranopia-B35FxJx-.js`),[]),"pierre-dark-tritanopia":()=>P(()=>import(`./pierre-dark-tritanopia-CpjhbsIL.js`),[]),"pierre-light":()=>P(()=>import(`./pierre-light-CoaEpmwp.js`),[]),"pierre-light-soft":()=>P(()=>import(`./pierre-light-soft-lWLdNTOI.js`),[]),"pierre-light-vibrant":()=>P(()=>import(`./pierre-light-vibrant-D80Fkn33.js`),[]),"pierre-light-protanopia-deuteranopia":()=>P(()=>import(`./pierre-light-protanopia-deuteranopia-0fSaH845.js`),[]),"pierre-light-tritanopia":()=>P(()=>import(`./pierre-light-tritanopia-CEbqgOJL.js`),[])};function Zn(e){return Vn({name:e,collection:Un,colorScheme:Jn(e),displayName:Yn[e],load:Xn[e]})}var Qn=wn({themes:Kn.map(e=>Zn(e))}),$n=`shiki`,er=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],tr=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),nr=new Set(er);function rr(e){return nr.has(e)?`light`:`dark`}var ir={andromeeda:()=>P(()=>import(`./andromeeda-vGVdxbeo.js`),[]),"aurora-x":()=>P(()=>import(`./aurora-x-CDeNXAV0.js`),[]),"ayu-dark":()=>P(()=>import(`./ayu-dark-DluEY0Gj.js`),[]),"ayu-light":()=>P(()=>import(`./ayu-light-C3h-C4tm.js`),[]),"ayu-mirage":()=>P(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[]),"catppuccin-frappe":()=>P(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[]),"catppuccin-latte":()=>P(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[]),"catppuccin-macchiato":()=>P(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[]),"catppuccin-mocha":()=>P(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[]),"dark-plus":()=>P(()=>import(`./dark-plus-Cs2F2srj.js`),[]),dracula:()=>P(()=>import(`./dracula-BHWKrbxM.js`),[]),"dracula-soft":()=>P(()=>import(`./dracula-soft-5eyTD99u.js`),[]),"everforest-dark":()=>P(()=>import(`./everforest-dark-sB-x3p7T.js`),[]),"everforest-light":()=>P(()=>import(`./everforest-light-Df2xbC6M.js`),[]),"github-dark":()=>P(()=>import(`./github-dark-C-LZuMrd.js`),[]),"github-dark-default":()=>P(()=>import(`./github-dark-default-DXG-b-1a.js`),[]),"github-dark-dimmed":()=>P(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[]),"github-dark-high-contrast":()=>P(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[]),"github-light":()=>P(()=>import(`./github-light-EUqPIrTm.js`),[]),"github-light-default":()=>P(()=>import(`./github-light-default-BXViO-2h.js`),[]),"github-light-high-contrast":()=>P(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[]),"gruvbox-dark-hard":()=>P(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[]),"gruvbox-dark-medium":()=>P(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[]),"gruvbox-dark-soft":()=>P(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[]),"gruvbox-light-hard":()=>P(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[]),"gruvbox-light-medium":()=>P(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[]),"gruvbox-light-soft":()=>P(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[]),horizon:()=>P(()=>import(`./horizon-CE9ld1lL.js`),[]),"horizon-bright":()=>P(()=>import(`./horizon-bright-DSNQnXHK.js`),[]),houston:()=>P(()=>import(`./houston-CsvMBhTu.js`),[]),"kanagawa-dragon":()=>P(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[]),"kanagawa-lotus":()=>P(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[]),"kanagawa-wave":()=>P(()=>import(`./kanagawa-wave-BML5mF2J.js`),[]),laserwave:()=>P(()=>import(`./laserwave-C_8bwKvT.js`),[]),"light-plus":()=>P(()=>import(`./light-plus-DVQuIRkW.js`),[]),"material-theme":()=>P(()=>import(`./material-theme-Bm3Qr25_.js`),[]),"material-theme-darker":()=>P(()=>import(`./material-theme-darker-2IIEA8gg.js`),[]),"material-theme-lighter":()=>P(()=>import(`./material-theme-lighter-uhdI0v04.js`),[]),"material-theme-ocean":()=>P(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[]),"material-theme-palenight":()=>P(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[]),"min-dark":()=>P(()=>import(`./min-dark-BSWPekZh.js`),[]),"min-light":()=>P(()=>import(`./min-light-DDpmG2fV.js`),[]),monokai:()=>P(()=>import(`./monokai-B_bV9PQ9.js`),[]),"night-owl":()=>P(()=>import(`./night-owl-DhmEMT88.js`),[]),"night-owl-light":()=>P(()=>import(`./night-owl-light-eJ-hLW7d.js`),[]),nord:()=>P(()=>import(`./nord-Cb4Vim4T.js`),[]),"one-dark-pro":()=>P(()=>import(`./one-dark-pro-CLwyXe_n.js`),[]),"one-light":()=>P(()=>import(`./one-light-D7Lr4KcI.js`),[]),plastic:()=>P(()=>import(`./plastic-DQwYfKfQ.js`),[]),poimandres:()=>P(()=>import(`./poimandres-DRFjx7u4.js`),[]),red:()=>P(()=>import(`./red-DX1BQOs8.js`),[]),"rose-pine":()=>P(()=>import(`./rose-pine-aMsaMD1D.js`),[]),"rose-pine-dawn":()=>P(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[]),"rose-pine-moon":()=>P(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[]),"slack-dark":()=>P(()=>import(`./slack-dark-DnToyrRv.js`),[]),"slack-ochin":()=>P(()=>import(`./slack-ochin-B2OO5cIa.js`),[]),"snazzy-light":()=>P(()=>import(`./snazzy-light-4G7pJPwS.js`),[]),"solarized-dark":()=>P(()=>import(`./solarized-dark-UdsmMDCL.js`),[]),"solarized-light":()=>P(()=>import(`./solarized-light-C1IUL_tW.js`),[]),"synthwave-84":()=>P(()=>import(`./synthwave-84-nFMaYfgc.js`),[]),"tokyo-night":()=>P(()=>import(`./tokyo-night-oM2G3aXe.js`),[]),vesper:()=>P(()=>import(`./vesper-DdrHHSXu.js`),[]),"vitesse-black":()=>P(()=>import(`./vitesse-black-fwtXNY1n.js`),[]),"vitesse-dark":()=>P(()=>import(`./vitesse-dark-BZCL-v6S.js`),[]),"vitesse-light":()=>P(()=>import(`./vitesse-light-VbXTXTou.js`),[])};function ar(e){return Vn({name:e,collection:$n,colorScheme:rr(e),load:ir[e]})}var or=wn({themes:Object.freeze([...er.map(e=>ar(e)),...tr.map(e=>ar(e))])});function sr(e){if(Ln())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(Pn.hasRegisteredTheme(e))return;let t=or.getTheme(e);if(t!=null){Pn.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function cr(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function lr(e){sr(e);let t=await Pn.resolveTheme(e);return cr(e,t),t}function ur(e){return Pn.getResolvedTheme(e)??lr(e)}var V;async function dr({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){V??=xe({themes:[],langs:[`text`],engine:n===`shiki-wasm`?be(P(()=>import(`./wasm-BnjxR4X6.js`),[])):ye()});let r=pr(V)?await V:V;V=r;let i=[];for(let e of Array.from(new Set(t))){if(e===`text`||e===`ansi`)continue;let t=zn(e);`then`in t?i.push(t):In(t,r)}let a=[];for(let t of e){let e=ur(t);`then`in e?a.push(e):Fn(e,V)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{In(e,r)}),Promise.all(a).then(e=>{Fn(e,r)})]),r}function fr(e){if(!(V==null||`then`in V)&&!(e!=null&&(!Bn(e.theme)||!xn(e.lang))))return V}function pr(e=V){return e!=null&&`then`in e}for(let e of Qn.getThemes())Pn.registerThemeIfAbsent(e.name,e.load);function mr(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}var hr=new Map,gr={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function H(e){if(hr.has(e))return hr.get(e)??`text`;if(gr[e]!=null)return gr[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(hr.has(t[1]))return hr.get(t[1])??`text`;if(gr[t[1]]!=null)return gr[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return hr.has(n)?hr.get(n)??`text`:gr[n]??`text`}function _r(e,t){for(let n of t)e.push(n)}function U(e){return{type:`text`,value:e}}function W({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function vr({name:e,width:t=16,height:n=16,properties:r}){return W({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[W({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function yr(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 br(e){return W({tagName:`div`,properties:{"data-gutter":``},children:e})}function xr(e,t,n,r={}){return W({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[W({tagName:`span`,properties:{"data-line-number-content":``},children:[U(`${t}`)]})]})}function G(e,t,n){return W({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 Sr(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(U(`
|
|
5
|
-
`)),e}var Cr=Symbol(`no-token`),wr=Symbol(`multiple-tokens`);function Tr(e){let t=Er(e);if(t!=null)return t;let n=Cr,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`){Or(e,a);for(let t of e.children)Dr(t)}else Dr(e);r.push(e),i=[],a=void 0;return}for(let e of i)Dr(e);r.push(W({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==Cr){if(e===wr){n=wr;return}if(n===Cr){n=e;return}n!==e&&(n=wr)}};for(let t of e.children){let e=t.type===`element`?Tr(t):Cr;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 Er(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function Dr(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)Dr(t)}}function Or(e,t){e.properties[`data-char`]=t}function kr(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=typeof e==`string`?e:a(e),s=t+Ar(o)+n;return s=r(s),i.has(s)||i.set(s,typeof e==`string`?e:{...e}),s}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function Ar(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 jr(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=yr(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&Tr(a),i.push(Sr(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(Nr,Mr),e&&r.push({line:e=>(e.type===`element`&&e.children.length===0&&e.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),e)}),{state:n,transformers:r,toClass:Mr}}var Mr=kr({classPrefix:`hl-`}),Nr={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 K(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var Pr=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Fr=/^0(?:\.0+)?%?$/;function Ir(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 Lr(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 Rr(e){if(e==null)return null;let t=Lr(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 zr(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||Pr.test(t))return!0;let n=Ir(t);return n!=null&&Fr.test(n)}function Br(e,t,n){if(t==null||n==null)return!1;let r=Rr(e),i=Rr(t),a=Rr(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var Vr=new WeakMap;function Hr(e){let t=Vr.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;q(r,`editor.background`,i),q(r,`editor.foreground`,a),q(r,`sideBar.background`,o),q(r,`sideBar.foreground`,s),q(r,`input.background`,n[`input.background`]??o),q(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),q(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),q(r,`gitDecoration.addedResourceForeground`,Ur(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),q(r,`gitDecoration.modifiedResourceForeground`,Ur(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),q(r,`gitDecoration.deletedResourceForeground`,Ur(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(zr(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(zr(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(Wr(l,o)||Br(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return Vr.set(e,u),u}function q(e,t,n){n!=null&&n!==``&&(e[t]=n)}function Ur(...e){for(let t of e)if(t!=null&&t!==``)return t}function Wr(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function Gr({theme:e=R,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=Hr(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${K(`global`)}fg:${a.fg};`,r+=`${K(`global`)}bg:${a.bg};`,r+=Kr(i,n)}else{let n=t.getTheme(e.dark),i=Hr(n);r+=`${K(`global`)}dark:${i.fg};`,r+=`${K(`global`)}dark-bg:${i.bg};`,r+=Kr(n,`dark`),n=t.getTheme(e.light),i=Hr(n),r+=`${K(`global`)}light:${i.fg};`,r+=`${K(`global`)}light-bg:${i.bg};`,r+=Kr(n,`light`)}return r}function Kr(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${K(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${K(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${K(`global`)}${t}modified-color:${a};`),n}function qr(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}function J(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function Jr(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Y(e,t){return mr(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Yr(e){let t=e.lang??H(e.name),n=e.lang??(e.prevName==null?`text`:H(e.prevName));return t===`text`&&n===`text`}function Xr(e){return{...sn,...e}}function Zr(e,t){let n=Qr(e,t);return t?n:e.diffHeaderHeight+n}function Qr(e,t){return e.paddingTop??(t?e.spacing:0)}function $r(e){return e.paddingBottom??e.spacing}function ei(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}function ti(e){return[z(e.additionStart,e.additionCount)+1,B(e.additionStart,e.additionCount)+1]}function X({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 ni(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-B(t.additionStart,t.additionCount),r=e.deletionLines.length-B(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function ri({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-B(n.additionStart,n.additionCount),i=e.deletionLines.length-B(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function ii({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=ri({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 ai({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=ti(a);if(t<o){let s=X({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=ii({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=ti(a);return t<o+i.fromStart||t>=o+i.rangeSize}function oi({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=ti(n),l=X({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=ii({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function si({type:e,metrics:t}){return t.hunkSeparatorHeight??ei(e)}function ci({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function li({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 ui(e){return e!==`simple`&&e!==`metadata`}function di({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!li({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=si({type:e,metrics:t}),a=ci({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function fi({type:e,metrics:t}){if(!ui(e))return;let n=si({type:e,metrics:t}),r=ci({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function pi({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=mi({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=z(r.deletionStart,r.deletionCount),s=z(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=X({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?ii({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(_i(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,_i(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(_i(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=vi(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(yi({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(_i(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function mi({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=hi({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 hi({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=X({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?ii({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 gi(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 _i(e,t,n,r,i,a){let[o,s]=gi(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 vi(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 yi({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}}function Z(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var bi=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},xi=new class extends bi{};function Si(e,t,n){return xi.diff(e,t,n)}function Ci(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 wi(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 Ti(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 Ei(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 Di(e,t){return Ti(e,t,``)}function Oi(e,t){return Ei(e,t,``)}function ki(e,t){return t.slice(0,Ai(e,t))}function Ai(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 ji(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function Mi(e,t){if(t)return Pi(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Ni(e,t){if(t)return Pi(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Pi(e,t){if(!t)return[Ni(e),Mi(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=ji(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var Fi=`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}`,Ii=RegExp(`[${Fi}]+|\\s+|[^${Fi}]`,`ug`);new class extends bi{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=ji(e,r)}else n=e.match(Ii)||[];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)&&Li(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Li(n,i,r,null,t.intlSegmenter),e}};function Li(e,t,n,r,i){if(t&&n){let[a,o]=Pi(t.value,i),[s,c]=Pi(n.value,i);if(e){let r=Ci(a,s);e.value=Ei(e.value,s,r),t.value=Di(t.value,r),n.value=Di(n.value,r)}if(r){let e=wi(o,c);r.value=Ti(r.value,c,e),t.value=Oi(t.value,e),n.value=Oi(n.value,e)}}else if(n){if(e){let e=Ni(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Ni(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Ni(r.value,i),[a,o]=Pi(t.value,i),s=Ci(n,a);t.value=Di(t.value,s);let c=wi(Di(n,s),o);t.value=Oi(t.value,c),r.value=Ti(r.value,n,c),e.value=Ei(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Ni(r.value,i),n=ki(Mi(t.value,i),e);t.value=Oi(t.value,n)}else if(e){let n=ki(Mi(e.value,i),Ni(t.value,i));t.value=Di(t.value,n)}}var Ri=new class extends bi{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Fi}]+|[^\\S\\n\\r]+|[^${Fi}]`,`ug`);return e.match(t)||[]}};function zi(e,t,n){return Ri.diff(e,t,n)}var Bi=new class extends bi{constructor(){super(...arguments),this.tokenize=Hi}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
6
|
-
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
7
|
-
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
8
|
-
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
9
|
-
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Vi(e,t,n){return Bi.diff(e,t,n)}function Hi(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
10
|
-
`));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 Ui(e){return e==`.`||e==`!`||e==`?`}new class extends bi{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(Ui(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 bi{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends bi{constructor(){super(...arguments),this.tokenize=Hi}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(Wi(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 Wi(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]=Wi(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]=Wi(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends bi{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function Gi(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function Ki(e){if(!Gi(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var qi={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Ji(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;Vi(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(Vi(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||Zi(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(`
|
|
11
|
-
`)?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 Yi(e,t){if(t||=qi,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>Yi(e,t)).join(`
|
|
12
|
-
`)}let n=[];if(e.isGit){if(t=qi,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+Ki(r)+` `+Ki(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+Ki((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+Ki((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+Ki((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+Ki((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+Ki(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+Ki(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
|
|
13
|
-
`)+`
|
|
14
|
-
`}function Xi(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Ji(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Yi(e,o.headerOptions):void 0)}}))}else{let s=Ji(e,t,n,r,i,a,o);return s?Yi(s,o?.headerOptions):void 0}}function Zi(e){let t=e.endsWith(`
|
|
15
|
-
`),n=e.split(`
|
|
16
|
-
`).map(e=>e+`
|
|
17
|
-
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Qi({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 $i({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 ea={forcePlainText:!1};function ta(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=ea){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=Gr({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)??ra();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)}pi({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&na({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}=ia({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 _r(f.deletionLines,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 _r(f.additionLines,c)}return{code:f,themeStyles:u,baseThemeType:l}}function na({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=Z(e),t=Z(t),e.length>s||t.length>s))return;let c=o===`char`?Si(e,t):zi(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?($i({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),$i({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?$i({item:e,arr:l,enableJoin:d,isLastItem:t}):$i({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(Qi({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(Qi({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function ra(){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 ia({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c,...l}}){let u=s??H(e.name),d=s??H(t.name),{state:f,transformers:p}=jr(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:K(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:K(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,qr(i.codeToHast(Z(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,qr(i.codeToHast(Z(t.contents),m)))}}var aa=(0,F.createContext)(void 0);function oa(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 sa(e,t){let n=e?.theme??R,r=t?.theme??R,i=ca(e),a=ca(t);return mr(n,r)&&oa(e,t,[`theme`,`parseDiffOptions`])&&oa(i,a)}function ca(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}var la=new Set,ua=null;function da(e){la.add(e),ua??=requestAnimationFrame(pa)}function fa(e){la.delete(e)&&la.size===0&&ua!=null&&(cancelAnimationFrame(ua),ua=null)}function pa(e){let t=new Set(la);la.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}ua=la.size>0?requestAnimationFrame(pa):null}function ma(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function ha(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function ga(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}var _a=`-1,-1`;function va(e){return e?.some(e=>e.lineNumber===0)??!1}function ya(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function ba(e){return e.startingLine===0&&e.totalLines>0}function xa(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function Sa(){return W({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[vr({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function Ca(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var wa=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),fa(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let n=!(e===this.selectedRange||ma(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!n&&!i||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!r&&!i||(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&Ca(e.composedPath())||(Q(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||(Q(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(Q(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){Q(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();Q(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);Q(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=ka(i)&&this.hoveredLine?.lineElement===i.lineElement;Oa(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),Oa(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),ka(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(ja(i)&&p!=null){p(i);break}if(Aa(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!ka(i))break;Oa(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,Q(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})()),Q(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),Q(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();Ca(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(xa(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=ve(Sa());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);Da(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(Pa(t));if(Da(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(Da(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(Da(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&&Ca(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=Pa(e);if(t&&Ca(n))return;let r=Fa(e);return r==null?this.pathFromAnnotationSlot(e):Pa(r)}pathFromAnnotationSlot(e){let t=Ia(e)?.previousElementSibling;if(t instanceof HTMLElement&&(t.hasAttribute(`data-line`)||t.hasAttribute(`data-column-number`)))return Pa(t);let n=Ra(La(e));if(n==null)return;let r=this.targetForSelectionPoint(n);return r==null?void 0:Pa(r.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=za(t)?t:za(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)}ma(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,da(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{fa(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!Va(this.renderedSelectedLinesState,n),i=!Va(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);Ma(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=Ua(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=Ua(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:Na(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:Na(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:Ha(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:Ha(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 Ta({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:Ea({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 Ea({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 Da(e){return e!=null&&`kind`in e&&e.kind===`line`}function Oa(e){return e!=null&&`kind`in e&&e.kind===`token`}function ka(e){return Da(e)||Oa(e)}function Aa(e){return`type`in e&&e.type===`line-info`}function ja(e){return`kind`in e&&e.kind===`merge-conflict-action`}function Ma(e){return e===`current`||e===`incoming`||e===`both`}function Na(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Pa(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Fa(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 Ia(e){let t=e.closest(`[slot^="annotation-"]`),n=(t instanceof HTMLElement&&t.assignedSlot!=null?t.assignedSlot:e.tagName===`SLOT`?e:void 0)?.closest(`[data-line-annotation]`);return n instanceof HTMLElement?n:void 0}function La(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 Ra(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 za(e){return e!=null&&typeof e.elementFromPoint==`function`}function Ba(e,t){return e===t||ma(e??void 0,t??void 0)}function Va(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&Ba(e?.range??null,t.range)}function Ha(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function Ua(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 Q(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}console.log(...n)}var Wa=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),qa(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?Xa(t):Za(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:Ga(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:Ka(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;!i&&!a||(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&Ja(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function Ga(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function Ka(e){return Math.max(Math.ceil(e),0)}function qa(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?Ja(e,{codeWidthChanged:!0,numberWidthChanged:!0}):Ya(e))}function Ja(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function Ya(e){e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`)}function Xa(e){e.codeElement.isConnected&&Ya(e)}function Za(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 Qa(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function $a(e,t){return e.endsWith(`\r
|
|
18
|
-
`)?t+`\r
|
|
19
|
-
`:e.endsWith(`\r`)?t+`\r`:e.endsWith(`
|
|
20
|
-
`)?t+`
|
|
21
|
-
`:t}function eo(e){return W({tagName:`div`,children:[W({tagName:`div`,children:e.annotations?.map(e=>W({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function to(e,t){return W({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function no(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 ro({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 W({tagName:`div`,children:[t===`custom`?W({tagName:`slot`,properties:{name:en}}):io({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[ao(r)]],properties:i})}function io({name:e,prevName:t,iconType:n}){let r=[W({tagName:`slot`,properties:{name:Zt}}),vr({name:no(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(W({tagName:`div`,children:[W({tagName:`bdi`,children:[U(t)]})],properties:{"data-prev-name":``}})),r.push(vr({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(W({tagName:`div`,children:[W({tagName:`bdi`,children:[U(e)]})],properties:{"data-title":``}})),r.push(W({tagName:`slot`,properties:{name:Qt}})),W({tagName:`div`,children:r,properties:{"data-header-content":``}})}function ao(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(W({tagName:`span`,children:[U(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(W({tagName:`span`,children:[U(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(W({tagName:`slot`,properties:{name:$t}})),W({tagName:`div`,children:t,properties:{"data-metadata":``}})}function oo(e){return W({tagName:`pre`,properties:so(e)})}function so({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}function co(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:Array.isArray(e)?e:[e??`text`],themes:Sn(t),preferredHighlighter:n}}function lo(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}var uo=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
22
|
-
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
23
|
-
<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"/>
|
|
24
|
-
</symbol>
|
|
25
|
-
<symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
|
|
26
|
-
<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"/>
|
|
27
|
-
</symbol>
|
|
28
|
-
<symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
|
|
29
|
-
<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"/>
|
|
30
|
-
</symbol>
|
|
31
|
-
<symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
|
|
32
|
-
<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"/>
|
|
33
|
-
</symbol>
|
|
34
|
-
<symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
|
|
35
|
-
<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"/>
|
|
36
|
-
</symbol>
|
|
37
|
-
<symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
|
|
38
|
-
<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"/>
|
|
39
|
-
</symbol>
|
|
40
|
-
<symbol id="diffs-icon-expand" viewBox="0 0 16 16">
|
|
41
|
-
<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"/>
|
|
42
|
-
</symbol>
|
|
43
|
-
<symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
|
|
44
|
-
<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"/>
|
|
45
|
-
</symbol>
|
|
46
|
-
<symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
|
|
47
|
-
<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"/>
|
|
48
|
-
</symbol>
|
|
49
|
-
<symbol id="diffs-icon-plus" viewBox="0 0 16 16">
|
|
50
|
-
<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"/>
|
|
51
|
-
</symbol>
|
|
52
|
-
<symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
|
|
53
|
-
<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"/>
|
|
54
|
-
</symbol>
|
|
55
|
-
<symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
|
|
56
|
-
<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"/>
|
|
57
|
-
</symbol>
|
|
58
|
-
<symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
|
|
59
|
-
<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"/>
|
|
60
|
-
</symbol>
|
|
61
|
-
<symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
|
|
62
|
-
<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"/>
|
|
63
|
-
</symbol>
|
|
64
|
-
<symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
|
|
65
|
-
<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"/>
|
|
66
|
-
</symbol>
|
|
67
|
-
<symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
|
|
68
|
-
<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"/>
|
|
69
|
-
</symbol>
|
|
70
|
-
<symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
|
|
71
|
-
<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"/>
|
|
72
|
-
</symbol>
|
|
73
|
-
</svg>`;function fo(e,t){return e==null||t==null?e===t:mo(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 po={};function mo(e=po,t=po){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 ho(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function go(){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 _o(){let e=document.createElement(`style`);return e.setAttribute(nn,``),e}var vo;function yo(e){if(vo!=null)return vo;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(rn,`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),vo=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),vo}function bo(e){return`${an}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var xo=`@layer base {
|
|
74
|
-
:host {
|
|
75
|
-
--diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
|
|
76
|
-
"Courier New", monospace;
|
|
77
|
-
--diffs-header-font-fallback: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
|
|
78
|
-
"Noto Sans", "Liberation Sans", Arial, sans-serif;
|
|
79
|
-
--diffs-mixer: light-dark(#000, #fff);
|
|
80
|
-
--diffs-gap-fallback: 8px;
|
|
81
|
-
--diffs-scrollbar-gutter-fallback: 6px;
|
|
82
|
-
--diffs-scrollbar-gutter: var(--diffs-scrollbar-gutter-override, var(--diffs-scrollbar-gutter-measured, var(--diffs-scrollbar-gutter-fallback)));
|
|
83
|
-
--diffs-added-light: #0dbe4e;
|
|
84
|
-
--diffs-added-dark: #5ecc71;
|
|
85
|
-
--diffs-modified-light: #009fff;
|
|
86
|
-
--diffs-modified-dark: #69b1ff;
|
|
87
|
-
--diffs-deleted-light: #ff2e3f;
|
|
88
|
-
--diffs-deleted-dark: #ff6762;
|
|
89
|
-
--diffs-warning-light: #d5a910;
|
|
90
|
-
--diffs-warning-dark: #ffd452;
|
|
91
|
-
color-scheme: light dark;
|
|
92
|
-
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
93
|
-
font-size: var(--diffs-font-size, 13px);
|
|
94
|
-
line-height: var(--diffs-line-height, 20px);
|
|
95
|
-
font-feature-settings: var(--diffs-font-features);
|
|
96
|
-
--diffs-bg: light-dark(var(--diffs-light-bg, #fff), var(--diffs-dark-bg, #000));
|
|
97
|
-
--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))));
|
|
98
|
-
--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))));
|
|
99
|
-
--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))));
|
|
100
|
-
--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))));
|
|
101
|
-
--diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff));
|
|
102
|
-
--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))));
|
|
103
|
-
--diffs-fg-conflict-marker: var(--diffs-fg-conflict-marker-override, var(--diffs-fg-number));
|
|
104
|
-
--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)))));
|
|
105
|
-
--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)))));
|
|
106
|
-
--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)))));
|
|
107
|
-
--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))));
|
|
108
|
-
--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)));
|
|
109
|
-
--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))));
|
|
110
|
-
--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)));
|
|
111
|
-
--diffs-selection-base: var(--diffs-modified-base);
|
|
112
|
-
--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)));
|
|
113
|
-
background-color: var(--diffs-bg);
|
|
114
|
-
color: var(--diffs-fg);
|
|
115
|
-
display: block;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
pre, code, [data-error-wrapper] {
|
|
119
|
-
isolation: isolate;
|
|
120
|
-
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
121
|
-
outline: none;
|
|
122
|
-
margin: 0;
|
|
123
|
-
padding: 0;
|
|
124
|
-
display: block;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
pre, code {
|
|
128
|
-
background-color: var(--diffs-bg);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
code {
|
|
132
|
-
contain: content;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
input, button {
|
|
136
|
-
font-family: inherit;
|
|
137
|
-
font-size: inherit;
|
|
138
|
-
line-height: inherit;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
*, :before, :after {
|
|
142
|
-
box-sizing: border-box;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
[data-icon-sprite] {
|
|
146
|
-
display: none;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
[data-diffs-header], [data-separator] {
|
|
150
|
-
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
[data-diffs-header][data-sticky] {
|
|
154
|
-
z-index: 1;
|
|
155
|
-
background-color: var(--diffs-bg);
|
|
156
|
-
position: sticky;
|
|
157
|
-
top: 0;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
[data-file-info] {
|
|
161
|
-
color: var(--fg);
|
|
162
|
-
background-color: color-mix(in lab, var(--bg) 98%, var(--fg));
|
|
163
|
-
border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));
|
|
164
|
-
padding: 10px;
|
|
165
|
-
font-weight: 700;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
[data-diff], [data-file] {
|
|
169
|
-
--diffs-grid-number-column-width: minmax(min-content, max-content);
|
|
170
|
-
--diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;
|
|
171
|
-
|
|
172
|
-
&[data-dehydrated] {
|
|
173
|
-
--diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
&:hover [data-code]::-webkit-scrollbar-thumb {
|
|
177
|
-
background-color: var(--diffs-bg-context);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
@supports (-webkit-touch-callout: none) {
|
|
182
|
-
:host {
|
|
183
|
-
--diffs-scrollbar-gutter-fallback: 0px;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
[data-line] span, [data-edit-prediction-suffix] span {
|
|
188
|
-
color: light-dark(var(--diffs-token-light, var(--diffs-light)), var(--diffs-token-dark, var(--diffs-dark)));
|
|
189
|
-
background-color: light-dark(var(--diffs-token-light-bg, inherit), var(--diffs-token-dark-bg, inherit));
|
|
190
|
-
font-weight: light-dark(var(--diffs-token-light-font-weight, inherit), var(--diffs-token-dark-font-weight, inherit));
|
|
191
|
-
font-style: light-dark(var(--diffs-token-light-font-style, inherit), var(--diffs-token-dark-font-style, inherit));
|
|
192
|
-
text-decoration: light-dark(var(--diffs-token-light-text-decoration, inherit), var(--diffs-token-dark-text-decoration, inherit));
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
[data-line], [data-gutter-buffer], [data-column-number], [data-line-annotation], [data-no-newline], [data-merge-conflict], [data-merge-conflict-actions], [data-editor-overlay] {
|
|
196
|
-
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
197
|
-
--diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
|
|
198
|
-
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
199
|
-
--diffs-computed-editor-active-line-bg: var(--diffs-computed-selected-line-bg);
|
|
200
|
-
--diffs-computed-hovered-line-bg: var(--diffs-computed-editor-active-line-bg);
|
|
201
|
-
--diffs-hover-mix-target: var(--diffs-bg-hover-override, var(--diffs-mixer));
|
|
202
|
-
--diffs-line-bg: var(--diffs-computed-hovered-line-bg);
|
|
203
|
-
color: var(--diffs-fg);
|
|
204
|
-
background-color: var(--diffs-line-bg, var(--diffs-bg));
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
[data-line], [data-no-newline] {
|
|
208
|
-
&[data-decoration-bg] {
|
|
209
|
-
--mix-deco-light: 92%;
|
|
210
|
-
--mix-deco-dark: 85%;
|
|
211
|
-
|
|
212
|
-
&[data-decoration-bg-depth="2"] {
|
|
213
|
-
--mix-deco-light: 88%;
|
|
214
|
-
--mix-deco-dark: 80%;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
&[data-decoration-bg-depth="3"] {
|
|
218
|
-
--mix-deco-light: 85%;
|
|
219
|
-
--mix-deco-dark: 78%;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
--diffs-hover-mix-target: var(--diffs-decoration-bg);
|
|
223
|
-
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
224
|
-
var(--diffs-bg) var(--mix-deco-light),
|
|
225
|
-
var(--diffs-decoration-bg)), color-mix(in lab,
|
|
226
|
-
var(--diffs-bg) var(--mix-deco-dark),
|
|
227
|
-
var(--diffs-decoration-bg)));
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
[data-line-annotation], [data-gutter-buffer="annotation"] {
|
|
232
|
-
--diffs-annotation-bg: var(--diffs-bg-context);
|
|
233
|
-
--diffs-computed-decoration-bg: var(--diffs-annotation-bg);
|
|
234
|
-
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
[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"] {
|
|
238
|
-
--diffs-computed-decoration-bg: var(--diffs-bg-context);
|
|
239
|
-
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
[data-gutter-buffer="merge-conflict-marker-start"], [data-merge-conflict="marker-start"] {
|
|
243
|
-
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
244
|
-
var(--diffs-bg) 78%,
|
|
245
|
-
var(--conflict-bg-current-header-override, var(--diffs-addition-base))), color-mix(in lab,
|
|
246
|
-
var(--diffs-bg) 68%,
|
|
247
|
-
var(--conflict-bg-current-header-override, var(--diffs-addition-base))));
|
|
248
|
-
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
[data-gutter-buffer="merge-conflict-marker-end"], [data-merge-conflict="marker-end"] {
|
|
252
|
-
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
253
|
-
var(--diffs-bg) 78%,
|
|
254
|
-
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))), color-mix(in lab,
|
|
255
|
-
var(--diffs-bg) 68%,
|
|
256
|
-
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))));
|
|
257
|
-
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
[data-has-merge-conflict] [data-line-annotation], [data-has-merge-conflict] [data-gutter-buffer="annotation"] {
|
|
261
|
-
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
262
|
-
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
:where([data-background]) {
|
|
266
|
-
& [data-gutter-buffer], & [data-column-number] {
|
|
267
|
-
--mix-light: 91%;
|
|
268
|
-
--mix-dark: 85%;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
& [data-line], & [data-no-newline] {
|
|
272
|
-
--mix-light: 88%;
|
|
273
|
-
--mix-dark: 80%;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
& [data-gutter-buffer], & [data-column-number], & [data-line], & [data-no-newline] {
|
|
277
|
-
--diffs-diff-line-mix-target: var(--diffs-bg);
|
|
278
|
-
|
|
279
|
-
&[data-line-type="change-deletion"] {
|
|
280
|
-
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-override, var(--diffs-deletion-base));
|
|
281
|
-
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
282
|
-
|
|
283
|
-
&:where([data-gutter-buffer], [data-column-number]) {
|
|
284
|
-
color: var(--diffs-fg-number-deletion-override, var(--diffs-deletion-base));
|
|
285
|
-
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base));
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
289
|
-
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
290
|
-
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
291
|
-
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
292
|
-
var(--diffs-diff-line-mix-target)));
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
&[data-line-type="change-addition"] {
|
|
296
|
-
--diffs-diff-line-mix-target: var(--diffs-bg-addition-override, var(--diffs-addition-base));
|
|
297
|
-
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
298
|
-
|
|
299
|
-
&:where([data-gutter-buffer], [data-column-number]) {
|
|
300
|
-
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
301
|
-
--diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base));
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
305
|
-
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
306
|
-
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
307
|
-
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
308
|
-
var(--diffs-diff-line-mix-target)));
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
&[data-merge-conflict="current"] {
|
|
312
|
-
--diffs-diff-line-mix-target: var(--conflict-bg-current-override, var(--diffs-addition-base));
|
|
313
|
-
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
314
|
-
|
|
315
|
-
&:where([data-gutter-buffer], [data-column-number]) {
|
|
316
|
-
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
317
|
-
--diffs-diff-line-mix-target: var(--conflict-bg-current-number-override, var(--diffs-addition-base));
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
321
|
-
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
322
|
-
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
323
|
-
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
324
|
-
var(--diffs-diff-line-mix-target)));
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
&[data-merge-conflict="incoming"] {
|
|
328
|
-
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-override, var(--diffs-modified-base));
|
|
329
|
-
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
330
|
-
|
|
331
|
-
&:where([data-gutter-buffer], [data-column-number]) {
|
|
332
|
-
color: var(--diffs-modified-base);
|
|
333
|
-
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-number-override, var(--diffs-modified-base));
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
337
|
-
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
338
|
-
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
339
|
-
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
340
|
-
var(--diffs-diff-line-mix-target)));
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
[data-gutter-buffer], [data-column-number], [data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline], [data-editor-overlay] {
|
|
346
|
-
--diffs-selection-mix-target: var(--diffs-bg-selection-override, var(--diffs-selection-base));
|
|
347
|
-
--diffs-selection-emphasis-mix-target: var(--diffs-selection-mix-target);
|
|
348
|
-
|
|
349
|
-
&:where([data-editor-overlay]), &:where([data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline])[data-selected-line] {
|
|
350
|
-
--mix-selection-light: 82%;
|
|
351
|
-
--mix-selection-dark: 75%;
|
|
352
|
-
--diffs-hover-mix-target: var(--diffs-selection-mix-target);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
&:where([data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line])) {
|
|
356
|
-
--mix-selection-light: 75%;
|
|
357
|
-
--mix-selection-dark: 60%;
|
|
358
|
-
--diffs-selection-mix-target: var(--diffs-bg-selection-number-override, var(--diffs-selection-base));
|
|
359
|
-
--diffs-hover-mix-target: var(--diffs-selection-mix-target);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
&:where([data-line][data-selected-line]):is([data-line-type="change-addition"], [data-line-type="change-deletion"]) {
|
|
363
|
-
--diffs-selection-emphasis-mix-target: light-dark(color-mix(in lab,
|
|
364
|
-
var(--diffs-diff-line-mix-target, var(--diffs-selection-mix-target))
|
|
365
|
-
var(--mix-selection-light),
|
|
366
|
-
var(--diffs-selection-mix-target)), var(--diffs-selection-mix-target));
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
&:where([data-editor-overlay]), &[data-selected-line] {
|
|
370
|
-
--diffs-computed-selected-line-bg: light-dark(color-mix(in lab,
|
|
371
|
-
var(--diffs-computed-diff-line-bg) var(--mix-selection-light),
|
|
372
|
-
var(--diffs-selection-mix-target)), color-mix(in lab,
|
|
373
|
-
var(--diffs-computed-diff-line-bg) var(--mix-selection-dark),
|
|
374
|
-
var(--diffs-selection-mix-target)));
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
[data-line][data-editor-active-line], [data-column-number][data-editor-active-line] {
|
|
379
|
-
--diffs-computed-editor-active-line-bg: color-mix(in lab,
|
|
380
|
-
var(--diffs-computed-selected-line-bg)
|
|
381
|
-
var(--diffs-editor-active-line-source-mix, 100%),
|
|
382
|
-
var(--diffs-selection-emphasis-mix-target));
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
@media (pointer: fine) {
|
|
386
|
-
[data-line][data-hovered], [data-gutter-buffer][data-hovered], [data-column-number][data-hovered], [data-line-annotation][data-hovered], [data-no-newline][data-hovered], [data-merge-conflict][data-hovered], [data-merge-conflict-actions][data-hovered], [data-editor-overlay][data-hovered] {
|
|
387
|
-
--diffs-computed-hovered-line-bg: light-dark(color-mix(in lab,
|
|
388
|
-
var(--diffs-computed-editor-active-line-bg) 97%,
|
|
389
|
-
var(--diffs-hover-mix-target)), color-mix(in lab,
|
|
390
|
-
var(--diffs-computed-editor-active-line-bg) 91%,
|
|
391
|
-
var(--diffs-hover-mix-target)));
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
[data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line]) {
|
|
396
|
-
color: var(--diffs-selection-number-fg);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
[data-no-newline] {
|
|
400
|
-
user-select: none;
|
|
401
|
-
|
|
402
|
-
& span {
|
|
403
|
-
opacity: .6;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
[data-diff-type="split"][data-overflow="scroll"] {
|
|
408
|
-
grid-template-columns: 1fr 1fr;
|
|
409
|
-
display: grid;
|
|
410
|
-
|
|
411
|
-
& [data-additions] {
|
|
412
|
-
border-left: 1px solid var(--diffs-bg);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
& [data-deletions] {
|
|
416
|
-
border-right: 1px solid var(--diffs-bg);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
[data-code] {
|
|
421
|
-
grid-auto-flow: dense;
|
|
422
|
-
grid-template-columns: var(--diffs-code-grid);
|
|
423
|
-
overflow: var(--diffs-overflow-override, scroll) clip;
|
|
424
|
-
overscroll-behavior-x: none;
|
|
425
|
-
tab-size: var(--diffs-tab-size, 2);
|
|
426
|
-
padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
427
|
-
padding-bottom: max(0px,
|
|
428
|
-
calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) -
|
|
429
|
-
var(--diffs-scrollbar-gutter)));
|
|
430
|
-
scrollbar-gutter: stable;
|
|
431
|
-
align-self: flex-start;
|
|
432
|
-
display: grid;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
[data-diffs-scrollbar-measure] {
|
|
436
|
-
opacity: 0;
|
|
437
|
-
pointer-events: none;
|
|
438
|
-
scrollbar-gutter: auto;
|
|
439
|
-
grid-template-columns: none;
|
|
440
|
-
width: 100px;
|
|
441
|
-
height: 100px;
|
|
442
|
-
padding: 0;
|
|
443
|
-
position: absolute;
|
|
444
|
-
top: -200px;
|
|
445
|
-
left: -200px;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
[data-container-size] {
|
|
449
|
-
container-type: inline-size;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
[data-code]::-webkit-scrollbar {
|
|
453
|
-
width: 0;
|
|
454
|
-
height: var(--diffs-scrollbar-gutter);
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
[data-code]::-webkit-scrollbar-track {
|
|
458
|
-
background: none;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
[data-code]::-webkit-scrollbar-thumb {
|
|
462
|
-
background-color: #0000;
|
|
463
|
-
background-clip: content-box;
|
|
464
|
-
border: 1px solid #0000;
|
|
465
|
-
border-radius: 3px;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
[data-code]::-webkit-scrollbar-corner {
|
|
469
|
-
background-color: #0000;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
@supports ((-moz-appearance: none)) {
|
|
473
|
-
[data-code] {
|
|
474
|
-
scrollbar-width: thin;
|
|
475
|
-
scrollbar-color: var(--diffs-bg-context) transparent;
|
|
476
|
-
padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
[data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] {
|
|
481
|
-
& [data-code], &[data-overflow="wrap"], &[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
|
|
482
|
-
padding-top: 0;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
[data-gutter] {
|
|
487
|
-
grid-template-rows: subgrid;
|
|
488
|
-
grid-template-columns: subgrid;
|
|
489
|
-
z-index: 3;
|
|
490
|
-
background-color: var(--diffs-bg);
|
|
491
|
-
grid-column: 1;
|
|
492
|
-
display: grid;
|
|
493
|
-
position: relative;
|
|
494
|
-
|
|
495
|
-
& [data-gutter-buffer], & [data-column-number] {
|
|
496
|
-
border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
[data-content] {
|
|
501
|
-
grid-template-rows: subgrid;
|
|
502
|
-
grid-template-columns: subgrid;
|
|
503
|
-
background-color: var(--diffs-bg);
|
|
504
|
-
grid-column: 2;
|
|
505
|
-
min-width: 0;
|
|
506
|
-
display: grid;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
[data-diff-type="split"][data-overflow="wrap"], [data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
|
|
510
|
-
grid-auto-flow: dense;
|
|
511
|
-
grid-template-columns: repeat(2, var(--diffs-code-grid));
|
|
512
|
-
padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
513
|
-
display: grid;
|
|
514
|
-
|
|
515
|
-
& [data-code] {
|
|
516
|
-
display: contents;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
& [data-deletions] {
|
|
520
|
-
& [data-gutter] {
|
|
521
|
-
grid-column: 1;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
& [data-content] {
|
|
525
|
-
border-right: 1px solid var(--diffs-bg);
|
|
526
|
-
grid-column: 2;
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
& [data-additions] {
|
|
531
|
-
& [data-gutter] {
|
|
532
|
-
border-left: 1px solid var(--diffs-bg);
|
|
533
|
-
grid-column: 3;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
& [data-content] {
|
|
537
|
-
grid-column: 4;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] [data-content] {
|
|
543
|
-
overflow: clip;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
[data-overflow="scroll"] [data-gutter] {
|
|
547
|
-
position: sticky;
|
|
548
|
-
left: 0;
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
[data-interactive-lines] [data-line] {
|
|
552
|
-
cursor: pointer;
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
[data-interactive-line-numbers] [data-column-number] {
|
|
556
|
-
cursor: pointer;
|
|
557
|
-
touch-action: none;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
[data-content-buffer], [data-gutter-buffer] {
|
|
561
|
-
user-select: none;
|
|
562
|
-
min-height: 1lh;
|
|
563
|
-
position: relative;
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
[data-gutter-buffer] {
|
|
567
|
-
padding-left: 2ch;
|
|
568
|
-
padding-right: 1ch;
|
|
569
|
-
|
|
570
|
-
&:before {
|
|
571
|
-
content: "";
|
|
572
|
-
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
573
|
-
display: block;
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
[data-gutter-buffer="annotation"] {
|
|
578
|
-
--diffs-annotation-bg: var(--diffs-bg-context-gutter);
|
|
579
|
-
min-height: 0;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
[data-gutter-buffer="buffer"] {
|
|
583
|
-
--diffs-line-bg: var(--diffs-bg-context-gutter);
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
[data-content-buffer] {
|
|
587
|
-
background-position: 5px 0;
|
|
588
|
-
background-size: 8px 8px;
|
|
589
|
-
background-origin: border-box;
|
|
590
|
-
background-image: repeating-linear-gradient(-45deg,
|
|
591
|
-
transparent,
|
|
592
|
-
transparent calc(3px * 1.414),
|
|
593
|
-
var(--diffs-bg-buffer) calc(3px * 1.414),
|
|
594
|
-
var(--diffs-bg-buffer) calc(4px * 1.414));
|
|
595
|
-
grid-column: 1;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
[data-separator] {
|
|
599
|
-
box-sizing: content-box;
|
|
600
|
-
background-color: var(--diffs-bg);
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
[data-separator="simple"] {
|
|
604
|
-
min-height: 4px;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"], [data-separator="simple"] {
|
|
608
|
-
background-color: var(--diffs-bg-separator);
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
612
|
-
height: 32px;
|
|
613
|
-
position: relative;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
[data-separator-wrapper] {
|
|
617
|
-
user-select: none;
|
|
618
|
-
fill: currentColor;
|
|
619
|
-
background-color: var(--diffs-bg);
|
|
620
|
-
align-items: center;
|
|
621
|
-
height: 100%;
|
|
622
|
-
display: flex;
|
|
623
|
-
position: absolute;
|
|
624
|
-
inset-inline: 0;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
[data-content] [data-separator-wrapper] {
|
|
628
|
-
display: none;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
[data-separator="metadata"] [data-separator-wrapper] {
|
|
632
|
-
background-color: var(--diffs-bg-separator);
|
|
633
|
-
height: 100%;
|
|
634
|
-
color: var(--diffs-fg-number);
|
|
635
|
-
white-space: nowrap;
|
|
636
|
-
text-overflow: ellipsis;
|
|
637
|
-
min-width: min-content;
|
|
638
|
-
padding-inline: 1ch;
|
|
639
|
-
inset-inline: 100% auto;
|
|
640
|
-
overflow: hidden;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
[data-separator="line-info"] {
|
|
644
|
-
margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
645
|
-
|
|
646
|
-
& [data-separator-wrapper] {
|
|
647
|
-
min-width: 16px;
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
[data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
652
|
-
margin-block: 0;
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
[data-separator="line-info"][data-separator-first] {
|
|
656
|
-
margin-top: 0;
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
[data-separator="line-info"][data-separator-last] {
|
|
660
|
-
margin-bottom: 0;
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
[data-expand-index] [data-separator-wrapper] {
|
|
664
|
-
grid-template-columns: 32px auto;
|
|
665
|
-
display: grid;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
[data-expand-index] [data-separator-wrapper][data-separator-multi-button] {
|
|
669
|
-
grid-template-columns: 32px 32px auto;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
[data-expand-button], [data-separator-content] {
|
|
673
|
-
background-color: var(--diffs-bg-separator);
|
|
674
|
-
flex: none;
|
|
675
|
-
align-items: center;
|
|
676
|
-
display: flex;
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
[data-expand-index] [data-separator-content]:hover {
|
|
680
|
-
cursor: pointer;
|
|
681
|
-
text-decoration: underline;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
[data-expand-button] {
|
|
685
|
-
cursor: pointer;
|
|
686
|
-
min-width: 32px;
|
|
687
|
-
color: var(--diffs-fg-number);
|
|
688
|
-
border-right: 2px solid var(--diffs-bg);
|
|
689
|
-
flex-shrink: 0;
|
|
690
|
-
justify-content: center;
|
|
691
|
-
align-self: stretch;
|
|
692
|
-
|
|
693
|
-
&:hover {
|
|
694
|
-
color: var(--diffs-fg);
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
&[data-expand-all-button] {
|
|
698
|
-
display: none;
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
[data-expand-down] [data-icon] {
|
|
703
|
-
transform: scaleY(-1);
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
[data-separator-content] {
|
|
707
|
-
height: 100%;
|
|
708
|
-
color: var(--diffs-fg-number);
|
|
709
|
-
flex: auto;
|
|
710
|
-
justify-content: flex-start;
|
|
711
|
-
padding: 0 1ch;
|
|
712
|
-
overflow: hidden;
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
716
|
-
& [data-separator-content] {
|
|
717
|
-
user-select: none;
|
|
718
|
-
height: 100%;
|
|
719
|
-
overflow: clip;
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
[data-unmodified-lines] {
|
|
724
|
-
text-overflow: ellipsis;
|
|
725
|
-
white-space: nowrap;
|
|
726
|
-
flex: 0 auto;
|
|
727
|
-
min-width: 0;
|
|
728
|
-
display: block;
|
|
729
|
-
overflow: hidden;
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
@supports (width: 1cqi) {
|
|
733
|
-
[data-unified] {
|
|
734
|
-
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
735
|
-
padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
736
|
-
width: 100cqi;
|
|
737
|
-
|
|
738
|
-
& [data-separator-content] {
|
|
739
|
-
border-radius: 6px;
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
& [data-separator="line-info"][data-expand-index] [data-separator-wrapper] [data-separator-content] {
|
|
744
|
-
border-top-left-radius: unset;
|
|
745
|
-
border-bottom-left-radius: unset;
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
[data-gutter] {
|
|
750
|
-
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
751
|
-
padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
& [data-separator="line-info"] [data-separator-content] {
|
|
755
|
-
border-top-left-radius: 6px;
|
|
756
|
-
border-bottom-left-radius: 6px;
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
& [data-separator="line-info"][data-expand-index] [data-separator-content] {
|
|
760
|
-
border-top-left-radius: unset;
|
|
761
|
-
border-bottom-left-radius: unset;
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
[data-additions] {
|
|
766
|
-
& [data-content] [data-separator="line-info"] {
|
|
767
|
-
background-color: var(--diffs-bg);
|
|
768
|
-
|
|
769
|
-
& [data-separator-wrapper] {
|
|
770
|
-
display: none;
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
& [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
775
|
-
background-color: var(--diffs-bg-separator);
|
|
776
|
-
border-top-right-radius: 6px;
|
|
777
|
-
border-bottom-right-radius: 6px;
|
|
778
|
-
height: 100%;
|
|
779
|
-
display: block;
|
|
780
|
-
|
|
781
|
-
& [data-separator-content], & [data-expand-button] {
|
|
782
|
-
display: none;
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
[data-overflow="scroll"] [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
788
|
-
width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
[data-overflow="wrap"] [data-additions] [data-content] [data-separator="line-info"] [data-separator-wrapper] {
|
|
792
|
-
background-color: var(--diffs-bg-separator);
|
|
793
|
-
height: 100%;
|
|
794
|
-
margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
795
|
-
border-top-right-radius: 6px;
|
|
796
|
-
border-bottom-right-radius: 6px;
|
|
797
|
-
display: block;
|
|
798
|
-
|
|
799
|
-
& [data-separator-content], & [data-expand-button] {
|
|
800
|
-
display: none;
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
[data-separator="line-info"] [data-separator-wrapper] {
|
|
805
|
-
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
806
|
-
border-top-left-radius: 6px;
|
|
807
|
-
border-bottom-left-radius: 6px;
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
@media (pointer: fine) {
|
|
812
|
-
[data-separator="line-info"] [data-separator-wrapper] {
|
|
813
|
-
&[data-separator-multi-button] {
|
|
814
|
-
& [data-expand-up] {
|
|
815
|
-
border-top-left-radius: 6px;
|
|
816
|
-
border-bottom-left-radius: unset;
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
& [data-expand-down] {
|
|
820
|
-
border-bottom-left-radius: 6px;
|
|
821
|
-
border-top-left-radius: unset;
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
@media (pointer: coarse) {
|
|
829
|
-
[data-separator="line-info-basic"] [data-separator-wrapper][data-separator-multi-button] {
|
|
830
|
-
grid-template-columns: 34px 34px auto;
|
|
831
|
-
|
|
832
|
-
& [data-separator-content] {
|
|
833
|
-
grid-column: unset;
|
|
834
|
-
grid-row: unset;
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
@supports (width: 1cqi) {
|
|
839
|
-
[data-separator="line-info"] [data-separator-wrapper] {
|
|
840
|
-
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
841
|
-
border-top-left-radius: 6px;
|
|
842
|
-
border-bottom-left-radius: 6px;
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
&[data-separator-multi-button] {
|
|
846
|
-
& [data-expand-up] {
|
|
847
|
-
border-top-left-radius: 6px;
|
|
848
|
-
border-bottom-left-radius: 6px;
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
& [data-expand-down] {
|
|
852
|
-
border-bottom-left-radius: unset;
|
|
853
|
-
border-top-left-radius: unset;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
@media (pointer: fine) {
|
|
861
|
-
[data-separator-wrapper][data-separator-multi-button] {
|
|
862
|
-
grid-template-rows: 50% 50%;
|
|
863
|
-
display: grid;
|
|
864
|
-
|
|
865
|
-
& [data-separator-content] {
|
|
866
|
-
grid-area: 1 / 2 / -1;
|
|
867
|
-
min-width: min-content;
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
& [data-expand-button] {
|
|
871
|
-
grid-column: 1;
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
[data-separator="line-info"] [data-separator-wrapper], [data-separator="line-info"] [data-separator-wrapper][data-separator-multi-button] {
|
|
876
|
-
grid-template-columns: 34px auto;
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
[data-separator="line-info-basic"][data-expand-index] [data-separator-wrapper] {
|
|
880
|
-
grid-template-columns: 100% auto;
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
884
|
-
& [data-separator-multi-button] {
|
|
885
|
-
& [data-expand-up] {
|
|
886
|
-
border-bottom: 1px solid var(--diffs-bg);
|
|
887
|
-
border-right: 2px solid var(--diffs-bg);
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
& [data-expand-down] {
|
|
891
|
-
border-top: 1px solid var(--diffs-bg);
|
|
892
|
-
border-right: 2px solid var(--diffs-bg);
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
[data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator="line-info-basic"] [data-separator-wrapper], [data-content] [data-separator-wrapper] {
|
|
899
|
-
display: none;
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
[data-line-annotation] {
|
|
903
|
-
min-height: var(--diffs-annotation-min-height, 0);
|
|
904
|
-
z-index: 2;
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
[data-merge-conflict-actions] {
|
|
908
|
-
z-index: 2;
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
[data-separator="custom"] {
|
|
912
|
-
grid-template-columns: subgrid;
|
|
913
|
-
display: grid;
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
[data-line], [data-column-number], [data-no-newline] {
|
|
917
|
-
padding-inline: 1ch;
|
|
918
|
-
position: relative;
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
[data-indicators="classic"] [data-line] {
|
|
922
|
-
padding-inline-start: 2ch;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
[data-indicators="classic"] {
|
|
926
|
-
& [data-line-type="change-addition"], & [data-line-type="change-deletion"] {
|
|
927
|
-
&[data-no-newline], &[data-line] {
|
|
928
|
-
&:before {
|
|
929
|
-
user-select: none;
|
|
930
|
-
width: 1ch;
|
|
931
|
-
height: 1lh;
|
|
932
|
-
display: inline-block;
|
|
933
|
-
position: absolute;
|
|
934
|
-
top: 0;
|
|
935
|
-
left: 0;
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
& [data-line-type="change-addition"] {
|
|
941
|
-
&[data-line], &[data-no-newline] {
|
|
942
|
-
&:before {
|
|
943
|
-
content: "+";
|
|
944
|
-
color: var(--diffs-addition-base);
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
& [data-line-type="change-deletion"] {
|
|
950
|
-
&[data-line], &[data-no-newline] {
|
|
951
|
-
&:before {
|
|
952
|
-
content: "-";
|
|
953
|
-
color: var(--diffs-deletion-base);
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
[data-indicators="bars"] {
|
|
960
|
-
& [data-line-type="change-deletion"], & [data-line-type="change-addition"] {
|
|
961
|
-
&[data-column-number] {
|
|
962
|
-
&:before {
|
|
963
|
-
content: "";
|
|
964
|
-
user-select: none;
|
|
965
|
-
contain: strict;
|
|
966
|
-
width: 4px;
|
|
967
|
-
height: 100%;
|
|
968
|
-
display: block;
|
|
969
|
-
position: absolute;
|
|
970
|
-
top: 0;
|
|
971
|
-
left: 0;
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
& [data-line-type="change-deletion"] {
|
|
977
|
-
&[data-column-number] {
|
|
978
|
-
&:before {
|
|
979
|
-
background-image: linear-gradient(0deg,
|
|
980
|
-
var(--diffs-bg-deletion) 50%,
|
|
981
|
-
var(--diffs-deletion-base) 50%);
|
|
982
|
-
background-repeat: repeat;
|
|
983
|
-
background-size: 2px 2px;
|
|
984
|
-
background-size: calc(1lh / round(1lh / 2px))
|
|
985
|
-
calc(1lh / round(1lh / 2px));
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
& [data-line-type="change-addition"] {
|
|
991
|
-
&[data-column-number] {
|
|
992
|
-
&:before {
|
|
993
|
-
background-color: var(--diffs-addition-base);
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
[data-overflow="wrap"] {
|
|
1000
|
-
& [data-line] {
|
|
1001
|
-
white-space: pre-wrap;
|
|
1002
|
-
word-break: break-word;
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
& [data-annotation-content] {
|
|
1006
|
-
word-break: break-word;
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
[data-overflow="scroll"] [data-line] {
|
|
1011
|
-
white-space: pre;
|
|
1012
|
-
min-height: 1lh;
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
[data-column-number] {
|
|
1016
|
-
box-sizing: content-box;
|
|
1017
|
-
text-align: right;
|
|
1018
|
-
user-select: none;
|
|
1019
|
-
color: var(--diffs-fg-number);
|
|
1020
|
-
padding-left: 2ch;
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
[data-line-number-content] {
|
|
1024
|
-
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
1025
|
-
z-index: 1;
|
|
1026
|
-
display: inline-block;
|
|
1027
|
-
position: relative;
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
[data-disable-line-numbers] {
|
|
1031
|
-
& [data-gutter-buffer], & [data-column-number] {
|
|
1032
|
-
min-width: 4px;
|
|
1033
|
-
padding: 0;
|
|
1034
|
-
|
|
1035
|
-
&:before {
|
|
1036
|
-
min-width: 0;
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
& [data-line-number-content] {
|
|
1041
|
-
display: none;
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
& [data-gutter-utility-slot] {
|
|
1045
|
-
right: unset;
|
|
1046
|
-
justify-content: flex-start;
|
|
1047
|
-
left: 0;
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
&[data-indicators="bars"] [data-gutter-utility-slot] {
|
|
1051
|
-
left: 6px;
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
[data-file][data-disable-line-numbers] {
|
|
1056
|
-
& [data-gutter-buffer], & [data-column-number] {
|
|
1057
|
-
border-right: 0;
|
|
1058
|
-
min-width: 0;
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
[data-diff-span] {
|
|
1063
|
-
box-decoration-break: clone;
|
|
1064
|
-
border-radius: 3px;
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
[data-line-type="change-addition"] [data-diff-span] {
|
|
1068
|
-
background-color: var(--diffs-bg-addition-emphasis);
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
[data-line-type="change-deletion"] [data-diff-span] {
|
|
1072
|
-
background-color: var(--diffs-bg-deletion-emphasis);
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"], [data-merge-conflict="marker-end"] {
|
|
1076
|
-
color: var(--diffs-fg);
|
|
1077
|
-
padding-left: 1ch;
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-end"] {
|
|
1081
|
-
align-items: center;
|
|
1082
|
-
display: flex;
|
|
1083
|
-
|
|
1084
|
-
&:after {
|
|
1085
|
-
color: var(--diffs-fg-conflict-marker);
|
|
1086
|
-
font-size: .75rem;
|
|
1087
|
-
font-style: normal;
|
|
1088
|
-
line-height: 1.25rem;
|
|
1089
|
-
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1090
|
-
padding-left: 1ch;
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
[data-merge-conflict="marker-start"]:after {
|
|
1095
|
-
content: "(Current Change)";
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
[data-merge-conflict="marker-end"]:after {
|
|
1099
|
-
content: "(Incoming Change)";
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
[data-merge-conflict-actions-content] {
|
|
1103
|
-
min-height: 1.75rem;
|
|
1104
|
-
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1105
|
-
color: var(--diffs-fg);
|
|
1106
|
-
align-items: center;
|
|
1107
|
-
gap: .25rem;
|
|
1108
|
-
padding-inline: .5rem;
|
|
1109
|
-
font-size: .75rem;
|
|
1110
|
-
line-height: 1.2;
|
|
1111
|
-
display: flex;
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
[data-merge-conflict-action] {
|
|
1115
|
-
appearance: none;
|
|
1116
|
-
color: var(--diffs-fg-number);
|
|
1117
|
-
font: inherit;
|
|
1118
|
-
cursor: pointer;
|
|
1119
|
-
background: none;
|
|
1120
|
-
border: 0;
|
|
1121
|
-
padding: 0;
|
|
1122
|
-
font-style: normal;
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
[data-merge-conflict-action]:hover {
|
|
1126
|
-
color: var(--diffs-fg);
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
[data-merge-conflict-action="current"]:hover {
|
|
1130
|
-
color: var(--diffs-addition-base);
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
[data-merge-conflict-action="incoming"]:hover {
|
|
1134
|
-
color: var(--diffs-modified-base);
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
[data-merge-conflict-action-separator] {
|
|
1138
|
-
color: var(--diffs-fg-number);
|
|
1139
|
-
opacity: .6;
|
|
1140
|
-
user-select: none;
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
[data-diffs-header="default"] {
|
|
1144
|
-
background-color: var(--diffs-bg);
|
|
1145
|
-
justify-content: space-between;
|
|
1146
|
-
align-items: center;
|
|
1147
|
-
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1148
|
-
min-height: calc(1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3));
|
|
1149
|
-
z-index: 2;
|
|
1150
|
-
flex-direction: row;
|
|
1151
|
-
padding-inline: 16px;
|
|
1152
|
-
display: flex;
|
|
1153
|
-
position: relative;
|
|
1154
|
-
top: 0;
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
[data-header-content] {
|
|
1158
|
-
align-items: center;
|
|
1159
|
-
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1160
|
-
white-space: nowrap;
|
|
1161
|
-
flex-direction: row;
|
|
1162
|
-
min-width: 0;
|
|
1163
|
-
display: flex;
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
[data-header-content] [data-prev-name], [data-header-content] [data-title] {
|
|
1167
|
-
text-overflow: ellipsis;
|
|
1168
|
-
white-space: nowrap;
|
|
1169
|
-
direction: rtl;
|
|
1170
|
-
min-width: 0;
|
|
1171
|
-
overflow: hidden;
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
[data-prev-name] {
|
|
1175
|
-
opacity: .7;
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
[data-rename-icon] {
|
|
1179
|
-
fill: currentColor;
|
|
1180
|
-
flex-grow: 0;
|
|
1181
|
-
flex-shrink: 0;
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
[data-diffs-header="default"] [data-metadata] {
|
|
1185
|
-
white-space: nowrap;
|
|
1186
|
-
align-items: center;
|
|
1187
|
-
gap: 1ch;
|
|
1188
|
-
display: flex;
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
|
-
[data-diffs-header="default"] [data-additions-count] {
|
|
1192
|
-
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1193
|
-
color: var(--diffs-addition-base);
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
[data-diffs-header="default"] [data-deletions-count] {
|
|
1197
|
-
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1198
|
-
color: var(--diffs-deletion-base);
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
[data-change-icon] {
|
|
1202
|
-
fill: currentColor;
|
|
1203
|
-
flex-shrink: 0;
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1206
|
-
[data-change-icon="change"], [data-change-icon="rename-pure"], [data-change-icon="rename-changed"] {
|
|
1207
|
-
color: var(--diffs-modified-base);
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
[data-change-icon="new"] {
|
|
1211
|
-
color: var(--diffs-addition-base);
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
[data-change-icon="deleted"] {
|
|
1215
|
-
color: var(--diffs-deletion-base);
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
[data-change-icon="file"] {
|
|
1219
|
-
opacity: .6;
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
[data-annotation-content] {
|
|
1223
|
-
z-index: 2;
|
|
1224
|
-
isolation: isolate;
|
|
1225
|
-
white-space: normal;
|
|
1226
|
-
align-self: flex-start;
|
|
1227
|
-
min-width: 0;
|
|
1228
|
-
display: flow-root;
|
|
1229
|
-
position: relative;
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
[data-overflow="scroll"] [data-annotation-content], [data-overflow="scroll"] [data-merge-conflict-actions-content] {
|
|
1233
|
-
width: var(--diffs-column-content-width, auto);
|
|
1234
|
-
left: var(--diffs-column-number-width, 0);
|
|
1235
|
-
position: sticky;
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
[data-annotation-slot] {
|
|
1239
|
-
text-wrap-mode: wrap;
|
|
1240
|
-
word-break: normal;
|
|
1241
|
-
white-space-collapse: collapse;
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
[data-gutter-utility-slot] {
|
|
1245
|
-
touch-action: none;
|
|
1246
|
-
justify-content: flex-end;
|
|
1247
|
-
display: flex;
|
|
1248
|
-
position: absolute;
|
|
1249
|
-
top: 0;
|
|
1250
|
-
bottom: 0;
|
|
1251
|
-
right: 0;
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
[data-utility-button] {
|
|
1255
|
-
appearance: none;
|
|
1256
|
-
cursor: pointer;
|
|
1257
|
-
width: 1lh;
|
|
1258
|
-
height: 1lh;
|
|
1259
|
-
font-size: var(--diffs-font-size, 13px);
|
|
1260
|
-
line-height: var(--diffs-line-height, 20px);
|
|
1261
|
-
background-color: var(--diffs-modified-base);
|
|
1262
|
-
color: var(--diffs-bg);
|
|
1263
|
-
fill: currentColor;
|
|
1264
|
-
z-index: 4;
|
|
1265
|
-
touch-action: none;
|
|
1266
|
-
border: none;
|
|
1267
|
-
border-radius: 4px;
|
|
1268
|
-
justify-content: center;
|
|
1269
|
-
align-items: center;
|
|
1270
|
-
margin-right: calc(-1lh + 1ch);
|
|
1271
|
-
padding: 0;
|
|
1272
|
-
display: flex;
|
|
1273
|
-
position: relative;
|
|
1274
|
-
|
|
1275
|
-
&:before {
|
|
1276
|
-
content: "";
|
|
1277
|
-
display: block;
|
|
1278
|
-
position: absolute;
|
|
1279
|
-
inset: 0 0 0 -4px;
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
[data-decoration-bar-stack] {
|
|
1284
|
-
pointer-events: none;
|
|
1285
|
-
isolation: isolate;
|
|
1286
|
-
z-index: 1;
|
|
1287
|
-
background-color: var(--diffs-decoration-bar-color, transparent);
|
|
1288
|
-
box-sizing: content-box;
|
|
1289
|
-
border-left: 2px solid var(--diffs-bg);
|
|
1290
|
-
border-right: 2px solid var(--diffs-bg);
|
|
1291
|
-
width: 6px;
|
|
1292
|
-
position: absolute;
|
|
1293
|
-
top: 0;
|
|
1294
|
-
bottom: 0;
|
|
1295
|
-
right: -2px;
|
|
1296
|
-
|
|
1297
|
-
[data-decoration-bar-depth="1"] & {
|
|
1298
|
-
background-color: color-mix(in lab,
|
|
1299
|
-
var(--diffs-bg) 20%,
|
|
1300
|
-
var(--diffs-decoration-bar-color, transparent));
|
|
1301
|
-
}
|
|
1302
|
-
|
|
1303
|
-
[data-decoration-bar-depth="2"] & {
|
|
1304
|
-
background-color: color-mix(in lab,
|
|
1305
|
-
var(--diffs-bg) 45%,
|
|
1306
|
-
var(--diffs-decoration-bar-color, transparent));
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
[data-decoration-bar-depth="3"] & {
|
|
1310
|
-
background-color: color-mix(in lab,
|
|
1311
|
-
var(--diffs-bg) 65%,
|
|
1312
|
-
var(--diffs-decoration-bar-color, transparent));
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
[data-decoration-bar-start] & {
|
|
1316
|
-
border-top-left-radius: 5px;
|
|
1317
|
-
border-top-right-radius: 5px;
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
[data-decoration-bar-end] & {
|
|
1321
|
-
z-index: 3;
|
|
1322
|
-
border-bottom-right-radius: 5px;
|
|
1323
|
-
border-bottom-left-radius: 5px;
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
[data-placeholder] {
|
|
1328
|
-
contain: strict;
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1331
|
-
[data-error-wrapper] {
|
|
1332
|
-
padding: var(--diffs-gap-block, var(--diffs-gap-fallback))
|
|
1333
|
-
var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1334
|
-
scrollbar-width: none;
|
|
1335
|
-
max-height: 400px;
|
|
1336
|
-
overflow: auto;
|
|
1337
|
-
|
|
1338
|
-
& [data-error-message] {
|
|
1339
|
-
color: var(--diffs-deletion-base);
|
|
1340
|
-
font-size: 18px;
|
|
1341
|
-
font-weight: bold;
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
& [data-error-stack] {
|
|
1345
|
-
color: var(--diffs-fg-number);
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
@layer theme, rendered, unsafe;
|
|
1351
|
-
`,So=`@layer base, theme, rendered, unsafe;`,Co=RegExp(`${Do(an)}\\s*:\\s*[^;]+;`);function wo(e){return`${So}
|
|
1352
|
-
@layer unsafe {
|
|
1353
|
-
${e}
|
|
1354
|
-
}`}function To(e,t=`system`,n){return`${So}
|
|
1355
|
-
@layer rendered {
|
|
1356
|
-
:host {${t===`system`?``:`
|
|
1357
|
-
color-scheme: ${t};`}
|
|
1358
|
-
${bo(n)}
|
|
1359
|
-
${e}
|
|
1360
|
-
}
|
|
1361
|
-
}`}function Eo(e,t){let n=bo(t);return e.replace(Co,n)}function Do(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var Oo=new WeakMap;function ko(e){return Oo.get(e)??e}function Ao(e,t,n){let r=new Map;for(let i of e){let e=ko(i);r.set(e,n?.slotNames.get(e)??t(i))}return{provided:e,current:e,slotNames:r}}function jo(e,t,n){for(let r of t){let t=ko(r);e.slotNames.has(t)||e.slotNames.set(t,n(r))}e.provided=t,e.current=t}function Mo(e,t,n){if(e==null)return n(t);let r=ko(t),i=e.slotNames.get(r);return i??(i=n(t),e.slotNames.set(r,i)),i}function No(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function Po({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 Fo(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function Io({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=Lo(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function Lo(){let e=document.createElement(`style`);return e.setAttribute(tn,``),e}var Ro=void 0;function zo(){return Ro??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Bo(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function Vo(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}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(xo)),t.adoptedStyleSheets=[e]}connectedCallback(){yo(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(Wt,t)}async function Ho(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function Uo({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=Zr(t,n),l=c,u=i?!0:a,d=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=X({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:u,hunkIndex:n,collapsedContextThreshold:o}),f=(a.fromStart+a.fromEnd)*t.lineHeight;if(c+=f,l+=f,a.collapsedLines>0){let e=di({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;c+=e,l+=e}c+=i.splitLineCount*t.lineHeight,l+=i.unifiedLineCount*t.lineHeight;let p=Wo(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?ii({fileDiff:e,hunkIndex:n,expandedHunks:u,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(m!=null){let e=(m.fromStart+m.fromEnd)*t.lineHeight;if(c+=e,l+=e,m.collapsedLines>0){let e=fi({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=fi({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=$r(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function Wo(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 Go(e,t)}function Go(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}}function Ko({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function qo(e){return e.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))}))}function Jo(e){return{...e,hunks:qo(e.hunks),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}var Yo=1;function Xo(e,...t){return`ck${Yo}:${JSON.stringify([e,...t])}`}function Zo(e){return e===``?[]:e.split(Kt)}function Qo(e,t,n){let r=e===`clone`?Jo(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return $o(r,ts(r,n),ns(r,n));case`rename-pure`:{let e=ns(r,n);rs(r,n);let t=Zo(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,as(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function $o(e,t,n){let r=Zo(t.contents),i=Zo(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=es(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,as(e,t,n),e}function es(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent){if(e.type===`context`){p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines;continue}p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let m=Math.max(z(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=B(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=B(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function ts(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function ns(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function rs(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function is(e,t,n){return e.cacheKey==null?os(t,n):`${e.cacheKey}:hydrated`}function as(e,t,n){let r=is(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function os(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?Xo(`hydrated-files`,e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}var ss=new TextEncoder,cs=new TextDecoder(`utf-8`,{ignoreBOM:!0}),ls=/[\uD800-\uDFFF]/,us=1024,ds=new Uint8Array(us);function fs(){ds.length!==us&&(ds=new Uint8Array(us))}function $(e){if(e.length===0)return e;if(ls.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;ds.length<t&&(ds=new Uint8Array(t));let{written:n}=ss.encodeInto(e,ds);return cs.decode(ds.subarray(0,n))}var ps=4096,ms=.5;function hs(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=_s(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}gs(t,e)}}function gs(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let r=n[e],i=n[e-1];if(r.type!==`change`||r.additions>0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;e<c;e++)if(o[s+e]!==l){u=!1;break}if(!u)continue;let d=0;for(;d<i.lines&&t.additionLines[i.additionLineIndex+i.lines-1-d]===l;)d++;if(d===0||e===1&&d===i.lines)continue;r.additionLineIndex-=d,r.deletionLineIndex-=d;let f=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,m=n[e+1];m?.type===`context`?(m.lines+=d,m.additionLineIndex=f,m.deletionLineIndex=p):n.splice(e+1,0,{type:`context`,lines:d,additionLineIndex:f,deletionLineIndex:p}),i.lines-=d,i.lines===0&&(n.splice(e-1,1),e--)}}function _s(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>ps)return null;let c=[];for(let t=0;t<n;t++)c.push(ys(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(ys(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=bs(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*ms:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var vs=/\s+/g;function ys(e){return e.replace(vs,``)}function bs(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}function xs(e,t){try{return Ss(e,t)}finally{fs()}}function Ss(e,{cacheKey:t,isGitDiff:n=Gt.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=As(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=ws(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=Ds(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?Cs(i.contents):[],deletionLines:!l&&r!=null&&i!=null?Cs(r.contents):[],cacheKey:Ms(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(Yt),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=$(r.trim()),n!==r&&(c.prevName=$(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?Jt:qt):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=$(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=$(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=$(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=$(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=$(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=$(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(Xt)??[];t!=null&&(c.prevObjectId=$(t)),n!=null&&(c.newObjectId=$(n)),r!=null&&(c.mode=$(r))}e.startsWith(`rename from `)&&(c.prevName=$(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=$(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
|
|
1362
|
-
`||s[s.length-1]===`\r`||s[s.length-1]===`\r
|
|
1363
|
-
`||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:Ms(p.hunkContext),hunkSpecs:$(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(!(Ts(t)&&!Es(t)))break;if(a)throw Error(`parsePatchContent: hunk has more lines than expected`)}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=Ns(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=Ps(t);(g==null||g.type!==`change`)&&(g=Fs(`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=Ps(t);(g==null||g.type!==`change`)&&(g=Fs(`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=Ps(t);(g==null||g.type!==`context`)&&(g=Fs(`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]=Z(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=Z(c.deletionLines[e]))}}}if(x!==b.additionCount||S!==b.deletionCount){if(a)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${f.trimEnd()}", declared old/new ${b.deletionCount}/${b.additionCount}, parsed old/new ${S}/${x}`);let e=z(b.additionStart,b.additionCount)+(x===0?0:1),t=z(b.deletionStart,b.deletionCount)+(S===0?0:1);if(!l){let n=e-b.additionStart,r=t-b.deletionStart;b.additionLineIndex+=n,b.deletionLineIndex+=r;for(let e of b.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}b.additionStart=e,b.deletionStart=t,b.additionCount=x,b.deletionCount=S}b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(z(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=B(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=B(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),hs(c),c}}function Cs(e){let t=ws(e);for(let e=0;e<t.length;e++)t[e]=$(t[e]);return t}function ws(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
|
|
1364
|
-
`,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 Ts(e){let t=e[0];return t===`+`||t===`-`||t===` `}function Es(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
|
|
1365
|
-
`&&n!==`\r`)return!1}return!0}function Ds(e){if(!e.startsWith(`@@ -`))return;let t=4,n=Os(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=Os(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=Os(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=Os(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=ks(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function Os(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 ks(e){return e.endsWith(`\r
|
|
1366
|
-
`)?e.slice(0,-2):e.endsWith(`
|
|
1367
|
-
`)?e.slice(0,-1):e}function As(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:js(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=js(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function js(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function Ms(e){return e==null?e:$(e)}function Ns(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function Ps(e){let t=e.slice(1);return $(t===``?`
|
|
1368
|
-
`:t)}function Fs(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var Is=`/dev/null`;function Ls(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??Rs(),a=t??Rs(),o=xs(Xi(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey,r=t?.cacheKey;return n!=null&&r!=null?Xo(`diff`,n,r):void 0})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function Rs(){return{name:Is,contents:``}}var zs=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 Bs(e,t){let n=Ls({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function Vs(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function Hs(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function Us(e,t){return t.length>0&&t.length<e.deletionLines.length&&Hs(t)}function Ws(e,t,n){let r=e.deletionLines.join(``),i=Vs(t.length,r),a=Ls({name:e.prevName??e.name,contents:r},{name:e.name,contents:i,lang:e.lang},n);return{hunks:a.hunks,splitLineCount:a.splitLineCount,unifiedLineCount:a.unifiedLineCount,additionLines:t,deletionLines:a.deletionLines,type:a.type}}function Gs(e,t){return Ws(e,[``],t)}function Ks(e,t){if(e.additionLines.length===0)return Gs(e,t);if(Us(e,e.additionLines))return Ws(e,e.additionLines,t);let n=e.additionLines,r=Bs(e,t);return Js(r,n),r}function qs(e){return e.length>1&&e.at(-1)===``}function Js(e,t){if(!qs(t))return;let n=t.length-e.additionLines.length;if(n<=0)return;let r=e.additionLines.length,i=e.hunks.at(-1);if(i!=null&&B(i.additionStart,i.additionCount)===r){for(let a of i.hunkContent)if(a.type===`change`&&a.additions<a.deletions&&a.additionLineIndex+a.additions===r){e.additionLines=t,a.additions+=n,i.additionCount+=n,i.additionLines+=n,ic(e);return}}}function Ys(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return Xs(e,Bs(e,n));let r=Array.from(t);if(r.length===0)return Xs(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||Z(r)===Z(i))return Xs(e,Bs(e,n))}let i=Zs(e,r);if(i.size===0)return Xs(e,Bs(e,n));for(let t of i)if(!$s(e,t,n))return Xs(e,Bs(e,n));return ic(e),ni(e)?Xs(e,Bs(e,n)):Xs(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function Xs(e,t){return Object.assign(e,t),t}function Zs(e,t){let n=new Set;for(let r of t){let t=Qs(e,r);if(t==null)return new Set;n.add(t)}return n}function Qs(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function $s(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=Ls({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:(tc(r,s),ec(e,t),!0)}function ec(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(`
|
|
1369
|
-
`),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
|
|
1370
|
-
`)}function tc(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>nc(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,rc(e)}function nc(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function rc(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function ic(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(z(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,rc(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=B(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-B(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var ac=new WeakMap;function oc(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function sc(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function cc(e,t){let n=e.hunks,r=e.additionLines,i=oc(r),a=i===r?e:{...e,additionLines:i},o=vc(n,_c(a,t),e.deletionLines.length),s=xc(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,jc(e),Js(e,r),wc(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function lc(e,t,n,r){let i=Array.from(new Set(t)).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(i.length===0)return;let{hunks:a}=e,o,s=0;for(let t of i){for(;s<a.length;){let e=a[s];if(t<Dc(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:Dc(r);if(i==null||t<i||o!=null&&o!==s)return cc(e,n);o=s}if(o!=null){if(uc(e,i,o,r,n)){e.editSessionDirty=!0;return}return cc(e,n)}}function uc(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=dc(e),o=e.hunks[n];if(o.hunkContent.some(fc))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function dc(e){let t=ac.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return ac.set(e,{lines:e.deletionLines,set:n}),n}function fc(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function pc(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function mc(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=X({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=Oc(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=ii({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=Oc(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function hc(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=Oc(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,Oc(i)+i.deletionCount,e.deletionLines.length),n}function gc(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?Bs(e,t):Ks(e,t)),!0)}function _c(e,t){if(sc(e.deletionLines,e.additionLines)==null)return[];let n=Ls({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),r=[],i=0,a=0;for(let e of n.hunks){let t=e.additionCount>0?e.additionLineIndex-i:e.deletionLineIndex-a;i+=t,a+=t;for(let t of e.hunkContent){if(t.type===`context`){i+=t.lines,a+=t.lines;continue}let e=nc(t,0,0);e.additions===0&&(e.additionLineIndex=i),e.deletions===0&&(e.deletionLineIndex=a),r.push(e),i+=e.additions,a+=e.deletions}}return r}function vc(e,t,n){let r=e.map((e,t)=>{let n=Oc(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&yc(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=bc(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function yc(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function bc(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function xc(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);Cc(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);Cc(s,c,i,r),r+=c,i+=c,n.push(Sc(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function Sc(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:kc(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:Ac(t.additionStart,r),deletionStart:kc(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:Ac(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${kc(t.deletionStart,i)},${i} +${kc(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return rc(s),s}function Cc(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function wc(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(Oc(r)!==Oc(i)||r.deletionCount!==i.deletionCount||Dc(r)!==Dc(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!Tc(r,i))return!0}return!1}function Tc(e,t){let n=Ec(e),r=Ec(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*Ec(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function Dc(e){return z(e.additionStart,e.additionCount)}function Oc(e){return z(e.deletionStart,e.deletionCount)}function kc(e,t){return t===0?e:e+1}function Ac(e,t){return t===0?e-1:e}function jc(e){ic(e);for(let t=0;t<e.hunks.length;t++)ec(e,t)}function Mc(e){return W({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function Nc(e){return W({tagName:`div`,children:[W({tagName:`span`,children:[U(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function Pc(e){return W({tagName:`div`,children:[vr({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{role:`button`,"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function Fc({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(W({tagName:`div`,children:[U(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(Pc(`up`)),s++),o||(e.push(Pc(`down`)),s++)):(e.push(Pc(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(W({tagName:`div`,children:[W({tagName:`span`,children:[U(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(W({tagName:`div`,children:[U(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(W({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(W({tagName:`slot`,properties:{name:i}})),W({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 Ic(e,t){return`hunk-separator-${e}-${t}`}function Lc(e){let t=e.at(-1);return t==null?0:Math.max(B(t.additionStart,t.additionCount),B(t.deletionStart,t.deletionCount))}var Rc=-1,zc=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++Rc}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLangs=[`text`];renderCache;pendingHighlightResult;pendingStructuralRows;editSessionActive=!1;constructor(e={theme:R},t=dn,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r,r?.isWorkingPool()!==!0&&(this.highlighter=Bn(e.theme??R)?fr():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(e,t){let{editSessionActive:n,renderCache:r}=this;if(this.editSessionActive=!0,n||(this.pendingHighlightResult=void 0),this.diff=e,!e.isPartial&&e.additionLines.length===0){Object.assign(e,Gs(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache();return}if(r==null||n&&r.diff===e)return;let{options:i}=this.getRenderOptions(e),a=r.diff===e,o=t!=null&&J(r.diff,t),{result:s}=r;if(!r.highlighted||s==null||!Y(r.options,i)||!a&&!o){this.clearRenderCache();return}a||(this.renderCache={diff:e,options:i,highlighted:!0,result:{...s,code:{...s.code,additionLines:[...s.code.additionLines]}},renderRange:r.renderRange})}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{diff:e,renderCache:t,workerManager:n}=this;return e==null||t==null||!J(t.diff,e)||Yr(e)||Qc(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&n?.isWorkingPool()===!0&&e.cacheKey!=null?(n.evictDiffFromCache(e.cacheKey),n.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,n.getDiffResultCache(e))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(e).then(t=>this.applyRefreshedResult(e,t)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){let{diff:n,renderCache:r}=this;if(t==null||n==null||r==null||!J(n,e)||!J(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);Y(i,t.options)&&(this.pendingHighlightResult={diff:n,options:t.options,highlighted:!0,result:t.result},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=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)??cn}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){this.pendingStructuralRows=void 0;let{renderCache:r}=this;if(r==null)return!1;let{result:i,diff:a}=r;if(i==null)return!1;if(a.isPartial)throw Error(`Could not update render cache for partial diff`);let o=i.code.additionLines,s=this.pendingStructuralRows=n?new Map:void 0,c=[],l=new Map;for(let[t,n]of e){let e=o[t]?.properties??{},r=n.map(e=>e[2]).join(``),i=t<a.additionLines.length,u=i?a.additionLines[t]??``:``,d=Z(u);s==null&&i&&(a.additionLines[t]=$a(u,r),d!==r&&(c.push(t),l.set(t,u)));let f={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};s==null?o[t]=f:s.set(t,f)}let u=!1;if(c.length>0){if(this.editSessionActive){if(a.additionLines.length<=1&&a.additionLines.join(``)===``)this.applyRecomputePreservingSessionType(a,Gs(a,this.options.parseDiffOptions)),u=!0;else if(Us(a,a.additionLines))this.applyRecomputePreservingSessionType(a,Ws(a,a.additionLines,this.options.parseDiffOptions)),u=!0;else{let e=lc(a,c,this.options.parseDiffOptions,l);this.applyExpansionRemap(e),u=e!=null}}else Object.assign(a,Ys(a,c,this.options.parseDiffOptions))}return i.baseThemeType=t,r.isDirty=!0,u}applyExpansionRemap(e){e!=null&&(this.expandedHunks=pc(this.expandedHunks,e))}applyDocumentChange(e){let{pendingStructuralRows:t,renderCache:n}=this;if(this.pendingStructuralRows=void 0,n==null)return;let{diff:r,result:i}=n;if(i==null)return;if(r.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:a}=r;if(r.additionLines=Xc(e),i.code.additionLines=Jc(a,r.additionLines,i.code.additionLines,e),r.additionLines.length<=1&&r.additionLines.join(``)===``?(this.applyRecomputePreservingSessionType(r,Gs(r,this.options.parseDiffOptions)),i.code.additionLines[0]=Yc(0,e.getLineText(0))):this.editSessionActive?this.applySessionDocumentChange(r):Object.assign(r,Ks(r,this.options.parseDiffOptions)),t!=null)for(let[e,n]of t)e<i.code.additionLines.length&&(i.code.additionLines[e]=n);n.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(Us(e,n)){this.applyRecomputePreservingSessionType(e,Ws(e,n,t));return}this.applyExpansionRemap(cc(e,t))}applyRecomputePreservingSessionType(e,t){let n=this.editSessionActive?e.type:void 0;Object.assign(e,t),n!=null&&(e.type=n),this.markEditSessionPass(e)}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>eo(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=R,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=on,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 dr(co(this.computedLangs,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=Qc(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!Y(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!Yr(e),options:t,result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLangs=Zc(e),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??R}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!J(e,n.diff)||!Y(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if(J(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||Yr(e)||Qc(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||J(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&Bn(t.theme):r.result==null&&r.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!r.highlighted:this.highlighter!=null&&Bn(t.theme)}renderDiff(e=this.diff,t=ln){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getReadyRenderResult(e,i);this.pendingHighlightResult=void 0,o!=null&&(this.renderCache={...o,diff:e,renderRange:void 0},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||Yr(e)||Qc(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!J(e,this.renderCache.diff),d=!Qa(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&lo(t);l&&!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(u||d))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||u||d||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,lo(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLangs=Zc(e),this.highlighter??=fr();let t=this.highlighter!=null&&Bn(i.theme),n=this.highlighter!=null&&xn(this.computedLangs),r=!c&&n;if(l&&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.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=ln){this.diff=e;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 oo({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=Qc(e,this.getTokenizeMaxLength());this.computedLangs=t?[`text`]:Zc(e);let n=this.highlighter!=null&&Bn(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&xn(this.computedLangs);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=ta(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(pi({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=Yc(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{diff:i,renderCache:a}=this;i==null||a==null||!J(i,e)||!Y(n,this.getRenderOptions(i).options)||(a.result==null||!a.highlighted||!Y(a.options,n)||!J(a.diff,i))&&(this.pendingHighlightResult={diff:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.())}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!Y(t,n.options)))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&J(n.diff,e)&&Y(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&J(e,n.diff)&&Y(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1,f=a===`unified`,p=$c(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:br(),deletionsGutterAST:br(),additionsGutterAST:br(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=ri({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(x.pushToGutter(`additions`,G(void 0,`buffer`,this.size)),h?.push(Mc(this.size))):(x.pushToGutter(`deletions`,G(void 0,`buffer`,this.size)),g?.push(Mc(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,xr(t,n,r,i))};function T(e){C.flush(),a===`unified`?Gc(`unified`,e,x):(Gc(`deletions`,e,x),Gc(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),pi({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&T({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&Hc(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});w(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=Kc(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=Kc(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),Wc({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Hc(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&Uc(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=Kc(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);w(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=Kc(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);w(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Wc({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Uc(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),E=_?n.noEOFCRDeletions:!1,D=_?n.noEOFCRAdditions:!1,O=(s?.noEOFCR??!1)||E,k=(o?.noEOFCR??!1)||D;if(k||O){if(a===`split`&&C.flush(),O){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(Nc(e)),x.pushToGutter(`unified`,G(e,`metadata`,1))):(x.deletionsContentAST.push(Nc(e)),x.pushToGutter(`deletions`,G(e,`metadata`,1)),k||(x.pushToGutter(`additions`,G(void 0,`buffer`,1)),x.additionsContentAST.push(Mc(1))))}if(k){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(Nc(e)),x.pushToGutter(`unified`,G(e,`metadata`,1))):(x.additionsContentAST.push(Nc(e)),x.pushToGutter(`additions`,G(e,`metadata`,1)),O||(x.pushToGutter(`deletions`,G(void 0,`buffer`,1)),x.deletionsContentAST.push(Mc(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let E=Math.max(Lc(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),D=t.bufferBefore>0||t.bufferAfter>0,O=!f&&e.type!==`deleted`,k=!f&&e.type!==`new`,A=x.rowCount>0||D;h=O&&A?h:void 0,g=k&&A?g:void 0,_=f&&A?_:void 0;let j=this.createPreElement(g!=null&&h!=null,E);return{fileDiff:e,unifiedGutterAST:f&&A?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:k&&A?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:O&&A?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:j,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(e),totalLines:E,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=br(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,to(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(W({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(W({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(W({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:W({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(!ba(n))return;let i=e.type===`new`?[]:this.getAnnotationNames(ya(this.deletionAnnotations)),a=e.type===`deleted`?[]:this.getAnnotationNames(ya(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){Wc({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}Wc({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(this.annotationSlotName(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(this.annotationSlotName(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}}getAnnotationNames(e){return e?.map(e=>this.annotationSlotName(e))??[]}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return ro({fileOrDiff:e,mode:t,stickyHeader:n})}},Bc=new Intl.PluralRules(`en-US`);function Vc(e){return`${e} unmodified line${Bc.select(e)===`one`?``:`s`}`}function Hc(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function Uc(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 Wc({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`,G(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`,G(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`,G(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function Gc(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,Fc({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(Fc({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,Fc({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(Fc({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=Ic(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?Vc(n):`More unchanged context may be available`;c.pushToGutter(e,Fc({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(Fc({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function Kc(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function qc(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function Jc(e,t,n,r){let i=qc(e),a=qc(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let e=s;e<t.length;e++)l[e]??=Yc(e,r.getLineText(e));return l}function Yc(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function Xc(e){let t=[];for(let n=0;n<e.lineCount;n++)t.push(e.getLineText(n,!0));return t}function Zc(e){if(e.lang!=null)return[e.lang];let t=H(e.prevName??e.name),n=H(e.name);return t===n?[n]:[t,n]}function Qc(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function $c(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function el(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function tl(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function nl(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:No(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function rl(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function il(e){let t={...e};return delete t.cacheKey,t}function al(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??H(e.name),r=t.lang??H(t.name),i=e.type!==`new`,a=t.type!==`new`;return e.name!==t.name||n!==r||i!==a||e.deletionLines.length!==t.deletionLines.length||e.deletionLines.some((e,n)=>e!==t.deletionLines[n])}function ol(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function sl(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&ol(n.lines,t.deletionLines)}var cl=-1,ll=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++cl}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;editSession;renderedDiff;renderRange;pendingFiles;appliedPreAttributes;headerCache={lastRenderedHTML:void 0,html:void 0,fileDiff:void 0};lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:R},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Wa,this.scrollSyncManager=new zs,this.interactionManager=new wa(`diff`,Ta(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()};getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??R}getHunksRendererOptions(e){return nl(e)}createHunksRenderer(e){return new zc(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>this.getLineIndexForDiff(this.getDiffForLineIndex(),e,t);getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(e,t,n){if(e==null)return;let r=e.hunks.at(-1),i,a;hunkIterator:for(let o of e.hunks){let e=n===`deletions`?o.deletionStart:o.additionStart,s=n===`deletions`?o.deletionCount:o.additionCount,c=z(e,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(t<c){let e=c-t;i=Math.max(u-e,0),a=Math.max(l-e,0);break hunkIterator}if(t>=c+s){if(o===r){let e=t-(c+s);i=u+o.unifiedLineCount+e,a=l+o.splitLineCount+e;break hunkIterator}continue}for(let e of o.hunkContent)if(e.type===`context`){if(t<c+e.lines){let e=t-c;a=l+e,i=u+e;break hunkIterator}c+=e.lines,l+=e.lines,u+=e.lines}else{let r=n===`deletions`?e.deletions:e.additions;if(t<c+r){let r=t-c;i=u+(n===`additions`?e.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(e.deletions,e.additions),u+=e.deletions+e.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]}setOptions(e){e!=null&&(this.options=e,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Ta(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!mr(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>Mo(this.editSession?.annotations,e,dn);getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){let t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,jo(t,e,dn))}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.hunksRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.getLatestAnnotations().length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){let{editor:t}=this;fa(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,e||(this.pendingFiles=void 0),this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,e||this.clearReusableHeader(),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.renderedDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=Ko(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||ml(this.pre,fl({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||hl(this.headerElement,pl({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,forceRender:l||a.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Bo(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)!(e instanceof HTMLElement)||e.tagName.toLowerCase()!==`code`||(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?Ls(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderedDiff=this.fileDiff,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;if(e==null||t==null||!rl(e)||this.pendingFiles?.fileDiff===e)return;let n=this.loadFilesForDiff(e,t),r=this.pendingFiles={fileDiff:e,promise:n};r.promise=n.finally(()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}}async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(Qo(`merge`,e,t),this.setHydratedState(t),this.startHydratedEditSession(e)){this.rerender();return}await Ho(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender()}}startHydratedEditSession(e){if(e.isPartial)throw Error(`FileDiff.startHydratedEditSession: diffs cannot be partial for editing`);if(this.fileDiff!==e)return!1;let{editor:t}=this;return this.editSession?.outgoingDiff==null?t==null||this.editSession!=null?!1:(this.installEditSession(e,t.__getDocumentContents(ul(e)),t.__getDocumentSessionState()),!0):(this.installEditSession(e),!0)}updateExternalDiff(e,t){if(J(this.fileDiff,e))return!1;let n=this.editSession?.outgoingDiff??this.editSession?.diff;return this.fileDiff=e,n==null?this.editor!=null&&(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e,this.editor.__getDocumentContents(ul(e)),this.editor.__getDocumentSessionState())):(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e),this.editSession!=null&&(this.editSession.outgoingDiff=n)),this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=Ao(t,dn,this.editSession.annotations)),!0}installEditSession(e,t,n){let r=e.additionLines.join(``),i=t==null?void 0:Zo(t.contents),a=n!=null&&sl(n,e);if(n!=null&&!a)throw Error(`FileDiff: retained session cannot resume against a different old file`);if(t!=null&&t.contents!==r&&!a)throw Error(`FileDiff: retained edits are missing their diff session state`);let o=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===r,s=il(e);t!=null&&i!=null&&!o&&(s.name=t.name,s.lang=t.lang),a&&n!=null&&i!=null&&(s.additionLines=i,s.type=n.type,s.hunks=n.hunks,s.editSessionDirty=!0,ic(s)),this.editSession={diff:s,annotations:this.editSession?.annotations??Ao(this.lineAnnotations,dn),outgoingDiff:this.editSession?.outgoingDiff},this.hunksRenderer.beginEditSession(s,o&&!a?e:void 0)}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let l=Ko(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!dl(u,this.deletionFile)||!dl(d,this.additionFile)),y=e!=null&&!J(e,this.fileDiff),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&Qa(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&!y||e==null&&!v)){let e=this.applyCachedThemeState(p);return e&&this.finalizeRender(),e}let x;e==null&&_&&(v||this.fileDiff==null)&&(x=Ls(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&y?this.updateExternalDiff(e,i):x!=null&&(y=!0,this.updateExternalDiff(x,i)),y&&this.clearReusableHeader(),i!=null&&this.setLineAnnotations(i);let C=this.getLatestDiff();if(C==null)return!1;C.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(gc(C,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());let{disableErrorHandling:w=!1,disableFileHeader:T=!1}=this.options;if(T&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(C,un);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a,e.fileDiff),this.renderSeparators([]),this.renderedDiff=e?.fileDiff??C,this.injectUnsafeCSS()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return this.finalizeRender(),r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g||!J(this.renderedDiff,C))&&this.applyPartialRender({fileDiff:C,previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(C,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a,t.fileDiff),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.renderedDiff=t.fileDiff}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(w)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}finalizeRender(){}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)}getLatestDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedDiff}syncRenderViewToEditor(){let{editor:e,fileContainer:t}=this,n=this.getLatestAnnotations(),r=this.computeEditorRenderRange(this.renderRange),i=this.getLatestDiff();if(e==null||t==null||i==null||i.isPartial)return;let a=a=>{if(!this.enabled||this.editor!==e||this.fileContainer!==t||this.getLatestDiff()!==i)return;let o=this.editSession?.outgoingDiff,s=this.fileDiff,c=o!=null&&s!=null&&o!==i,l=c?al(o,s):!1;e.__syncRenderView({highlighter:a,fileContainer:t,fileDiff:i,lineAnnotations:n,renderRange:r,externalDocument:c,resetHistory:l})},o=this.getTheme(),s=i.lang??H(i.name),c=fr({theme:o,lang:s});c==null?dr({themes:Sn(o),langs:[`text`,s],preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(a):a(c)}computeEditorRenderRange(e){let t=this.getLatestDiff();if(e==null||t==null||lo(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return pi({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.outgoingDiff=void 0)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(e=!0){let{fileDiff:t,editSession:{diff:n,outgoingDiff:r}={}}=this;if(r!=null&&t!=null){if(!t.isPartial&&al(r,t))return;n=r}if(!(n==null||n.isPartial))return{diffSession:{oldFile:n.type===`new`?null:{name:n.prevName??n.name,lines:e?[...n.deletionLines]:n.deletionLines},type:n.type,hunks:e?qo(n.hunks):n.hunks},hasChanges:n.editSessionDirty===!0}}__attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw Error(`FileDiff.__attachEditor: an editor is already attached`);let t=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`FileDiff.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){let{fileDiff:t}=this,n=this.editSession?.outgoingDiff;n!=null&&t!=null&&!t.isPartial&&this.editSession?.diff===n&&this.installEditSession(t);let r=this.editSession==null&&t!=null&&!t.isPartial?t:void 0;r==null?this.editSession!=null&&this.hunksRenderer.beginEditSession(this.editSession.diff):this.installEditSession(r,e.__getDocumentContents(ul(r)),e.__getDocumentSessionState()),this.editor=e,this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary();let i=this.editSession?.diff;this.hunksRenderer.editorRenderReady()?(i!=null&&this.hunksRenderer.diffCache===i&&(this.renderedDiff=i),this.syncRenderViewToEditor()):this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n,fileDiff:r,lineAnnotations:i}=this;if(n==null||r==null)return;let{diff:a,annotations:o}=n;if(this.editor!=null)throw Error(`FileDiff.__completeEditSession: detach the editor before completing the session`);this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();let s=o?.current,c,l=null,u=null,d=!1,f;if(t==null)throw Error(`FileDiff.__completeEditSession: editor is required for completion`);let p=Jo(a),m={name:p.name,contents:p.additionLines.join(``)};p.lang!=null&&(m.lang=p.lang);let h={fileDiff:p,editor:t,originalFileDiff:r,oldFile:p.type===`new`?null:{name:p.prevName??p.name,contents:p.deletionLines.join(``)},newFile:m,lineAnnotations:s,originalLineAnnotations:i};Object.freeze(h);try{if(t.__emitEditComplete(h),this.options.onEditComplete?.(h)===`accept`){if(p.cacheKey!=null&&p.cacheKey===r.cacheKey)throw Error(`FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey`);c=p,l=h.oldFile,u=h.newFile}}catch(e){d=!0,f=e}if(e&&c!=null&&(this.fileDiff=c,this.additionFile!=null&&(this.deletionFile=l,this.additionFile=u),s!=null&&(this.lineAnnotations=s)),this.editSession=void 0,e&&this.fileContainer!=null&&this.rerender(),d)throw f}finalizeEditSessionHunks(){let e=this.getLatestDiff();if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=mc(e,this.hunksRenderer.getExpandedHunksMap(),t);return gc(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(hc(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){let n=this.editSession?.diff;if(n==null)throw Error(`FileDiff.applyDocumentChange: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(n),this.hunksRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let r=this.editSession?.diff;if(r==null)throw Error(`FileDiff.updateRenderCache: requires an active edit session`);this.detachAdditionLines(),this.hunksRenderer.beginEditSession(r);let{shouldRefreshDiffsView:i,lineCountChangeInFlight:a}=n;if(this.hunksRenderer.updateRenderCache(e,t,a)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}i===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}detachAdditionLines(){let e=this.editSession?.diff,{fileDiff:t}=this;e!=null&&(e.additionLines===t?.additionLines||e.additionLines===e.deletionLines)&&(e.additionLines=[...e.additionLines])}isLineRenderable(e){let t=this.getRenderedDiff();if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return ai({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.getRenderedDiff();if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return oi({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.getRenderedDiff(),{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=ti(o);if(e<s){let c=X({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=ii({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=ti(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){da(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||Yr(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=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||!tl(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,n=this.getLatestAnnotations();if(t!=null&&n.length>0)for(let[r,i]of n.entries()){let n=this.getAnnotationSlotName(i),a=`${r}-${n}`,o=this.annotationCache.get(a);if(o==null||!el(i,o.annotation)){o?.element.remove();let e=t(i);if(e==null)continue;o={element:ho(n),annotation:i},o.element.appendChild(e),this.fileContainer.appendChild(o.element),this.annotationCache.set(a,o)}e.delete(a)}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=go();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.headerCache.lastRenderedHTML=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:ha(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):ha(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=uo;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{headerCache:{fileDiff:r,html:i,lastRenderedHTML:a}}=this,o=(n!==this.editSession?.diff&&J(r,n)?i:void 0)??ve(e);if(this.headerCache.html=o,this.headerCache.fileDiff=n,o!==a){let e=document.createElement(`div`);e.innerHTML=o;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.headerCache.lastRenderedHTML=o}if(this.isContainerManaged)return;let{renderCustomHeader:s,renderHeaderPrefix:c,renderHeaderFilenameSuffix:l,renderHeaderMetadata:u}=this.options;if(s!=null){let e=s(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,en,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let d=c?.(n)??void 0,f=l?.(n)??void 0,p=u?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Zt,d),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Qt,f),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,$t,p),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=_o(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=wo(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=yo(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=Io({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:To(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=Eo(this.themeCSSStyle.textContent??``,yo(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&zo()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Fo(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=gl(t[0]),a=gl(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=ve(i),r.content.innerHTML=ve(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Po({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Po({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=Po({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({fileDiff:e,previousRenderRange:t,renderRange:n}){let{pre:r,codeUnified:i,codeAdditions:a,codeDeletions:o,options:{diffStyle:s=`split`}}=this;if(r==null||t==null||n==null||!Number.isFinite(t.totalLines)||!Number.isFinite(n.totalLines)||this.lastRowCount==null)return!1;let c=this.getCodeColumns(s,i,o,a);if(c==null)return!1;let l=t.startingLine,u=n.startingLine,d=l+t.totalLines,f=u+n.totalLines,p=Math.max(l,u),m=Math.min(d,f);if(m<=p)return!1;let h=Math.max(0,p-l),g=Math.max(0,d-m),_=this.trimColumns({columns:c,trimStart:h,trimEnd:g,previousStart:l,overlapStart:p,overlapEnd:m,diffStyle:s});if(_<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<_)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let v=this.lastRowCount-_,y=(t,n)=>{if(!(n<=0))return this.hunksRenderer.renderDiff(e,{startingLine:t,totalLines:n,bufferBefore:0,bufferAfter:0})},b=y(u,Math.max(p-u,0));if(b==null&&u<p)return!1;let x=y(m,Math.max(f-m,0));if(x==null&&f>m)return!1;let S=(e,t)=>{if(e!=null){if(s===`unified`&&!Array.isArray(c))this.insertPartialHTML(s,c,e,t);else if(s===`split`&&Array.isArray(c))this.insertPartialHTML(s,c,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);v+=e.rowCount,this.renderedDiff=e.fileDiff}};return this.cleanupErrorWrapper(),S(b,`afterbegin`),S(x,`beforeend`),this.lastRowCount!==v&&(this.applyRowSpan(s,c,v),this.lastRowCount=v),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`split`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(n))return;let r=(e,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(e,t),i=gl(r?.[0]),a=gl(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};r(`deletions`,n[0]),r(`additions`,n[1]),this.renderedDiff=t.fileDiff}refreshUnifiedDiffView(){let e=this.getLatestDiff();if(this.options.diffStyle!==`unified`||e==null)return;let t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;let n=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(n==null||Array.isArray(n))return;let r=this.hunksRenderer.renderCodeAST(`unified`,t),i=gl(r?.[0]),a=gl(r?.[1]),o=()=>{for(let[e,t]of[[n.gutter,i],[n.content,a]])t!=null&&(e.innerHTML=ve(t));t.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,n,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?Fo(this.pre,o):o(),this.renderSeparators(t.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=gl(t[0]),i=gl(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};fo(u,this.appliedPreAttributes)||(Vo(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 ul(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function dl(e,t){return e==null||t==null?e==null&&t==null:Jr(e,t)}function fl({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function pl({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function ml(e,t,n=!1){return!n&&e==null&&t}function hl(e,t,n=!1){return e==null&&t&&!n}function gl(e){if(e!=null&&e.type===`element`)return e.children??[]}var _l=3e3,vl=new Map,yl=-1,bl=class extends ll{__id=`little-virtualized-file-diff:${++yl}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:vl,ghostTextRowsByIndex:new Map};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;pendingHydratedDiff;pendingExpansions;pendingRender;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=Xr(n)}setMetrics(e,t=!1){let n=Xr(e);!t&&oa(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.resetLayoutCache({includeEstimatedHeights:!1}),!0):!1}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e){let t=this.getLatestAnnotations();return va(t)?t.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1):!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=!sa(t,e),r=n&&Ol(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:kl(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,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=vl,this.cache.ghostTextRowsByIndex.size>0&&this.cache.ghostTextRowsByIndex.clear(),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}applyGhostTextRows(e,t){let{cache:{heightDeltas:n,ghostTextRows:r,ghostTextRowsByIndex:i},metrics:{lineHeight:a}}=this;if(r===t)return!1;let o=this.getDiffStyle(),s=new Map;for(let[n,r]of t){let t=this.getLineIndexForDiff(e,n+1,`additions`);t!=null&&s.set(o===`split`?t[1]:t[0],r)}let c=!1;for(let e of new Set([...i.keys(),...s.keys()])){let t=((s.get(e)??0)-(i.get(e)??0))*a;if(t===0)continue;let r=(n.get(e)??0)+t;r===0?n.delete(e):n.set(e,r),this.cache.measuredHeightDeltaTotal+=t,c=!0}return this.cache.ghostTextRows=t,this.cache.ghostTextRowsByIndex=s,c}reconcileHeights(){let e=!1,{options:{overflow:t=`scroll`},cache:{ghostTextRowsByIndex:n},metrics:{lineHeight:r}}=this,i=this.getRenderedDiff();if(this.fileContainer==null||i==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(i,this.editor?.__getGhostTextRows()??vl);let a=this.getLatestAnnotations();if(t===`scroll`&&a.length===0&&!this.isResizeDebuggingEnabled())return e&&this.computeApproximateSize(!0),e;let o=this.getDiffStyle(),s=o===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],c=this.hasFileAnnotations(i);if(this.renderRange!=null&&c&&ba(this.renderRange)){let t=xl(s)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!c&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of s){if(t==null)continue;let i=t.children[1];if(!(i instanceof HTMLElement))continue;let a=o===`split`&&t===this.codeDeletions;for(let t of i.children){if(!(t instanceof HTMLElement))continue;let i=t.dataset.lineIndex;if(i==null)continue;let s=Nl(i,o),c=n.get(s)??0;if(a&&c>0)continue;let l=t.getBoundingClientRect().height+c*r,u=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(u=!0),l+=t.nextElementSibling.getBoundingClientRect().height);let d=this.getEstimatedLineHeight(u),f=this.cache.heightDeltas.get(s)??0,p=l-d;p!==f&&(e=!0,this.cache.measuredHeightDeltaTotal+=p-f,p===0?this.cache.heightDeltas.delete(s):this.cache.heightDeltas.set(s,p))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}updateCodeViewLayout(e,t,n,r){let i=!1,a=!1,{pendingExpansions:o,pendingHydratedDiff:s,options:{collapsed:c=!1}}=this;if(s!=null&&(this.pendingHydratedDiff=void 0,s.expectedDiff===e&&(Object.assign(e,s.nextDiff),this.setHydratedState(s.files),this.startHydratedEditSession(e),this.forceRenderOverride=!0,i=!0,a=!0)),o!=null){this.pendingExpansions=void 0;for(let{hunkIndex:e,direction:t,expansionLineCountOverride:n}of o)this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,a=!0}let l=this.updateExternalDiff(e,r),{pendingRenderDiff:u,layoutDiffChanged:d,renderedDiffChanged:f,annotationsChanged:p}=this.updatePendingRender(e,r);return!this.forceRenderOverride&&(l||f||p)&&(this.forceRenderOverride=!0),(n?.resetDiffLayoutCache===!0||d||p)&&(i=!0),(d||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(a=!0),n?.metrics!=null&&(this.metrics=Xr(n.metrics),i=!0,a=!0),this.currentCollapsed!==c&&(this.currentCollapsed=c,i=!0),i?this.resetLayoutCache({includeEstimatedHeights:a}):a&&this.invalidateDerivedLayoutCache(!0),this.top=t,this.computeApproximateSize(!1,u),this.height}getLinePosition(e,t=`additions`){let n=this.getLayoutDiff();if(n==null||e<1)return;let r=this.getLineIndexForDiff(n,e,t);if(r==null)return;let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options,c=this.getDiffStyle(),l=this.getHunkSeparatorType(),u=c===`split`?r[1]:r[0];this.approximateLayoutCheckpoints(n);let d=Zr(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:d,height:0};let m;return pi({diff:n,diffStyle:c,startingLine:f?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=c===`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=di({type:l,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(p+=r.gapBefore,u>=o-n&&u<o)return m={top:p,height:r.height},!0;p+=r.height+r.gapAfter}}let s=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===u)return m={top:p,height:s},!0;if(p+=s,r>0){let e=fi({type:l,metrics:this.metrics});if(e!=null){if(u>o&&u<=o+r)return m={top:p+e.gapBefore,height:e.height},!0;p+=e.totalHeight}}return!1}}),m}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){let t=this.getLayoutDiff();if(t==null)return;let{disableFileHeader:n=!1,expandUnchanged:r=!1,collapsed:i=!1,collapsedContextThreshold:a=1}=this.options;if(i)return;let o=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(t);let c=this.getLayoutCheckpointBeforeTop(e),l=c?.top??Zr(this.metrics,n)+this.cache.fileAnnotationHeight,u;return pi({diff:t,diffStyle:o,startingLine:c?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:a,additionLine:c})=>{let d=o===`split`?c?.splitLineIndex??a?.splitLineIndex:c?.unifiedLineIndex??a?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=di({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(l+=e.totalHeight)}if(l>=e&&(a==null?c!=null&&(u={lineNumber:c.lineNumber,side:`additions`,top:l}):u={lineNumber:a.lineNumber,side:`deletions`,top:l},u!=null))return!0;let f=this.getLineHeight(d,(c?.noEOFCR??!1)||(a?.noEOFCR??!1));if(l+=f,i>0){let e=fi({type:s,metrics:this.metrics});e!=null&&(l+=e.totalHeight)}return!1}}),u}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutDiff();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!J(this.getRenderedDiff(),this.getLatestDiff()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(this.isAdvancedMode()){let n=Qo(`clone`,e,t);if(await Ho(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(Qo(`merge`,e,t),this.setHydratedState(t),!this.startHydratedEditSession(e)&&(await Ho(()=>this.primeHighlightCache(e)),!this.enabled||this.fileDiff!==e))return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.getRenderedDiff();if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return ai({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),!(!this.enabled||this.fileDiff==null)&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}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(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;let e=this.getLatestDiff(),t=e==null?void 0:this.hunksRenderer.getDiffForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!J(this.getRenderedDiff(),t))}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});let i=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&i!=null){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(i,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutDiff()){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(t,this.editor?.__getGhostTextRows()??vl);let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=Zr(this.metrics,i);if(this.height+=o,a){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getActiveEstimatedHeight(e=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.getLayoutDiff()){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=Uo({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Al(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.getLayoutDiff()){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:e.name,elementHeight:t.height,computedHeight:this.height})}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=Ko(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!Ml(s,this.deletionFile)||!Ml(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=Ls(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!J(this.fileDiff,u),m=p||l;if(e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;p&&this.updateExternalDiff(u,r);let{pendingRenderDiff:h,layoutDiffChanged:g,renderedDiffChanged:_,annotationsChanged:v}=this.pendingRender!=null&&this.pendingRender.latestDiff===(this.getLatestDiff(u)??u)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:!1}:this.updatePendingRender(u,r);if((v||g)&&this.resetLayoutCache({includeEstimatedHeights:g}),f)this.top??=this.getVirtualizedTop(),g&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,h));else{this.computeApproximateSize(!1,h);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()&&(!m||!f))return a!=null&&(this.deletionFile=s,this.additionFile=c),p&&this.clearReusableHeader(),this.pendingRender=void 0,this.renderPlaceholder(this.height);let y=this.virtualizer.getWindowSpecs(),b=this.top??0,x=this.computeRenderRangeFromWindow(h,b,y);return super.render({fileDiff:u,fileContainer:e,renderRange:x,lineAnnotations:r,forceRender:(d??n)||v||_||p,...a,...i})}finalizeRender(){if(this.getRenderedDiff()!==this.pendingRender?.diff)throw Error(`VirtualizedFileDiff.render: rendered a different diff than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getLatestDiff(e)??e,r=this.getRenderedDiff(),{pendingRender:i}=this,a=i?.diff??r,o=this.hunksRenderer.getDiffForNextRender(n);return this.pendingRender={latestDiff:n,diff:o},{pendingRenderDiff:o,annotationsChanged:this.syncLineAnnotations(t),layoutDiffChanged:!J(a,o),renderedDiffChanged:!J(r,o)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}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}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return jl(this.options.hunkSeparators)}approximateLayoutCheckpoints(e){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=Al(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=Sl(this.cache.heightDeltas),u=Zr(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=Tl(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+El(i,e)*this.metrics.lineHeight+Cl(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=_l}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Cl(l,t,t+e)+r,d=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let l=X({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?di({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?ii({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?fi({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:Dl({diffStyle:o,hunk:n,rowCount:g})}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}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}=X({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=ii({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=t===`split`?e.splitLineCount:e.unifiedLineCount;return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}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=Al(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=Zr(this.metrics,i),h=e.hunks.length>0?$r(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],D=(n+r)/2,O=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),k=t+(O?.top??_),A=O?.renderedLineIndex??0,j,M,N;if(pi({diff:e,diffStyle:l,startingLine:O?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,deletionLine:f,additionLine:p})=>{let m=p==null?f.splitLineIndex:p.splitLineIndex,h=p==null?f.unifiedLineIndex:p.unifiedLineIndex,g=(p?.noEOFCR??!1)||(f?.noEOFCR??!1),v=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?di({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;k+=y;let b=A%s===0,x=Math.floor(A/s);if(b&&(E[x]=k-(t+_+y),N!=null)){if(N<=0)return!0;N--}let S=this.getLineHeight(l===`split`?m:h,g);if(k>n-S&&k<r&&(j??=x),M==null&&k+S>D&&(M=x),N==null&&k>=r&&b&&(N=T),A++,k+=S,c>0||v&&d){let e=fi({type:u,metrics:this.metrics});e!=null&&(k<r&&k+e.totalHeight>n&&(j??=x),M==null&&k+e.totalHeight>D&&(M=x),k+=e.totalHeight)}return!1}}),j==null){if(x)j=0,M=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}M??=j;let ee=Math.round(M-w/2),te=Math.max(0,Math.ceil(p/s)-w),ne=Math.max(0,Math.min(ee,te)),re=ne*s,ie=ee<0?C+ee*s:C,ae=E[ne]??0,oe=re===0?0:g+ae,se=ne+ie/s,ce=se<E.length?v-E[se]:v-(k-t-_);return{startingLine:re,totalLines:ie,bufferBefore:oe,bufferAfter:Math.max(0,ce)}}};function xl(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===_a&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function Sl(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 Cl({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=wl(e,n);return(t[wl(e,r)]??0)-(t[i]??0)}function wl(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 Tl(e){return Math.ceil(e/_l)*_l}function El(e,t){let n=0;for(let r of e)r<t&&n++;return n}function Dl({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 Ol(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.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function kl(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Al(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function jl(e){return typeof e==`function`?`custom`:e??`line-info`}function Ml(e,t){return e==null||t==null?e==null&&t==null:Jr(e,t)}function Nl(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function Pl(e,t){return typeof window>`u`&&t!=null?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,I.jsx)(I.Fragment,{children:e})}var Fl=(0,F.createContext)(void 0);function Il(){return(0,F.useContext)(Fl)}var Ll=typeof window>`u`?F.useEffect:F.useLayoutEffect;function Rl({fileDiff:e,oldFile:t,newFile:n,options:r,editorOptions:i,editStateKey:a,lineAnnotations:o,selectedLines:s,prerenderedHTML:c,metrics:l,hasGutterRenderUtility:u,hasCustomHeader:d,disableWorkerPool:f,edit:p,onEditChange:m,onEditComplete:h}){let g=Il(),_=s!==void 0,v=(0,F.useContext)(aa),y=Bt(),b=Rt(e=>m?.(e)),x=m==null?void 0:b,S=(0,F.useRef)(null),C=Rt(r=>{let i=h?.(r)??`reject`;return i===`accept`&&(S.current={fileDiff:{installed:r.fileDiff,stale:r.originalFileDiff},filePair:e==null?{fileDiff:r.fileDiff,installed:{oldFile:r.oldFile,newFile:r.newFile},stale:{oldFile:t??null,newFile:n??null}}:null,annotations:{installed:r.lineAnnotations,stale:r.originalLineAnnotations}}),i}),w=h==null?void 0:C,T=zl({acceptedCache:S,fileDiff:e,newFile:n,oldFile:t,parseDiffOptions:r?.parseDiffOptions}),E=(0,F.useRef)(null),D=(0,F.useRef)(null),O=Rt(()=>{if(y==null)throw Error(`FileDiff: EditContext is not attached`);return y(`file-diff`,i??{},a)}),k=Rt(e=>{if(e!=null){if(E.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);g==null?E.current=new ll(Hl({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:x,onEditComplete:w,options:r}),f?void 0:v,!0):E.current=new bl(Hl({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:x,onEditComplete:w,options:r}),g,l,f?void 0:v,!0),p&&D.current==null&&(D.current=Ul(E.current,O)),E.current.hydrate({fileDiff:T,fileContainer:e,lineAnnotations:o,prerenderedHTML:c})}else{if(E.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);E.current.cleanUp(),E.current=null,D.current=null}});return Ll(()=>{let{current:e}=E;if(e==null)return;let t=Hl({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:x,onEditComplete:w,options:r}),n=t!==void 0&&!sa(e.options,t);if(e.setOptions(t),!p&&D.current!=null){let{current:e}=D;D.current=null,e()}let i=Vl(T,o,S);e.render({forceRender:n,fileDiff:i.fileDiff,lineAnnotations:i.lineAnnotations}),s!==void 0&&e.setSelectedLines(s),p&&D.current==null&&(D.current=Ul(e,O))}),{fileDiff:T,ref:k,getHoveredLine:(0,F.useCallback)(()=>E.current?.getHoveredLine(),[]),getAnnotationSlotName:(0,F.useCallback)(e=>E.current?.getAnnotationSlotName(e)??dn(e),[])}}function zl({acceptedCache:e,fileDiff:t,newFile:n,oldFile:r,parseDiffOptions:i}){return(0,F.useMemo)(()=>{if(t!=null)return t;let{current:a}=e,o=a?.filePair;if(a!=null&&o!=null){if(Bl(r,n,o.stale)||Bl(r,n,o.installed))return o.fileDiff;a.filePair=null}return Ls(r??null,n??null,i)},[e,t,r,n,i])}function Bl(e,t,n){return ga(e??void 0,n.oldFile??void 0)&&ga(t??void 0,n.newFile??void 0)}function Vl(e,t,n){let{current:r}=n;if(r==null)return{fileDiff:e,lineAnnotations:t};let{fileDiff:i,annotations:a}=r,o=e;i!=null&&(J(e,i.stale)?o=i.installed:r.fileDiff=null);let s=t;return a!=null&&(t===a.stale?s=a.installed:r.annotations=null),r.fileDiff==null&&r.annotations==null&&r.filePair==null&&(n.current=null),{fileDiff:o,lineAnnotations:s}}function Hl({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return t||r||n||i!=null||a!=null?{...e,controlledSelection:t,renderCustomHeader:n?Ut:e?.renderCustomHeader,renderGutterUtility:r?Ut:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}:e}function Ul(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function Wl({oldFile:e,newFile:t,options:n,editorOptions:r,editStateKey:i,metrics:a,lineAnnotations:o,selectedLines:s,className:c,style:l,prerenderedHTML:u,renderAnnotation:d,renderCustomHeader:f,renderHeaderPrefix:p,renderHeaderFilenameSuffix:m,renderHeaderMetadata:h,renderGutterUtility:g,disableWorkerPool:_=!1,edit:v=!1,onEditChange:y,onEditComplete:b}){let{fileDiff:x,ref:S,getHoveredLine:C,getAnnotationSlotName:w}=Rl({oldFile:e,newFile:t,options:n,editorOptions:r,editStateKey:i,metrics:a,lineAnnotations:o,selectedLines:s,prerenderedHTML:u,hasGutterRenderUtility:g!=null,hasCustomHeader:f!=null,disableWorkerPool:_,edit:v,onEditChange:y,onEditComplete:b}),T=hn({fileDiff:x,renderCustomHeader:f,renderHeaderPrefix:p,renderHeaderFilenameSuffix:m,renderHeaderMetadata:h,renderAnnotation:d,lineAnnotations:o,renderGutterUtility:g,getHoveredLine:C,getAnnotationSlotName:w});return(0,I.jsx)(Wt,{ref:S,className:c,style:l,children:Pl(T,u)})}function Gl({filename:e,className:t}){let n=e.split(`.`).pop()?.toLowerCase()??``,r=t??`w-2.5 h-2.5 shrink-0`;return n===`ts`||n===`tsx`?(0,I.jsx)(`svg`,{viewBox:`0 0 32 32`,className:r,children:(0,I.jsx)(`path`,{d:`M23.827,8.243A4.424,4.424,0,0,1,26.05,9.524a5.853,5.853,0,0,1,.852,1.143c.011.045-1.534,1.083-2.471,1.662-.034.023-.169-.124-.322-.35a2.014,2.014,0,0,0-1.67-1c-1.077-.074-1.771.49-1.766,1.433a1.3,1.3,0,0,0,.153.666c.237.49.677.784,2.059,1.383,2.544,1.095,3.636,1.817,4.31,2.843a5.158,5.158,0,0,1,.416,4.333,4.764,4.764,0,0,1-3.932,2.815,10.9,10.9,0,0,1-2.708-.028,6.531,6.531,0,0,1-3.616-1.884,6.278,6.278,0,0,1-.926-1.371,2.655,2.655,0,0,1,.327-.208c.158-.09.756-.434,1.32-.761L19.1,19.6l.214.312a4.771,4.771,0,0,0,1.35,1.292,3.3,3.3,0,0,0,3.458-.175,1.545,1.545,0,0,0,.2-1.974c-.276-.395-.84-.727-2.443-1.422a8.8,8.8,0,0,1-3.349-2.055,4.687,4.687,0,0,1-.976-1.777,7.116,7.116,0,0,1-.062-2.268,4.332,4.332,0,0,1,3.644-3.374A9,9,0,0,1,23.827,8.243ZM15.484,9.726l.011,1.454h-4.63V24.328H7.6V11.183H2.97V9.755A13.986,13.986,0,0,1,3.01,8.289c.017-.023,2.832-.034,6.245-.028l6.211.017Z`,fill:`#007acc`})}):n===`js`||n===`mjs`||n===`cjs`||n===`jsx`?(0,I.jsxs)(`svg`,{viewBox:`0 0 32 32`,className:r,children:[(0,I.jsx)(`rect`,{x:`2`,y:`2`,width:`28`,height:`28`,rx:`1.312`,fill:`#f5de19`}),(0,I.jsx)(`path`,{d:`M20.809,23.875a2.866,2.866,0,0,0,2.6,1.6c1.09,0,1.787-.545,1.787-1.3,0-.9-.715-1.222-1.916-1.747l-.658-.282c-1.9-.809-3.16-1.822-3.16-3.964,0-1.973,1.5-3.476,3.853-3.476a3.889,3.889,0,0,1,3.742,2.107L25,18.128A1.789,1.789,0,0,0,23.311,17a1.145,1.145,0,0,0-1.259,1.128c0,.789.489,1.109,1.618,1.6l.658.282c2.236.959,3.5,1.936,3.5,4.133,0,2.369-1.861,3.667-4.36,3.667a5.055,5.055,0,0,1-4.795-2.691Zm-9.295.228c.413.733.789,1.353,1.693,1.353.864,0,1.41-.338,1.41-1.653V14.856h2.631v8.982c0,2.724-1.6,3.964-3.929,3.964a4.085,4.085,0,0,1-3.947-2.4Z`,fill:`#000`})]}):n===`json`||n===`jsonc`?(0,I.jsxs)(`svg`,{viewBox:`0 0 32 32`,className:r,children:[(0,I.jsx)(`path`,{d:`M4.014,14.976a2.51,2.51,0,0,0,1.567-.518A2.377,2.377,0,0,0,6.386,13l.129-1.334A5.435,5.435,0,0,1,7.6,9.071,3.157,3.157,0,0,1,10.519,8h1.316v1.86H10.937a1.257,1.257,0,0,0-1.1.465,3.405,3.405,0,0,0-.357,1.585l-.127,1.244a3.283,3.283,0,0,1-.573,1.61A2.482,2.482,0,0,1,7.6,15.537a2.482,2.482,0,0,1,1.18.773A3.283,3.283,0,0,1,9.349,17.9l.127,1.244a3.405,3.405,0,0,0,.357,1.585,1.257,1.257,0,0,0,1.1.465h.9V23.06H10.519A3.157,3.157,0,0,1,7.6,21.981a5.435,5.435,0,0,1-1.082-2.595L6.386,18.05a2.377,2.377,0,0,0-.805-1.456A2.51,2.51,0,0,0,4.014,16.07Z`,fill:`#fbc02d`}),(0,I.jsx)(`path`,{d:`M27.986,16.07a2.51,2.51,0,0,0-1.567.518,2.377,2.377,0,0,0-.805,1.456l-.129,1.334a5.435,5.435,0,0,1-1.082,2.595A3.157,3.157,0,0,1,21.481,23.06H20.165V21.2h.9a1.257,1.257,0,0,0,1.1-.465,3.405,3.405,0,0,0,.357-1.585l.127-1.244a3.283,3.283,0,0,1,.573-1.61,2.482,2.482,0,0,1,1.18-.773,2.482,2.482,0,0,1-1.18-.773,3.283,3.283,0,0,1-.573-1.61L22.527,11.9a3.405,3.405,0,0,0-.357-1.585,1.257,1.257,0,0,0-1.1-.465h-.9V8h1.316a3.157,3.157,0,0,1,2.924,1.071,5.435,5.435,0,0,1,1.082,2.595l.129,1.334A2.377,2.377,0,0,0,26.419,14.458a2.51,2.51,0,0,0,1.567.518Z`,fill:`#fbc02d`})]}):null}function Kl({step:e,state:t,onComplete:n,input:r,output:i,isCollapsible:a=!1,approval:o,onFilePathClick:s}){te(t===`animating`,e.duration,n);let c=t===`animating`,l=e.filePath?.split(`/`).pop()??e.toolDetail,u=!!l,d=e.toolName===`Write`,[f,p]=F.useState(`light`),[m,h]=F.useState(!a);F.useEffect(()=>{if(typeof window>`u`)return;let e=()=>{let e=document.documentElement.classList.contains(`dark`);p(e?`dark`:`light`)};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>{t.disconnect()}},[]),F.useEffect(()=>{h(!a)},[a]);let g=F.useMemo(()=>{let t=l||`file`,n=typeof i?.old_content==`string`?i.old_content:void 0,a=typeof i?.content==`string`?i.content:void 0,o=!n&&typeof r?.old_string==`string`?r.old_string:void 0,s=!a&&typeof r?.new_string==`string`?r.new_string:void 0,c=e.diffLines?.filter(e=>e.type!==`add`).map(e=>e.content).join(`
|
|
1371
|
-
`),u=e.diffLines?.filter(e=>e.type!==`remove`).map(e=>e.content).join(`
|
|
1372
|
-
`),d=o??n??c??``,f=s??a??u??``;return!d&&!f?null:{oldFile:{name:t,contents:d},newFile:{name:t,contents:f}}},[l,r,i,e.diffLines]),_=F.useMemo(()=>f===`dark`?{"--diffs-bg":`#000`,"--diffs-bg-buffer-override":`#000`,"--diffs-bg-context-override":`#000`,"--diffs-bg-hover-override":`#0a0a0a`,"--diffs-bg-separator-override":`#0f0f0f`}:void 0,[f]),v=F.useMemo(()=>f===`dark`?`
|
|
1373
|
-
[data-diff],
|
|
1374
|
-
[data-file],
|
|
1375
|
-
[data-diffs-header],
|
|
1376
|
-
[data-error-wrapper],
|
|
1377
|
-
[data-virtualizer-buffer] {
|
|
1378
|
-
--diffs-bg: #000;
|
|
1379
|
-
--diffs-bg-buffer-override: #000;
|
|
1380
|
-
--diffs-bg-context-override: #000;
|
|
1381
|
-
--diffs-bg-hover-override: #0a0a0a;
|
|
1382
|
-
--diffs-bg-separator-override: #0f0f0f;
|
|
1383
|
-
}
|
|
1384
|
-
`:void 0,[f]),y=`an-edit-diff dark:bg-black dark:[--diffs-bg:#000] dark:[--diffs-bg-buffer-override:#000] dark:[--diffs-bg-context-override:#000] dark:[--diffs-bg-hover-override:#0a0a0a] dark:[--diffs-bg-separator-override:#0f0f0f]`;return(0,I.jsxs)(`div`,{className:`an-edit-tool-card overflow-hidden rounded-chat-tool border border-border bg-muted dark:bg-black`,children:[(0,I.jsxs)(`div`,{className:`flex h-7 items-center justify-between bg-muted px-2.5 py-0 `+(c&&!g?``:`border-b border-border`),children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[u&&(0,I.jsx)(Gl,{filename:l,className:`h-3 w-3 shrink-0`}),c&&!g?(0,I.jsx)(ie,{as:`span`,duration:1.2,className:`text-xs`,children:`Generating...`}):c?(0,I.jsxs)(ie,{as:`span`,duration:1.2,className:`text-xs`,children:[d?`Creating`:`Editing`,` `,l]}):(0,I.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[d?`Created`:`Edited`,` `,e.filePath&&s?(0,I.jsx)(`button`,{type:`button`,onClick:()=>s(e.filePath??``),className:`truncate underline-offset-2 hover:text-foreground hover:underline`,children:l}):l]})]}),e.diffStats&&!c&&(0,I.jsx)(`span`,{className:`inline-flex gap-2 font-mono text-caption text-muted-foreground`,children:e.diffStats.split(` `).map(e=>(0,I.jsx)(`span`,{className:e.startsWith(`+`)?`text-product-diff-added`:e.startsWith(`-`)?`text-product-diff-removed`:void 0,children:e},e))})]}),g?(0,I.jsx)(`div`,{className:`${y} text-label`,style:_,children:(0,I.jsxs)(`div`,{className:a?`group/edit-diff relative`:`relative`,children:[(0,I.jsx)(`div`,{className:a&&!m?`max-h-[260px] overflow-hidden`:void 0,children:(0,I.jsx)(Wl,{oldFile:g.oldFile,newFile:g.newFile,className:y,style:_,options:{theme:{dark:`github-dark`,light:`github-light`},themeType:f,unsafeCSS:v,diffStyle:`unified`,disableFileHeader:!0}},f)}),a&&(0,I.jsx)(I.Fragment,{children:(0,I.jsx)(`button`,{type:`button`,onClick:()=>h(e=>!e),"aria-label":m?`Hide`:`Show more`,className:`group absolute inset-x-0 bottom-0 flex h-16 items-end justify-center pb-2 text-muted-foreground `+(m?`bg-transparent`:`bg-linear-to-b from-transparent to-background`),children:(0,I.jsx)(w,{className:`h-4 w-4 opacity-0 transition-opacity duration-150 group-hover:opacity-100 `+(m?`rotate-180`:`rotate-0`)})})})]})}):null,o&&(0,I.jsx)(ne,{isPending:c,...o})]})}var ql=(0,F.memo)(function({part:e,isCollapsible:t=!1,onFilePathClick:n}){let r=e.input?.approval??e.args?.approval,i=e.type?.replace(`tool-`,``)||`Edit`,{step:a,stepState:o}=re(e,i);return(0,I.jsx)(Kl,{step:a,state:o,onComplete:()=>{},input:e.input??e.args,output:e.output??e.result,isCollapsible:t,approval:r,onFilePathClick:n})});function Jl({icon:e,shimmerLabel:t,completeLabel:n,isAnimating:r,detail:a,onDetailClick:o,trailingContent:s,expandable:c=!1,expanded:l,defaultOpen:u=!1,onToggleExpand:d,children:f}){let p=!r,m=l??!1,h=c&&(p||m||r),g=(0,I.jsxs)(`div`,{className:i(`flex max-w-full items-center gap-1 rounded-chat-tool select-none`,h?`cursor-pointer`:`cursor-default`),children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm text-muted-foreground`,children:[e&&(0,I.jsx)(`span`,{className:`flex size-3 shrink-0 items-center justify-center`,children:e}),(0,I.jsx)(`span`,{className:`shrink-0 font-[450] whitespace-nowrap`,children:r&&t?(0,I.jsx)(ie,{as:`span`,duration:1.2,className:`m-0 inline-flex h-4 items-center leading-none`,children:t}):n}),a&&(o?(0,I.jsx)(`button`,{type:`button`,onClick:o,className:`min-w-0 flex-1 truncate text-left font-normal text-muted-foreground/60 underline-offset-2 hover:text-muted-foreground hover:underline`,children:a}):(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-normal text-muted-foreground/60`,children:a})),s]}),c&&(p||m||r)&&(0,I.jsx)(`div`,{children:(0,I.jsx)(T,{className:i(`shrink-0 text-muted-foreground transition-transform duration-150 ease-out`,`size-3`,`rotate-0 group-data-panel-open:rotate-90`)})})]});return c?(0,I.jsxs)(Te,{className:`flex w-full flex-col gap-2`,...l===void 0?{defaultOpen:u}:{open:l,onOpenChange:d},children:[(0,I.jsx)(we,{className:`group flex`,disabled:!h,"aria-disabled":!h,children:g}),(0,I.jsx)(Ce,{className:i(`overflow-hidden`,`h-[var(--collapsible-panel-height)] transition-all duration-150 ease-out`,`data-ending-style:h-0 data-starting-style:h-0`,`[&[hidden]:not([hidden='until-found'])]:hidden`),children:f})]}):(0,I.jsx)(`div`,{className:`flex flex-col gap-1`,children:g})}var Yl=(0,F.memo)(function({icon:e,title:t,subtitle:n,isPending:r,onSubtitleClick:i}){let a=e;return(0,I.jsx)(Jl,{icon:a?(0,I.jsx)(a,{className:`h-full w-full shrink-0 text-muted-foreground`}):void 0,shimmerLabel:t,completeLabel:t,isAnimating:r,detail:n,onDetailClick:i})}),Xl=new Map;function Zl(e){return{state:e.state,inputJson:JSON.stringify(e.input||{}),outputJson:JSON.stringify(e.output||{})}}function Ql(e,t){let n=Xl.get(e),r=Zl(t);if(!n)return Xl.set(e,r),!0;let i=n.state!==r.state||n.inputJson!==r.inputJson||n.outputJson!==r.outputJson;return i&&Xl.set(e,r),i}function $l(e,t){if(e.toolCallId!==t.toolCallId||e.type!==t.type)return!1;let n=t.toolCallId;return n?!Ql(n,t):e.state===t.state}function eu(e){return e.output!==void 0&&e.output!==null||e.state===`error`||e.state===`result`}function tu(e,t){return $l(e.part,t.part)?eu(t.part)?!0:e.chatStatus===t.chatStatus:!1}function nu(e){if(e<1e3)return``;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return r===0?`${n}m`:`${n}m ${r}s`}function ru(e,t){let n=e.state!==`output-available`&&e.state!==`output-error`,r=e.state===`output-error`||e.state===`output-available`&&e.output?.success===!1,i=e.state===`output-available`&&!r;return{isPending:n&&t===`streaming`,isError:r,isSuccess:i,isInterrupted:n&&t!==`streaming`&&t!==void 0}}var iu=[`query`,`question`,`email`,`name`,`id`,`customer`,`url`,`issue`,`body`,`summary`,`title`],au={List:`Listing`,Get:`Getting`,Create:`Creating`,Update:`Updating`,Delete:`Deleting`,Search:`Searching`,Fetch:`Fetching`,Retrieve:`Retrieving`,Send:`Sending`,Generate:`Generating`,Add:`Adding`,Remove:`Removing`,Modify:`Modifying`,Draft:`Drafting`,Manage:`Managing`,Query:`Querying`,Start:`Starting`,Set:`Setting`,Check:`Checking`,Find:`Finding`},ou={List:`Listed`,Get:`Got`,Create:`Created`,Update:`Updated`,Delete:`Deleted`,Search:`Searched`,Fetch:`Fetched`,Retrieve:`Retrieved`,Send:`Sent`,Generate:`Generated`,Add:`Added`,Remove:`Removed`,Modify:`Modified`,Draft:`Drafted`,Manage:`Managed`,Query:`Queried`,Start:`Started`,Set:`Set`,Check:`Checked`,Find:`Found`};function su(e){let t=e.displayName.split(` `),n=t[0],r=t.slice(1).join(` `),i=au[n];return i?r?`${i} ${r}`:i:e.displayName}function cu(e){let t=e.displayName.split(` `),n=t[0],r=t.slice(1).join(` `),i=ou[n];return i?r?`${i} ${r}`:i:e.displayName}function lu(e){if(!e||typeof e!=`object`)return``;let t=Object.entries(e).filter(([,e])=>e!=null&&e!==``);if(t.length===0)return``;let n=[...t].sort(([e],[t])=>{let n=iu.indexOf(e),r=iu.indexOf(t);return n!==-1&&r!==-1?n-r:n===-1?r===-1?0:1:-1}),r=[];for(let[e,t]of n){if(r.length>=2)break;let n=typeof t==`string`?t:JSON.stringify(t),i=n.length>30?n.slice(0,27)+`...`:n;r.push(`${e}: ${i}`)}return r.join(` `)}function uu(e){if(!e)return e;if(Array.isArray(e)){let t=[];for(let n of e)n?.type===`text`&&typeof n?.text==`string`&&t.push(n.text);if(t.length>0){let e=t.join(``);try{return JSON.parse(e)}catch{return e}}return e}if(e?.type===`text`&&typeof e?.text==`string`)try{return JSON.parse(e.text)}catch{return e.text}if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}function du(e){let t=uu(e);if(typeof t==`string`)return t.length>3e3?t.slice(0,3e3)+`
|
|
1385
|
-
...`:t;let n=JSON.stringify(t,null,2);return n.length>3e3?n.slice(0,3e3)+`
|
|
1386
|
-
...`:n}var fu=(0,F.memo)(function({part:e,mcpInfo:t,chatStatus:n,defaultOpen:r}){let{isPending:i,isInterrupted:a}=ru(e,n),o=(0,F.useMemo)(()=>e.state===`input-streaming`?`Preparing ${t.displayName}`:i?su(t):cu(t),[e.state,i,t]),s=(0,F.useMemo)(()=>e.state===`input-streaming`?``:lu(e.input),[e.input,e.state]),c=(0,F.useMemo)(()=>e.output?du(e.output):null,[e.output]),l=(0,F.useMemo)(()=>{if(!c)return null;let e=c.trim();return e?`\`\`\`${e.startsWith(`{`)||e.startsWith(`[`)?`json`:`text`}\n${c}\n\`\`\``:null},[c]),u=!!l&&!i;return a&&!e.output?(0,I.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[t.displayName,` interrupted`]}):(0,I.jsx)(`div`,{className:`an-tool-mcp`,children:(0,I.jsx)(Jl,{shimmerLabel:o,completeLabel:o,isAnimating:i,detail:s||void 0,trailingContent:void 0,expandable:u,defaultOpen:r,children:l&&(0,I.jsx)(Ee,{className:`text-label`,codeControls:!1,content:l})})})},tu);function pu({className:e,...t}){return(0,I.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,className:e??`animate-spin text-muted-foreground will-change-transform`,...t,children:[(0,I.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,fill:`none`,opacity:.2}),(0,I.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,fill:`none`})]})}function mu(e){let t=e.id?.trim();return t?t.endsWith(`.md`)?t:`plan-${t}.md`:`plan-working.md`}var hu=(0,F.memo)(function({part:e,chatStatus:t}){let{isPending:n}=ru(e,t),r=e.input?.plan,[a,o]=(0,F.useState)(!1),[s,c]=(0,F.useState)(!1),[l,u]=(0,F.useState)(null),[d,f]=(0,F.useState)(!1),[p,m]=(0,F.useState)(``);if(!r)return null;let h=mu(r),g=r.summary?.trim()??``,_=g.length>0,v=e.input?.completed??0,y=e.input?.total??r.todos?.length??0,b=!!e.input?.pendingDecision,x=b&&!n,S=e.input?.approved||s||r.status===`approved`||r.status===`completed`,C=async(e,t,n)=>{if(!(!t||l)){u(e);try{await t(n),e===`execute`&&c(!0),e===`refine`&&(m(``),f(!1))}finally{u(null)}}},w=y>0?`${v}/${y} complete`:b?`Awaiting review`:void 0;return(0,I.jsxs)(`div`,{className:`an-tool-plan overflow-hidden rounded-chat-tool border border-border bg-muted`,children:[(0,I.jsxs)(`div`,{className:`flex h-7 items-center justify-between pr-2.5 pl-3`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[n?(0,I.jsx)(pu,{className:`h-3 w-3 shrink-0 animate-spin text-muted-foreground`}):(0,I.jsx)(k,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,I.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:h})]}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>o(e=>!e),"aria-label":a?`Collapse plan`:`Expand plan`,className:`inline-flex size-5 items-center justify-center text-muted-foreground`,children:a?(0,I.jsx)(Pe,{className:`h-3.5 w-3.5`}):(0,I.jsx)(Me,{className:`h-3.5 w-3.5`})})]}),(0,I.jsxs)(`div`,{className:`border-t border-border bg-background pt-2`,children:[(0,I.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3`,children:[(0,I.jsx)(`div`,{className:`text-sm text-foreground`,children:r.title}),w?(0,I.jsx)(`div`,{className:`rounded-full border border-border px-2 py-0.5 text-caption text-muted-foreground`,children:w}):null]}),_?(0,I.jsxs)(`div`,{className:`relative`,children:[(0,I.jsx)(`div`,{className:i(`px-3`,`text-sm text-muted-foreground`,!a&&`max-h-[94px] overflow-hidden`),children:(0,I.jsx)(Ee,{content:g,className:`text-sm`})}),!a&&(0,I.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 h-16 pr-2 pb-2 pl-3.5`,children:[(0,I.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 h-full w-full bg-linear-to-b from-transparent from-0% to-background to-50%`}),(0,I.jsx)(`div`,{className:`relative flex h-full items-end justify-between`,children:(0,I.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`-mx-2 h-5 rounded-[4px] px-1.5 text-xs text-muted-foreground hover:text-foreground`,children:`Read detailed plan`})})]})]}):(0,I.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No plan summary provided.`})]}),(a||!_)&&(0,I.jsxs)(`div`,{className:`mt-2 flex items-center justify-between border-t border-border bg-muted pt-1.5 pr-2 pb-2 pl-3.5`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:()=>o(e=>!e),className:`-mx-2 h-5 rounded-[4px] px-1.5 text-xs text-muted-foreground hover:text-foreground`,children:a?`Hide detailed plan`:`Read detailed plan`}),x?(0,I.jsx)(`div`,{className:`text-caption text-muted-foreground`,children:`Choose what to do with this plan.`}):S?(0,I.jsx)(`div`,{className:`text-caption text-muted-foreground`,children:`Approved`}):null]}),x?(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border bg-muted px-3 py-2.5`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:()=>C(`execute`,e.input?.onExecute),disabled:!!l,className:`h-7 rounded-[6px] bg-primary px-2.5 text-xs font-medium text-primary-foreground disabled:opacity-60`,children:l===`execute`?`Executing...`:e.input?.executeLabel??`Execute`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>C(`stay`,e.input?.onStay),disabled:!!l,className:`h-7 rounded-[6px] border border-border px-2.5 text-xs text-foreground disabled:opacity-60`,children:l===`stay`?`Saving...`:e.input?.stayLabel??`Stay`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>f(e=>!e),disabled:!!l,className:`h-7 rounded-[6px] border border-border px-2.5 text-xs text-foreground disabled:opacity-60`,children:e.input?.refineLabel??`Refine`})]}),d?(0,I.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,I.jsx)(`textarea`,{value:p,onChange:e=>m(e.target.value),rows:3,placeholder:`Describe what should change in the plan`,className:`w-full resize-y rounded-[8px] border border-border bg-background px-3 py-2 text-base text-foreground outline-none focus:border-primary md:text-sm`}),(0,I.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),m(``)},disabled:!!l,className:`h-7 rounded-[6px] border border-border px-2.5 text-xs text-foreground disabled:opacity-60`,children:`Cancel`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>C(`refine`,e.input?.onRefine,p),disabled:!!l,className:`h-7 rounded-[6px] bg-primary px-2.5 text-xs font-medium text-primary-foreground disabled:opacity-60`,children:l===`refine`?`Submitting...`:`Submit refinement`})]})]}):null]}):null]})]})},tu);function gu({step:e,animating:t,onStepComplete:n}){return te(t,e.duration,()=>n(e.id)),null}function _u({toolSteps:e,stepStates:t,onStepComplete:n,results:r=[],defaultOpen:a}){let o=e.some(e=>t[e.id]===`animating`),s=e.find(e=>e.searchQuery)?.searchQuery??`searching...`,c=r.length,l=c>0;return(0,I.jsxs)(I.Fragment,{children:[e.map(e=>(0,I.jsx)(gu,{step:e,animating:t[e.id]===`animating`,onStepComplete:n},e.id)),(0,I.jsx)(Jl,{shimmerLabel:`Searching...`,completeLabel:`Found ${c} results`,isAnimating:o,expandable:l,defaultOpen:a,children:(0,I.jsxs)(`div`,{className:`overflow-hidden rounded-chat-tool border border-border bg-muted`,children:[(0,I.jsxs)(`div`,{className:`flex h-7 items-center gap-1 border-b border-border px-2.5 py-0 text-xs`,children:[(0,I.jsx)(`span`,{className:`font-medium text-foreground`,children:`Searched for`}),` `,(0,I.jsxs)(`span`,{className:`truncate text-muted-foreground`,children:[`“`,s,`”`]})]}),(0,I.jsx)(`div`,{className:`max-h-[200px] overflow-y-auto bg-background`,children:(0,I.jsx)(`div`,{className:`flex flex-col gap-1 p-1`,children:r.map(e=>(0,I.jsxs)(`div`,{className:i(`flex cursor-default items-center gap-2 rounded-[calc(var(--chat-tool-radius)-4px)] px-2 py-1`,`hover:bg-muted/50`),children:[(0,I.jsx)(`div`,{className:`flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground`,children:(0,I.jsx)(k,{className:`h-4 w-4`})}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-foreground/90`,children:e.title}),(0,I.jsx)(`span`,{className:`shrink-0 text-xs whitespace-nowrap text-muted-foreground`,children:e.date||e.source})]},`${e.title}-${e.source}-${e.date}`))})})]})})]})}function vu(e){if(!Array.isArray(e))return;let t=e.map(e=>{if(!e||typeof e!=`object`)return null;let t=e.source,n=e.title,r=e.date;return typeof t!=`string`||typeof n!=`string`||typeof r!=`string`?null:{source:t,title:n,date:r}}).filter(e=>!!e);return t.length>0?t:void 0}var yu=(0,F.memo)(function({part:e,results:t,defaultOpen:n}){let r=e.type?.replace(`tool-`,``)||`WebSearch`,{step:i,stepState:a}=re(e,r),o={[i.id]:a};return(0,I.jsx)(_u,{toolSteps:[i],stepStates:o,onStepComplete:()=>{},results:t??vu(e.output?.results)??vu(e.result?.results),defaultOpen:n})});function bu(e){return e===`in_progress`||e===`in-progress`?`in-progress`:e===`completed`?`completed`:e===`cancelled`?`cancelled`:`pending`}function xu(e){return(e??[]).flatMap((e,t)=>{let n=e.title??e.content;return n?[{id:`${t}-${n}`,title:n,status:bu(e.status)}]:[]})}var Su=(0,F.memo)(function({part:e}){let t=e.state===`input-streaming`,n=(0,F.useMemo)(()=>xu(e.input?.todos??e.output?.newTodos),[e.input?.todos,e.output?.newTodos]);return t||n.length===0?(0,I.jsx)(ie,{as:`span`,duration:1.2,className:`m-0 inline-flex h-4 items-center text-label leading-none`,children:`Updating to-dos...`}):(0,I.jsx)($e,{items:n,title:`Todo list`,defaultOpen:!0,collapseOnComplete:!1,maxHeight:240})},tu);function Cu(e,t){let[n,r]=(0,F.useState)(0);return(0,F.useEffect)(()=>{if(t&&e){r(Date.now()-e);let t=setInterval(()=>{r(Date.now()-e)},1e3);return()=>clearInterval(t)}},[t,e]),n}function wu(e){if(!e)return``;let t=De(e);if(t!==e)return t;if(e.startsWith(`/`)){let t=e.split(`/`),n=[`apps`,`packages`,`src`,`lib`,`components`],r=t.findIndex(e=>n.includes(e));if(r>0)return t.slice(r).join(`/`)}return e}function Tu(e,t){let n=e.split(`
|
|
1387
|
-
`),r=t.split(`
|
|
1388
|
-
`),i=Math.max(n.length,r.length),a=0,o=0;for(let e=0;e<i;e++)n[e]!==void 0&&r[e]!==void 0?n[e]!==r[e]&&(o++,a++):n[e]===void 0?r[e]!==void 0&&a++:o++;return{addedLines:a,removedLines:o}}var Eu={"tool-Task":{icon:ce,title:e=>{let t=e.state!==`output-available`&&e.state!==`output-error`,n=e.input?.subagent_type||`Agent`;return t?`Running ${n}`:`${n} completed`},subtitle:e=>{let t=e.input?.description||``;return t.length>50?`${t.slice(0,47)}...`:t},variant:`simple`},"tool-Agent":{icon:ce,title:e=>{let t=e.state!==`output-available`&&e.state!==`output-error`,n=e.input?.subagent_type||`Agent`;return t?`Running ${n}`:`${n} completed`},subtitle:e=>{let t=e.input?.description||``;return t.length>50?`${t.slice(0,47)}...`:t},variant:`simple`},"tool-Skill":{icon:ce,title:()=>`Skill`,subtitle:e=>e.input?.skill||``,variant:`simple`},"tool-Grep":{icon:pe,title:e=>{if(e.state!==`output-available`&&e.state!==`output-error`)return`Grepping`;let t=e.output?.numFiles||0;return t>0?`Grepped ${t} files`:`No matches`},subtitle:e=>{let t=e.input?.pattern||``,n=e.input?.path||``;if(n){let e=`${t} in ${wu(n)}`;return e.length>40?`${e.slice(0,37)}...`:e}return t.length>40?`${t.slice(0,37)}...`:t},variant:`simple`},"tool-Glob":{icon:Re,title:e=>{if(e.state!==`output-available`&&e.state!==`output-error`)return`Exploring files`;let t=e.output?.numFiles||0;return t>0?`Found ${t} files`:`No files found`},subtitle:e=>{let t=e.input?.pattern||``;return t.length>40?`${t.slice(0,37)}...`:t},variant:`simple`},"tool-Read":{icon:le,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Reading`:`Read`,subtitle:e=>{let t=e.input?.file_path||``;return t&&t.split(`/`).pop()||``},variant:`simple`},"tool-Edit":{icon:N,title:e=>{let t=e.input?.file_path||``;return t&&t.split(`/`).pop()||`Edit`},subtitle:e=>{if(e.state!==`output-available`&&e.state!==`output-error`)return``;let t=e.input?.old_string||``,n=e.input?.new_string||``;if(!t&&!n)return``;if(t!==n){let{addedLines:e,removedLines:r}=Tu(t,n);return`+${e} -${r}`}return``},variant:`simple`},"tool-Write":{icon:Ie,title:()=>`Create`,subtitle:e=>{let t=e.input?.file_path||``;return t&&t.split(`/`).pop()||``},variant:`simple`},"tool-Bash":{icon:me,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Running command`:`Ran command`,subtitle:e=>{let t=e.input?.command||``;if(!t)return``;let n=t.replace(/\\\s*\n\s*/g,` `).trim();return n=n.replace(/\/(?:Users|home|root)\/[^\s"']+/g,e=>wu(e)),n.length>50?`${n.slice(0,47)}...`:n},variant:`simple`},"tool-IPython":{icon:N,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Running cell`:`Ran cell`,subtitle:e=>{let t=e.input?.code||``;if(!t)return``;let n=t.split(`
|
|
1389
|
-
`,1)[0].trim();return n.length>50?`${n.slice(0,47)}...`:n},variant:`simple`},"tool-WebFetch":{icon:se,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Fetching`:`Fetched`,subtitle:e=>{let t=e.input?.url||``;try{return new URL(t).hostname.replace(`www.`,``)}catch{return t.slice(0,30)}},variant:`simple`},"tool-WebSearch":{icon:pe,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Searching web`:`Searched web`,subtitle:e=>{let t=e.input?.query||``;return t.length>40?`${t.slice(0,37)}...`:t},variant:`collapsible`},"tool-TodoWrite":{icon:S,title:e=>{let t=e.state!==`output-available`&&e.state!==`output-error`,n=e.input?.action||`update`;return t?n===`add`?`Adding todo`:`Updating todos`:n===`add`?`Added todo`:`Updated todos`},subtitle:e=>{let t=e.input?.todos||[];return t.length===0?``:`${t.length} ${t.length===1?`item`:`items`}`},variant:`simple`},"tool-PlanWrite":{icon:ce,title:e=>{let t=e.state!==`output-available`&&e.state!==`output-error`,n=e.input?.action||`create`;if(t)return n===`create`?`Creating plan`:n===`approve`?`Approving plan`:`Updating plan`;let r=e.input?.plan?.status;return r===`awaiting_approval`?`Plan ready for review`:r===`approved`?`Plan approved`:r===`completed`?`Plan completed`:n===`create`?`Created plan`:`Updated plan`},variant:`simple`},"tool-ExitPlanMode":{icon:b,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Finishing plan`:`Plan complete`,variant:`simple`},"tool-NotebookEdit":{icon:N,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Editing notebook`:`Edited notebook`,subtitle:e=>{let t=e.input?.file_path||``;return t&&t.split(`/`).pop()||``},variant:`simple`},"tool-BashOutput":{icon:me,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Getting output`:`Command output`,subtitle:e=>{let t=e.output;if(typeof t==`string`&&t.trim())return t.trim();let n=e.input?.command||``;if(!n)return``;let r=n.replace(/\\\s*\n\s*/g,` `).trim();return r=r.replace(/\/(?:Users|home|root)\/[^\s"']+/g,e=>wu(e)),r.length>50?`${r.slice(0,47)}...`:r},variant:`simple`},"tool-KillShell":{icon:j,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Stopping shell`:`Shell stopped`,subtitle:e=>{let t=e.input?.pid;return typeof t==`number`?`pid ${t}`:``},variant:`simple`},"tool-cloning":{icon:ue,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Cloning repo`:`Repo cloned`,subtitle:e=>e.input?.repo??``,variant:`simple`},"tool-Thinking":{icon:ce,title:e=>e.state!==`output-available`&&e.state!==`output-error`?`Thinking...`:`Thought`,variant:`collapsible`}},Du=`tool-mcp__`,Ou={"tool-ListMcpResources":{serverName:`mcp`,toolName:`list_resources`,displayName:`List Resources`,category:`list`},"tool-ListMcpResourcesTool":{serverName:`mcp`,toolName:`list_resources`,displayName:`List Resources`,category:`list`},"tool-ReadMcpResource":{serverName:`mcp`,toolName:`read_resource`,displayName:`Read Resource`,category:`get`},"tool-ReadMcpResourceTool":{serverName:`mcp`,toolName:`read_resource`,displayName:`Read Resource`,category:`get`}};function ku(e){let t=Ou[e];if(t)return t;if(!e.startsWith(Du))return null;let n=e.slice(10),r=n.indexOf(`__`);if(r===-1)return null;let i=n.slice(0,r),a=n.slice(r+2);return{serverName:i,toolName:a,displayName:a.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim(),category:`other`}}var Au=[];function ju(e,t){return`${e} ${e===1?t:`${t}s`}`}function Mu(e){if(e.length===0)return``;let t=new Set([`tool-Read`,`tool-Edit`,`tool-Write`]),n=new Set([`tool-Search`,`tool-Grep`,`tool-Glob`,`tool-WebSearch`]),r=new Set([`tool-Bash`]),i=0,a=0,o=0;for(let s of e)t.has(s.type)?i+=1:n.has(s.type)?a+=1:r.has(s.type)&&(o+=1);let s=[];return i>0&&s.push(ju(i,`file`)),a>0&&s.push(`${a} ${a===1?`search`:`searches`}`),o>0&&s.push(ju(o,`command`)),s.length===0?``:s.length===1?s[0]:s.length===2?`${s[0]} and ${s[1]}`:`${s.slice(0,-1).join(`, `)}, and ${s[s.length-1]}`}function Nu(e){let t=new Set([`tool-Read`,`tool-Edit`,`tool-Write`]),n=new Set([`tool-Search`,`tool-Grep`,`tool-Glob`,`tool-WebSearch`]),r=0,i=0;for(let a of e)t.has(a.type)?r+=1:n.has(a.type)&&(i+=1);return{fileCount:r,searchCount:i}}function Pu(e,t){let n=[];return e>0&&n.push(ju(e,`file`)),t>0&&n.push(`${t} ${t===1?`search`:`searches`}`),n.join(`, `)}var Fu=(0,F.memo)(function({part:e,nestedTools:t=Au,chatStatus:n,completeLabel:r,shimmerLabel:a,interruptedLabel:o,maxVisibleTools:s=5,defaultOpen:c,showElapsed:l=!0}){let{isPending:u,isInterrupted:d}=ru(e,n),f=e.input?.description||``,[p,m]=(0,F.useState)(c??!1),[h,g]=(0,F.useState)(0),_=e.callProviderMetadata?.custom?.startedAt??e.startedAt,v=t.length>0,y=e.toolCallId??e.id??``,b=e.output?.totalDurationMs||e.output?.duration||e.output?.duration_ms,x=Math.max(1,s)*28,S=u?Math.max(h,0):t.length,C=(0,F.useRef)(u),w=(0,F.useRef)(!1),T=(0,F.useRef)(null),{fileCount:E,searchCount:D}=(0,F.useMemo)(()=>Nu(u?t.slice(0,Math.max(h,0)):t),[u,t,h]),O=Pu(E,D),k=(0,F.useRef)(null),A=Cu(_,u);(0,F.useEffect)(()=>{let e=C.current;return T.current&&=(window.clearTimeout(T.current),null),u&&!e&&!w.current&&c!==!1&&(m(!1),T.current=window.setTimeout(()=>{m(!0)},60)),!u&&e&&(m(!1),w.current=!1),C.current=u,()=>{T.current&&=(window.clearTimeout(T.current),null)}},[c,u]),(0,F.useEffect)(()=>{if(!u||t.length===0){g(t.length);return}let e=1;g(Math.min(e,t.length));let n=setInterval(()=>{e+=1,g(Math.min(e,t.length)),e>=t.length&&clearInterval(n)},450);return()=>clearInterval(n)},[u,t.length,y]),(0,F.useEffect)(()=>{!u||!k.current||(k.current.scrollTop=k.current.scrollHeight)},[u,h]);let j=(()=>{if(u&&v)return O;if(!u&&v){let e=Mu(t);if(e)return e}return f?f.length>60?`${f.slice(0,57)}...`:f:``})(),M=nu(!u&&b?b:A);return d&&!e.output?(0,I.jsx)(Jl,{completeLabel:o,isAnimating:!1}):(0,I.jsx)(Jl,{completeLabel:r,shimmerLabel:a,isAnimating:u,detail:j,expandable:v,expanded:p,onToggleExpand:()=>{w.current=!0,m(e=>!e)},trailingContent:l&&M?(0,I.jsx)(`span`,{className:`shrink-0 font-normal text-muted-foreground/60 tabular-nums`,children:M}):void 0,children:(0,I.jsxs)(`div`,{className:`relative`,children:[u&&p&&S>4&&(0,I.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 h-10 bg-linear-to-b from-background to-transparent`}),(0,I.jsx)(`div`,{ref:k,className:i(t.length>1?`flex flex-col gap-2`:void 0,u&&p&&S>4&&`overflow-y-auto`),style:u&&p&&S>4?{height:`${x}px`}:void 0,children:(u?t.slice(0,Math.max(h,0)):t).map((e,t)=>{let r=u?{...e,state:t===h-1?`input-streaming`:`output-available`}:e,i=Eu[r.type];if(!i)return null;let{isPending:a,isError:o}=ru(r,n);return(0,I.jsx)(Yl,{icon:i.icon,title:i.title(r),subtitle:i.subtitle?.(r),isPending:a,isError:o},r.toolCallId??r.id??`${r.type}-${i.title(r)}`)})})]})})});function Iu(e,t){if(e.state===`input-streaming`)return`streaming`;if(e.state===`output-available`)return`success`;if(e.state===`output-error`)return`error`;let{isPending:n}=ru(e,t);return n?`pending`:`success`}var Lu=(0,F.memo)(function({part:e,nestedTools:t,chatStatus:n,toolRenderers:r}){let i=e.type;switch(i){case`tool-Bash`:return(0,I.jsx)(Lt,{part:e});case`tool-IPython`:return(0,I.jsx)(ae,{part:e});case`tool-Edit`:case`tool-Write`:return(0,I.jsx)(ql,{part:e});case`tool-WebSearch`:case`tool-Grep`:case`tool-Glob`:return(0,I.jsx)(yu,{part:e});case`tool-PlanWrite`:return(0,I.jsx)(hu,{part:e,chatStatus:n});case`tool-TodoWrite`:return(0,I.jsx)(Su,{part:e,chatStatus:n});case`tool-Question`:return(0,I.jsx)(Pt,{part:e,chatStatus:n});case`tool-Task`:case`tool-Agent`:{let r=e.type===`tool-Agent`?`Agent`:`Task`;return(0,I.jsx)(Fu,{part:e,nestedTools:t,chatStatus:n,completeLabel:`${r} completed`,shimmerLabel:`Running ${r.toLowerCase()}`,interruptedLabel:`${r} interrupted`,defaultOpen:!1})}case`tool-Thinking`:return null}let a=ku(i);if(a){if(r){let t=r[a.toolName];if(t)return(0,I.jsx)(t,{name:a.toolName,input:e.input??{},output:e.output?uu(e.output):void 0,status:Iu(e,n)})}return(0,I.jsx)(fu,{part:e,mcpInfo:a,chatStatus:n})}if(r&&i.startsWith(`tool-`)){let t=i.slice(5),a=r[t];if(a)return(0,I.jsx)(a,{name:t,input:e.input??{},output:e.output??e.result,status:Iu(e,n)})}let o=Eu[i];if(o){let{isPending:t,isError:r}=ru(e,n);return(0,I.jsx)(Yl,{title:o.title(e),subtitle:o.subtitle?.(e),isPending:t,isError:r})}let s=i.startsWith(`tool-`)?i.slice(5):i,{isPending:c,isError:l}=ru(e,n);return(0,I.jsx)(Yl,{title:c?`Running ${s}`:s,isPending:c,isError:l})});function Ru(e){return e.map(e=>({id:String(e.id),title:typeof e.title==`string`?e.title:``,status:e.status===`in-progress`?`in_progress`:e.status===`completed`?`completed`:e.status===`cancelled`?`cancelled`:`pending`}))}function zu(e,t){return t.toLowerCase().includes(`bash`)||t.toLowerCase().includes(`shell`)?(0,I.jsx)(me,{"aria-hidden":`true`,className:`size-4`}):e===`success`?(0,I.jsx)(A,{"aria-hidden":`true`,className:`size-4`}):(0,I.jsx)(he,{"aria-hidden":`true`,className:`size-4`})}function Bu({approval:e,name:t,status:n}){if(!e)return null;let r=n===`running`?`pending`:n===`error`?`error`:`complete`,i=Object.entries(e).flatMap(([e,t])=>typeof t==`object`||typeof t==`function`?[]:[{id:e,label:e,value:String(t)}]);return(0,I.jsx)(nt,{tool:t,title:`Fleet Prime permission`,description:`This tool reported a permission decision from Fleet Prime.`,parameters:i,status:r})}function Vu({code:e,language:t,languageLabel:n,status:r}){return(0,I.jsx)(m,{code:e,language:t,languageLabel:n,status:r===`running`?`streaming`:`complete`,showStatus:!1,maxHeight:160,showLineNumbers:!1,wrap:!0})}var Hu=(0,F.memo)(function({part:e,nestedTools:t,chatStatus:n,toolRenderers:r}){let i=()=>(0,I.jsx)(Lu,{part:e,nestedTools:t,chatStatus:n,toolRenderers:r}),a=Dt(e,n);if(!a||a.lowerName===`question`)return i();let{detail:o,status:s}=a;if(!o)return i();if(o.kind===`todo`){let t=Ru(o.items),n=!!e.input?.pendingDecision;if(a.lowerName===`planwrite`&&n)return i();let r=a.lowerName===`planwrite`&&e.input?.executing?Je(t):void 0;return r?(0,I.jsx)(Ye,{presentation:r,className:`mb-2`}):(0,I.jsx)($e,{items:o.items,title:o.title,defaultOpen:!0,collapseOnComplete:!1,maxHeight:240})}if(o.kind===`citations`)return(0,I.jsx)(x,{citations:o.citations,title:`Sources`,defaultOpen:!0});if(o.kind===`image`)return(0,I.jsx)(Ke,{status:s===`running`?`generating`:s===`error`?`error`:`complete`,children:(0,I.jsx)(`img`,{src:o.url,alt:`Generated result`,width:640,height:320,loading:`lazy`,decoding:`async`,className:`h-auto max-h-80 w-full object-contain`})});if(o.kind===`diff`)return(0,I.jsx)(g,{file:o.file,lines:o.lines,status:s===`running`?`streaming`:`complete`,language:`diff`,maxHeight:240,copyText:o.copyText,defaultOpen:s===`running`});let c=o.content||`No output.`;return(0,I.jsxs)(_,{tool:`Prime`,title:a.name,status:s,kind:a.lowerName.includes(`bash`)||a.lowerName.includes(`shell`)||a.lowerName.includes(`python`)?`terminal`:`custom`,meta:a.metadata.length>0?a.metadata.join(` · `):void 0,icon:zu(s,a.name),defaultOpen:s===`running`,collapseOnComplete:!1,maxHeight:240,copyText:c,children:[o.sourceCode?(0,I.jsx)(Vu,{code:o.sourceCode,language:o.sourceLanguage??`text`,languageLabel:o.sourceLabel,status:s}):null,o.sections.map(e=>(0,I.jsx)(h,{language:e.language,label:e.label,children:e.content},e.label)),(0,I.jsx)(Bu,{approval:a.approval,name:a.name,status:s})]})}),Uu=e({SessionToolRenderer:()=>Wu}),Wu=(0,F.memo)(function(e){let t=e.part.type;return t===`tool-Thinking`||t===`tool-FleetReasoning`?null:t.startsWith(`tool-`)?(0,I.jsx)(Hu,{...e}):(0,I.jsx)(Lu,{...e})});export{Uu as n,Wu as t};
|