diffhub 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/.next/standalone/apps/web/.next/BUILD_ID +1 -1
  2. package/.next/standalone/apps/web/.next/build-manifest.json +3 -3
  3. package/.next/standalone/apps/web/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/apps/web/.next/server/app/_global-error.html +1 -1
  5. package/.next/standalone/apps/web/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/standalone/apps/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  12. package/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  13. package/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -1
  14. package/.next/standalone/apps/web/.next/server/app/_not-found.rsc +11 -11
  15. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_full.segment.rsc +11 -11
  16. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  17. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_index.segment.rsc +6 -6
  18. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  19. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  20. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  21. package/.next/standalone/apps/web/.next/server/app/api/comments/route.js +1 -1
  22. package/.next/standalone/apps/web/.next/server/app/api/comments/route.js.nft.json +1 -1
  23. package/.next/standalone/apps/web/.next/server/app/api/diff/route.js +3 -2
  24. package/.next/standalone/apps/web/.next/server/app/api/diff/route.js.nft.json +1 -1
  25. package/.next/standalone/apps/web/.next/server/app/api/discard/route.js +1 -1
  26. package/.next/standalone/apps/web/.next/server/app/api/discard/route.js.nft.json +1 -1
  27. package/.next/standalone/apps/web/.next/server/app/api/file/route.js +1 -1
  28. package/.next/standalone/apps/web/.next/server/app/api/file/route.js.nft.json +1 -1
  29. package/.next/standalone/apps/web/.next/server/app/api/files/route.js +1 -1
  30. package/.next/standalone/apps/web/.next/server/app/api/files/route.js.nft.json +1 -1
  31. package/.next/standalone/apps/web/.next/server/app/api/open/route.js +1 -1
  32. package/.next/standalone/apps/web/.next/server/app/api/open/route.js.nft.json +1 -1
  33. package/.next/standalone/apps/web/.next/server/app/favicon.ico/route.js +1 -1
  34. package/.next/standalone/apps/web/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  35. package/.next/standalone/apps/web/.next/server/app/index.html +1 -1
  36. package/.next/standalone/apps/web/.next/server/app/index.rsc +12 -12
  37. package/.next/standalone/apps/web/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  38. package/.next/standalone/apps/web/.next/server/app/index.segments/_full.segment.rsc +12 -12
  39. package/.next/standalone/apps/web/.next/server/app/index.segments/_head.segment.rsc +4 -4
  40. package/.next/standalone/apps/web/.next/server/app/index.segments/_index.segment.rsc +6 -6
  41. package/.next/standalone/apps/web/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  42. package/.next/standalone/apps/web/.next/server/app/page/react-loadable-manifest.json +1 -2
  43. package/.next/standalone/apps/web/.next/server/app/page.js.nft.json +1 -1
  44. package/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  45. package/.next/standalone/apps/web/.next/server/chunks/[externals]_shiki_wasm_0~fgmgp._.js +3 -0
  46. package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__01.zj5h._.js +3 -0
  47. package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__0tbrp5x._.js +13 -0
  48. package/.next/standalone/apps/web/.next/server/chunks/_0r24f4c._.js +69 -0
  49. package/.next/standalone/apps/web/.next/server/chunks/node_modules_@pierre_theme_dist_pierre-dark_mjs_0ojo3_n._.js +3 -0
  50. package/.next/standalone/apps/web/.next/server/chunks/node_modules_@pierre_theme_dist_pierre-light_mjs_0pw9wwg._.js +3 -0
  51. package/.next/standalone/apps/web/.next/server/chunks/ssr/0fuv_@swc_helpers_cjs__interop_require_default_cjs_0ghzfn9._.js +3 -0
  52. package/.next/standalone/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0bit3~x._.js +3 -0
  53. package/.next/standalone/apps/web/.next/server/chunks/ssr/{_0qo42r0._.js → _0m1v4-9._.js} +2 -2
  54. package/.next/standalone/apps/web/.next/server/chunks/ssr/_0oc3qg_._.js +3 -3
  55. package/.next/standalone/apps/web/.next/server/middleware-build-manifest.js +3 -3
  56. package/.next/standalone/apps/web/.next/server/pages/404.html +1 -1
  57. package/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
  58. package/.next/standalone/apps/web/.next/server/server-reference-manifest.js +1 -1
  59. package/.next/standalone/apps/web/.next/server/server-reference-manifest.json +1 -1
  60. package/.next/standalone/apps/web/.next/static/chunks/01f1ms~jsc5vh.js +138 -0
  61. package/.next/standalone/apps/web/.next/static/chunks/0c7yx0ttmhb4s.js +63 -0
  62. package/.next/standalone/apps/web/.next/static/chunks/0ogqv_xj2r0c6.js +1 -0
  63. package/.next/standalone/apps/web/.next/static/chunks/0qp8t.3t~v6um.js +1 -0
  64. package/.next/standalone/apps/web/.next/static/chunks/130i667qy-j80.css +3 -0
  65. package/.next/standalone/apps/web/.next/static/chunks/15uwrard~z-l5.js +16 -0
  66. package/.next/standalone/apps/web/package.json +1 -1
  67. package/bin/diffhub.mjs +25 -1
  68. package/package.json +1 -1
  69. package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__0gf_xk6._.js +0 -13
  70. package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__0t.tl18._.js +0 -3
  71. package/.next/standalone/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0jit913._.js +0 -3
  72. package/.next/standalone/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0v19a7g._.js +0 -3
  73. package/.next/standalone/apps/web/.next/server/chunks/ssr/_0f40lcw._.js +0 -3
  74. package/.next/standalone/apps/web/.next/server/chunks/ssr/node_modules_0v8w2j~._.js +0 -70
  75. package/.next/standalone/apps/web/.next/static/chunks/00zp83w4g1v1r.js +0 -16
  76. package/.next/standalone/apps/web/.next/static/chunks/042ip11u2i2z6.js +0 -138
  77. package/.next/standalone/apps/web/.next/static/chunks/07ndp5x2cvqo..css +0 -3
  78. package/.next/standalone/apps/web/.next/static/chunks/085s9eg867ha-.js +0 -1
  79. package/.next/standalone/apps/web/.next/static/chunks/0_vmme_k_ff_u.js +0 -67
  80. package/.next/standalone/apps/web/.next/static/chunks/0ap~_hc7r17_6.js +0 -1
  81. package/.next/standalone/apps/web/.next/static/chunks/0nt5-rwas5thn.js +0 -67
  82. package/.next/standalone/apps/web/.next/static/chunks/0p~3-4_.v0cft.js +0 -1
  83. package/.next/standalone/apps/web/.next/static/chunks/0wx-2dr44ql-g.js +0 -1
  84. /package/.next/standalone/apps/web/.next/static/{mAVCL4HCmtJwT35feBPdK → C1Ggd_ITpnb7yBHrIOODV}/_buildManifest.js +0 -0
  85. /package/.next/standalone/apps/web/.next/static/{mAVCL4HCmtJwT35feBPdK → C1Ggd_ITpnb7yBHrIOODV}/_clientMiddlewareManifest.js +0 -0
  86. /package/.next/standalone/apps/web/.next/static/{mAVCL4HCmtJwT35feBPdK → C1Ggd_ITpnb7yBHrIOODV}/_ssgManifest.js +0 -0
@@ -0,0 +1,63 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,15126,e=>{"use strict";let t={position:"absolute",top:0,bottom:0,textAlign:"center"},n={display:"contents"};function i(){return null}var r=e.i(27101);function o(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}var a=e.i(81099);function s({file:e,renderCustomHeader:n,renderHeaderPrefix:i,renderHeaderMetadata:l,renderAnnotation:d,lineAnnotations:h,renderGutterUtility:f,renderHoverUtility:c,getHoveredLine:u}){let p=f??c,m=n?.(e),g=i?.(e),v=l?.(e);return(0,a.jsxs)(a.Fragment,{children:[null!=m?(0,a.jsx)("div",{slot:r.CUSTOM_HEADER_SLOT_ID,children:m}):(0,a.jsxs)(a.Fragment,{children:[null!=g&&(0,a.jsx)("div",{slot:r.HEADER_PREFIX_SLOT_ID,children:g}),null!=v&&(0,a.jsx)("div",{slot:r.HEADER_METADATA_SLOT_ID,children:v})]}),null!=d&&h?.map((e,t)=>(0,a.jsx)("div",{slot:o(e),children:d(e)},t)),null!=p&&(0,a.jsx)("div",{slot:"gutter-utility-slot",style:t,children:p(u)})]})}function l(e,t){return"u"<typeof window&&null!=t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("template",{shadowrootmode:"open",dangerouslySetInnerHTML:{__html:t}}),e]}):(0,a.jsx)(a.Fragment,{children:e})}let d=new Set,h=new Set,f=null,c=!1;function u(e){c?d.add(e):(h.add(e),f??=requestAnimationFrame(p))}function p(e){for(let t of(c=!0,h))try{t(e)}catch(e){console.error(e)}h.clear(),d.size>0?(h=new Set(d),d.clear(),f=requestAnimationFrame(p)):f=null,c=!1}function m({scrollTop:e,scrollHeight:t,height:n,containerOffset:i=0,fitPerfectly:r,overscrollSize:o}){let a=n+2*o,s=r?n:a;if(a>=(t=Math.max(t,s))||r){let n=Math.max(e-i,0);return{top:n,bottom:Math.max(Math.min(e+s,t)-i,n)}}let l=e+n/2-a/2,d=l+a;return l<0&&(l=0),d>t&&(d=t),{top:l=Math.floor(Math.max(l-i,0)),bottom:Math.ceil(Math.max(Math.min(d,t)-i,l))}}let g=[0,1e-6,.99999,1],v={overscrollSize:1e3,intersectionObserverMargin:4e3,resizeDebugging:!1},b=0,C=-1;var x=class e{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++C}`;config;type="basic";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...v,...e}}setup(t,n){if(null==this.root){for(let[i,r]of(this.root=t,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:g,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),t instanceof Document?this.setupWindow():this.setupElement(n),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:e.__lastScrollPosition}),u(this.computeRenderRangeAndEmit)):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)},this.connectQueue.entries()))this.connect(i,r);this.connectQueue.clear(),this.markDOMDirty(),u(this.computeRenderRangeAndEmit)}}instanceChanged(e){this.instancesChanged.add(e),this.markDOMDirty(),u(this.computeRenderRangeAndEmit)}getWindowSpecs(){return 0===this.windowSpecs.top&&0===this.windowSpecs.bottom&&(this.windowSpecs=m({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),fitPerfectly:!1,overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){let n=this.getScrollTop(),i=this.getHeight(),r=this.config.intersectionObserverMargin;return!(e<n-r-t||e>n+i+r)}handleContainerResize=e=>{if(null==this.root)return;let t=!1;for(let n of e){let e=n.borderBoxSize[0].blockSize;this.root instanceof Document?e!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:e-b,newSize:e}),b=e)):n.target===this.root?e!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:e-b,newSize:e}),b=e))}t&&u(this.computeRenderRangeAndEmit)};setupWindow(){if(null==this.root||!(this.root instanceof Document))throw Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(null==this.root||this.root instanceof Document)throw Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),(e??=this.root.firstElementChild??void 0)instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+S(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw Error("Virtualizer.connect: instance is already connected...");return null==this.intersectionObserver?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),u(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){let t=this.observers.get(e);this.connectQueue.delete(e),null!=t&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),u(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{e.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,u(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{!e.__STOP&&null!=this.root&&this.root instanceof Document&&(this.scrollDirty=!0,u(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{e.__STOP||null==this.root||this.root instanceof Document||(this.scrollDirty=!0,u(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(e.__STOP)return;let t=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&0===this.instancesChanged.size)return;if(0===this.instancesChanged.size){var n;let e=m({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),fitPerfectly:!1,overscrollSize:this.config.overscrollSize});if(n=this.windowSpecs,(null==n||null==e?n===e:n.top===e.top&&n.bottom===e.bottom)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&0===this.instancesChanged.size)return;this.windowSpecs=e}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;let i=this.getScrollAnchor(this.height),r=new Set;for(let e of t?this.observers.values():this.visibleInstances.values())e.onRender(t)&&r.add(e);for(let e of this.instancesChanged)!r.has(e)&&e.onRender(t)&&r.add(e);for(let e of(this.scrollFix(i),this.instancesChanged.size>0&&this.markDOMDirty(),r))e.reconcileHeights();(this.instancesChanged.size>0||t)&&u(this.computeRenderRangeAndEmit),r.clear(),this.instancesChanged.clear()};scrollFix(e){if(null==e)return;let t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:i,fileElement:r,fileOffset:o,fileTypeOffset:a}=e;if(null!=n&&null!=i){let e=r.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(e instanceof HTMLElement){let n=S(e,t);n!==i&&this.applyScrollFix(n-i);return}}let s=S(r,t);if("top"===a)s!==o&&this.applyScrollFix(s-o);else{let e=s+r.getBoundingClientRect().height;e!==o&&this.applyScrollFix(e-o)}}applyScrollFix(e){null==this.root||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(e){let t,n=this.getScrollContainerElement();for(let[i]of this.visibleInstances.entries()){let r,o,a,s,l=S(i,n),d=l+i.offsetHeight;if(d<=0?(r=d,o="bottom"):(r=l,o="top"),d>0&&l<e)for(let e of i.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(e instanceof HTMLElement))continue;let t=e.dataset.lineIndex;if(null==t)continue;let i=S(e,n);if(!(i<0)){a=t,s=i;break}}if(t?.lineOffset!=null&&null==s)continue;let h=!1;null==t||null!=s&&(null==t.lineOffset||s<t.lineOffset)?h=!0:null==s&&null==t.lineOffset&&(r>=0&&(t.fileOffset<0||r<t.fileOffset)?h=!0:r<0&&t.fileOffset<0&&r>t.fileOffset&&(h=!0)),h&&(t={fileElement:i,fileTypeOffset:o,fileOffset:r,lineIndex:a,lineOffset:s})}return t}handleIntersectionChange=e=>{for(let{target:t,isIntersecting:n}of(this.scrollDirty=!0,e)){if(!(t instanceof HTMLElement))throw Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");let e=this.observers.get(t);if(null==e)throw Error("Virtualizer.handleIntersectionChange: no instance for target");n&&!this.visibleInstances.has(t)?(e.setVisibility(!0),this.visibleInstances.set(t,e),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(e.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0)}this.visibleInstancesDirty&&u(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=null==this.root?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty&&(this.scrollHeightDirty=!1,this.scrollHeight=null==this.root?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight),this.scrollHeight}getHeight(){return this.heightDirty&&(this.heightDirty=!1,this.height=null==this.root?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height),this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return null==this.root||this.root instanceof Document?void 0:this.root}};function S(e,t){let n=e.getBoundingClientRect(),i=t?.getBoundingClientRect().top??0;return n.top-i}var y=e.i(14499);let L=(0,y.createContext)(void 0);function k(){return(0,y.useContext)(L)}var E=e.i(2540);function w(e){let t=(0,y.useRef)(e);return(0,y.useInsertionEffect)(()=>void(t.current=e)),(0,y.useCallback)((...e)=>t.current(...e),[])}function A(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}var T=e.i(6104),M=e.i(27118),I=class{hoveredLine;hoveredToken;pre;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;renderedSelectionRange;selectionAnchor;queuedSelectionRender;pointerSession={mode:"idle"};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener("click",this.handlePointerClick),this.pre?.removeEventListener("pointerdown",this.handlePointerDown),this.pre?.removeEventListener("pointermove",this.handlePointerMove),this.pre?.removeEventListener("pointerleave",this.handlePointerLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),null!=this.queuedSelectionRender&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):null!=this.gutterUtilityContainer&&(this.gutterUtilityContainer.remove(),this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,"gutterSelecting"===this.pointerSession.mode&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection()}setSelectionDirty(){this.renderedSelectionRange=void 0}isSelectionDirty(){return null===this.renderedSelectionRange}setSelection(e){let t=!(e===this.selectedRange||A(e??void 0,this.selectedRange??void 0));(this.isSelectionDirty()||t)&&(this.selectedRange=e,this.renderSelection(),t&&this.notifySelectionCommitted())}getSelection(){return this.selectedRange}getHoveredLine=()=>{if(null!=this.hoveredLine){if("diff"===this.mode&&"diff-line"===this.hoveredLine.type)return{lineNumber:this.hoveredLine.lineNumber,side:this.hoveredLine.annotationSide};if("file"===this.mode&&"line"===this.hoveredLine.type)return{lineNumber:this.hoveredLine.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:i,onTokenClick:r,onMergeConflictActionClick:o}=this.options;null==t&&null==n&&null==i&&null==o&&null==r||null!=this.options.onGutterUtilityClick&&U(e.composedPath())||(z(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{let{lineHoverHighlight:t="disabled",onLineEnter:n,onLineLeave:i,onTokenEnter:r,onTokenLeave:o,enableGutterUtility:a=!1}=this.options;("disabled"!==t||a||null!=n||null!=i||null!=r||null!=o)&&(z(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;(z(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),null==this.hoveredLine&&null==this.hoveredToken)?z(t,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token"):(this.gutterUtilityContainer?.remove(),null!=this.hoveredToken&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),null!=this.hoveredLine&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()))};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,i=t.composedPath();z(n,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:i});let r=this.resolvePointerTarget(i);z(n,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",r);let{onLineClick:o,onLineNumberClick:a,onLineEnter:s,onLineLeave:l,onTokenClick:d,onTokenEnter:h,onTokenLeave:f,onHunkExpand:c,onMergeConflictActionClick:u}=this.options;switch(e){case"move":{let e=N(r)&&this.hoveredLine?.lineElement===r.lineElement;!(H(r)&&this.hoveredToken?.tokenElement===r.tokenElement)&&(null!=this.hoveredToken&&(f?.(this.hoveredToken,t),this.clearHoveredToken()),H(r)&&(this.setHoveredToken(this.toTokenEventBaseProps(r)),h?.(this.hoveredToken,t))),!e&&(null!=this.hoveredLine&&(this.gutterUtilityContainer?.remove(),l?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),N(r)&&(this.setHoveredLine(this.toEventBaseProps(r)),null!=this.gutterUtilityContainer&&r.numberElement.appendChild(this.gutterUtilityContainer),s?.({...this.hoveredLine,event:t})));break}case"click":{var p,m;if(null==r)break;if("kind"in(p=r)&&"merge-conflict-action"===p.kind&&null!=u){u(r);break}if("type"in(m=r)&&"line-info"===m.type&&null!=c){c(r.hunkIndex,r.all||t.shiftKey?"both":r.direction,r.all||t.shiftKey?1/0:void 0);break}if(!N(r))break;H(r)&&null!=d&&d(this.toTokenEventBaseProps(r),t);let e=this.toEventBaseProps(r);null!=a&&r.numberColumn?a({...e,event:t}):null!=o&&o({...e,event:t})}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:i,onLineNumberClick:r,onLineEnter:o,onLineLeave:a,onTokenClick:s,onTokenEnter:l,onTokenLeave:d,onHunkExpand:h,onMergeConflictActionClick:f,enableGutterUtility:c=!1,enableLineSelection:u=!1,onGutterUtilityClick:p}=this.options,m=null!=p,g="disabled"!==n||null!=i||null!=r||null!=o||null!=a||null!=s||null!=l||null!=d||null!=h||null!=f||c||u||m;if(g&&!this.hasPointerListeners){let n;e.addEventListener("click",this.handlePointerClick),e.addEventListener("pointerdown",this.handlePointerDown),e.addEventListener("pointermove",this.handlePointerMove),e.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,z(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(n=[],("both"===t||"click"===t)&&(null!=i&&n.push("onLineClick"),null!=r&&n.push("onLineNumberClick"),null!=h&&n.push("expandable hunk separators"),null!=f&&n.push("merge conflict actions")),n)),z(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),z(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")}else!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 v="selecting"===this.pointerSession.mode||"pendingSingleLineUnselect"===this.pointerSession.mode,b="gutterSelecting"===this.pointerSession.mode;(!u&&v||!m&&b)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(null==this.pre)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,i=null!=e,r=null!=t||n;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),r&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!r&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if("mouse"===e.pointerType&&0!==e.button||null==this.pre||"idle"!==this.pointerSession.mode)return;let t=e.composedPath();U(t)&&null!=this.options.onGutterUtilityClick?this.startGutterSelectionFromPointerDown(e,t):this.startLineSelectionFromPointerDown(e,t)};startLineSelectionFromPointerDown(e,t){let{enableLineSelection:n=!1}=this.options;if(!n)return;let i=this.getSelectionPointerInfo(t,!0);if(null==i)return;let{pre:r}=this;if(null==r)return;e.preventDefault();let{lineNumber:o,eventSide:a,lineIndex:s}=i;if(e.shiftKey&&null!=this.selectedRange){let t=this.getIndexesFromSelection(this.selectedRange,"split"===r.getAttribute("data-diff-type"));if(null==t)return;let n=t.start<=t.end?s>=t.start:s<=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(o,a,!1),this.notifySelectionStart(this.selectedRange),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===o&&this.selectedRange?.end===o){let t={lineNumber:o,side:a};this.selectionAnchor=t,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.selectedRange=null,this.selectionAnchor={lineNumber:o,side:a},this.updateSelection(o,a,!1),this.notifySelectionStart(this.selectedRange),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e,t){let{enableLineSelection:n=!1,onGutterUtilityClick:i}=this.options;if(null==i)return;let r=this.getSelectionPointFromPath(t);null!=r&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:r,current:r},n&&(this.selectionAnchor={lineNumber:r.lineNumber,side:r.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.selectedRange)),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{let{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;let n=this.getSelectionPointFromPath(e.composedPath());if(null==n)return;this.pointerSession.current=n,!0===t&&this.updateSelection(n.lineNumber,n.side);return}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;let t=this.getSelectionPointerInfo(e.composedPath(),!1);if(null==t||null==this.selectionAnchor)return;this.updateSelection(t.lineNumber,t.eventSide);return}case"pendingSingleLineUnselect":{var n;if(e.pointerId!==this.pointerSession.pointerId)return;let t=this.getSelectionPointerInfo(e.composedPath(),!1);if(null==t||null==this.selectionAnchor)return;let i={lineNumber:t.lineNumber,side:t.eventSide};if(n=this.pointerSession.pending,n.lineNumber===i.lineNumber&&n.side===i.side)return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.selectedRange),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;let i=this.getSelectionPointFromPath(e.composedPath());null!=i&&(this.pointerSession.current=i,t&&this.updateSelection(i.lineNumber,i.side)),n?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.selectedRange),this.notifySelectionCommitted()),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.selectedRange),this.notifySelectionCommitted();return;case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.selectedRange),this.notifySelectionCommitted()}};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.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){null!=this.hoveredLine&&(this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t="disabled"}=this.options;null!=this.hoveredLine&&this.clearHoveredLine(),this.hoveredLine=e,"disabled"!==t&&(("both"===t||"line"===t)&&this.hoveredLine.lineElement.setAttribute("data-hovered",""),("both"===t||"number"===t)&&this.hoveredLine.numberElement.setAttribute("data-hovered",""))}clearHoveredToken(){null!=this.hoveredToken&&(this.hoveredToken=void 0)}setHoveredToken(e){null!=this.hoveredToken&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(null==this.gutterUtilityContainer&&(this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","")),e)null!=this.gutterUtilityButton&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),null==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,null==this.gutterUtilityButton){let e=document.createElement("div");e.innerHTML=(0,M.toHtml)((0,T.createHastElement)({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[(0,T.createIconElement)({name:"diffs-icon-plus",properties:{"data-icon":""}})]}));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)}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){"pendingSingleLineUnselect"===this.pointerSession.mode&&(this.pointerSession={mode:"idle"})}getSelectionPointerInfo(e,t){let n=this.resolvePointerTarget(e);if(D(n)&&(!t||n.numberColumn)&&null!=n.splitLineIndex)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:"diff"===this.mode?n.side:void 0}}getSelectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(D(t))return{lineNumber:t.lineNumber,side:"diff"===this.mode?t.side:void 0}}getLineIndex(e,t){let{getLineIndex:n}=this.options;return null!=n?n(e,t):[e-1,e-1]}updateSelection(e,t,n=!0){let i,{selectedRange:r}=this;if(null==e)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}A(r??void 0,i??void 0)||(this.selectedRange=i,n&&this.notifySelectionChangeDelta(),this.queuedSelectionRender??=requestAnimationFrame(this.renderSelection))}getIndexesFromSelection(e,t){if(null==this.pre)return;let n=this.getLineIndex(e.start,e.side),i=this.getLineIndex(e.end,e.endSide??e.side);return null!=n&&null!=i?{start:t?n[1]:n[0],end:t?i[1]:i[0]}:void 0}renderSelection=()=>{if(null!=this.queuedSelectionRender&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),null==this.pre||this.renderedSelectionRange===this.selectedRange)return;for(let e of this.pre.querySelectorAll("[data-selected-line]"))e.removeAttribute("data-selected-line");if(this.renderedSelectionRange=this.selectedRange,null==this.selectedRange)return;let{children:e}=this.pre;if(0===e.length)return;if(e.length>2)throw console.error(e),Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");let t="split"===this.pre.getAttribute("data-diff-type"),n=this.getIndexesFromSelection(this.selectedRange,t);if(null==n)throw console.error({rowRange:n,selectedRange:this.selectedRange}),Error("InteractionManager.renderSelection: No valid rowRange");let i=n.start===n.end,r=Math.min(n.start,n.end),o=Math.max(n.start,n.end);for(let n of e){let[e,a]=n.children,s=a.children.length;if(s!==e.children.length)throw Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");for(let n=0;n<s;n++){let s=a.children[n],l=e.children[n];if(!(s instanceof HTMLElement)||!(l instanceof HTMLElement))continue;let d=this.parseLineIndex(s,t);if((d??0)>o)break;if(null==d||d<r)continue;let h=i?"single":d===r?"first":d===o?"last":"";s.setAttribute("data-selected-line",h),l.setAttribute("data-selected-line",h),l.nextSibling instanceof HTMLElement&&s.nextSibling instanceof HTMLElement&&(s.nextSibling.hasAttribute("data-line-annotation")||s.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(i?(h="last",s.setAttribute("data-selected-line","first")):d===r?h="":d===o&&s.setAttribute("data-selected-line",""),s.nextSibling.setAttribute("data-selected-line",h),l.nextSibling.setAttribute("data-selected-line",h))}}};notifySelectionCommitted(){this.options.onLineSelected?.(this.selectedRange??null)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.selectedRange??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return"file"===this.mode?{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:i,tokenElement:r,tokenText:o}){return"file"===this.mode?{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:r,tokenText:o}:{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:r,tokenText:o}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,i){return{start:e,end:t,...null!=n?{side:n}:{},...n!==i&&null!=i?{endSide:i}:{}}}resolvePointerTarget(e){let t,n,i,r,o,a,s,l,d,h,f=!1;for(let u of e){if(!(u instanceof HTMLElement))continue;if(null==h&&u.hasAttribute("data-merge-conflict-action")){var c;let e=u.getAttribute("data-merge-conflict-action")??void 0,t=u.getAttribute("data-merge-conflict-conflict-index")??void 0,n=null!=t?Number.parseInt(t,10):NaN;("current"===(c=e)||"incoming"===c||"both"===c)&&Number.isFinite(n)&&(h={kind:"merge-conflict-action",resolution:e,conflictIndex:n})}if(null==a&&u.hasAttribute("data-char")){a=u;let e=u.getAttribute("data-char");if(null!=e){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=u.textContent??"",n=t+e.length;(""!==e.trim()||!0===this.options.enableTokenInteractionsOnWhitespace)&&(s={tokenElement:a,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=null==o?u.getAttribute("data-column-number")??void 0:void 0;if(null!=e){o=u,d=Number.parseInt(e,10),f=!0,t=O(u),r=u.getAttribute("data-line-index")??void 0;continue}let p=null==i?u.getAttribute("data-line")??void 0:void 0;if(null!=p){i=u,d=Number.parseInt(p,10),t=O(u),r=u.getAttribute("data-line-index")??void 0;continue}if(null==l&&(u.hasAttribute("data-expand-button")||u.hasAttribute("data-unmodified-lines"))){l={hunkIndex:void 0,direction:u.hasAttribute("data-expand-up")?"up":u.hasAttribute("data-expand-down")?"down":"both",all:u.hasAttribute("data-expand-all-button")};continue}let m=null!=l?u.getAttribute("data-expand-index")??void 0:void 0;if(null!=l&&null!=m){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(null==n&&u.hasAttribute("data-code")){n=u;break}}if(null!=h)return h;if(l?.hunkIndex!=null)return{type:"line-info",hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=null!=r?P(n,`[data-line][data-line-index="${r}"]`):void 0,o??=null!=r?P(n,`[data-column-number][data-line-index="${r}"]`):void 0,null==n||null==i||null==o||null==t||null==d||Number.isNaN(d))return;let u=this.parseLineIndex(i,this.isSplitDiff());return null!=s?"file"===this.mode?{kind:"token",lineType:t,lineElement:i,lineNumber:d,numberColumn:f,numberElement:o,side:void 0,splitLineIndex:u,...s}:{kind:"token",lineType:t,lineElement:i,lineNumber:d,numberColumn:f,numberElement:o,side:F(t,n),splitLineIndex:u,...s}:"file"===this.mode?{kind:"line",lineType:t,lineElement:i,lineNumber:d,numberColumn:f,numberElement:o,side:void 0,splitLineIndex:u}:{kind:"line",lineType:t,lineElement:i,lineNumber:d,numberColumn:f,numberElement:o,side:F(t,n),splitLineIndex:u}}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));return t&&2===n.length?n[1]:t?void 0:n[0]}};function R({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,enableHoverUtility:n,lineHoverHighlight:i,onGutterUtilityClick:r,onLineClick:o,onLineEnter:a,onLineLeave:s,onLineNumberClick:l,onTokenClick:d,onTokenEnter:h,onTokenLeave:f,renderGutterUtility:c,renderHoverUtility:u,__debugPointerEvents:p,enableLineSelection:m,onLineSelected:g,onLineSelectionStart:v,onLineSelectionChange:b,onLineSelectionEnd:C},x,S,y){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:function({enableGutterUtility:e,enableHoverUtility:t,renderGutterUtility:n,renderHoverUtility:i,onGutterUtilityClick:r}){if(void 0!==e&&void 0!==t)throw Error("Cannot use both 'enableGutterUtility' and deprecated 'enableHoverUtility'. Use only 'enableGutterUtility'.");if(null!=n&&null!=i)throw Error("Cannot use both 'renderGutterUtility' and deprecated 'renderHoverUtility'. Use only 'renderGutterUtility'.");if(null!=r&&(null!=n||null!=i))throw Error("Cannot use both 'onGutterUtilityClick' and render utility callbacks ('renderGutterUtility'/'renderHoverUtility'). Use only one gutter utility API.");return e??t??!1}({enableGutterUtility:t,enableHoverUtility:n,renderGutterUtility:c,renderHoverUtility:u,onGutterUtilityClick:r}),usesCustomGutterUtility:null!=c||null!=u,lineHoverHighlight:i,onGutterUtilityClick:r,onHunkExpand:x,onMergeConflictActionClick:y,onLineClick:o,onLineEnter:a,onLineLeave:s,onLineNumberClick:l,onTokenClick:d,onTokenEnter:h,onTokenLeave:f,__debugPointerEvents:p,enableLineSelection:m,onLineSelected:g,onLineSelectionStart:v,onLineSelectionChange:b,onLineSelectionEnd:C,getLineIndex:S}}function D(e){return null!=e&&"kind"in e&&"line"===e.kind}function H(e){return null!=e&&"kind"in e&&"token"===e.kind}function N(e){return D(e)||H(e)}function P(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function F(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function O(e){let t=e.getAttribute("data-line-type");if(null!=t)switch(t){case"change-deletion":case"change-addition":case"context":case"context-expanded":return t;default:return}}function U(e){for(let t of e)if(t instanceof HTMLElement&&t.hasAttribute("data-utility-button"))return!0;return!1}function z(e="none",t,...n){switch(e){case"none":return;case"both":break;case"click":if("click"!==t)return;break;case"move":if("move"!==t)return}console.log(...n)}var _=class{observedNodes=new Map;queuedUpdates=new Map;cleanUp(){this.resizeObserver?.disconnect(),this.observedNodes.clear(),this.queuedUpdates.clear()}resizeObserver;setup(e,t){this.resizeObserver??=new ResizeObserver(this.handleResizeObserver);let n=e.querySelectorAll("code"),i=new Map(this.observedNodes);for(let e of(this.observedNodes.clear(),n)){let t=i.get(e);if(null!=t&&"code"!==t.type)throw Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let n=e.firstElementChild;n instanceof HTMLElement||(n=null),null!=t?(this.observedNodes.set(e,t),i.delete(e),t.numberElement!==n?(null!=t.numberElement&&this.resizeObserver.unobserve(t.numberElement),null!=n&&(this.resizeObserver.observe(n),i.delete(n),this.observedNodes.set(n,t)),t.numberElement=n):null!=t.numberElement&&(i.delete(t.numberElement),this.observedNodes.set(t.numberElement,t))):(t={type:"code",codeElement:e,numberElement:n,codeWidth:"auto",numberWidth:0},this.observedNodes.set(e,t),this.resizeObserver.observe(e),null!=n&&(this.observedNodes.set(n,t),this.resizeObserver.observe(n)))}if(n.length>1&&!t){let t=e.querySelectorAll('[data-line-annotation*=","]'),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let{lineAnnotation:t=""}=e.dataset;if(!/^\d+,\d+$/.test(t)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:t,element:e});continue}let i=n.get(t);null==i&&(i=[],n.set(t,i)),i.push(e)}for(let[e,t]of n){if(2!==t.length){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",e,t);continue}let[n,r]=t,o=n.firstElementChild,a=r.firstElementChild;if(!(n instanceof HTMLElement)||!(r instanceof HTMLElement)||!(o instanceof HTMLElement)||!(a instanceof HTMLElement))continue;let s=i.get(o);if(null!=s){this.observedNodes.set(o,s),this.observedNodes.set(a,s),i.delete(o),i.delete(a);continue}let l=Math.max((s={type:"annotations",column1:{container:n,child:o,childHeight:o.getBoundingClientRect().height},column2:{container:r,child:a,childHeight:a.getBoundingClientRect().height},currentHeight:"auto"}).column1.childHeight,s.column2.childHeight);this.applyNewHeight(s,l),this.observedNodes.set(o,s),this.observedNodes.set(a,s),this.resizeObserver.observe(o),this.resizeObserver.observe(a)}}for(let e of i.keys())e.isConnected&&(e.style.removeProperty("--diffs-column-content-width"),e.style.removeProperty("--diffs-column-number-width"),e.style.removeProperty("--diffs-column-width"),e.parentElement instanceof HTMLElement&&e.parentElement.style.removeProperty("--diffs-annotation-min-height")),this.resizeObserver.unobserve(e);i.clear()}handleResizeObserver=e=>{for(let t of e){let{target:e,borderBoxSize:n}=t;if(!(e instanceof HTMLElement)){console.error("FileDiff.handleResizeObserver: Invalid element for ResizeObserver",t);continue}let i=this.observedNodes.get(e);if(null==i){console.error("FileDiff.handleResizeObserver: Not a valid observed node",t);continue}let r=n[0];if("annotations"===i.type){let t=e===i.column1.child?i.column1:e===i.column2.child?i.column2:void 0;if(null==t){console.error("FileDiff.handleResizeObserver: Couldn't find a column for",{item:i,target:e});continue}t.childHeight=r.blockSize;let n=Math.max(i.column1.childHeight,i.column2.childHeight);this.applyNewHeight(i,n)}else if("code"===i.type){let t=[e,r.inlineSize],n=this.queuedUpdates.get(i)??[];n.push(t),this.queuedUpdates.set(i,n)}}this.handleColumnChange()};handleColumnChange=()=>{for(let[e,t]of this.queuedUpdates)for(let[n,i]of t)if(n===e.codeElement){let n=Math.max(Math.floor(i),0);if(n!==e.codeWidth){let t=Math.max(n-e.numberWidth,0);e.codeWidth=0===n?"auto":n,e.codeElement.style.setProperty("--diffs-column-content-width",`${t>0?`${t}px`:"auto"}`),e.codeElement.style.setProperty("--diffs-column-width",`${"number"==typeof e.codeWidth?`${e.codeWidth}px`:"auto"}`)}null!=e.numberElement&&"number"==typeof e.codeWidth&&0===e.numberWidth&&t.push([e.numberElement,e.numberElement.getBoundingClientRect().width])}else if(n===e.numberElement){let t=Math.max(Math.ceil(i),0);if(t!==e.numberWidth&&(e.numberWidth=t,e.codeElement.style.setProperty("--diffs-column-number-width",`${0===e.numberWidth?"auto":`${e.numberWidth}px`}`),"auto"!==e.codeWidth)){let t=Math.max(e.codeWidth-e.numberWidth,0);e.codeElement.style.setProperty("--diffs-column-content-width",`${0===t?"auto":`${t}px`}`)}}this.queuedUpdates.clear()};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 B(e,t){return null==e||null==t?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}var G=e.i(22256);function W(e){for(let t of Array.isArray(e)?e:[e])if(!G.AttachedLanguages.has(t))return!1;return!0}var $=e.i(30891),j=e.i(51045),V=e.i(86309);function q(e){for(let t of(0,j.getThemes)(e))if(!V.AttachedThemes.has(t))return!1;return!0}var K=e.i(16049),X=e.i(8456);function Q(e){return(0,T.createHastElement)({tagName:"div",children:[(0,T.createHastElement)({tagName:"div",children:e.annotations?.map(e=>(0,T.createHastElement)({tagName:"slot",properties:{name:e}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function Y(e,t){return(0,T.createHastElement)({tagName:"div",children:e,properties:{"data-content":"",style:`grid-row: span ${t}`}})}function J({fileOrDiff:e,mode:t}){let n="type"in e?e:void 0,i={"data-diffs-header":t,"data-change-type":n?.type};return(0,T.createHastElement)({tagName:"div",children:["custom"===t?(0,T.createHastElement)({tagName:"slot",properties:{name:r.CUSTOM_HEADER_SLOT_ID}}):function({name:e,prevName:t,iconType:n}){let i=[(0,T.createHastElement)({tagName:"slot",properties:{name:r.HEADER_PREFIX_SLOT_ID}}),(0,T.createIconElement)({name:function(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"}}(n),properties:{"data-change-icon":n}})];return null!=t&&(i.push((0,T.createHastElement)({tagName:"div",children:[(0,T.createHastElement)({tagName:"bdi",children:[(0,T.createTextNodeElement)(t)]})],properties:{"data-prev-name":""}})),i.push((0,T.createIconElement)({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push((0,T.createHastElement)({tagName:"div",children:[(0,T.createHastElement)({tagName:"bdi",children:[(0,T.createTextNodeElement)(e)]})],properties:{"data-title":""}})),(0,T.createHastElement)({tagName:"div",children:i,properties:{"data-header-content":""}})}({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:n?.type??"file"}),..."custom"===t?[]:[function(e){let t=[];if(null!=e){let n=0,i=0;for(let t of e.hunks)n+=t.additionLines,i+=t.deletionLines;(i>0||0===n)&&t.push((0,T.createHastElement)({tagName:"span",children:[(0,T.createTextNodeElement)(`-${i}`)],properties:{"data-deletions-count":""}})),(n>0||0===i)&&t.push((0,T.createHastElement)({tagName:"span",children:[(0,T.createTextNodeElement)(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push((0,T.createHastElement)({tagName:"slot",properties:{name:r.HEADER_METADATA_SLOT_ID}})),(0,T.createHastElement)({tagName:"div",children:t,properties:{"data-metadata":""}})}(n)]],properties:i})}function Z(e){return(0,T.createHastElement)({tagName:"pre",properties:function({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:i,split:r,totalLines:o,type:a,customProperties:s}){return{...s,"data-diff":"diff"===a?"":void 0,"data-file":"file"===a?"":void 0,"data-diff-type":"diff"===a?r?"split":"single":void 0,"data-overflow":i,"data-disable-line-numbers":n?"":void 0,"data-background":t?void 0:"","data-indicators":"bars"===e||"classic"===e?e:void 0,tabIndex:0,style:`--diffs-min-number-column-width-default:${`${o}`.length}ch;`}}(e)})}var ee=e.i(35864);function et(e,{theme:t,preferredHighlighter:n="shiki-js"}){return{langs:[e??"text"],themes:(0,j.getThemes)(t),preferredHighlighter:n}}var en=e.i(82189),ei=e.i(6609),er=e.i(59390),eo=e.i(16876);function ea(e){return!0===e.useTokenTransformer||null!=e.onTokenClick||null!=e.onTokenEnter||null!=e.onTokenLeave}let es=-1;var el=class{__id=`file-renderer:${++es}`;highlighter;renderCache;computedLang="text";lineAnnotations={};lineCache;constructor(e={theme:r.DEFAULT_THEMES},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=q(e.theme??r.DEFAULT_THEMES)?(0,$.getHighlighterIfLoaded)():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){for(let t of(this.lineAnnotations={},e)){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.renderCache=void 0,this.highlighter=void 0,this.workerManager=void 0,this.onRenderUpdate=void 0,this.lineCache=void 0}hydrate(e){let{options:t}=this.getRenderOptions(e),n=this.workerManager?.getFileResultCache(e);null==n||ed(t,n.options)||(n=void 0),this.renderCache??={file:e,options:t,highlighted:!(0,en.isFilePlainText)(e),result:n?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?null==this.renderCache.result&&this.workerManager.highlightFileAST(this,e):null==this.highlighter&&(this.computedLang=e.lang??(0,ee.getFiletypeFromFileName)(e.name),this.initializeHighlighter())}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getFileRenderOptions();let{theme:e=r.DEFAULT_THEMES,tokenizeMaxLineLength:t=1e3}=this.options;return{theme:e,useTokenTransformer:ea(this.options),tokenizeMaxLineLength:t}})(),{renderCache:n}=this;return n?.result!=null&&e===n.file&&ed(t,n.options)?{options:t,forceRender:!1}:{options:t,forceRender:!0}}getOrCreateLineCache(e){if(null==e.cacheKey)return this.lineCache=void 0,(0,er.splitFileContents)(e.contents);let{lineCache:t}=this;return(null==t||t.cacheKey!==e.cacheKey)&&(t={cacheKey:e.cacheKey,lines:(0,er.splitFileContents)(e.contents)}),this.lineCache=t,t.lines}renderFile(e=this.renderCache?.file,t=r.DEFAULT_RENDER_RANGE){if(null==e)return;let n=this.workerManager?.getFileResultCache(e);null!=n&&null==this.renderCache&&(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...n});let{options:i,forceRender:o}=this.getRenderOptions(e);if(this.renderCache??={file:e,highlighted:!1,options:i,result:void 0,renderRange:void 0},this.workerManager?.isWorkingPool()===!0)null!=this.renderCache.result&&(this.renderCache.highlighted||e===this.renderCache.file&&B(this.renderCache.renderRange,t))||(this.renderCache.file=e,this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,this.getOrCreateLineCache(e)),this.renderCache.renderRange=t),t.totalLines>0&&(!this.renderCache.highlighted||o)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??(0,ee.getFiletypeFromFileName)(e.name);let t=null!=this.highlighter&&q(i.theme),n=null!=this.highlighter&&W(this.computedLang);if(null!=this.highlighter&&t&&(o||!this.renderCache.highlighted&&n||null==this.renderCache.result)){let{result:t,options:i}=this.renderFileWithHighlighter(e,this.highlighter,!n);this.renderCache={file:e,options:i,highlighted:n,result:t,renderRange:void 0}}t&&n||this.asyncHighlight(e).then(({result:t,options:n})=>{null!=this.renderCache&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n)})}return null!=this.renderCache.result?this.processFileResult(this.renderCache.file,t,this.renderCache.result):void 0}async asyncRender(e,t=r.DEFAULT_RENDER_RANGE){let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){this.computedLang=e.lang??(0,ee.getFiletypeFromFileName)(e.name);let t=null!=this.highlighter&&(0,K.hasResolvedThemes)((0,j.getThemes)(this.options.theme)),n=null!=this.highlighter&&W(this.computedLang);return null!=this.highlighter&&t&&n||(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter)}renderFileWithHighlighter(e,t,n=!1){let{options:i}=this.getRenderOptions(e);return{result:(0,eo.renderFileWithHighlighter)(e,t,i,{forcePlainText:n}),options:i}}processFileResult(e,t,{code:n,themeStyles:i,baseThemeType:r}){let{disableFileHeader:a=!1}=this.options,s=[],l=(0,T.createGutterWrapper)(),d=this.getOrCreateLineCache(e),h=0;return(0,ei.iterateOverFile)({lines:d,startingLine:t.startingLine,totalLines:t.totalLines,callback:({lineIndex:t,lineNumber:i})=>{let r=n[t];if(null==r){let n="FileRenderer.processFileResult: Line doesnt exist";throw console.error(n,{name:e.name,lineIndex:t,lineNumber:i,lines:d}),Error(n)}if(null!=r){l.children.push((0,T.createGutterItem)("context",i,`${t}`)),s.push(r),h++;let e=this.lineAnnotations[i];null!=e&&(l.children.push((0,T.createGutterGap)("context","annotation",1)),s.push(Q({type:"annotation",hunkIndex:0,lineIndex:i,annotations:e.map(e=>o(e))})),h++)}}}),l.properties.style=`grid-row: span ${h}`,{gutterAST:l.children??[],contentAST:s,preAST:this.createPreElement(d.length),headerAST:a?void 0:this.renderHeader(e),totalLines:d.length,rowCount:h,themeStyles:i,baseThemeType:r,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderHeader(e){let{headerRenderMode:t="default"}=this.options;return J({fileOrDiff:e,mode:t})}renderFullHTML(e){return(0,M.toHtml)(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push((0,T.createHastElement)({tagName:"code",children:this.renderCodeAST(e),properties:{"data-code":""}})),{...e.preAST,children:t}}renderCodeAST(e){let t=(0,T.createGutterWrapper)();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,Y(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return t?(0,M.toHtml)((0,T.createHastElement)({tagName:"code",children:e,properties:{"data-code":""}})):(0,M.toHtml)(e)}async initializeHighlighter(){return this.highlighter=await (0,$.getSharedHighlighter)(et(this.computedLang,this.options)),this.highlighter}onHighlightSuccess(e,t,n){if(null==this.renderCache)return;let i=this.renderCache.file!==e||!this.renderCache.highlighted||!ed(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:!0,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}onHighlightError(e){console.error(e)}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n="scroll"}=this.options;return Z({type:"file",diffIndicators:"none",disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function ed(e,t){return(0,X.areThemesEqual)(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}let eh=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
2
+ <symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
3
+ <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"/>
4
+ </symbol>
5
+ <symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
6
+ <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"/>
7
+ </symbol>
8
+ <symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
9
+ <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"/>
10
+ </symbol>
11
+ <symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
12
+ <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"/>
13
+ </symbol>
14
+ <symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
15
+ <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"/>
16
+ </symbol>
17
+ <symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
18
+ <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"/>
19
+ </symbol>
20
+ <symbol id="diffs-icon-expand" viewBox="0 0 16 16">
21
+ <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"/>
22
+ </symbol>
23
+ <symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
24
+ <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"/>
25
+ </symbol>
26
+ <symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
27
+ <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"/>
28
+ </symbol>
29
+ <symbol id="diffs-icon-plus" viewBox="0 0 16 16">
30
+ <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"/>
31
+ </symbol>
32
+ <symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
33
+ <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"/>
34
+ </symbol>
35
+ <symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
36
+ <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"/>
37
+ </symbol>
38
+ <symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
39
+ <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"/>
40
+ </symbol>
41
+ <symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
42
+ <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"/>
43
+ </symbol>
44
+ <symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
45
+ <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"/>
46
+ </symbol>
47
+ <symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
48
+ <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"/>
49
+ </symbol>
50
+ <symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
51
+ <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"/>
52
+ </symbol>
53
+ </svg>`;var ef=e.i(60166);function ec(e,t){return null==e||null==t?e===t:function(e=eu,t=eu){if(e===t)return!0;let n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(let i of n)if(e[i]!==t[i])return!1;return!0}(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}let eu={};function ep(e){let t=document.createElement("div");return t.dataset.annotationSlot="",t.slot=e,t.style.whiteSpace="normal",t}function em(){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}function eg(){let e=document.createElement("style");return e.setAttribute(r.UNSAFE_CSS_ATTRIBUTE,""),e}let ev="@layer base, theme, rendered, unsafe;";function eb(e){return`${ev}
54
+ @layer unsafe {
55
+ ${e}
56
+ }`}function eC(e,t="system"){return`${ev}
57
+ @layer rendered {
58
+ :host {${"system"===t?"":`
59
+ color-scheme: ${t};`}
60
+ ${e}
61
+ }
62
+ }`}function ex({code:e,pre:t,columnType:n,rowSpan:i,containerSize:r=!1}={}){return null==e&&((e=document.createElement("code")).setAttribute("data-code",""),null!=n&&e.setAttribute(`data-${n}`,""),t?.appendChild(e)),null!=i?e.style.setProperty("grid-row",`span ${i}`):e.style.removeProperty("grid-row"),r?e.setAttribute("data-container-size",""):e.removeAttribute("data-container-size"),e}function eS({shadowRoot:e,currentNode:t,themeCSS:n}){let i;return""===n.trim()?void t?.remove():((t??=((i=document.createElement("style")).setAttribute(r.THEME_CSS_ATTRIBUTE,""),i)).textContent=n,t.parentNode!==e&&e.appendChild(t),t)}function ey(e,t){if(null==t)return;let n=e.shadowRoot??e.attachShadow({mode:"open"});""===n.innerHTML&&(n.innerHTML=t)}function eL(e,{type:t,diffIndicators:n,disableBackground:i,disableLineNumbers:r,overflow:o,split:a,totalLines:s,customProperties:l}){if(null!=l)for(let t in l){let n=l[t];null!=n&&e.setAttribute(t,`${n}`)}switch("diff"===t?(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 r?e.setAttribute("data-disable-line-numbers",""):e.removeAttribute("data-disable-line-numbers"),i?e.removeAttribute("data-background"):e.setAttribute("data-background",""),"diff"===t?e.setAttribute("data-diff-type",a?"split":"single"):e.removeAttribute("data-diff-type"),e.setAttribute("data-overflow",o),e.tabIndex=0,e.style.setProperty("--diffs-min-number-column-width-default",`${`${s}`.length}ch`),e}if("u">typeof HTMLElement&&null==customElements.get(r.DIFFS_TAG_NAME)){let e;class t extends HTMLElement{constructor(){if(super(),null!=this.shadowRoot)return;const t=this.attachShadow({mode:"open"});null==e&&(e=new CSSStyleSheet).replaceSync("@layer base, theme, rendered, unsafe;\n\n@layer base {\n :host {\n --diffs-font-fallback:\n 'SF Mono', Monaco, Consolas, 'Ubuntu Mono', 'Liberation Mono',\n 'Courier New', monospace;\n --diffs-header-font-fallback:\n system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',\n 'Noto Sans', 'Liberation Sans', Arial, sans-serif;\n\n --diffs-mixer: light-dark(black, white);\n --diffs-gap-fallback: 8px;\n\n --diffs-added-light: #0dbe4e;\n --diffs-added-dark: #5ecc71;\n --diffs-modified-light: #009fff;\n --diffs-modified-dark: #69b1ff;\n --diffs-deleted-light: #ff2e3f;\n --diffs-deleted-dark: #ff6762;\n\n /*\n // Available CSS Color Overrides\n --diffs-bg-buffer-override\n --diffs-bg-hover-override\n --diffs-bg-context-override\n --diffs-bg-separator-override\n\n --diffs-fg-number-override\n --diffs-fg-number-addition-override\n --diffs-fg-number-deletion-override\n --diffs-fg-conflict-marker-override\n\n --diffs-deletion-color-override\n --diffs-addition-color-override\n --diffs-modified-color-override\n\n --diffs-bg-deletion-override\n --diffs-bg-deletion-number-override\n --diffs-bg-deletion-hover-override\n --diffs-bg-deletion-emphasis-override\n\n --diffs-bg-addition-override\n --diffs-bg-addition-number-override\n --diffs-bg-addition-hover-override\n --diffs-bg-addition-emphasis-override\n\n // Line Selection Color Overrides (for enableLineSelection)\n --diffs-selection-color-override\n --diffs-bg-selection-override\n --diffs-bg-selection-number-override\n --diffs-bg-selection-background-override\n --diffs-bg-selection-number-background-override\n\n // Available CSS Layout Overrides\n --diffs-gap-inline\n --diffs-gap-block\n --diffs-gap-style\n --diffs-tab-size\n */\n\n color-scheme: light dark;\n display: block;\n font-family: var(\n --diffs-header-font-family,\n var(--diffs-header-font-fallback)\n );\n font-size: var(--diffs-font-size, 13px);\n line-height: var(--diffs-line-height, 20px);\n font-feature-settings: var(--diffs-font-features);\n\n /* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor\n * and vscode use an older build of chrome that appears to have a bug with\n * color-mix and 'in oklch', so use 'in lab' instead */\n --diffs-bg: light-dark(\n var(--diffs-light-bg, #fff),\n var(--diffs-dark-bg, #000)\n );\n --diffs-bg-buffer: var(\n --diffs-bg-buffer-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)),\n color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))\n )\n );\n --diffs-bg-hover: var(\n --diffs-bg-hover-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 97%, var(--diffs-mixer)),\n color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-mixer))\n )\n );\n\n --diffs-bg-context: var(\n --diffs-bg-context-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)),\n color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))\n )\n );\n --diffs-bg-context-number: var(\n --diffs-bg-context-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg-context) 80%, var(--diffs-bg)),\n color-mix(in lab, var(--diffs-bg-context) 60%, var(--diffs-bg))\n )\n );\n --diffs-bg-conflict-marker: var(\n --diffs-bg-conflict-marker-override,\n light-dark(\n color-mix(\n in lab,\n var(--diffs-bg-context) 88%,\n var(--diffs-modified-base)\n ),\n color-mix(\n in lab,\n var(--diffs-bg-context) 80%,\n var(--diffs-modified-base)\n )\n )\n );\n --diffs-bg-conflict-current: var(\n --diffs-bg-conflict-current-override,\n light-dark(#e5f8ea, #274432)\n );\n --diffs-bg-conflict-base: var(\n --diffs-bg-conflict-base-override,\n light-dark(\n color-mix(\n in lab,\n var(--diffs-bg-context) 90%,\n var(--diffs-modified-base)\n ),\n color-mix(\n in lab,\n var(--diffs-bg-context) 82%,\n var(--diffs-modified-base)\n )\n )\n );\n --diffs-bg-conflict-incoming: var(\n --diffs-bg-conflict-incoming-override,\n light-dark(#e6f1ff, #253b5a)\n );\n --diffs-bg-conflict-marker-number: var(\n --diffs-bg-conflict-marker-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg-conflict-marker) 72%, var(--diffs-bg)),\n color-mix(in lab, var(--diffs-bg-conflict-marker) 54%, var(--diffs-bg))\n )\n );\n --diffs-bg-conflict-current-number: var(\n --diffs-bg-conflict-current-number-override,\n light-dark(#d7f1de, #30533d)\n );\n --diffs-bg-conflict-base-number: var(\n --diffs-bg-conflict-base-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg-conflict-base) 72%, var(--diffs-bg)),\n color-mix(in lab, var(--diffs-bg-conflict-base) 54%, var(--diffs-bg))\n )\n );\n --diffs-bg-conflict-incoming-number: var(\n --diffs-bg-conflict-incoming-number-override,\n light-dark(#d8e8ff, #2f4b73)\n );\n --conflict-bg-current: var(\n --conflict-bg-current-override,\n var(--diffs-bg-addition)\n );\n --conflict-bg-incoming: var(\n --conflict-bg-incoming-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-modified-base)),\n color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-modified-base))\n )\n );\n --conflict-bg-current-number: var(\n --conflict-bg-current-number-override,\n var(--diffs-bg-addition-number)\n );\n --conflict-bg-incoming-number: var(\n --conflict-bg-incoming-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-modified-base)),\n color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-modified-base))\n )\n );\n --conflict-bg-current-header: var(\n --conflict-bg-current-header-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 78%, var(--diffs-addition-base)),\n color-mix(in lab, var(--diffs-bg) 68%, var(--diffs-addition-base))\n )\n );\n --conflict-bg-incoming-header: var(\n --conflict-bg-incoming-header-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 78%, var(--diffs-modified-base)),\n color-mix(in lab, var(--diffs-bg) 68%, var(--diffs-modified-base))\n )\n );\n --conflict-bg-current-header-number: var(\n --conflict-bg-current-header-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 72%, var(--diffs-addition-base)),\n color-mix(in lab, var(--diffs-bg) 62%, var(--diffs-addition-base))\n )\n );\n --conflict-bg-incoming-header-number: var(\n --conflict-bg-incoming-header-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 72%, var(--diffs-modified-base)),\n color-mix(in lab, var(--diffs-bg) 62%, var(--diffs-modified-base))\n )\n );\n\n --diffs-bg-separator: var(\n --diffs-bg-separator-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)),\n color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))\n )\n );\n\n --diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff));\n --diffs-fg-number: var(\n --diffs-fg-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)),\n color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))\n )\n );\n --diffs-fg-conflict-marker: var(\n --diffs-fg-conflict-marker-override,\n var(--diffs-fg-number)\n );\n\n --diffs-deletion-base: var(\n --diffs-deletion-color-override,\n light-dark(\n var(\n --diffs-light-deletion-color,\n var(--diffs-deletion-color, var(--diffs-deleted-light))\n ),\n var(\n --diffs-dark-deletion-color,\n var(--diffs-deletion-color, var(--diffs-deleted-dark))\n )\n )\n );\n --diffs-addition-base: var(\n --diffs-addition-color-override,\n light-dark(\n var(\n --diffs-light-addition-color,\n var(--diffs-addition-color, var(--diffs-added-light))\n ),\n var(\n --diffs-dark-addition-color,\n var(--diffs-addition-color, var(--diffs-added-dark))\n )\n )\n );\n --diffs-modified-base: var(\n --diffs-modified-color-override,\n light-dark(\n var(\n --diffs-light-modified-color,\n var(--diffs-modified-color, var(--diffs-modified-light))\n ),\n var(\n --diffs-dark-modified-color,\n var(--diffs-modified-color, var(--diffs-modified-dark))\n )\n )\n );\n\n /* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor\n * and vscode use an older build of chrome that appears to have a bug with\n * color-mix and 'in oklch', so use 'in lab' instead */\n --diffs-bg-deletion: var(\n --diffs-bg-deletion-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)),\n color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))\n )\n );\n --diffs-bg-deletion-number: var(\n --diffs-bg-deletion-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-deletion-base)),\n color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-deletion-base))\n )\n );\n --diffs-bg-deletion-hover: var(\n --diffs-bg-deletion-hover-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base)),\n color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-deletion-base))\n )\n );\n --diffs-bg-deletion-emphasis: var(\n --diffs-bg-deletion-emphasis-override,\n light-dark(\n rgb(from var(--diffs-deletion-base) r g b / 0.15),\n rgb(from var(--diffs-deletion-base) r g b / 0.2)\n )\n );\n\n --diffs-bg-addition: var(\n --diffs-bg-addition-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)),\n color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))\n )\n );\n --diffs-bg-addition-number: var(\n --diffs-bg-addition-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-addition-base)),\n color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-addition-base))\n )\n );\n --diffs-bg-addition-hover: var(\n --diffs-bg-addition-hover-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base)),\n color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-addition-base))\n )\n );\n --diffs-bg-addition-emphasis: var(\n --diffs-bg-addition-emphasis-override,\n light-dark(\n rgb(from var(--diffs-addition-base) r g b / 0.15),\n rgb(from var(--diffs-addition-base) r g b / 0.2)\n )\n );\n\n --diffs-selection-base: var(--diffs-modified-base);\n --diffs-selection-number-fg: light-dark(\n color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)),\n color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer))\n );\n --diffs-bg-selection: var(\n --diffs-bg-selection-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 82%, var(--diffs-selection-base)),\n color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-selection-base))\n )\n );\n --diffs-bg-selection-number: var(\n --diffs-bg-selection-number-override,\n light-dark(\n color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-selection-base)),\n color-mix(in lab, var(--diffs-bg) 60%, var(--diffs-selection-base))\n )\n );\n\n background-color: var(--diffs-bg);\n color: var(--diffs-fg);\n }\n\n /* NOTE(mdo): Some semantic HTML elements (e.g. `pre`, `code`) have default\n * user-agent styles. These must be overridden to use our custom styles. */\n pre,\n code,\n [data-error-wrapper] {\n isolation: isolate;\n margin: 0;\n padding: 0;\n display: block;\n outline: none;\n font-family: var(--diffs-font-family, var(--diffs-font-fallback));\n }\n\n pre,\n code {\n background-color: var(--diffs-bg);\n }\n\n code {\n contain: content;\n }\n\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n [data-icon-sprite] {\n display: none;\n }\n\n /* NOTE(mdo): Headers and separators are within pre/code, so we need to reset\n * their font-family explicitly. */\n [data-diffs-header],\n [data-separator] {\n font-family: var(\n --diffs-header-font-family,\n var(--diffs-header-font-fallback)\n );\n }\n\n [data-file-info] {\n padding: 10px;\n font-weight: 700;\n color: var(--fg);\n /* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor\n * and vscode use an older build of chrome that appears to have a bug with\n * color-mix and 'in oklch', so use 'in lab' instead */\n background-color: color-mix(in lab, var(--bg) 98%, var(--fg));\n border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));\n }\n\n [data-diff],\n [data-file] {\n /* This feels a bit crazy to me... so I need to think about it a bit more... */\n --diffs-grid-number-column-width: minmax(min-content, max-content);\n --diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;\n\n &[data-dehydrated] {\n --diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);\n }\n\n &:hover [data-code]::-webkit-scrollbar-thumb {\n background-color: var(--diffs-bg-context);\n }\n }\n\n [data-line] span {\n color: light-dark(\n var(--diffs-token-light, var(--diffs-light)),\n var(--diffs-token-dark, var(--diffs-dark))\n );\n background-color: light-dark(\n var(--diffs-token-light-bg, inherit),\n var(--diffs-token-dark-bg, inherit)\n );\n font-weight: light-dark(\n var(--diffs-token-light-font-weight, inherit),\n var(--diffs-token-dark-font-weight, inherit)\n );\n font-style: light-dark(\n var(--diffs-token-light-font-style, inherit),\n var(--diffs-token-dark-font-style, inherit)\n );\n -webkit-text-decoration: light-dark(\n var(--diffs-token-light-text-decoration, inherit),\n var(--diffs-token-dark-text-decoration, inherit)\n );\n text-decoration: light-dark(\n var(--diffs-token-light-text-decoration, inherit),\n var(--diffs-token-dark-text-decoration, inherit)\n );\n }\n\n [data-line],\n [data-gutter-buffer],\n [data-line-annotation],\n [data-no-newline] {\n color: var(--diffs-fg);\n background-color: var(--diffs-line-bg, var(--diffs-bg));\n }\n\n [data-no-newline] {\n -webkit-user-select: none;\n user-select: none;\n\n span {\n opacity: 0.6;\n }\n }\n\n [data-diff-type='split'][data-overflow='scroll'] {\n display: grid;\n grid-template-columns: 1fr 1fr;\n\n [data-additions] {\n border-left: 1px solid var(--diffs-bg);\n }\n\n [data-deletions] {\n border-right: 1px solid var(--diffs-bg);\n }\n }\n\n [data-code] {\n display: grid;\n grid-auto-flow: dense;\n grid-template-columns: var(--diffs-code-grid);\n overflow: scroll clip;\n overscroll-behavior-x: none;\n tab-size: var(--diffs-tab-size, 2);\n align-self: flex-start;\n padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));\n padding-bottom: max(\n 0px,\n calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) - 6px)\n );\n }\n\n [data-container-size] {\n container-type: inline-size;\n }\n\n [data-code]::-webkit-scrollbar {\n width: 0;\n height: 6px;\n }\n\n [data-code]::-webkit-scrollbar-track {\n background: transparent;\n }\n\n [data-code]::-webkit-scrollbar-thumb {\n background-color: transparent;\n border: 1px solid transparent;\n background-clip: content-box;\n border-radius: 3px;\n }\n\n [data-code]::-webkit-scrollbar-corner {\n background-color: transparent;\n }\n\n /*\n * If we apply these rules globally it will mean that webkit will opt into the\n * standards compliant version of custom css scrollbars, which we do not want\n * because the custom stuff will look better\n */\n @supports (-moz-appearance: none) {\n [data-code] {\n scrollbar-width: thin;\n scrollbar-color: var(--diffs-bg-context) transparent;\n padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));\n }\n }\n\n [data-diffs-header] ~ [data-diff],\n [data-diffs-header] ~ [data-file] {\n [data-code],\n &[data-overflow='wrap'] {\n padding-top: 0;\n }\n }\n\n [data-gutter] {\n display: grid;\n grid-template-rows: subgrid;\n grid-template-columns: subgrid;\n grid-column: 1;\n z-index: 3;\n position: relative;\n background-color: var(--diffs-bg);\n\n [data-gutter-buffer],\n [data-column-number] {\n border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));\n }\n }\n\n [data-content] {\n display: grid;\n grid-template-rows: subgrid;\n grid-template-columns: subgrid;\n grid-column: 2;\n min-width: 0;\n }\n\n [data-diff-type='split'][data-overflow='wrap'] {\n display: grid;\n grid-auto-flow: dense;\n grid-template-columns: repeat(2, var(--diffs-code-grid));\n padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));\n\n [data-deletions] {\n display: contents;\n\n [data-gutter] {\n grid-column: 1;\n }\n\n [data-content] {\n grid-column: 2;\n border-right: 1px solid var(--diffs-bg);\n }\n }\n\n [data-additions] {\n display: contents;\n\n [data-gutter] {\n grid-column: 3;\n border-left: 1px solid var(--diffs-bg);\n }\n\n [data-content] {\n grid-column: 4;\n }\n }\n }\n\n [data-overflow='scroll'] [data-gutter] {\n position: sticky;\n left: 0;\n }\n\n [data-line-annotation][data-selected-line] {\n background-color: unset;\n\n &::before {\n content: '';\n /* FIXME(amadeus): This needs to be audited ... */\n position: sticky;\n top: 0;\n left: 0;\n display: block;\n border-right: var(--diffs-gap-style, 1px solid var(--diffs-bg));\n background-color: var(--diffs-bg-selection-number);\n }\n\n [data-annotation-content] {\n background-color: var(--diffs-bg-selection);\n }\n }\n\n [data-interactive-lines] [data-line] {\n cursor: pointer;\n }\n\n [data-content-buffer],\n [data-gutter-buffer] {\n position: relative;\n -webkit-user-select: none;\n user-select: none;\n min-height: 1lh;\n }\n\n [data-gutter-buffer='annotation'] {\n min-height: 0;\n }\n\n [data-gutter-buffer='buffer'] {\n background-size: 8px 8px;\n background-position: 0 0;\n background-origin: border-box;\n background-color: var(--diffs-bg);\n /* This is incredibley expensive... */\n background-image: repeating-linear-gradient(\n -45deg,\n transparent,\n transparent calc(3px * 1.414),\n rgb(from var(--diffs-bg-buffer) r g b / 0.8) calc(3px * 1.414),\n rgb(from var(--diffs-bg-buffer) r g b / 0.8) calc(4px * 1.414)\n );\n }\n\n [data-content-buffer] {\n grid-column: 1;\n /* We multiply by 1.414 (√2) to better approximate the diagonal repeat distance */\n background-size: 8px 8px;\n background-position: 5px 0;\n background-origin: border-box;\n background-color: var(--diffs-bg);\n /* This is incredibley expensive... */\n background-image: repeating-linear-gradient(\n -45deg,\n transparent,\n transparent calc(3px * 1.414),\n var(--diffs-bg-buffer) calc(3px * 1.414),\n var(--diffs-bg-buffer) calc(4px * 1.414)\n );\n }\n\n [data-separator] {\n box-sizing: content-box;\n background-color: var(--diffs-bg);\n }\n\n [data-separator='simple'] {\n min-height: 4px;\n }\n\n [data-separator='line-info'],\n [data-separator='line-info-basic'],\n [data-separator='metadata'],\n [data-separator='simple'] {\n background-color: var(--diffs-bg-separator);\n }\n\n [data-separator='line-info'],\n [data-separator='line-info-basic'],\n [data-separator='metadata'] {\n height: 32px;\n position: relative;\n }\n\n [data-separator-wrapper] {\n -webkit-user-select: none;\n user-select: none;\n fill: currentColor;\n position: absolute;\n inset-inline: 0;\n display: flex;\n align-items: center;\n background-color: var(--diffs-bg);\n height: 100%;\n }\n\n [data-content] [data-separator-wrapper] {\n display: none;\n }\n\n [data-separator='metadata'] [data-separator-wrapper] {\n inset-inline: 100% auto;\n padding-inline: 1ch;\n height: 100%;\n background-color: var(--diffs-bg-separator);\n color: var(--diffs-fg-number);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n min-width: min-content;\n }\n\n [data-separator='line-info'] {\n margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));\n }\n\n [data-separator='line-info-basic'],\n [data-separator='metadata'] {\n margin-block: 0;\n }\n\n [data-separator='line-info'][data-separator-first] {\n margin-top: 0;\n }\n\n [data-separator='line-info'][data-separator-last] {\n margin-bottom: 0;\n }\n\n [data-expand-index] [data-separator-wrapper] {\n display: grid;\n grid-template-columns: 32px auto;\n }\n\n [data-expand-index] [data-separator-wrapper][data-separator-multi-button] {\n grid-template-columns: 32px 32px auto;\n }\n\n [data-expand-button],\n [data-separator-content] {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n background-color: var(--diffs-bg-separator);\n }\n\n [data-expand-index] [data-separator-content]:hover {\n text-decoration: underline;\n cursor: pointer;\n }\n\n [data-expand-button] {\n justify-content: center;\n flex-shrink: 0;\n cursor: pointer;\n min-width: 32px;\n align-self: stretch;\n color: var(--diffs-fg-number);\n border-right: 2px solid var(--diffs-bg);\n\n &:hover {\n color: var(--diffs-fg);\n }\n\n &[data-expand-all-button] {\n display: none;\n }\n }\n\n [data-expand-down] [data-icon] {\n transform: scaleY(-1);\n }\n\n [data-separator-content] {\n flex: 1 1 auto;\n padding: 0 1ch;\n height: 100%;\n color: var(--diffs-fg-number);\n\n overflow: hidden;\n justify-content: flex-start;\n }\n\n [data-separator='line-info'],\n [data-separator='line-info-basic'] {\n [data-separator-content] {\n height: 100%;\n -webkit-user-select: none;\n user-select: none;\n overflow: clip;\n }\n }\n\n @supports (width: 1cqi) {\n [data-unified] {\n [data-separator='line-info'] [data-separator-wrapper] {\n padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n width: 100cqi;\n\n [data-separator-content] {\n border-radius: 6px;\n }\n }\n\n [data-separator='line-info'][data-expand-index]\n [data-separator-wrapper]\n [data-separator-content] {\n border-top-left-radius: unset;\n border-bottom-left-radius: unset;\n }\n }\n\n [data-gutter] {\n [data-separator='line-info'] [data-separator-wrapper] {\n padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n }\n\n [data-separator='line-info'] [data-separator-content] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n [data-separator='line-info'][data-expand-index] [data-separator-content] {\n border-top-left-radius: unset;\n border-bottom-left-radius: unset;\n }\n }\n\n [data-additions] {\n [data-content] [data-separator='line-info'] {\n background-color: var(--diffs-bg);\n\n [data-separator-wrapper] {\n display: none;\n }\n }\n\n [data-gutter] [data-separator='line-info'] [data-separator-wrapper] {\n display: block;\n height: 100%;\n background-color: var(--diffs-bg-separator);\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n\n [data-separator-content],\n [data-expand-button] {\n display: none;\n }\n }\n }\n\n [data-overflow='scroll']\n [data-additions]\n [data-gutter]\n [data-separator='line-info']\n [data-separator-wrapper] {\n width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));\n }\n\n [data-overflow='wrap']\n [data-additions]\n [data-content]\n [data-separator='line-info']\n [data-separator-wrapper] {\n background-color: var(--diffs-bg-separator);\n display: block;\n height: 100%;\n margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n\n [data-separator-content],\n [data-expand-button] {\n display: none;\n }\n }\n\n [data-separator='line-info'] [data-separator-wrapper] {\n [data-expand-both],\n [data-expand-down],\n [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n }\n\n @media (pointer: fine) {\n [data-separator='line-info'] [data-separator-wrapper] {\n &[data-separator-multi-button] {\n [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: unset;\n }\n\n [data-expand-down] {\n border-bottom-left-radius: 6px;\n border-top-left-radius: unset;\n }\n }\n }\n }\n }\n\n @media (pointer: coarse) {\n [data-separator='line-info-basic']\n [data-separator-wrapper][data-separator-multi-button] {\n grid-template-columns: 34px 34px auto;\n\n [data-separator-content] {\n grid-column: unset;\n grid-row: unset;\n }\n }\n\n @supports (width: 1cqi) {\n [data-separator='line-info'] [data-separator-wrapper] {\n [data-expand-both],\n [data-expand-down],\n [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n &[data-separator-multi-button] {\n [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n [data-expand-down] {\n border-bottom-left-radius: unset;\n border-top-left-radius: unset;\n }\n }\n }\n }\n }\n\n @media (pointer: fine) {\n [data-separator-wrapper][data-separator-multi-button] {\n display: grid;\n grid-template-rows: 50% 50%;\n\n [data-separator-content] {\n grid-column: 2;\n grid-row: 1 / -1;\n min-width: min-content;\n }\n\n [data-expand-button] {\n grid-column: 1;\n }\n }\n\n [data-separator='line-info'] [data-separator-wrapper],\n [data-separator='line-info']\n [data-separator-wrapper][data-separator-multi-button] {\n grid-template-columns: 34px auto;\n }\n\n [data-separator='line-info-basic'][data-expand-index]\n [data-separator-wrapper] {\n grid-template-columns: 100% auto;\n }\n\n [data-separator='line-info'],\n [data-separator='line-info-basic'] {\n [data-separator-multi-button] {\n [data-expand-up] {\n border-bottom: 1px solid var(--diffs-bg);\n border-right: 2px solid var(--diffs-bg);\n }\n [data-expand-down] {\n border-top: 1px solid var(--diffs-bg);\n border-right: 2px solid var(--diffs-bg);\n }\n }\n }\n }\n\n [data-additions] [data-gutter] [data-separator-wrapper],\n [data-additions] [data-separator='line-info-basic'] [data-separator-wrapper],\n [data-content] [data-separator-wrapper] {\n display: none;\n }\n\n [data-line-annotation],\n [data-gutter-buffer='annotation'] {\n --diffs-line-bg: var(--diffs-bg-context);\n }\n\n [data-merge-conflict-actions],\n [data-gutter-buffer='merge-conflict-action'] {\n --diffs-line-bg: var(--diffs-bg-context);\n }\n\n [data-has-merge-conflict] [data-line-annotation],\n [data-has-merge-conflict] [data-gutter-buffer='annotation'] {\n --diffs-line-bg: var(--diffs-bg);\n }\n\n [data-has-merge-conflict] [data-gutter-buffer='merge-conflict-action'] {\n --diffs-line-bg: var(--diffs-bg);\n }\n\n [data-line-annotation] {\n min-height: var(--diffs-annotation-min-height, 0);\n z-index: 2;\n }\n\n [data-merge-conflict-actions] {\n z-index: 2;\n }\n\n [data-separator='custom'] {\n display: grid;\n grid-template-columns: subgrid;\n }\n\n [data-line],\n [data-column-number],\n [data-no-newline] {\n position: relative;\n padding-inline: 1ch;\n }\n\n [data-indicators='classic'] [data-line] {\n padding-inline-start: 2ch;\n }\n\n [data-indicators='classic'] {\n [data-line-type='change-addition'],\n [data-line-type='change-deletion'] {\n &[data-no-newline],\n &[data-line] {\n &::before {\n display: inline-block;\n width: 1ch;\n height: 1lh;\n position: absolute;\n top: 0;\n left: 0;\n -webkit-user-select: none;\n user-select: none;\n }\n }\n }\n\n [data-line-type='change-addition'] {\n &[data-line],\n &[data-no-newline] {\n &::before {\n content: '+';\n color: var(--diffs-addition-base);\n }\n }\n }\n\n [data-line-type='change-deletion'] {\n &[data-line],\n &[data-no-newline] {\n &::before {\n content: '-';\n color: var(--diffs-deletion-base);\n }\n }\n }\n }\n\n [data-indicators='bars'] {\n [data-line-type='change-deletion'],\n [data-line-type='change-addition'] {\n &[data-column-number] {\n &::before {\n content: '';\n display: block;\n width: 4px;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n -webkit-user-select: none;\n user-select: none;\n contain: strict;\n }\n }\n }\n\n [data-line-type='change-deletion'] {\n &[data-column-number] {\n &::before {\n background-image: linear-gradient(\n 0deg,\n var(--diffs-bg-deletion) 50%,\n var(--diffs-deletion-base) 50%\n );\n background-repeat: repeat;\n background-size: 2px 2px;\n background-size: calc(1lh / round(1lh / 2px))\n calc(1lh / round(1lh / 2px));\n }\n }\n }\n\n [data-line-type='change-addition'] {\n &[data-column-number] {\n &::before {\n background-color: var(--diffs-addition-base);\n }\n }\n }\n }\n\n [data-overflow='wrap'] {\n [data-line],\n [data-annotation-content] {\n white-space: pre-wrap;\n word-break: break-word;\n }\n }\n\n [data-overflow='scroll'] [data-line] {\n white-space: pre;\n min-height: 1lh;\n }\n\n [data-column-number] {\n box-sizing: content-box;\n text-align: right;\n -webkit-user-select: none;\n user-select: none;\n background-color: var(--diffs-bg);\n color: var(--diffs-fg-number);\n padding-left: 2ch;\n }\n\n [data-line-number-content] {\n display: inline-block;\n min-width: var(\n --diffs-min-number-column-width,\n var(--diffs-min-number-column-width-default, 3ch)\n );\n }\n\n [data-disable-line-numbers] {\n [data-column-number] {\n min-width: 4px;\n padding: 0;\n }\n\n [data-line-number-content] {\n display: none;\n }\n\n [data-gutter-utility-slot] {\n right: unset;\n left: 0;\n justify-content: flex-start;\n }\n\n &[data-indicators='bars'] [data-gutter-utility-slot] {\n /* Using 5px here because theres a 1px separator after the bar */\n left: 5px;\n }\n }\n\n [data-file][data-disable-line-numbers] {\n [data-gutter-buffer],\n [data-column-number] {\n min-width: 0;\n border-right: 0;\n }\n }\n\n [data-interactive-line-numbers] [data-column-number] {\n cursor: pointer;\n }\n\n [data-diff-span] {\n border-radius: 3px;\n -webkit-box-decoration-break: clone;\n box-decoration-break: clone;\n }\n\n [data-line-type='change-addition'] {\n &[data-column-number] {\n color: var(\n --diffs-fg-number-addition-override,\n var(--diffs-addition-base)\n );\n }\n\n [data-diff-span] {\n background-color: var(--diffs-bg-addition-emphasis);\n }\n }\n\n [data-line-type='change-deletion'] {\n &[data-column-number] {\n color: var(\n --diffs-fg-number-deletion-override,\n var(--diffs-deletion-base)\n );\n }\n\n [data-diff-span] {\n background-color: var(--diffs-bg-deletion-emphasis);\n }\n }\n\n [data-background] [data-line-type='change-addition'] {\n --diffs-line-bg: var(--diffs-bg-addition);\n\n &[data-column-number] {\n background-color: var(--diffs-bg-addition-number);\n }\n }\n\n [data-background] [data-line-type='change-deletion'] {\n --diffs-line-bg: var(--diffs-bg-deletion);\n\n &[data-column-number] {\n background-color: var(--diffs-bg-deletion-number);\n }\n }\n\n [data-merge-conflict='marker-start'],\n [data-merge-conflict='marker-base'],\n [data-merge-conflict='marker-separator'],\n [data-merge-conflict='marker-end'] {\n padding-left: 1ch;\n color: var(--diffs-fg);\n }\n\n [data-merge-conflict='marker-start'],\n [data-merge-conflict='marker-end'] {\n display: flex;\n align-items: center;\n\n &::after {\n color: var(--diffs-fg-conflict-marker);\n font-style: normal;\n font-size: 0.75rem;\n line-height: 1.25rem;\n padding-left: 1ch;\n font-family: var(\n --diffs-header-font-family,\n var(--diffs-header-font-fallback)\n );\n }\n }\n\n [data-merge-conflict='marker-start']::after {\n content: '(Current Change)';\n }\n\n [data-merge-conflict='marker-end']::after {\n content: '(Incoming Change)';\n }\n\n [data-merge-conflict='marker-base'],\n [data-merge-conflict='marker-end'] {\n &[data-line],\n &[data-no-newline] {\n background-color: var(--diffs-bg-conflict-marker);\n }\n\n &[data-column-number] {\n background-color: var(--diffs-bg-conflict-marker-number);\n color: var(--diffs-fg-conflict-marker);\n\n [data-line-number-content] {\n color: var(--diffs-fg-conflict-marker);\n }\n }\n }\n\n [data-merge-conflict='current'] {\n &[data-line],\n &[data-no-newline] {\n background-color: var(--conflict-bg-current);\n }\n\n &[data-column-number] {\n background-color: var(--conflict-bg-current-number);\n color: var(--diffs-addition-base);\n }\n }\n\n [data-gutter-buffer='merge-conflict-marker-start'],\n [data-merge-conflict='marker-start'] {\n background-color: var(--conflict-bg-current-header);\n }\n\n [data-gutter-buffer='merge-conflict-marker-end'],\n [data-merge-conflict='marker-end'] {\n background-color: var(--conflict-bg-incoming-header);\n }\n\n [data-merge-conflict='marker-separator'] {\n &[data-line],\n &[data-no-newline] {\n background-color: var(--diffs-bg);\n }\n\n &[data-column-number] {\n background-color: var(--diffs-bg);\n }\n }\n\n [data-merge-conflict='base'] {\n &[data-line],\n &[data-no-newline] {\n background-color: var(--diffs-bg-conflict-base);\n }\n\n &[data-column-number] {\n background-color: var(--diffs-bg-conflict-base-number);\n color: var(--diffs-modified-base);\n }\n }\n\n [data-merge-conflict='incoming'] {\n &[data-line],\n &[data-no-newline] {\n background-color: var(--conflict-bg-incoming);\n }\n\n &[data-column-number] {\n background-color: var(--conflict-bg-incoming-number);\n color: var(--diffs-modified-base);\n }\n }\n\n @media (pointer: fine) {\n [data-column-number],\n [data-line] {\n &[data-hovered] {\n background-color: var(--diffs-bg-hover);\n }\n }\n\n [data-background] {\n [data-column-number],\n [data-line] {\n &[data-hovered] {\n &[data-line-type='change-deletion'] {\n background-color: var(--diffs-bg-deletion-hover);\n }\n\n &[data-line-type='change-addition'] {\n background-color: var(--diffs-bg-addition-hover);\n }\n }\n }\n }\n }\n\n [data-diffs-header='default'] {\n position: relative;\n background-color: var(--diffs-bg);\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n min-height: calc(\n 1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3)\n );\n padding-inline: 16px;\n top: 0;\n z-index: 2;\n }\n\n [data-header-content] {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n min-width: 0;\n white-space: nowrap;\n }\n\n [data-header-content] [data-prev-name],\n [data-header-content] [data-title] {\n direction: rtl;\n overflow: hidden;\n text-overflow: ellipsis;\n min-width: 0;\n white-space: nowrap;\n }\n\n [data-prev-name] {\n opacity: 0.7;\n }\n\n [data-rename-icon] {\n fill: currentColor;\n flex-shrink: 0;\n flex-grow: 0;\n }\n\n [data-diffs-header='default'] [data-metadata] {\n display: flex;\n align-items: center;\n gap: 1ch;\n white-space: nowrap;\n }\n\n [data-diffs-header='default'] [data-additions-count] {\n font-family: var(--diffs-font-family, var(--diffs-font-fallback));\n color: var(--diffs-addition-base);\n }\n\n [data-diffs-header='default'] [data-deletions-count] {\n font-family: var(--diffs-font-family, var(--diffs-font-fallback));\n color: var(--diffs-deletion-base);\n }\n\n [data-annotation-content] {\n position: relative;\n display: flow-root;\n align-self: flex-start;\n z-index: 2;\n min-width: 0;\n isolation: isolate;\n }\n\n [data-merge-conflict-actions-content] {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n padding-inline: 0.5rem;\n min-height: 1.75rem;\n font-family: var(\n --diffs-header-font-family,\n var(--diffs-header-font-fallback)\n );\n font-size: 0.75rem;\n line-height: 1.2;\n color: var(--diffs-fg);\n }\n\n [data-merge-conflict-action] {\n appearance: none;\n border: 0;\n background: transparent;\n color: var(--diffs-fg-number);\n font: inherit;\n font-style: normal;\n cursor: pointer;\n padding: 0;\n }\n\n [data-merge-conflict-action]:hover {\n color: var(--diffs-fg);\n }\n\n [data-merge-conflict-action='current']:hover {\n color: var(--diffs-addition-base);\n }\n\n [data-merge-conflict-action='incoming']:hover {\n color: var(--diffs-modified-base);\n }\n\n [data-merge-conflict-action-separator] {\n color: var(--diffs-fg-number);\n opacity: 0.6;\n -webkit-user-select: none;\n user-select: none;\n }\n\n /* Sticky positioning has a composite costs, so we should _only_ pay it if we\n * need to */\n [data-overflow='scroll'] [data-annotation-content] {\n position: sticky;\n width: var(--diffs-column-content-width, auto);\n left: var(--diffs-column-number-width, 0);\n }\n\n [data-overflow='scroll'] [data-merge-conflict-actions-content] {\n position: sticky;\n width: var(--diffs-column-content-width, auto);\n left: var(--diffs-column-number-width, 0);\n }\n\n /* Undo some of the stuff that the 'pre' tag does */\n [data-annotation-slot] {\n text-wrap-mode: wrap;\n word-break: normal;\n white-space-collapse: collapse;\n }\n\n [data-change-icon] {\n fill: currentColor;\n flex-shrink: 0;\n }\n\n [data-change-icon='change'],\n [data-change-icon='rename-pure'],\n [data-change-icon='rename-changed'] {\n color: var(--diffs-modified-base);\n }\n\n [data-change-icon='new'] {\n color: var(--diffs-addition-base);\n }\n\n [data-change-icon='deleted'] {\n color: var(--diffs-deletion-base);\n }\n\n [data-change-icon='file'] {\n opacity: 0.6;\n }\n\n /* Line selection highlighting */\n [data-selected-line] {\n &[data-gutter-buffer='annotation'],\n &[data-column-number] {\n color: var(--diffs-selection-number-fg);\n background-color: var(--diffs-bg-selection-number);\n }\n\n &[data-line] {\n background-color: var(--diffs-bg-selection);\n }\n }\n\n [data-line-type='change-addition'],\n [data-line-type='change-deletion'] {\n &[data-selected-line] {\n &[data-line],\n &[data-line][data-hovered] {\n background-color: light-dark(\n color-mix(\n in lab,\n var(--diffs-line-bg, var(--diffs-bg)) 82%,\n var(--diffs-selection-base)\n ),\n color-mix(\n in lab,\n var(--diffs-line-bg, var(--diffs-bg)) 75%,\n var(--diffs-selection-base)\n )\n );\n }\n\n &[data-column-number],\n &[data-column-number][data-hovered] {\n color: var(--diffs-selection-number-fg);\n background-color: light-dark(\n color-mix(\n in lab,\n var(--diffs-line-bg, var(--diffs-bg)) 75%,\n var(--diffs-selection-base)\n ),\n color-mix(\n in lab,\n var(--diffs-line-bg, var(--diffs-bg)) 60%,\n var(--diffs-selection-base)\n )\n );\n }\n }\n }\n\n [data-gutter-utility-slot] {\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n display: flex;\n justify-content: flex-end;\n }\n\n [data-unmodified-lines] {\n display: block;\n overflow: hidden;\n min-width: 0;\n text-overflow: ellipsis;\n white-space: nowrap;\n flex: 0 1 auto;\n }\n\n [data-error-wrapper] {\n overflow: auto;\n padding: var(--diffs-gap-block, var(--diffs-gap-fallback))\n var(--diffs-gap-inline, var(--diffs-gap-fallback));\n max-height: 400px;\n scrollbar-width: none;\n\n [data-error-message] {\n font-weight: bold;\n font-size: 18px;\n color: var(--diffs-deletion-base);\n }\n\n [data-error-stack] {\n color: var(--diffs-fg-number);\n }\n }\n\n [data-placeholder] {\n contain: strict;\n }\n\n [data-utility-button] {\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n appearance: none;\n width: 1lh;\n height: 1lh;\n margin-right: calc((1lh - 1ch) * -1);\n padding: 0;\n cursor: pointer;\n font-size: var(--diffs-font-size, 13px);\n line-height: var(--diffs-line-height, 20px);\n border-radius: 4px;\n background-color: var(--diffs-modified-base);\n color: var(--diffs-bg);\n fill: currentColor;\n position: relative;\n z-index: 4;\n }\n}\n"),t.adoptedStyleSheets=[e]}}customElements.define(r.DIFFS_TAG_NAME,t)}let ek=[],eE=-1;var ew=class{static LoadedCustomComponent=!0;__id=`file:${++eE}`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;appliedPreAttributes;lastRowCount;headerElement;headerCustom;headerPrefix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];file;renderRange;constructor(e={theme:r.DEFAULT_THEMES},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new el(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new _,this.interactionManager=new I("file",R(e)),this.workerManager?.subscribeToThemeChanges(this)}handleHighlightRender=()=>{this.rerender()};rerender(){null!=this.file&&this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}setOptions(e){null!=e&&(this.options=e,this.interactionManager.setOptions(R(e)))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??"system")===e||(this.mergeOptions({themeType:e}),"string"!=typeof this.options.theme&&null!=this.fileContainer&&null!=this.appliedThemeCSS&&this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType))}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}setSelectedLines(e){this.interactionManager.setSelection(e)}cleanUp(){this.fileRenderer.cleanUp(),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.workerManager?.unsubscribeToThemeChanges(this),this.workerManager=void 0,this.renderRange=void 0,this.file=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer?.shadowRoot!=null&&(this.fileContainer.shadowRoot.innerHTML=""),this.fileContainer=void 0,this.pre=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,this.errorWrapper=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder=void 0}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:i=!1,file:r,lineAnnotations:o}=e;this.hydrateElements(t,n),null==this.pre&&null==this.headerElement?this.render({...e,preventEmit:!0}):this.hydrationSetup({file:r,lineAnnotations:o}),i||this.emitPostRender()}hydrateElements(e,t){for(let n of(ey(e,t),Array.from(e.shadowRoot?.children??[]))){if(n instanceof SVGElement){this.spriteSVG=n;continue}if(n instanceof HTMLElement){if(n instanceof HTMLPreElement){this.pre=n,this.appliedPreAttributes=void 0;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute(r.THEME_CSS_ATTRIBUTE)){this.themeCSSStyle=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute(r.UNSAFE_CSS_ATTRIBUTE)){this.unsafeCSSStyle=n,this.appliedUnsafeCSS=n.textContent;continue}if("diffsHeader"in n.dataset){this.headerElement=n,this.lastRenderedHeaderHTML=void 0;continue}}}null!=this.pre&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute("data-dehydrated")),(null!=this.pre||null!=this.headerElement)&&(this.fileContainer=e)}hydrationSetup({file:e,lineAnnotations:t}){let{overflow:n="scroll"}=this.options;this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions({...this.options,headerRenderMode:null!=this.options.renderCustomHeader?"custom":"default"}),null!=this.pre&&(this.fileRenderer.hydrate(e),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,"wrap"===n))}getOrCreateLineCache(e=this.file){return null!=e?this.fileRenderer.getOrCreateLineCache(e):ek}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:i=!1,containerWrapper:o,lineAnnotations:a,renderRange:s}){let{collapsed:l=!1,themeType:d="system"}=this.options,h=l?void 0:s,f=this.renderRange,c=null!=a&&(a.length>0||this.lineAnnotations.length>0)&&a!==this.lineAnnotations,u=!(0,ef.areFilesEqual)(this.file,e);if(!l&&!n&&B(h,this.renderRange)&&!u&&!c)return!1;this.renderRange=h,this.file=e,this.fileRenderer.setOptions({...this.options,headerRenderMode:null!=this.options.renderCustomHeader?"custom":"default"}),null!=a&&this.setLineAnnotations(a),this.fileRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:p=!1,disableFileHeader:m=!1,overflow:g="scroll"}=this.options;if(m&&(null!=this.headerElement&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,o),l){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let n=this.fileRenderer.renderFile(e,r.EMPTY_RENDER_RANGE);null!=n&&this.applyThemeState(t,n.themeStyles,d,n.baseThemeType),n?.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.injectUnsafeCSS()}catch(e){if(p)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return i||this.emitPostRender(),!0}try{let i=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,c,u)||!this.applyPartialRender(f,h)){let n=this.fileRenderer.renderFile(e,h);if(null==n)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,d,n.baseThemeType),null!=n.headerAST&&this.applyHeaderToDOM(n.headerAST,t),this.applyFullRender(n,i)}this.applyBuffers(i,h),this.injectUnsafeCSS(),this.interactionManager.setup(i),this.resizeManager.setup(i,"wrap"===g),this.renderAnnotations(),this.renderGutterUtility()}catch(e){if(p)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return i||this.emitPostRender(),!0}emitPostRender(){null!=this.fileContainer&&this.options.onPostRender?.(this.fileContainer,this)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!e&&!t&&!n}renderPlaceholder(e){if(null==this.fileContainer)return!1;if(this.cleanChildNodes(),null==this.placeHolder){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}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.gutterUtilityContent?.remove(),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.gutterUtilityContent=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0}renderAnnotations(){if(this.isContainerManaged||null==this.fileContainer){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(null!=t&&this.lineAnnotations.length>0)for(let[i,r]of this.lineAnnotations.entries()){var n;let a=`${i}-${o(r)}`,s=this.annotationCache.get(a);if(null==s||(n=s.annotation,r.lineNumber!==n.lineNumber||r.metadata!==n.metadata)){s?.element.remove();let e=t(r);if(null==e)continue;(s={element:ep(o(r)),annotation:r}).element.appendChild(e),this.fileContainer.appendChild(s.element),this.annotationCache.set(a,s)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let e=this.options.renderGutterUtility??this.options.renderHoverUtility;if(null==this.fileContainer||null==e){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(null!=t&&null!=this.gutterUtilityContent)return;if(null==t){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=em();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(null!=t){if(null==e||""===e){null!=this.unsafeCSSStyle&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=eg(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=eb(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,i){let r=e.shadowRoot??e.attachShadow({mode:"open"}),o=i??n;(this.themeCSSStyle?.parentNode!==r||this.appliedThemeCSS?.themeStyles!==t||this.appliedThemeCSS.themeType!==o)&&(this.themeCSSStyle=eS({shadowRoot:r,currentNode:this.themeCSSStyle,themeCSS:eC(t,o)}),this.appliedThemeCSS=null!=this.themeCSSStyle?{themeStyles:t,themeType:o,baseThemeType:i}:void 0)}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e),this.code=ex({code:this.code}),this.code.innerHTML=this.fileRenderer.renderPartialHTML(this.fileRenderer.renderCodeAST(e)),t.replaceChildren(this.code),this.lastRowCount=e.rowCount}applyPartialRender(e,t){if(null==e||null==t)return!1;let{file:n,code:i}=this,r=null!=i?this.getColumns(i):void 0;if(null==n||null==i||null==r)return!1;let o=e.startingLine,a=t.startingLine,s=e.totalLines===1/0?1/0:o+e.totalLines,l=t.totalLines===1/0?1/0:a+t.totalLines,d=Math.max(o,a),h=Math.min(s,l);if(h<=d||!this.trimDOMToOverlap(r.gutter,d,h)||!this.trimDOMToOverlap(r.content,d,h))return!1;let{length:f}=r.content.children,c=(e,t)=>{if(!(t<=0))return this.fileRenderer.renderFile(n,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},u=a<d?c(a,d-a):void 0;if(void 0===u&&a<d)return!1;let p=l===1/0?1/0:Math.max(0,l-h),m=l>h?c(h,p):void 0;return(void 0!==m||!(l>h))&&(this.cleanupErrorWrapper(),null!=u&&(r.gutter.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(u.gutterAST)),r.content.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(u.contentAST)),f+=u.rowCount),null!=m&&(r.gutter.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(m.gutterAST)),r.content.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(m.contentAST)),f+=m.rowCount),this.lastRowCount!==f&&(r.gutter.style.setProperty("grid-row",`span ${f}`),r.content.style.setProperty("grid-row",`span ${f}`),this.lastRowCount=f),!0)}getColumns(e){let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&null!=t.dataset.gutter&&null!=n.dataset.content)return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){let i=this.getDOMBoundaryIndices(e,[t,n]),r=i.get(t)??e.children.length,o=i.get(n)??e.children.length;if(r>o)return!1;for(let t=e.children.length-1;t>=o;t-=1)e.children[t]?.remove();for(let t=r-1;t>=0;t-=1)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),i=new Map;if(0===n.length)return i;let r=0,o=n[0],{children:a}=e;for(let e=0;e<a.length;e+=1){let t=a[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(null!=s){for(;null!=o&&s>=o;)i.set(o,e),r+=1,o=n[r];if(r>=n.length)break}}for(let e of n)i.has(e)||i.set(e,a.length);return i}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(null==t)return;let n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){let{disableVirtualizationBuffers:n=!1}=this.options;if(n||null==t){null!=this.bufferBefore&&(this.bufferBefore.remove(),this.bufferBefore=void 0),null!=this.bufferAfter&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(null==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")):null!=this.bufferBefore&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(null==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")):null!=this.bufferAfter&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}applyHeaderToDOM(e,t){let{file:n}=this;if(null==n)return;this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let i=(0,M.toHtml)(e);if(i!==this.lastRenderedHeaderHTML){let e=document.createElement("div");e.innerHTML=i;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;null!=this.headerElement?t.shadowRoot?.replaceChild(n,this.headerElement):t.shadowRoot?.prepend(n),this.headerElement=n,this.lastRenderedHeaderHTML=i}if(this.isContainerManaged)return;let{renderHeaderPrefix:o,renderCustomHeader:a,renderCustomMetadata:s}=this.options;if(null!=a){let e=a(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,r.CUSTOM_HEADER_SLOT_ID,e),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0}else{let e=o?.(n)??void 0,i=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,r.HEADER_PREFIX_SLOT_ID,e),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,r.HEADER_METADATA_SLOT_ID,i),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,i){if(null==i)return void t?.remove();let r=t??this.createHeaderSlotElement(n);return null==t&&e.appendChild(r),this.replaceHeaderSlotContent(r,i),r}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement("div");return t.slot=e,t}getOrCreateFileContainerNode(e,t){let n=this.fileContainer;if(this.fileContainer=e??this.fileContainer??document.createElement(r.DIFFS_TAG_NAME),null!=n&&n!==this.fileContainer&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),null!=t&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),null==this.spriteSVG){let e=document.createElement("div");e.innerHTML=eh;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t,this.fileContainer.shadowRoot?.appendChild(this.spriteSVG))}return this.fileContainer}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:"open"});return null==this.pre?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){for(let t of(this.code=void 0,Array.from(e.children)))if(t instanceof HTMLElement&&t.hasAttribute("data-code")){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n="scroll",disableLineNumbers:i=!1}=this.options,r={type:"file",split:!1,overflow:n,disableLineNumbers:i,diffIndicators:"none",disableBackground:!0,totalLines:t};ec(r,this.appliedPreAttributes)||(eL(e,r),this.appliedPreAttributes=r)}applyErrorToDOM(e,t){this.cleanupErrorWrapper();let n=this.getOrCreatePreNode(t);n.innerHTML="",n.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let i=t.shadowRoot??t.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.innerHTML="",i.appendChild(this.errorWrapper);let r=document.createElement("div");r.dataset.errorMessage="",r.innerText=e.message,this.errorWrapper.appendChild(r);let o=document.createElement("pre");o.dataset.errorStack="",o.innerText=e.stack??"No Error Stack",this.errorWrapper.appendChild(o)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};let eA=-1;var eT=class extends ew{__id=`virtualized-file:${++eA}`;top;height=0;heightCache=new Map;isVisible=!1;constructor(e,t,n=r.DEFAULT_VIRTUAL_FILE_METRICS,i,o=!1){super(e,i,o),this.virtualizer=t,this.metrics=n}getLineHeight(e,t=!1){let n=this.heightCache.get(e);return null!=n?n:this.metrics.lineHeight*(t?2:1)}setOptions(e){if(null==e)return;let t=this.options.overflow,n=this.options.collapsed;super.setOptions(e),(t!==this.options.overflow||n!==this.options.collapsed)&&(this.heightCache.clear(),this.computeApproximateSize(),this.renderRange=void 0),this.virtualizer.instanceChanged(this)}reconcileHeights(){if(null==this.fileContainer||null==this.file){this.height=0;return}let{overflow:e="scroll"}=this.options;if(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer),"scroll"===e&&0===this.lineAnnotations.length&&!this.virtualizer.config.resizeDebugging)return;let t=!1;if(null==this.code)return;let n=this.code.children[1];if(n instanceof HTMLElement){for(let e of n.children){if(!(e instanceof HTMLElement))continue;let n=e.dataset.lineIndex;if(null==n)continue;let i=Number(n),r=e.getBoundingClientRect().height,o=!1;e.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in e.nextElementSibling.dataset||"noNewline"in e.nextElementSibling.dataset)&&("noNewline"in e.nextElementSibling.dataset&&(o=!0),r+=e.nextElementSibling.getBoundingClientRect().height),r!==this.getLineHeight(i,o)&&(t=!0,r===this.metrics.lineHeight*(o?2:1)?this.heightCache.delete(i):this.heightCache.set(i,r))}(t||this.virtualizer.config.resizeDebugging)&&this.computeApproximateSize()}}onRender=e=>null!=this.fileContainer&&null!=this.file&&(e&&(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer)),this.render({file:this.file}));cleanUp(){null!=this.fileContainer&&this.virtualizer.disconnect(this.fileContainer),super.cleanUp()}computeApproximateSize(){let e=0===this.height;if(this.height=0,null==this.file)return;let{disableFileHeader:t=!1,collapsed:n=!1,overflow:i="scroll"}=this.options,{diffHeaderHeight:r,fileGap:o,lineHeight:a}=this.metrics,s=this.getOrCreateLineCache(this.file);if(t?this.height+=o:this.height+=r,!n&&("scroll"===i&&0===this.lineAnnotations.length?this.height+=this.getOrCreateLineCache(this.file).length*a:(0,ei.iterateOverFile)({lines:s,callback:({lineIndex:e})=>{this.height+=this.getLineHeight(e,!1)}}),s.length>0&&(this.height+=o),null!=this.fileContainer&&this.virtualizer.config.resizeDebugging&&!e)){let e=this.fileContainer.getBoundingClientRect();e.height!==this.height?console.log("VirtualizedFile.computeApproximateSize: computed height doesnt match",{name:this.file.name,elementHeight:e.height,computedHeight:this.height}):console.log("VirtualizedFile.computeApproximateSize: computed height IS CORRECT")}}setVisibility(e){null!=this.fileContainer&&(e&&!this.isVisible?(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}render({fileContainer:e,file:t,...n}){let i=null==this.fileContainer;if(this.file??=t,e=this.getOrCreateFileContainerNode(e),null==this.file)return console.error("VirtualizedFile.render: attempting to virtually render when we dont have file"),!1;if(i?(this.computeApproximateSize(),this.virtualizer.connect(e,this),this.top??=this.virtualizer.getOffsetInScrollContainer(e),this.isVisible=this.virtualizer.isInstanceVisible(this.top,this.height)):this.top??=this.virtualizer.getOffsetInScrollContainer(e),!this.isVisible)return this.renderPlaceholder(this.height);let r=this.virtualizer.getWindowSpecs(),o=this.computeRenderRangeFromWindow(this.file,this.top,r);return super.render({file:this.file,fileContainer:e,renderRange:o,...n})}computeRenderRangeFromWindow(e,t,{top:n,bottom:i}){let r,o,a,{disableFileHeader:s=!1,overflow:l="scroll"}=this.options,{diffHeaderHeight:d,fileGap:h,hunkLineCount:f,lineHeight:c}=this.metrics,u=this.getOrCreateLineCache(e),p=u.length,m=this.height,g=s?h:d;if(t<n-m||t>i)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:m-g-h};if(p<=f)return{startingLine:0,totalLines:f,bufferBefore:0,bufferAfter:0};let v=Math.ceil(Math.ceil(Math.max(i-n,0)/c)/f)*f+2*f,b=v/f,C=(n+i)/2;if("scroll"===l&&0===this.lineAnnotations.length){let e=Math.floor(Math.floor((C-(t+g))/c)/f)-Math.floor(b/2),n=Math.max(0,Math.min(e,Math.ceil(p/f)))*f,i=e<0?v+e*f:v,r=Math.min(i,p-n);return{startingLine:n,totalLines:i,bufferBefore:n*c,bufferAfter:Math.max(0,(p-n-r)*c)}}let x=[],S=t+g,y=0;if((0,ei.iterateOverFile)({lines:u,callback:({lineIndex:e})=>{let s=y%f==0;if(s&&(x.push(S-(t+g)),null!=a)){if(a<=0)return!0;a--}let l=this.getLineHeight(e,!1),d=Math.floor(y/f);return S>n-l&&S<i&&(r??=d),S+l>C&&(o??=d),null==a&&S>=i&&s&&(a=b),y++,S+=l,!1}}),null==r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:m-g-h};let L=x.length,k=Math.round((o??=r)-b/2),E=Math.max(0,Math.min(k,Math.max(0,L-b))),w=k<0?v+k*f:v,A=x[E]??0,T=E+w/f;return{startingLine:E*f,totalLines:w,bufferBefore:A,bufferAfter:T<x.length?m-g-x[T]-h:m-(S-t)-h}}};function eM(e,t,n){if(e===t||null==e||null==t)return e===t;let i=new Set(n),r=Object.keys(e),o=new Set(Object.keys(t));for(let n of r)if(o.delete(n),!i.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(o))if(!i.has(e))return!1;return!0}function eI(e,t){let n=e?.theme??r.DEFAULT_THEMES,i=t?.theme??r.DEFAULT_THEMES,o=eR(e),a=eR(t);return(0,X.areThemesEqual)(n,i)&&eM(e,t,["theme","parseDiffOptions"])&&eM(o,a)}function eR(e){if(null!=e&&"parseDiffOptions"in e)return e.parseDiffOptions}let eD="u"<typeof window?y.useEffect:y.useLayoutEffect;function eH({file:e,options:t,lineAnnotations:n,selectedLines:i,prerenderedHTML:r,metrics:o,hasGutterRenderUtility:a,hasCustomHeader:s,disableWorkerPool:l}){let d=k(),h=(0,y.useContext)(E.WorkerPoolContext),f=(0,y.useRef)(null),c=w(i=>{if(null!=i){if(null!=f.current)throw Error("File: An instance should not already exist when a node is created");null!=d?f.current=new eT(eN({hasCustomHeader:s,hasGutterRenderUtility:a,options:t}),d,o,!l?h:void 0,!0):f.current=new ew(eN({hasCustomHeader:s,hasGutterRenderUtility:a,options:t}),!l?h:void 0,!0),f.current.hydrate({file:e,fileContainer:i,lineAnnotations:n,prerenderedHTML:r})}else{if(null==f.current)throw Error("File: A File instance should exist when unmounting");f.current.cleanUp(),f.current=null}});return eD(()=>{if(null==f.current)return;let r=eN({hasCustomHeader:s,hasGutterRenderUtility:a,options:t}),o=!eI(f.current.options,r);f.current.setOptions(r),f.current.render({file:e,lineAnnotations:n,forceRender:o}),void 0!==i&&f.current.setSelectedLines(i)}),{ref:c,getHoveredLine:(0,y.useCallback)(()=>f.current?.getHoveredLine(),[])}}function eN({options:e,hasCustomHeader:t,hasGutterRenderUtility:n}){return n||t?{...e,renderCustomHeader:t?i:void 0,renderGutterUtility:n?i:void 0}:e}function eP({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function eF(e,t){let n=t.hunks[e.hunkIndex];if(null!=n)return{hunkIndex:e.hunkIndex,lineIndex:function(e,t){let n=e.unifiedLineStart;for(let i=0;i<t;i++){let t=e.hunkContent[i];n+="context"===t.type?t.lines:t.deletions+t.additions}return n}(n,e.startContentIndex)}}function eO(e,t=6){let n={deletionLines:[],additionLines:[],conflictStack:[],conflictBuilders:[],actions:[],hunks:[],nextConflictIndex:0,splitLineCount:0,unifiedLineCount:0,lastHunkEnd:0,activeHunk:void 0,maxContextLines:t=Math.max(t,1),maxContextLines2:2*t},i=e.contents,r=i.length;if(r>0){let e=0,t=0,o=i.indexOf("\n",e);for(;-1!==o;)eU(n,i.slice(e,o+1),t),e=o+1,t++,o=i.indexOf("\n",e);e<r&&eU(n,i.slice(e),t)}if(n.conflictStack.length>0)throw Error("parseMergeConflictDiffFromFile: unfinished merge conflict marker stack");null!=n.activeHunk&&n.activeHunk.hunkContent.length>0&&(eB(n,n.activeHunk,"trailing"),eG(n));for(let e=0;e<n.conflictBuilders.length;e++){let t=n.conflictBuilders[e];if(null==t||!t.completed)throw Error(`parseMergeConflictDiffFromFile: failed to build merge conflict action ${e}`)}if(n.hunks.length>0&&n.additionLines.length>0&&n.deletionLines.length>0){let e=n.hunks[n.hunks.length-1],t=Math.max(n.additionLines.length-(e.additionStart+e.additionCount-1),0);n.splitLineCount+=t,n.unifiedLineCount+=t}let o=n.deletionLines.join(""),a=n.additionLines.join(""),s=eX(e,"current",o),l=eX(e,"incoming",a),d="change";""===a?d="deleted":""===o&&(d="new");let h={name:e.name,prevName:void 0,type:d,hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,isPartial:!1,deletionLines:n.deletionLines,additionLines:n.additionLines,cacheKey:null!=e.cacheKey?`${e.cacheKey}:merge-conflict-diff`:void 0};return{fileDiff:h,currentFile:s,incomingFile:l,actions:n.actions,markerRows:eQ(h,n.actions)}}function eU(e,t,n){let i=e.conflictStack[e.conflictStack.length-1];if(null==i)return t.length>=7&&60===t.charCodeAt(0)&&"start"===eK(t)?void ej(e,t,n):void eW(e,t);let r=eK(t);if("start"===r)return void ej(e,t,n);if("base"===r){i.stage="base",i.baseMarkerLineIndex=n,i.markerLines.base=t;return}if("separator"===r){i.stage="incoming",i.separatorLineIndex=n,i.markerLines.separator=t;return}if("end"===r){let i=e.conflictStack.pop();if(null==i)throw Error("parseMergeConflictDiffFromFile: encountered end marker before start marker");var o=e,a=i,s=n,l=t;if(null==a.separatorLineIndex||null==a.markerLines.separator)throw Error(`parseMergeConflictDiffFromFile: conflict ${a.conflictIndex} is missing a separator marker`);let r=o.conflictBuilders[a.conflictIndex];if(null==r)throw Error(`parseMergeConflictDiffFromFile: failed to finalize conflict ${a.conflictIndex}`);let d=r.action;d.markerLines.separator=a.markerLines.separator,d.markerLines.end=l,null!=a.markerLines.base&&(d.markerLines.base=a.markerLines.base),d.conflict={conflictIndex:a.conflictIndex,startLineIndex:a.startLineIndex,startLineNumber:a.startLineIndex+1,separatorLineIndex:a.separatorLineIndex,separatorLineNumber:a.separatorLineIndex+1,endLineIndex:s,endLineNumber:s+1,baseMarkerLineIndex:a.baseMarkerLineIndex,baseMarkerLineNumber:null!=a.baseMarkerLineIndex?a.baseMarkerLineIndex+1:void 0};let h=d.currentContentIndex??d.incomingContentIndex;if(d.currentContentIndex??=h,d.incomingContentIndex??=h,d.startContentIndex<0&&null!=h&&(d.startContentIndex=h),d.endContentIndex<0&&null!=h&&(d.endContentIndex=h),d.endMarkerContentIndex<0&&null!=h&&(d.endMarkerContentIndex=h),d.hunkIndex<0||d.startContentIndex<0||d.endContentIndex<0||d.endMarkerContentIndex<0)throw Error(`parseMergeConflictDiffFromFile: failed to anchor merge conflict ${a.conflictIndex}`);o.actions[d.conflictIndex]=d,r.completed=!0;return}"current"===i.stage?e$(e,"deletion",t,i.conflictIndex,"current"):"base"===i.stage?eW(e,t,i.conflictIndex):e$(e,"addition",t,i.conflictIndex,"incoming")}function ez(e){return e.activeHunk??=eV(e.additionLines.length+1,e.deletionLines.length+1),e.activeHunk}function e_(e,t,n,i){let r=e.conflictBuilders[t];if(null==r)throw Error(`parseMergeConflictDiffFromFile: failed to locate conflict action ${t}`);let o=r.action,a=e.hunks.length;if(o.hunkIndex<0)o.hunkIndex=a;else if(o.hunkIndex!==a)throw Error(`parseMergeConflictDiffFromFile: conflict ${t} spans multiple hunks and cannot be anchored`);if(o.startContentIndex<0&&(o.startContentIndex=i),o.endContentIndex=i,o.endMarkerContentIndex=i,"current"===n){o.currentContentIndex??=i;return}if("base"===n){o.baseContentIndex??=i;return}o.incomingContentIndex=i}function eB(e,t,n){let i,r=t.contextBufferCount,o=t.contextBufferAdditionStart,a=t.contextBufferDeletionStart;if("leading"===n&&r>e.maxContextLines){let n=r-e.maxContextLines;o+=n,a+=n,r=e.maxContextLines,t.additionStart+=n,t.deletionStart+=n,t.additionLineIndex+=n,t.deletionLineIndex+=n}if("trailing"===n&&r>e.maxContextLines&&(r=e.maxContextLines),0===r){t.contextBufferCount=0,t.contextBufferBaseConflicts=void 0;return}let s=t.hunkContent,l=s[s.length-1];l?.type==="context"?l.lines+=r:s.push({type:"context",lines:r,additionLineIndex:o,deletionLineIndex:a}),i=s.length-1,t.additionCount+=r,t.deletionCount+=r;let d=t.contextBufferBaseConflicts;if(null!=d){let n=o-t.contextBufferAdditionStart;for(let[t,o]of d)t>=n&&t<n+r&&e_(e,o,"base",i)}t.contextBufferCount=0,t.contextBufferBaseConflicts=void 0}function eG(e){if(null==e.activeHunk)return;let t=e.activeHunk;if(e.activeHunk=void 0,0===t.hunkContent.length)return;let n=0,i=0;for(let e of t.hunkContent)"context"===e.type?(n+=e.lines,i+=e.lines):(n+=Math.max(e.additions,e.deletions),i+=e.additions+e.deletions);let r=Math.max(t.additionStart-1-e.lastHunkEnd,0),o={collapsedBefore:r,additionStart:t.additionStart,additionCount:t.additionCount,additionLines:t.additionLines,additionLineIndex:t.additionLineIndex,deletionStart:t.deletionStart,deletionCount:t.deletionCount,deletionLines:t.deletionLines,deletionLineIndex:t.deletionLineIndex,hunkContent:t.hunkContent,hunkContext:void 0,hunkSpecs:`@@ -${eq(t.deletionStart,t.deletionCount)} +${eq(t.additionStart,t.additionCount)} @@
63
+ `,splitLineStart:e.splitLineCount+r,splitLineCount:n,unifiedLineStart:e.unifiedLineCount+r,unifiedLineCount:i,noEOFCRAdditions:!1,noEOFCRDeletions:!1};e.hunks.push(o),e.splitLineCount+=r+n,e.unifiedLineCount+=r+i,e.lastHunkEnd=t.additionStart+t.additionCount-1}function eW(e,t,n=-1){let i=ez(e);0===i.contextBufferCount&&(i.contextBufferAdditionStart=e.additionLines.length,i.contextBufferDeletionStart=e.deletionLines.length),e.additionLines.push(t),e.deletionLines.push(t),n>=0&&(i.contextBufferBaseConflicts??=new Map,i.contextBufferBaseConflicts.set(i.contextBufferCount,n)),i.contextBufferCount++}function e$(e,t,n,i,r){let o,a,s=ez(e);s.hunkContent.length>0&&s.contextBufferCount>e.maxContextLines2&&(!function(e){let t;if(null==e.activeHunk)return;let n=e.activeHunk,i=n.contextBufferCount,r=i-e.maxContextLines2,o=n.contextBufferAdditionStart+i-e.maxContextLines,a=n.contextBufferDeletionStart+i-e.maxContextLines;if(null!=n.contextBufferBaseConflicts){let r=i-e.maxContextLines;for(let[e,i]of n.contextBufferBaseConflicts)e>=r&&(t??=new Map).set(e-r,i)}eB(e,n,"trailing");let s=n.additionCount,l=n.deletionCount;eG(e),e.activeHunk=eV(n.additionStart+s+r,n.deletionStart+l+r),e.activeHunk.contextBufferAdditionStart=o,e.activeHunk.contextBufferDeletionStart=a,e.activeHunk.contextBufferCount=e.maxContextLines,e.activeHunk.contextBufferBaseConflicts=t}(e),s=e.activeHunk),eB(e,s,0===s.hunkContent.length?"leading":"before-change");let l=e.additionLines.length,d=e.deletionLines.length;"addition"===t?e.additionLines.push(n):e.deletionLines.push(n);let h=(a=(o=s.hunkContent)[o.length-1],a?.type==="change"?"addition"===t?a.additions++:a.deletions++:o.push({type:"change",additions:+("addition"===t),deletions:+("deletion"===t),additionLineIndex:l,deletionLineIndex:d}),o.length-1);"addition"===t?(s.additionCount++,s.additionLines++):(s.deletionCount++,s.deletionLines++),e_(e,i,r,h)}function ej(e,t,n){let i=e.nextConflictIndex;e.nextConflictIndex++,e.conflictStack.push({conflictIndex:i,stage:"current",startLineIndex:n,markerLines:{start:t}}),e.conflictBuilders[i]={completed:!1,action:{conflict:{conflictIndex:i,startLineIndex:n,startLineNumber:n+1,separatorLineIndex:n,separatorLineNumber:n+1,endLineIndex:n,endLineNumber:n+1,baseMarkerLineIndex:void 0,baseMarkerLineNumber:void 0},conflictIndex:i,hunkIndex:-1,startContentIndex:-1,endContentIndex:-1,endMarkerContentIndex:-1,markerLines:{start:t,separator:"",end:""}}}}function eV(e,t){return{additionStart:e,deletionStart:t,additionCount:0,deletionCount:0,additionLines:0,deletionLines:0,additionLineIndex:Math.max(e-1,0),deletionLineIndex:Math.max(t-1,0),hunkContent:[],contextBufferAdditionStart:Math.max(e-1,0),contextBufferDeletionStart:Math.max(t-1,0),contextBufferCount:0,contextBufferBaseConflicts:void 0}}function eq(e,t){return 1===t?`${e}`:`${e},${t}`}function eK(e){var t,n;let i;if(e.length<7)return;let r=e.charCodeAt(0);if(60!==r&&62!==r&&61!==r&&124!==r)return;let o=((i=(t=e).length)>0&&10===t.charCodeAt(i-1)&&i--,i>0&&13===t.charCodeAt(i-1)&&i--,i);if(o<7)return;let a=1;for(;a<o&&e.charCodeAt(a)===r;)a++;if(!(a<7)){if(61===r)return a===o?"separator":void 0;if(a===o||9===(n=e.charCodeAt(a))||10===n||11===n||12===n||13===n||32===n)return 60===r?"start":62===r?"end":"base"}}function eX(e,t,n){return{...e,contents:n,cacheKey:null!=e.cacheKey?`${e.cacheKey}:merge-conflict-${t}`:void 0}}function eQ(e,t){let n=[],i=Array(e.hunks.length),r=(t,n)=>{let r=e.hunks[t];if(null==r)return 0;let o=i[t];if(null==o){o=Array(r.hunkContent.length+1);let e=r.unifiedLineStart;o[0]=e;for(let t=0;t<r.hunkContent.length;t++){let n=r.hunkContent[t];e+="context"===n.type?n.lines:n.deletions+n.additions,o[t+1]=e}i[t]=o}return o[Math.max(n,0)]??r.unifiedLineStart},o=(e,t)=>Math.max(r(e,t),(i[e]?.[Math.max(t+1,0)]??r(e,t+1))-1);for(let i of t){if(null==i)continue;let t=e.hunks[i.hunkIndex];if(null==t)continue;let a=r(i.hunkIndex,i.startContentIndex);if(n.push(eY(i,"marker-start",i.startContentIndex,i.markerLines.start,a)),null!=i.baseContentIndex){let e=i.currentContentIndex,a=i.incomingContentIndex;if(null==e||null==a)continue;let s=i.markerLines.base;if(null==s)continue;let l=t.hunkContent[e],d=t.hunkContent[i.baseContentIndex],h=t.hunkContent[a];if(l?.type!=="change"||d?.type!=="context"||h?.type!=="change")continue;let f=r(i.hunkIndex,e),c=r(i.hunkIndex,a);n.push(eY(i,"marker-base",i.baseContentIndex,s,f+l.deletions)),n.push(eY(i,"marker-separator",i.baseContentIndex,i.markerLines.separator,c),eY(i,"marker-end",i.endMarkerContentIndex,i.markerLines.end,o(i.hunkIndex,i.endMarkerContentIndex)));continue}let s=i.currentContentIndex;if(null==s)continue;let l=t.hunkContent[s];if(l?.type!=="change")continue;let d=r(i.hunkIndex,s),h=l.deletions>0?d+l.deletions:a;n.push(eY(i,"marker-separator",s,i.markerLines.separator,h),eY(i,"marker-end",i.endMarkerContentIndex,i.markerLines.end,o(i.hunkIndex,i.endMarkerContentIndex)))}return n}function eY(e,t,n,i,r){return{type:t,hunkIndex:e.hunkIndex,contentIndex:n,conflictIndex:e.conflictIndex,lineText:i,lineIndex:r}}function eJ({fileDiff:e,actions:i,renderCustomHeader:s,renderHeaderPrefix:l,renderHeaderMetadata:d,renderAnnotation:h,renderGutterUtility:f,renderHoverUtility:c,renderMergeConflictUtility:u,lineAnnotations:p,getHoveredLine:m,getInstance:g}){let v=f??c,b=s?.(e),C=l?.(e),x=d?.(e);return(0,a.jsxs)(a.Fragment,{children:[null!=b?(0,a.jsx)("div",{slot:r.CUSTOM_HEADER_SLOT_ID,children:b}):(0,a.jsxs)(a.Fragment,{children:[null!=C&&(0,a.jsx)("div",{slot:r.HEADER_PREFIX_SLOT_ID,children:C}),null!=x&&(0,a.jsx)("div",{slot:r.HEADER_METADATA_SLOT_ID,children:x})]}),null!=h&&p?.map((e,t)=>(0,a.jsx)("div",{slot:o(e),children:h(e)},t)),null!=i&&null!=u&&null!=g&&i.map(t=>{var i;let r;if(null==t)return;let o=null!=(r=eF(i=t,e))?eP({hunkIndex:r.hunkIndex,lineIndex:r.lineIndex,conflictIndex:i.conflictIndex}):void 0;return(0,a.jsx)("div",{slot:o,style:n,children:u(t,g)},o)}),null!=v&&(0,a.jsx)("div",{slot:"gutter-utility-slot",style:t,children:v(m)})]})}var eZ=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,this.enabled=!1)}setup(e,t,n){if(null==t||null==n)for(let i of e.children??[])i instanceof HTMLElement&&("deletions"in i.dataset?t=i:"additions"in i.dataset&&(n=i));null==n||null==t?this.cleanUp():(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}))}},e0=e.i(19013);function e1(e){return(0,T.createHastElement)({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function e8(e){return(0,T.createHastElement)({tagName:"div",children:[(0,T.createHastElement)({tagName:"span",children:[(0,T.createTextNodeElement)("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":e,"data-column-content":""}})}function e2(e){return(0,T.createHastElement)({tagName:"div",children:[(0,T.createIconElement)({name:"both"===e?"diffs-icon-expand-all":"diffs-icon-expand",properties:{"data-icon":""}})],properties:{role:"button","data-expand-button":"","data-expand-both":"both"===e?"":void 0,"data-expand-up":"up"===e?"":void 0,"data-expand-down":"down"===e?"":void 0}})}function e5({type:e,content:t,expandIndex:n,chunked:i=!1,slotName:r,isFirstHunk:o,isLastHunk:a}){let s=0,l=[];if("metadata"===e&&null!=t&&l.push((0,T.createHastElement)({tagName:"div",children:[(0,T.createTextNodeElement)(t)],properties:{"data-separator-wrapper":""}})),("line-info"===e||"line-info-basic"===e)&&null!=t){let e=[];null!=n&&(i?(!o&&(e.push(e2("up")),s++),!a&&(e.push(e2("down")),s++)):(e.push(e2(o||a?o?"down":"up":"both")),s++)),e.push((0,T.createHastElement)({tagName:"div",children:[(0,T.createHastElement)({tagName:"span",children:[(0,T.createTextNodeElement)(t)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),i&&null!=n&&e.push((0,T.createHastElement)({tagName:"div",children:[(0,T.createTextNodeElement)("Expand all")],properties:{role:"button","data-expand-button":"","data-expand-all-button":""}})),l.push((0,T.createHastElement)({tagName:"div",children:e,properties:{"data-separator-wrapper":"","data-separator-multi-button":s>1?"":void 0}}))}return"custom"===e&&null!=r&&l.push((0,T.createHastElement)({tagName:"slot",properties:{name:r}})),(0,T.createHastElement)({tagName:"div",children:l,properties:{"data-separator":0===l.length?"simple":e,"data-expand-index":n,"data-separator-first":o?"":void 0,"data-separator-last":a?"":void 0}})}var e6=e.i(84036),e7=e.i(89107),e4=e.i(10906);let e3=-1;var e9=class{__id=`diff-hunks-renderer:${++e3}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang="text";renderCache;constructor(e={theme:r.DEFAULT_THEMES},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=q(e.theme??r.DEFAULT_THEMES)?(0,$.getHighlighterIfLoaded)():void 0)}cleanUp(){this.highlighter=void 0,this.diff=void 0,this.renderCache=void 0,this.workerManager?.cleanUpPendingTasks(this),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.renderCache=void 0,this.workerManager?.cleanUpPendingTasks(this)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let i={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};("up"===t||"both"===t)&&(i.fromStart+=n),("down"===t||"both"===t)&&(i.fromEnd+=n),this.renderCache?.highlighted!==!0&&(this.renderCache=void 0),this.expandedHunks.set(e,i)}getExpandedHunk(e){return this.expandedHunks.get(e)??r.DEFAULT_EXPANDED_REGION}getExpandedHunksMap(){return this.expandedHunks}setLineAnnotations(e){for(let t of(this.additionAnnotations={},this.deletionAnnotations={},e)){let e=(()=>{switch(t.side){case"deletions":return this.deletionAnnotations;case"additions":return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e}}getSplitLineDecoration({side:e,type:t}){return"change"!==t?{gutterLineType:t}:{gutterLineType:"deletions"===e?"change-deletion":"change-addition"}}createAnnotationElement(e){return Q(e)}getOptionsWithDefaults(){let{diffIndicators:e="bars",diffStyle:t="split",disableBackground:n=!1,disableFileHeader:i=!1,disableLineNumbers:o=!1,disableVirtualizationBuffers:a=!1,collapsed:s=!1,expandUnchanged:l=!1,collapsedContextThreshold:d=r.DEFAULT_COLLAPSED_CONTEXT_THRESHOLD,expansionLineCount:h=100,hunkSeparators:f="line-info",lineDiffType:c="word-alt",maxLineDiffLength:u=1e3,overflow:p="scroll",theme:m=r.DEFAULT_THEMES,headerRenderMode:g="default",tokenizeMaxLineLength:v=1e3,useTokenTransformer:b=!1,useCSSClasses:C=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:i,disableLineNumbers:o,disableVirtualizationBuffers:a,collapsed:s,expandUnchanged:l,collapsedContextThreshold:d,expansionLineCount:h,hunkSeparators:f,lineDiffType:c,maxLineDiffLength:u,overflow:p,theme:this.workerManager?.getDiffRenderOptions().theme??m,headerRenderMode:g,tokenizeMaxLineLength:v,useTokenTransformer:b,useCSSClasses:C}}async initializeHighlighter(){return this.highlighter=await (0,$.getSharedHighlighter)(et(this.computedLang,this.options)),this.highlighter}hydrate(e){if(null==e)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=this.workerManager?.getDiffResultCache(e);null==n||(0,e0.areDiffRenderOptionsEqual)(t,n.options)||(n=void 0),this.renderCache??={diff:e,highlighted:!(0,e6.isDiffPlainText)(e),options:t,result:n?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?null==this.renderCache.result&&this.workerManager.highlightDiffAST(this,this.diff):null==this.highlighter&&(this.computedLang=e.lang??(0,ee.getFiletypeFromFileName)(e.name),this.initializeHighlighter())}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getDiffRenderOptions();let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:i}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:ea(this.options),tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:i}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result!=null&&e===n.diff&&(0,e0.areDiffRenderOptionsEqual)(t,n.options)?{options:t,forceRender:!1}:{options:t,forceRender:!0}}renderDiff(e=this.renderCache?.diff,t=r.DEFAULT_RENDER_RANGE){if(null==e)return;let{expandUnchanged:n=!1,collapsedContextThreshold:i}=this.getOptionsWithDefaults(),o=this.workerManager?.getDiffResultCache(e);null!=o&&null==this.renderCache&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...o});let{options:a,forceRender:s}=this.getRenderOptions(e);if(this.renderCache??={diff:e,highlighted:!1,options:a,result:void 0,renderRange:void 0},this.workerManager?.isWorkingPool()===!0){(null==this.renderCache.result||!this.renderCache.highlighted&&(e!==this.renderCache.diff||!B(this.renderCache.renderRange,t)))&&(this.renderCache.diff=e,this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,0===t.startingLine&&t.totalLines===1/0&&0===t.bufferBefore&&0===t.bufferAfter||!!n||this.expandedHunks,i),this.renderCache.renderRange=t);t.totalLines>0&&(!this.renderCache.highlighted||s)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLang=e.lang??(0,ee.getFiletypeFromFileName)(e.name);let t=null!=this.highlighter&&q(a.theme),n=null!=this.highlighter&&W(this.computedLang);if(null!=this.highlighter&&t&&(s||!this.renderCache.highlighted&&n||null==this.renderCache.result)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,!n);this.renderCache={diff:e,options:i,highlighted:n,result:t,renderRange:void 0}}t&&n||this.asyncHighlight(e).then(({result:t,options:n})=>{null!=this.renderCache&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n)})}return null!=this.renderCache.result?this.processDiffResult(this.renderCache.diff,t,this.renderCache.result):void 0}async asyncRender(e,t=r.DEFAULT_RENDER_RANGE){let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:i,disableBackground:r,disableLineNumbers:o,overflow:a}=this.getOptionsWithDefaults();return Z({type:"diff",diffIndicators:i,disableBackground:r,disableLineNumbers:o,overflow:a,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){this.computedLang=e.lang??(0,ee.getFiletypeFromFileName)(e.name);let t=null!=this.highlighter&&q(this.options.theme??r.DEFAULT_THEMES),n=null!=this.highlighter&&W(this.computedLang);return null!=this.highlighter&&t&&n||(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter)}renderDiffWithHighlighter(e,t,n=!1){let{options:i}=this.getRenderOptions(e),{collapsedContextThreshold:r}=this.getOptionsWithDefaults();return{result:(0,e4.renderDiffWithHighlighter)(e,t,i,{forcePlainText:n,expandedHunks:!!n||void 0,collapsedContextThreshold:r}),options:i}}onHighlightSuccess(e,t,n){if(null==this.renderCache)return;let i=!this.renderCache.highlighted||!(0,e0.areDiffRenderOptionsEqual)(this.renderCache.options,n)||this.renderCache.diff!==e;this.renderCache={diff:e,options:n,highlighted:!0,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}onHighlightError(e){console.error(e)}processDiffResult(e,t,{code:n,themeStyles:i,baseThemeType:r}){let o,{diffStyle:a,disableFileHeader:s,expandUnchanged:l,expansionLineCount:d,collapsedContextThreshold:h,hunkSeparators:f}=this.getOptionsWithDefaults();this.diff=e;let c="unified"===a,u=[],p=[],m=[],g=[],{additionLines:v,deletionLines:b}=n,C={rowCount:0,hunkSeparators:f,additionsContentAST:u,deletionsContentAST:p,unifiedContentAST:m,unifiedGutterAST:(0,T.createGutterWrapper)(),deletionsGutterAST:(0,T.createGutterWrapper)(),additionsGutterAST:(0,T.createGutterWrapper)(),expansionLineCount:d,hunkData:g,incrementRowCount(e=1){C.rowCount+=e},pushToGutter(e,t){switch(e){case"unified":C.unifiedGutterAST.children.push(t);break;case"deletions":C.deletionsGutterAST.children.push(t);break;case"additions":C.additionsGutterAST.children.push(t)}}},x=function(e){let t=e.hunks.at(-1);if(null==t||e.isPartial||0===e.additionLines.length||0===e.deletionLines.length)return 0;let n=e.additionLines.length-(t.additionLineIndex+t.additionCount),i=e.deletionLines.length-(t.deletionLineIndex+t.deletionCount);if(n!==i)throw Error(`DiffHunksRenderer.processDiffResult: trailing context mismatch (additions=${n}, deletions=${i}) for ${e.name}`);return Math.min(n,i)}(e),S={size:0,side:void 0,increment(){this.size+=1},flush(){if("unified"!==a){if(this.size<=0||null==this.side){this.side=void 0,this.size=0;return}"additions"===this.side?(C.pushToGutter("additions",(0,T.createGutterGap)(void 0,"buffer",this.size)),u?.push(e1(this.size))):(C.pushToGutter("deletions",(0,T.createGutterGap)(void 0,"buffer",this.size)),p?.push(e1(this.size))),this.size=0,this.side=void 0}}},y=(e,t,n,i,r)=>{C.pushToGutter(e,(0,T.createGutterItem)(t,n,i,r))};function L(e){S.flush(),"unified"===a?tr("unified",e,C):(tr("deletions",e,C),tr("additions",e,C))}(0,e7.iterateOverDiff)({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:!!l||this.expandedHunks,collapsedContextThreshold:h,callback:({hunkIndex:t,hunk:n,collapsedBefore:i,collapsedAfter:r,additionLine:o,deletionLine:s,type:l})=>{let d=null!=s?s.splitLineIndex:o.splitLineIndex,h=null!=o?o.unifiedLineIndex:s.unifiedLineIndex;"split"===a&&"change"!==l&&S.flush(),i>0&&L({hunkIndex:t,collapsedLines:i,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:0===t,isLastHunk:!1,isExpandable:!e.isPartial});let c="unified"===a?h:d,u={type:l,hunkIndex:t,lineIndex:c,unifiedLineIndex:h,splitLineIndex:d,deletionLine:s,additionLine:o};if("unified"===a){let n=this.getUnifiedInjectedRowsForLine?.(u);n?.before!=null&&tt(n.before,C);let i=null!=s?b[s.lineIndex]:void 0,r=null!=o?v[o.lineIndex]:void 0;if(null==i&&null==r){let t="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(t,{file:e.name}),Error(t)}let a="change"===l?null!=o?"change-addition":"change-deletion":l,f=this.getUnifiedLineDecoration({type:l,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});y("unified",f.gutterLineType,null!=o?o.lineNumber:s.lineNumber,`${h},${d}`,f.gutterProperties),null!=r?r=to(r,f.contentProperties):null!=i&&(i=to(i,f.contentProperties)),ti({diffStyle:"unified",type:l,deletionLine:i,additionLine:r,unifiedSpan:this.getAnnotations("unified",s?.lineNumber,o?.lineNumber,t,c),createAnnotationElement:e=>this.createAnnotationElement(e),context:C}),n?.after!=null&&tt(n.after,C)}else{let n=this.getSplitInjectedRowsForLine?.(u);n?.before!=null&&tn(n.before,C,S);let i=null!=s?b[s.lineIndex]:void 0,r=null!=o?v[o.lineIndex]:void 0,a=this.getSplitLineDecoration({side:"deletions",type:l,lineIndex:s?.lineIndex}),h=this.getSplitLineDecoration({side:"additions",type:l,lineIndex:o?.lineIndex});if(null==i&&null==r){let t="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if("change"===l){if(null==r)return"additions";else if(null==i)return"deletions"}})();if(null!=f){if(null!=S.side&&S.side!==f)throw Error("DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits");S.side=f,S.increment()}let p=this.getAnnotations("split",s?.lineNumber,o?.lineNumber,t,c);if(null!=p&&S.size>0&&S.flush(),null!=s){let e=to(i,a.contentProperties);y("deletions",a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${d}`,a.gutterProperties),null!=e&&(i=e)}if(null!=o){let e=to(r,h.contentProperties);y("additions",h.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${d}`,h.gutterProperties),null!=e&&(r=e)}ti({diffStyle:"split",type:l,additionLine:r,deletionLine:i,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:C}),n?.after!=null&&tn(n.after,C,S)}let p=s?.noEOFCR??!1,m=o?.noEOFCR??!1;if(m||p){if(p){let e="context"===l||"context-expanded"===l?l:"change-deletion";"unified"===a?(C.unifiedContentAST.push(e8(e)),C.pushToGutter("unified",(0,T.createGutterGap)(e,"metadata",1))):(C.deletionsContentAST.push(e8(e)),C.pushToGutter("deletions",(0,T.createGutterGap)(e,"metadata",1)),m||(C.pushToGutter("additions",(0,T.createGutterGap)(void 0,"buffer",1)),C.additionsContentAST.push(e1(1))))}if(m){let e="context"===l||"context-expanded"===l?l:"change-addition";"unified"===a?(C.unifiedContentAST.push(e8(e)),C.pushToGutter("unified",(0,T.createGutterGap)(e,"metadata",1))):(C.additionsContentAST.push(e8(e)),C.pushToGutter("additions",(0,T.createGutterGap)(e,"metadata",1)),p||(C.pushToGutter("deletions",(0,T.createGutterGap)(void 0,"buffer",1)),C.deletionsContentAST.push(e1(1))))}C.incrementRowCount(1)}r>0&&"simple"!==f&&L({hunkIndex:"context-expanded"===l?t:t+1,collapsedLines:r,rangeSize:x,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!e.isPartial}),C.incrementRowCount(1)}}),"split"===a&&S.flush();let k=Math.max(null==(o=e.hunks.at(-1))?0:Math.max(o.additionStart+o.additionCount,o.deletionStart+o.deletionCount),e.additionLines.length??0,e.deletionLines.length??0),E=t.bufferBefore>0||t.bufferAfter>0,w=!c&&"deleted"!==e.type,A=!c&&"new"!==e.type,M=C.rowCount>0||E;u=w&&M?u:void 0,p=A&&M?p:void 0,m=c&&M?m:void 0;let I=this.createPreElement(null!=p&&null!=u,k);return{unifiedGutterAST:c&&M?C.unifiedGutterAST.children:void 0,unifiedContentAST:m,deletionsGutterAST:A&&M?C.deletionsGutterAST.children:void 0,deletionsContentAST:p,additionsGutterAST:w&&M?C.additionsGutterAST.children:void 0,additionsContentAST:u,hunkData:g,preNode:I,themeStyles:i,baseThemeType:r,headerElement:s?void 0:this.renderHeader(this.diff),totalLines:k,rowCount:C.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderCodeAST(e,t){let n="unified"===e?t.unifiedGutterAST:"deletions"===e?t.deletionsGutterAST:t.additionsGutterAST,i="unified"===e?t.unifiedContentAST:"deletions"===e?t.deletionsContentAST:t.additionsContentAST;if(null==n||null==i)return;let r=(0,T.createGutterWrapper)(n);return r.properties.style=`grid-row: span ${t.rowCount}`,[r,Y(i,t.rowCount)]}renderFullAST(e,t=[]){let n="line-info"===this.getOptionsWithDefaults().hunkSeparators,i=this.renderCodeAST("unified",e);if(null!=i)return t.push((0,T.createHastElement)({tagName:"code",children:i,properties:{"data-code":"","data-container-size":n?"":void 0,"data-unified":""}})),{...e.preNode,children:t};let r=this.renderCodeAST("deletions",e);null!=r&&t.push((0,T.createHastElement)({tagName:"code",children:r,properties:{"data-code":"","data-container-size":n?"":void 0,"data-deletions":""}}));let o=this.renderCodeAST("additions",e);return null!=o&&t.push((0,T.createHastElement)({tagName:"code",children:o,properties:{"data-code":"","data-container-size":n?"":void 0,"data-additions":""}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return(0,M.toHtml)(this.renderFullAST(e,t))}renderPartialHTML(e,t){return null==t?(0,M.toHtml)(e):(0,M.toHtml)((0,T.createHastElement)({tagName:"code",children:e,properties:{"data-code":"","data-container-size":"line-info"===this.getOptionsWithDefaults().hunkSeparators?"":void 0,[`data-${t}`]:""}}))}getAnnotations(e,t,n,i,r){let a={type:"annotation",hunkIndex:i,lineIndex:r,annotations:[]};if(null!=t)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(o(e));let s={type:"annotation",hunkIndex:i,lineIndex:r,annotations:[]};if(null!=n)for(let t of this.additionAnnotations[n]??[])("unified"===e?a:s).annotations.push(o(t));return"unified"===e?a.annotations.length>0?a:void 0:0!==s.annotations.length||0!==a.annotations.length?{deletionSpan:a,additionSpan:s}:void 0}renderHeader(e){let{headerRenderMode:t}=this.getOptionsWithDefaults();return J({fileOrDiff:e,mode:t})}};function te(e){return`${e} unmodified line${e>1?"s":""}`}function tt(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter("unified",n.gutter),t.incrementRowCount(1)}function tn(e,t,n){for(let{deletion:i,addition:r}of e){if(null==i&&null==r)continue;let e=null!=i&&null!=r?void 0:null==i?"deletions":"additions";(null==e||n.side!==e)&&n.flush(),null!=i&&(t.deletionsContentAST.push(i.content),t.pushToGutter("deletions",i.gutter)),null!=r&&(t.additionsContentAST.push(r.content),t.pushToGutter("additions",r.gutter)),null!=e&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function ti({diffStyle:e,type:t,deletionLine:n,additionLine:i,unifiedSpan:r,deletionSpan:o,additionSpan:a,createAnnotationElement:s,context:l}){let d=!1;"unified"===e?(null!=i?l.unifiedContentAST.push(i):null!=n&&l.unifiedContentAST.push(n),null!=r&&(l.unifiedContentAST.push(s(r)),l.pushToGutter("unified",(0,T.createGutterGap)("change"===t?null!=n?"change-deletion":"change-addition":t,"annotation",1)),d=!0)):"split"===e&&(null!=n&&l.deletionsContentAST.push(n),null!=i&&l.additionsContentAST.push(i),null!=o&&(l.deletionsContentAST.push(s(o)),l.pushToGutter("deletions",(0,T.createGutterGap)("change"===t?null!=n?"change-deletion":"context":t,"annotation",1)),d=!0),null!=a&&(l.additionsContentAST.push(s(a)),l.pushToGutter("additions",(0,T.createGutterGap)("change"===t?null!=i?"change-addition":"context":t,"annotation",1)),d=!0)),d&&l.incrementRowCount(1)}function tr(e,{hunkIndex:t,collapsedLines:n,rangeSize:i,hunkSpecs:r,isFirstHunk:o,isLastHunk:a,isExpandable:s},l){if(n<=0)return;let d="unified"===e?l.unifiedContentAST:"deletions"===e?l.deletionsContentAST:l.additionsContentAST;if("metadata"===l.hunkSeparators){null!=r&&(l.pushToGutter(e,e5({type:"metadata",content:r,isFirstHunk:o,isLastHunk:a})),d.push(e5({type:"metadata",content:r,isFirstHunk:o,isLastHunk:a})),"additions"!==e&&l.incrementRowCount(1));return}if("simple"===l.hunkSeparators){t>0&&(l.pushToGutter(e,e5({type:"simple",isFirstHunk:o,isLastHunk:!1})),d.push(e5({type:"simple",isFirstHunk:o,isLastHunk:!1})),"additions"!==e&&l.incrementRowCount(1));return}let h=`hunk-separator-${e}-${t}`,f=i>l.expansionLineCount,c=s?t:void 0;l.pushToGutter(e,e5({type:l.hunkSeparators,content:te(n),expandIndex:c,chunked:f,slotName:h,isFirstHunk:o,isLastHunk:a})),d.push(e5({type:l.hunkSeparators,content:te(n),expandIndex:c,chunked:f,slotName:h,isFirstHunk:o,isLastHunk:a})),"additions"!==e&&l.incrementRowCount(1),l.hunkData.push({slotName:h,hunkIndex:t,lines:n,type:e,expandable:s?{up:!o,down:!a,chunked:f}:void 0})}function to(e,t){return null==e||"element"!==e.type||null==t?e:{...e,properties:{...e.properties,...t}}}var ta=e.i(17443);function ts(e,{cacheKey:t,isGitDiff:n=r.GIT_DIFF_FILE_BREAK_REGEX.test(e),oldFile:i,newFile:o,throwOnError:a=!1}={}){let s,l=0,d=e.split(r.FILE_CONTEXT_BLOB),h=null==i||null==o,f=0,c=0;for(let e of d){let d,u,p=e.split(r.SPLIT_WITH_NEWLINES),m=p.shift();if(null==m){if(a)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",e);continue}let g=m.match(r.HUNK_HEADER),v=0,b=0;if(null==g||null==s){if(null!=s){if(a)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",e);continue}for(let e of(1===(s={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:h,additionLines:h||null==i||null==o?[]:o.contents.split(r.SPLIT_WITH_NEWLINES),deletionLines:h||null==i||null==o?[]:i.contents.split(r.SPLIT_WITH_NEWLINES),cacheKey:t}).additionLines.length&&o?.contents===""&&(s.additionLines.length=0),1===s.deletionLines.length&&i?.contents===""&&(s.deletionLines.length=0),p.unshift(m),p)){let t=e.match(n?r.FILENAME_HEADER_REGEX_GIT:r.FILENAME_HEADER_REGEX);if(e.startsWith("diff --git")){let[,,t,,n]=e.trim().match(r.ALTERNATE_FILE_NAMES_GIT)??[];s.name=n.trim(),t!==n&&(s.prevName=t.trim())}else if(null!=t){let[,e,n]=t;"---"===e&&"/dev/null"!==n?(s.prevName=n.trim(),s.name=n.trim()):"+++"===e&&"/dev/null"!==n&&(s.name=n.trim())}else if(n){if(e.startsWith("new mode ")&&(s.mode=e.replace("new mode","").trim()),e.startsWith("old mode ")&&(s.prevMode=e.replace("old mode","").trim()),e.startsWith("new file mode")&&(s.type="new",s.mode=e.replace("new file mode","").trim()),e.startsWith("deleted file mode")&&(s.type="deleted",s.mode=e.replace("deleted file mode","").trim()),e.startsWith("similarity index")&&(e.startsWith("similarity index 100%")?s.type="rename-pure":s.type="rename-changed"),e.startsWith("index ")){let[,t,n,i]=e.trim().match(r.INDEX_LINE_METADATA)??[];null!=t&&(s.prevObjectId=t),null!=n&&(s.newObjectId=n),null!=i&&(s.mode=i)}e.startsWith("rename from ")&&(s.prevName=e.replace("rename from ","").trim()),e.startsWith("rename to ")&&(s.name=e.replace("rename to ","").trim())}}continue}for(;p.length>0&&("\n"===p[p.length-1]||"\r"===p[p.length-1]||"\r\n"===p[p.length-1]||""===p[p.length-1]);)p.pop();let C=parseInt(g[3]),x=parseInt(g[1]);f=h?f:x-1,c=h?c:C-1;let S={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:parseInt(g[4]??"1"),additionStart:C,additionLines:v,deletionCount:parseInt(g[2]??"1"),deletionStart:x,deletionLines:b,deletionLineIndex:f,additionLineIndex:c,hunkContent:[],hunkContext:g[5],hunkSpecs:m,noEOFCRAdditions:!1,noEOFCRDeletions:!1};if(isNaN(S.additionCount)||isNaN(S.deletionCount)||isNaN(S.additionStart)||isNaN(S.deletionStart)){if(a)throw Error("parsePatchContent: invalid hunk metadata");console.error("parsePatchContent: invalid hunk metadata",S);continue}for(let e of p){let t=function(e){let t=e[0];if("+"!==t&&"-"!==t&&" "!==t&&"\\"!==t)return void console.error(`parseLineType: Invalid firstChar: "${t}", full line: "${e}"`);let n=e.substring(1);return{line:""===n?"\n":n,type:" "===t?"context":"\\"===t?"metadata":"+"===t?"addition":"deletion"}}(e);if(null==t){console.error("processFile: invalid rawLine:",e);continue}let{type:n,line:i}=t;if("addition"===n)(null==d||"change"!==d.type)&&(d=tl("change",f,c),S.hunkContent.push(d)),c++,h&&s.additionLines.push(i),d.additions++,v++,u="addition";else if("deletion"===n)(null==d||"change"!==d.type)&&(d=tl("change",f,c),S.hunkContent.push(d)),f++,h&&s.deletionLines.push(i),d.deletions++,b++,u="deletion";else if("context"===n)(null==d||"context"!==d.type)&&(d=tl("context",f,c),S.hunkContent.push(d)),c++,f++,h&&(s.deletionLines.push(i),s.additionLines.push(i)),d.lines++,u="context";else if("metadata"===n&&null!=d){if("context"===d.type?(S.noEOFCRAdditions=!0,S.noEOFCRDeletions=!0):"deletion"===u?S.noEOFCRDeletions=!0:"addition"===u&&(S.noEOFCRAdditions=!0),h&&("addition"===u||"context"===u)){let e=s.additionLines.length-1;e>=0&&(s.additionLines[e]=(0,ta.cleanLastNewline)(s.additionLines[e]))}if(h&&("deletion"===u||"context"===u)){let e=s.deletionLines.length-1;e>=0&&(s.deletionLines[e]=(0,ta.cleanLastNewline)(s.deletionLines[e]))}}}for(let e of(S.additionLines=v,S.deletionLines=b,S.collapsedBefore=Math.max(S.additionStart-1-l,0),s.hunks.push(S),l=S.additionStart+S.additionCount-1,S.hunkContent))"context"===e.type?(S.splitLineCount+=e.lines,S.unifiedLineCount+=e.lines):(S.splitLineCount+=Math.max(e.additions,e.deletions),S.unifiedLineCount+=e.deletions+e.additions);S.splitLineStart=s.splitLineCount+S.collapsedBefore,S.unifiedLineStart=s.unifiedLineCount+S.collapsedBefore,s.splitLineCount+=S.collapsedBefore+S.splitLineCount,s.unifiedLineCount+=S.collapsedBefore+S.unifiedLineCount}if(null!=s){if(s.hunks.length>0&&!h&&s.additionLines.length>0&&s.deletionLines.length>0){let e=s.hunks[s.hunks.length-1],t=e.additionStart+e.additionCount-1,n=Math.max(s.additionLines.length-t,0);s.splitLineCount+=n,s.unifiedLineCount+=n}return n||(null!=s.prevName&&s.name!==s.prevName?s.hunks.length>0?s.type="rename-changed":s.type="rename-pure":null!=o&&""===o.contents?s.type="deleted":null!=i&&""===i.contents&&(s.type="new")),"rename-pure"!==s.type&&"rename-changed"!==s.type&&(s.prevName=void 0),s}}function tl(e,t,n){return"change"===e?{type:"change",additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:n,deletionLineIndex:t}}var td=e.i(24315);class th extends td.default{constructor(){super(...arguments),this.tokenize=tc}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes("\n")||(e=e.trim()),n.newlineIsToken&&t.includes("\n")||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith("\n")&&(e=e.slice(0,-1)),t.endsWith("\n")&&(t=t.slice(0,-1))),super.equals(e,t,n)}}let tf=new th;function tc(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,"\n"));let n=[],i=e.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let e=0;e<i.length;e++){let r=i[e];e%2&&!t.newlineIsToken?n[n.length-1]+=r:n.push(r)}return n}let tu={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function tp(e,t,n,i,r,o,a){var s;let l;void 0===(l=a?"function"==typeof a?{callback:a}:a:{}).context&&(l.context=4);let d=l.context;if(l.newlineIsToken)throw Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(!l.callback)return h(tf.diff(n,i,l));{let{callback:e}=l;s=Object.assign(Object.assign({},l),{callback:t=>{e(h(t))}}),tf.diff(n,i,s)}function h(n){if(!n)return;function i(e){return e.map(function(e){return" "+e})}n.push({value:"",lines:[]});let a=[],s=0,l=0,h=[],f=1,c=1;for(let e=0;e<n.length;e++){let t=n[e],r=t.lines||function(e){let t=e.endsWith("\n"),n=e.split("\n").map(e=>e+"\n");return t?n.pop():n.push(n.pop().slice(0,-1)),n}(t.value);if(t.lines=r,t.added||t.removed){if(!s){let t=n[e-1];s=f,l=c,t&&(s-=(h=d>0?i(t.lines.slice(-d)):[]).length,l-=h.length)}for(let e of r)h.push((t.added?"+":"-")+e);t.added?c+=r.length:f+=r.length}else{if(s)if(r.length<=2*d&&e<n.length-2)for(let e of i(r))h.push(e);else{let e=Math.min(r.length,d);for(let t of i(r.slice(0,e)))h.push(t);let t={oldStart:s,oldLines:f-s+e,newStart:l,newLines:c-l+e,lines:h};a.push(t),s=0,l=0,h=[]}f+=r.length,c+=r.length}}for(let e of a)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith("\n")?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,"\"),t++);return{oldFileName:e,newFileName:t,oldHeader:r,newHeader:o,hunks:a}}}function tm(e,t){if(t||(t=tu),Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders)throw Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return e.map(e=>tm(e,t)).join("\n")}let n=[];t.includeIndex&&e.oldFileName==e.newFileName&&n.push("Index: "+e.oldFileName),t.includeUnderline&&n.push("==================================================================="),t.includeFileHeaders&&(n.push("--- "+e.oldFileName+(void 0===e.oldHeader?"":" "+e.oldHeader)),n.push("+++ "+e.newFileName+(void 0===e.newHeader?"":" "+e.newHeader)));for(let t=0;t<e.hunks.length;t++){let i=e.hunks[t];for(let e of(0===i.oldLines&&(i.oldStart-=1),0===i.newLines&&(i.newStart-=1),n.push("@@ -"+i.oldStart+","+i.oldLines+" +"+i.newStart+","+i.newLines+" @@"),i.lines))n.push(e)}return n.join("\n")+"\n"}function tg(e,t,n,i=!1){let r=ts(function(e,t,n,i,r,o,a){if("function"==typeof a&&(a={callback:a}),null==a?void 0:a.callback){let{callback:s}=a;tp(e,t,n,i,r,o,Object.assign(Object.assign({},a),{callback:e=>{e?s(tm(e,a.headerOptions)):s(void 0)}}))}else{let s=tp(e,t,n,i,r,o,a);if(!s)return;return tm(s,null==a?void 0:a.headerOptions)}}(e.name,t.name,e.contents,t.contents,e.header,t.header,n),{cacheKey:(()=>{if(null!=e.cacheKey&&null!=t.cacheKey)return`${e.cacheKey}:${t.cacheKey}`})(),oldFile:e,newFile:t,throwOnError:i});if(null==r)throw Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");return null!=t.lang&&(r.lang=t.lang),r}let tv=-1;var tb=class{static LoadedCustomComponent=!0;__id=`file-diff:${++tv}`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];deletionFile;additionFile;fileDiff;renderRange;appliedPreAttributes;lastRenderedHeaderHTML;lastRowCount;enabled=!0;constructor(e={theme:r.DEFAULT_THEMES},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new _,this.scrollSyncManager=new eZ,this.interactionManager=new I("diff",R(e,"function"==typeof e.hunkSeparators||(e.hunkSeparators??"line-info")==="line-info"||"line-info-basic"===e.hunkSeparators?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getHunksRendererOptions(e){return{...e,headerRenderMode:null!=e.renderCustomHeader?"custom":"default",hunkSeparators:"function"==typeof e.hunkSeparators?"custom":e.hunkSeparators}}createHunksRenderer(e){return new e9(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t="additions")=>{let n,i;if(null==this.fileDiff)return;let r=this.fileDiff.hunks.at(-1);e:for(let o of this.fileDiff.hunks){let a="deletions"===t?o.deletionStart:o.additionStart,s="deletions"===t?o.deletionCount:o.additionCount,l=o.splitLineStart,d=o.unifiedLineStart;if(e<a){let t=a-e;n=Math.max(d-t,0),i=Math.max(l-t,0);break}if(e>=a+s){if(o===r){let t=e-(a+s);n=d+o.unifiedLineCount+t,i=l+o.splitLineCount+t;break}continue}for(let r of o.hunkContent)if("context"===r.type)if(e<a+r.lines){let t=e-a;i=l+t,n=d+t;break e}else a+=r.lines,l+=r.lines,d+=r.lines;else{let o="deletions"===t?r.deletions:r.additions;if(e<a+o){let o=e-a;n=d+("additions"===t?r.deletions:0)+o,i=l+o;break e}a+=o,l+=Math.max(r.deletions,r.additions),d+=r.deletions+r.additions}break}if(null!=n&&null!=i)return[n,i]};setOptions(e){null!=e&&(this.options=e,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.interactionManager.setOptions(R(e,"function"==typeof e.hunkSeparators||(e.hunkSeparators??"line-info")==="line-info"||"line-info-basic"===e.hunkSeparators?this.handleExpandHunk:void 0,this.getLineIndex)))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??"system")===e||(this.mergeOptions({themeType:e}),"string"!=typeof this.options.theme&&null!=this.fileContainer&&null!=this.appliedThemeCSS&&this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType))}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!e&&!t&&!n&&"function"!=typeof this.options.hunkSeparators}setSelectedLines(e){this.interactionManager.setSelection(e)}cleanUp(e=!1){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer?.shadowRoot!=null&&(this.fileContainer.shadowRoot.innerHTML=""),this.fileContainer=void 0,null!=this.pre&&(this.pre.innerHTML="",this.pre=void 0),this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:i=!1,lineAnnotations:r,oldFile:o,newFile:a,fileDiff:s}=e;this.hydrateElements(t,n),null==this.pre&&null==this.headerElement?this.render({...e,preventEmit:!0}):this.hydrationSetup({fileDiff:s,oldFile:o,newFile:a,lineAnnotations:r}),i||this.emitPostRender()}hydrateElements(e,t){for(let n of(ey(e,t),e.shadowRoot?.children??[])){if(n instanceof SVGElement){this.spriteSVG=n;continue}if(n instanceof HTMLElement){if(n instanceof HTMLPreElement){for(let e of(this.pre=n,n.children))e instanceof HTMLElement&&"code"===e.tagName.toLowerCase()&&("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 n.dataset){this.headerElement=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute(r.THEME_CSS_ATTRIBUTE)){this.themeCSSStyle=n;continue}if(n instanceof HTMLStyleElement&&n.hasAttribute(r.UNSAFE_CSS_ATTRIBUTE)){this.unsafeCSSStyle=n,this.appliedUnsafeCSS=n.textContent;continue}}}null!=this.pre&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute("data-dehydrated")),(null!=this.pre||null!=this.headerElement)&&(this.fileContainer=e)}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:i}){let{diffStyle:r="split",overflow:o="scroll"}=this.options;this.lineAnnotations=i??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(null!=t&&null!=n?tg(t,n,this.options.parseDiffOptions):void 0),null!=this.pre&&(this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,"wrap"===o),"scroll"===o&&"split"===r&&this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions))}rerender(){this.enabled&&(null!=this.fileDiff||null!=this.additionFile||null!=this.deletionFile)&&this.render({forceRender:!0,renderRange:this.renderRange})}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.rerender()};render({oldFile:e,newFile:t,fileDiff:n,forceRender:i=!1,preventEmit:o=!1,lineAnnotations:a,fileContainer:s,containerWrapper:l,renderRange:d}){if(!this.enabled)throw Error("FileDiff.render: attempting to call render after cleaned up");let{collapsed:h=!1}=this.options,f=h?void 0:d,c=null!=e&&null!=t&&(!(0,ef.areFilesEqual)(e,this.deletionFile)||!(0,ef.areFilesEqual)(t,this.additionFile)),u=null!=n&&n!==this.fileDiff,p=null!=a&&(a.length>0||this.lineAnnotations.length>0)&&a!==this.lineAnnotations;if(!h&&B(f,this.renderRange)&&!i&&!p&&(null!=n&&n===this.fileDiff||null==n&&!c))return!1;let{renderRange:m}=this;if(this.renderRange=f,this.deletionFile=e,this.additionFile=t,null!=n?this.fileDiff=n:null!=e&&null!=t&&c&&(u=!0,this.fileDiff=tg(e,t,this.options.parseDiffOptions)),null!=a&&this.setLineAnnotations(a),null==this.fileDiff)return!1;this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{diffStyle:g="split",disableErrorHandling:v=!1,disableFileHeader:b=!1,overflow:C="scroll",themeType:x="system"}=this.options;if(b&&(null!=this.headerElement&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),s=this.getOrCreateFileContainer(s,l),h){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,r.EMPTY_RENDER_RANGE);null!=e&&this.applyThemeState(s,e.themeStyles,x,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,s),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(v)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,s)}return o||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(s);if(!(this.canPartiallyRender(i,p,c||u)&&this.applyPartialRender({previousRenderRange:m,renderRange:f}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,f);if(null==t)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(s,t.themeStyles,x,t.baseThemeType),null!=t.headerElement&&this.applyHeaderToDOM(t.headerElement,s),null!=t.additionsContentAST||null!=t.deletionsContentAST||null!=t.unifiedContentAST?this.applyHunksToDOM(e,t):null!=this.pre&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,f),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.interactionManager.setup(e),this.resizeManager.setup(e,"wrap"===C),"scroll"===C&&"split"===g?this.scrollSyncManager.setup(e,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp()}catch(e){if(v)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,s)}return o||this.emitPostRender(),!0}emitPostRender(){null!=this.fileContainer&&this.options.onPostRender?.(this.fileContainer,this)}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();for(let{element:e}of(this.separatorCache.clear(),this.annotationCache.values()))e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(null==this.fileContainer)return!1;if(this.cleanChildNodes(),null==this.placeHolder){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}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.gutterUtilityContent?.remove(),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.gutterUtilityContent=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||null==this.fileContainer||"function"!=typeof t){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){var i;let e=r.slotName,o=this.separatorCache.get(e);if(null==o||(i=o.hunkData,r.slotName!==i.slotName||r.hunkIndex!==i.hunkIndex||r.lines!==i.lines||r.type!==i.type||r.expandable?.chunked!==i.expandable?.chunked||r.expandable?.up!==i.expandable?.up||r.expandable?.down!==i.expandable?.down)){o?.element.remove();let n=document.createElement("div");n.style.display="contents",n.slot=r.slotName;let i=t(r,this);null!=i&&n.appendChild(i),this.fileContainer.appendChild(n),o={element:n,hunkData:r},this.separatorCache.set(e,o)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||null==this.fileContainer){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(null!=t&&this.lineAnnotations.length>0)for(let[i,r]of this.lineAnnotations.entries()){var n;let a=`${i}-${o(r)}`,s=this.annotationCache.get(a);if(null==s||(n=s.annotation,r.lineNumber!==n.lineNumber||r.side!==n.side||r.metadata!==n.metadata)){s?.element.remove();let e=t(r);if(null==e)continue;(s={element:ep(o(r)),annotation:r}).element.appendChild(e),this.fileContainer.appendChild(s.element),this.annotationCache.set(a,s)}e.delete(a)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let e=this.options.renderGutterUtility??this.options.renderHoverUtility;if(null==this.fileContainer||null==e){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(null!=t&&null!=this.gutterUtilityContent)return;if(null==t){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=em();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let n=this.fileContainer;if(this.fileContainer=e??this.fileContainer??document.createElement(r.DIFFS_TAG_NAME),null!=n&&n!==this.fileContainer&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),null!=t&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),null==this.spriteSVG){let e=document.createElement("div");e.innerHTML=eh;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t,this.fileContainer.shadowRoot?.appendChild(this.spriteSVG))}return this.fileContainer}getFileContainer(){return this.fileContainer}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:"open"});return null==this.pre?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){for(let t of(this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,Array.from(e.children)))t instanceof HTMLElement&&(t.hasAttribute("data-unified")?this.codeUnified=t:t.hasAttribute("data-deletions")?this.codeDeletions=t:t.hasAttribute("data-additions")&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,i=(0,M.toHtml)(e);if(i!==this.lastRenderedHeaderHTML){let e=document.createElement("div");e.innerHTML=i;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;null!=this.headerElement?t.shadowRoot?.replaceChild(n,this.headerElement):t.shadowRoot?.prepend(n),this.headerElement=n,this.lastRenderedHeaderHTML=i}if(this.isContainerManaged||null==n)return;let{renderCustomHeader:o,renderHeaderPrefix:a,renderHeaderMetadata:s}=this.options;if(null!=o){let e=o(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,r.CUSTOM_HEADER_SLOT_ID,e),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0;return}let l=a?.(n)??void 0,d=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,r.HEADER_PREFIX_SLOT_ID,l),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,r.HEADER_METADATA_SLOT_ID,d),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,i){if(null==i)return void t?.remove();let r=t??this.createHeaderSlotElement(n);return null==t&&e.appendChild(r),this.replaceHeaderSlotContent(r,i),r}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(null!=t){if(null==e||""===e){null!=this.unsafeCSSStyle&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=eg(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=eb(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,i){let r=e.shadowRoot??e.attachShadow({mode:"open"}),o=i??n;(this.themeCSSStyle?.parentNode!==r||this.appliedThemeCSS?.themeStyles!==t||this.appliedThemeCSS.themeType!==o)&&(this.themeCSSStyle=eS({shadowRoot:r,currentNode:this.themeCSSStyle,themeCSS:eC(t,o)}),this.appliedThemeCSS=null!=this.themeCSSStyle?{themeStyles:t,themeType:o,baseThemeType:i}:void 0)}applyHunksToDOM(e,t){let{overflow:n="scroll"}=this.options,i=(this.options.hunkSeparators??"line-info")==="line-info",r="wrap"===n?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let o=!1,a=[],s=this.hunksRenderer.renderCodeAST("unified",t),l=this.hunksRenderer.renderCodeAST("deletions",t),d=this.hunksRenderer.renderCodeAST("additions",t);null!=s?(o=null==this.codeUnified||null!=this.codeAdditions||null!=this.codeDeletions,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=ex({code:this.codeUnified,columnType:"unified",rowSpan:r,containerSize:i}),this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s),a.push(this.codeUnified)):null!=l||null!=d?(null!=l?(o=null==this.codeDeletions||null!=this.codeUnified,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=ex({code:this.codeDeletions,columnType:"deletions",rowSpan:r,containerSize:i}),this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(l),a.push(this.codeDeletions)):(this.codeDeletions?.remove(),this.codeDeletions=void 0),null!=d?(o=o||null==this.codeAdditions||null!=this.codeUnified,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=ex({code:this.codeAdditions,columnType:"additions",rowSpan:r,containerSize:i}),this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(d),a.push(this.codeAdditions)):(this.codeAdditions?.remove(),this.codeAdditions=void 0)):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0),0===a.length?e.textContent="":o&&e.replaceChildren(...a),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:i,codeAdditions:r,codeDeletions:o,options:{diffStyle:a="split"}}=this;if(null==n||null==e||null==t||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||null==this.lastRowCount)return!1;let s=this.getCodeColumns(a,i,o,r);if(null==s)return!1;let l=e.startingLine,d=t.startingLine,h=l+e.totalLines,f=d+t.totalLines,c=Math.max(l,d),u=Math.min(h,f);if(u<=c)return!1;let p=Math.max(0,c-l),m=Math.max(0,h-u),g=this.trimColumns({columns:s,trimStart:p,trimEnd:m,previousStart:l,overlapStart:c,overlapEnd:u,diffStyle:a});if(g<0)throw Error("applyPartialRender: failed to trim to overlap");if(this.lastRowCount<g)throw Error("applyPartialRender: trimmed beyond DOM row count");let v=this.lastRowCount-g,b=(e,t)=>{if(!(t<=0)&&null!=this.fileDiff)return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},C=b(d,Math.max(c-d,0));if(null==C&&d<c)return!1;let x=b(u,Math.max(f-u,0));if(null==x&&f>u)return!1;let S=(e,t)=>{if(null!=e){if("unified"!==a||Array.isArray(s))if("split"===a&&Array.isArray(s))this.insertPartialHTML(a,s,e,t);else throw Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");else this.insertPartialHTML(a,s,e,t);v+=e.rowCount}};return this.cleanupErrorWrapper(),S(C,"afterbegin"),S(x,"beforeend"),this.lastRowCount!==v&&(this.applyRowSpan(a,s,v),this.lastRowCount=v),!0}insertPartialHTML(e,t,n,i){if("unified"!==e||Array.isArray(t))if("split"===e&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST("deletions",n),r=this.hunksRenderer.renderCodeAST("additions",n);this.renderPartialColumn(t[0],e,i),this.renderPartialColumn(t[1],r,i)}else throw Error("FileDiff.insertPartialHTML: Invalid argument composition");else{let e=this.hunksRenderer.renderCodeAST("unified",n);this.renderPartialColumn(t,e,i)}}renderPartialColumn(e,t,n){if(null==e||null==t)return;let i=tC(t[0]),r=tC(t[1]);if(null==i||null==r)throw Error("FileDiff.insertPartialHTML: Unexpected AST structure");let o=r.at(0);"beforeend"===n&&o?.type==="element"&&"number"==typeof o.properties["data-buffer-size"]&&this.mergeBuffersIfNecessary(o.properties["data-buffer-size"],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],i,r,!0);let a=r.at(-1);"afterbegin"===n&&a?.type==="element"&&"number"==typeof a.properties["data-buffer-size"]&&this.mergeBuffersIfNecessary(a.properties["data-buffer-size"],e.content.children[0],e.gutter.children[0],i,r,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r))}mergeBuffersIfNecessary(e,t,n,i,r,o){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let a=this.getBufferSize(t.dataset);null!=a&&(o?(i.shift(),r.shift()):(i.pop(),r.pop()),this.updateBufferSize(t,a+e),this.updateBufferSize(n,a+e))}applyRowSpan(e,t,n){let i=e=>{null!=e&&(e.gutter.style.setProperty("grid-row",`span ${n}`),e.content.style.setProperty("grid-row",`span ${n}`))};if("unified"!==e||Array.isArray(t))if("split"===e&&Array.isArray(t))i(t[0]),i(t[1]);else throw Error("dun fuuuuked up");else i(t)}trimColumnRows(e,t,n){let i=0,r=0,o=0,a=!1,s=n>=0;if(null==e)return 0;let l=Array.from(e.content.children),d=Array.from(e.gutter.children);if(l.length!==d.length)throw Error("FileDiff.trimColumnRows: columns do not match");for(;o<l.length&&(!(t<=0)||s||a);){let e=d[o],h=l[o];if(o++,!(e instanceof HTMLElement)||!(h instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:h}),Error("FileDiff.trimColumnRows: invalid row elements");if(a&&(a=!1,"annotation"===e.dataset.gutterBuffer&&"lineAnnotation"in h.dataset||"metadata"===e.dataset.gutterBuffer&&"noNewline"in h.dataset)){e.remove(),h.remove(),r++;continue}if("lineIndex"in e.dataset&&"lineIndex"in h.dataset){(t>0||s&&i>=n)&&(e.remove(),h.remove(),t>0&&0==--t&&(a=!0),r++),i++;continue}if("separator"in e.dataset&&"separator"in h.dataset||"annotation"===e.dataset.gutterBuffer&&"lineAnnotation"in h.dataset||"metadata"===e.dataset.gutterBuffer&&"noNewline"in h.dataset){(t>0||s&&i>=n)&&(e.remove(),h.remove(),r++);continue}if("buffer"===e.dataset.gutterBuffer&&"contentBuffer"in h.dataset){let o=this.getBufferSize(h.dataset);if(null==o)throw Error("FileDiff.trimColumnRows: invalid element");if(t>0){let n=Math.min(t,o),i=o-n;i>0?(this.updateBufferSize(e,i),this.updateBufferSize(h,i),r+=n):(e.remove(),h.remove(),r+=o),t-=n}else if(s){let t=i,a=i+o-1;if(n<=t)e.remove(),h.remove(),r+=o;else if(n<=a){let t=a-n+1,i=o-t;this.updateBufferSize(e,i),this.updateBufferSize(h,i),r+=t}}i+=o;continue}throw console.error({gutterElement:e,contentElement:h}),Error("FileDiff.trimColumnRows: unknown row elements")}return r}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:i,previousStart:r,trimEnd:o,trimStart:a}){let s=Math.max(0,i-r),l=n-r;if(l<0)throw Error("FileDiff.trimColumns: overlap ends before previous");let d=a>0,h=o>0;if(!d&&!h)return 0;let f=d?s:0,c=h?l:-1;if("unified"===t&&!Array.isArray(e))return this.trimColumnRows(e,f,c);if("split"===t&&Array.isArray(e)){let t=this.trimColumnRows(e[0],f,c),n=this.trimColumnRows(e[1],f,c);if(null!=e[0]&&null!=e[1]&&t!==n)throw Error("FileDiff.trimColumns: split columns out of sync");return null!=e[0]?t:n}throw console.error({diffStyle:t,columns:e}),Error("FileDiff.trimColumns: Invalid columns for diffType")}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??"",10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty("grid-row",`span ${t}`),e.style.setProperty("min-height",`calc(${t} * 1lh)`)}getCodeColumns(e,t,n,i){function r(e){if(null==e)return;let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&null!=t.dataset.gutter&&null!=n.dataset.content)return{gutter:t,content:n}}if("unified"===e)return r(t);{let e=r(n),t=r(i);return null!=e||null!=t?[e,t]:void 0}}applyBuffers(e,t){let{disableVirtualizationBuffers:n=!1}=this.options;if(n||null==t){null!=this.bufferBefore&&(this.bufferBefore.remove(),this.bufferBefore=void 0),null!=this.bufferAfter&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(null==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")):null!=this.bufferBefore&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(null==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")):null!=this.bufferAfter&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:i},r){let{diffIndicators:o="bars",disableBackground:a=!1,disableLineNumbers:s=!1,overflow:l="scroll",diffStyle:d="split"}=this.options,h={type:"diff",diffIndicators:o,disableBackground:a,disableLineNumbers:s,overflow:l,split:"unified"!==d&&null!=t&&null!=n,totalLines:i,customProperties:r};ec(h,this.appliedPreAttributes)||(eL(e,h),this.appliedPreAttributes=h)}applyErrorToDOM(e,t){this.cleanupErrorWrapper();let n=this.getOrCreatePreNode(t);n.innerHTML="",n.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let i=t.shadowRoot??t.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.innerHTML="",i.appendChild(this.errorWrapper);let r=document.createElement("div");r.dataset.errorMessage="",r.innerText=e.message,this.errorWrapper.appendChild(r);let o=document.createElement("pre");o.dataset.errorStack="",o.innerText=e.stack??"No Error Stack",this.errorWrapper.appendChild(o)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function tC(e){if(null!=e&&"element"===e.type)return e.children??[]}let tx=-1;var tS=class extends tb{__id=`little-virtualized-file-diff:${++tx}`;top;height=0;metrics;heightCache=new Map;isVisible=!1;virtualizer;constructor(e,t,n,i,o=!1){super(e,i,o);const{hunkSeparators:a="line-info"}=this.options;this.virtualizer=t,this.metrics=function(e,t){let n={...r.DEFAULT_VIRTUAL_FILE_METRICS,...t};return n.hunkSeparatorHeight=function(e,t){if(null!=t)return t;switch(e){case"simple":return 4;case"metadata":case"line-info":case"line-info-basic":case"custom":return 32}}(e,t?.hunkSeparatorHeight),n}("function"==typeof a?"custom":a,n)}getLineHeight(e,t=!1){let n=this.heightCache.get(e);return null!=n?n:this.metrics.lineHeight*(t?2:1)}setOptions(e){if(null==e)return;let t=this.options.diffStyle,n=this.options.overflow,i=this.options.collapsed;super.setOptions(e),(t!==this.options.diffStyle||n!==this.options.overflow||i!==this.options.collapsed)&&(this.heightCache.clear(),this.computeApproximateSize(),this.renderRange=void 0),this.virtualizer.instanceChanged(this)}reconcileHeights(){let{overflow:e="scroll"}=this.options;if(null!=this.fileContainer&&(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer)),null==this.fileContainer||null==this.fileDiff){this.height=0;return}if("scroll"===e&&0===this.lineAnnotations.length&&!this.virtualizer.config.resizeDebugging)return;let t=this.getDiffStyle(),n=!1;for(let e of"split"===t?[this.codeDeletions,this.codeAdditions]:[this.codeUnified]){if(null==e)continue;let i=e.children[1];if(i instanceof HTMLElement)for(let e of i.children){if(!(e instanceof HTMLElement))continue;let i=e.dataset.lineIndex;if(null==i)continue;let r=function(e,t){let[n,i]=e.split(",").map(Number);return"split"===t?i:n}(i,t),o=e.getBoundingClientRect().height,a=!1;e.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in e.nextElementSibling.dataset||"noNewline"in e.nextElementSibling.dataset)&&("noNewline"in e.nextElementSibling.dataset&&(a=!0),o+=e.nextElementSibling.getBoundingClientRect().height),o!==this.getLineHeight(r,a)&&(n=!0,o===this.metrics.lineHeight*(a?2:1)?this.heightCache.delete(r):this.heightCache.set(r,o))}}(n||this.virtualizer.config.resizeDebugging)&&this.computeApproximateSize()}onRender=e=>null!=this.fileContainer&&(e&&(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer)),this.render());cleanUp(){null!=this.fileContainer&&this.virtualizer.disconnect(this.fileContainer),super.cleanUp()}expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.computeApproximateSize(),this.renderRange=void 0,this.virtualizer.instanceChanged(this)};setVisibility(e){null!=this.fileContainer&&(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}computeApproximateSize(){let e=0===this.height;if(this.height=0,null==this.fileDiff)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:i=!1,collapsedContextThreshold:o=r.DEFAULT_COLLAPSED_CONTEXT_THRESHOLD,hunkSeparators:a="line-info"}=this.options,{diffHeaderHeight:s,fileGap:l,hunkSeparatorHeight:d}=this.metrics,h=this.getDiffStyle(),f="simple"!==a&&"metadata"!==a&&"line-info-basic"!==a?l:0;if(t?"simple"!==a&&"metadata"!==a&&(this.height+=l):this.height+=s,!i&&((0,e7.iterateOverDiff)({diff:this.fileDiff,diffStyle:h,expandedHunks:!!n||this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,collapsedBefore:t,collapsedAfter:n,deletionLine:i,additionLine:r})=>{let o=null!=r?r.splitLineIndex:i.splitLineIndex,s=null!=r?r.unifiedLineIndex:i.unifiedLineIndex,l=(r?.noEOFCR??!1)||(i?.noEOFCR??!1);t>0&&(e>0&&(this.height+=f),this.height+=d+f),this.height+=this.getLineHeight("split"===h?o:s,l),n>0&&"simple"!==a&&(this.height+=f+d)}}),this.fileDiff.hunks.length>0&&(this.height+=l),null!=this.fileContainer&&this.virtualizer.config.resizeDebugging&&!e)){let e=this.fileContainer.getBoundingClientRect();e.height!==this.height?console.log("VirtualizedFileDiff.computeApproximateSize: computed height doesnt match",{name:this.fileDiff.name,elementHeight:e.height,computedHeight:this.height}):console.log("VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT")}}render({fileContainer:e,oldFile:t,newFile:n,fileDiff:i,...r}={}){let o=null==this.fileContainer;if(this.fileDiff??=i??(null!=t&&null!=n?tg(t,n,this.options.parseDiffOptions):void 0),e=this.getOrCreateFileContainer(e),null==this.fileDiff)return console.error("VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data"),!1;if(o?(this.computeApproximateSize(),this.virtualizer.connect(e,this),this.top??=this.virtualizer.getOffsetInScrollContainer(e),this.isVisible=this.virtualizer.isInstanceVisible(this.top,this.height)):this.top??=this.virtualizer.getOffsetInScrollContainer(e),!this.isVisible)return this.renderPlaceholder(this.height);let a=this.virtualizer.getWindowSpecs(),s=this.computeRenderRangeFromWindow(this.fileDiff,this.top,a);return super.render({fileDiff:this.fileDiff,fileContainer:e,renderRange:s,oldFile:t,newFile:n,...r})}getDiffStyle(){return this.options.diffStyle??"split"}getExpandedRegion(e,t,n){if(n<=0||e)return{fromStart:0,fromEnd:0,collapsedLines:Math.max(n,0),renderAll:!1};let{expandUnchanged:i=!1,collapsedContextThreshold:o=r.DEFAULT_COLLAPSED_CONTEXT_THRESHOLD}=this.options;if(i||n<=o)return{fromStart:n,fromEnd:0,collapsedLines:0,renderAll:!0};let a=this.hunksRenderer.getExpandedHunk(t),s=Math.min(Math.max(a.fromStart,0),n),l=Math.min(Math.max(a.fromEnd,0),n),d=s+l;return{fromStart:s,fromEnd:l,collapsedLines:Math.max(n-d,0),renderAll:d>=n}}getExpandedLineCount(e,t){var n;let i,r=0;if(e.isPartial){for(let n of e.hunks)r+="split"===t?n.splitLineCount:n.unifiedLineCount;return r}for(let[n,i]of e.hunks.entries()){r+="split"===t?i.splitLineCount:i.unifiedLineCount;let o=Math.max(i.collapsedBefore,0),{fromStart:a,fromEnd:s,renderAll:l}=this.getExpandedRegion(e.isPartial,n,o);o>0&&(r+=l?o:a+s)}let o=e.hunks.at(-1);if(null!=o&&null!=(i=(n=e).hunks.at(-1))&&!n.isPartial&&0!==n.additionLines.length&&0!==n.deletionLines.length&&(i.additionLineIndex+i.additionCount<n.additionLines.length||i.deletionLineIndex+i.deletionCount<n.deletionLines.length)){let t=e.additionLines.length-(o.additionLineIndex+o.additionCount),n=e.deletionLines.length-(o.deletionLineIndex+o.deletionCount);if(null!=o&&t!==n)throw Error(`VirtualizedFileDiff: trailing context mismatch (additions=${t}, deletions=${n}) for ${e.name}`);let i=Math.min(t,n);if(null!=o&&i>0){let{fromStart:t,renderAll:n}=this.getExpandedRegion(e.isPartial,e.hunks.length,i);r+=n?i:t}}return r}computeRenderRangeFromWindow(e,t,{top:n,bottom:i}){let o,a,s,{disableFileHeader:l=!1,expandUnchanged:d=!1,collapsedContextThreshold:h=r.DEFAULT_COLLAPSED_CONTEXT_THRESHOLD,hunkSeparators:f="line-info"}=this.options,{diffHeaderHeight:c,fileGap:u,hunkLineCount:p,hunkSeparatorHeight:m,lineHeight:g}=this.metrics,v=this.getDiffStyle(),b=this.height,C=this.getExpandedLineCount(e,v),x=l?u:c;if(t<n-b||t>i)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:b-x-u};if(C<=p||0===e.hunks.length)return{startingLine:0,totalLines:p,bufferBefore:0,bufferAfter:0};let S=Math.ceil(Math.ceil(Math.max(i-n,0)/g)/p)*p+p,y=S/p,L=[],k=(n+i)/2,E="simple"===f||"metadata"===f||"line-info-basic"===f?0:u,w=t+x,A=0;if((0,e7.iterateOverDiff)({diff:e,diffStyle:v,expandedHunks:!!d||this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:h,callback:({hunkIndex:e,collapsedBefore:r,collapsedAfter:l,deletionLine:d,additionLine:h})=>{let c=null!=h?h.splitLineIndex:d.splitLineIndex,u=null!=h?h.unifiedLineIndex:d.unifiedLineIndex,g=(h?.noEOFCR??!1)||(d?.noEOFCR??!1),b=r>0?m+E+(e>0?E:0):0;0===e&&"simple"===f&&(b=0),w+=b;let C=A%p==0;if(C&&(L.push(w-(t+x+b)),null!=s)){if(s<=0)return!0;s--}let S=this.getLineHeight("split"===v?c:u,g),T=Math.floor(A/p);return w>n-S&&w<i&&(o??=T),null==a&&w+S>k&&(a=T),null==s&&w>=i&&C&&(s=y),A++,w+=S,l>0&&"simple"!==f&&(w+=m+E),!1}}),null==o)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:b-x-u};let T=L.length,M=Math.round((a??=o)-y/2),I=Math.max(0,Math.min(M,Math.max(0,T-y))),R=M<0?S+M*p:S,D=L[I]??0,H=I+R/p;return{startingLine:I*p,totalLines:R,bufferBefore:D,bufferAfter:H<L.length?b-x-L[H]-u:b-(w-t)-u}}};let ty="u"<typeof window?y.useEffect:y.useLayoutEffect;function tL({fileDiff:e,options:t,lineAnnotations:n,selectedLines:i,prerenderedHTML:r,metrics:o,hasGutterRenderUtility:a,hasCustomHeader:s,disableWorkerPool:l}){let d=k(),h=(0,y.useContext)(E.WorkerPoolContext),f=(0,y.useRef)(null),c=w(i=>{if(null!=i){if(null!=f.current)throw Error("useFileDiffInstance: An instance should not already exist when a node is created");null!=d?f.current=new tS(tk({hasCustomHeader:s,hasGutterRenderUtility:a,options:t}),d,o,!l?h:void 0,!0):f.current=new tb(tk({hasCustomHeader:s,hasGutterRenderUtility:a,options:t}),!l?h:void 0,!0),f.current.hydrate({fileDiff:e,fileContainer:i,lineAnnotations:n,prerenderedHTML:r})}else{if(null==f.current)throw Error("useFileDiffInstance: A FileDiff instance should exist when unmounting");f.current.cleanUp(),f.current=null}});return ty(()=>{let{current:r}=f;if(null==r)return;let o=tk({hasCustomHeader:s,hasGutterRenderUtility:a,options:t}),l=!eI(r.options,o);r.setOptions(o),r.render({forceRender:l,fileDiff:e,lineAnnotations:n}),void 0!==i&&r.setSelectedLines(i)}),{ref:c,getHoveredLine:(0,y.useCallback)(()=>f.current?.getHoveredLine(),[])}}function tk({options:e,hasCustomHeader:t,hasGutterRenderUtility:n}){return n||t?{...e,renderCustomHeader:t?i:void 0,renderGutterUtility:n?i:void 0}:e}var tE=class extends e9{pendingConflictActions=[];pendingMarkerRows=[];injectedRows=new Map;options;constructor(e={theme:r.DEFAULT_THEMES},t,n){super(void 0,t,n),this.options=e}setConflictState(e,t,n){this.pendingConflictActions=e,this.pendingMarkerRows=t,this.syncInjectedRows(e,t,n)}syncInjectedRows(e,t,n){for(let t of(this.injectedRows.clear(),e)){let e=null!=t?eF(t,n):void 0;if(null==t||null==e)continue;let i={type:"actions",hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:t.conflictIndex};this.addInjectedRow(i)}for(let e of t)this.addInjectedRow(e)}addInjectedRow(e){let t=`${e.hunkIndex}:${e.lineIndex}`,n=this.injectedRows.get(t);null==n?this.injectedRows.set(t,[e]):n.push(e)}renderDiff(e,t=r.DEFAULT_RENDER_RANGE){return null!=e&&this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.renderDiff(e,t)}async asyncRender(e,t=r.DEFAULT_RENDER_RANGE){return this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.asyncRender(e,t)}createPreElement(e,t){return super.createPreElement(e,t,{"data-has-merge-conflict":""})}getUnifiedLineDecoration({type:e,lineType:t}){let n="change"===e?"change-deletion"===t?"current":"incoming":void 0;return{gutterLineType:"change"===e?"context":t,gutterProperties:tw(n),contentProperties:tA(e,n)}}getSplitLineDecoration({side:e,type:t}){let n="change"===t?"deletions"===e?"current":"incoming":void 0;return{gutterLineType:"change"===t?"context":t,gutterProperties:tw(n),contentProperties:tA(t,n)}}getUnifiedInjectedRowsForLine=e=>{let t=this.injectedRows.get(`${e.hunkIndex}:${e.lineIndex}`);if(null==t||0===t.length)return;let{mergeConflictActionsType:n}=this.getOptionsWithDefaults(),i=[],r=[];for(let e of t){var o;if("actions"===e.type){i.push({content:function({row:e,includeDefaultActions:t,includeSlot:n}){var i;let r=t?[tM({resolution:"current",label:"Accept current change",conflictIndex:i=e.conflictIndex}),tI(),tM({resolution:"incoming",label:"Accept incoming change",conflictIndex:i}),tI(),tM({resolution:"both",label:"Accept both",conflictIndex:i})]:[];return n&&r.push((0,T.createHastElement)({tagName:"slot",properties:{name:eP({hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:e.conflictIndex}),"data-merge-conflict-action-slot":""}})),(0,T.createHastElement)({tagName:"div",properties:{"data-merge-conflict-actions":""},children:[(0,T.createHastElement)({tagName:"div",properties:{"data-merge-conflict-actions-content":""},children:r})]})}({row:e,includeDefaultActions:"default"===n,includeSlot:!0}),gutter:tT("action")});continue}("marker-end"===e.type?r:i).push({content:(o=e,(0,T.createHastElement)({tagName:"div",properties:{"data-merge-conflict":o.type,"data-merge-conflict-marker-row":""},children:[(0,T.createTextNodeElement)(o.lineText.replace(/(?:\r\n|\n|\r)$/,""))]})),gutter:tT("marker",e.type)})}return{before:i.length>0?i:void 0,after:r.length>0?r:void 0}};getOptionsWithDefaults(){let e=super.getOptionsWithDefaults();return e.diffStyle="unified",e.lineDiffType="none",e.mergeConflictActionsType=this.options.mergeConflictActionsType??"default",e}};function tw(e){return null!=e?{"data-merge-conflict":e}:void 0}function tA(e,t){if(null!=t){if("change"===e)return"current"===t||"incoming"===t?{"data-line-type":"context","data-merge-conflict":t}:void 0;if("marker-start"===t||"marker-base"===t||"marker-separator"===t||"marker-end"===t)return{"data-merge-conflict":t}}}function tT(e,t){let n=(0,T.createGutterGap)(void 0,"annotation",1);return n.properties["data-gutter-buffer"]="action"===e?"merge-conflict-action":`merge-conflict-${t??"marker"}`,n}function tM({resolution:e,label:t,conflictIndex:n}){return(0,T.createHastElement)({tagName:"button",properties:{type:"button","data-merge-conflict-action":e,"data-merge-conflict-conflict-index":`${n}`},children:[(0,T.createTextNodeElement)(t)]})}function tI(){return(0,T.createHastElement)({tagName:"span",properties:{"data-merge-conflict-action-separator":""},children:[(0,T.createTextNodeElement)("|")]})}function tR(e,t,n,i,r,o){for(let a=0;a<o;a++){let o=t[i+a],s=n[r+a];if(null==o||null==s)throw Error("pushCollapsedContextLines: missing collapsed context line");e.deletionLines.push(o),e.additionLines.push(s)}}function tD(e,t,n,i){if("context"===e.type)for(let n=0;n<e.lines;n++){let r=i[e.additionLineIndex+n];if(null==r)throw console.error({additionLines:i,content:e,i:n}),Error("pushContentLinesToDiff: Context line does not exist");t.deletionLines.push(r),t.additionLines.push(r)}else{let r=Math.max(e.deletions,e.additions);for(let o=0;o<r;o++){if(o<e.deletions){let i=n[e.deletionLineIndex+o];if(null==i)throw console.error({deletionLines:n,content:e,i:o}),Error("pushContentLinesToDiff: Deletion line does not exist");t.deletionLines.push(i)}if(o<e.additions){let n=i[e.additionLineIndex+o];if(null==n)throw console.error({additionLines:i,content:e,i:o}),Error("pushContentLinesToDiff: Addition line does not exist");t.additionLines.push(n)}}}}function tH(e,t,n){"context"===e.type?(t.nextAdditionLineIndex+=e.lines,t.nextDeletionLineIndex+=e.lines,t.nextAdditionStart+=e.lines,t.nextDeletionStart+=e.lines,t.splitLineCount+=e.lines,t.unifiedLineCount+=e.lines,n.additionCount+=e.lines,n.deletionCount+=e.lines,n.splitLineCount+=e.lines,n.unifiedLineCount+=e.lines):(t.nextAdditionLineIndex+=e.additions,t.nextDeletionLineIndex+=e.deletions,t.nextAdditionStart+=e.additions,t.nextDeletionStart+=e.deletions,t.splitLineCount+=Math.max(e.deletions,e.additions),t.unifiedLineCount+=e.deletions+e.additions,n.deletionCount+=e.deletions,n.deletionLines+=e.deletions,n.additionCount+=e.additions,n.additionLines+=e.additions,n.splitLineCount+=Math.max(e.deletions,e.additions),n.unifiedLineCount+=e.deletions+e.additions)}let tN=-1;var tP=class extends tb{__id=`unresolved-file:${++tN}`;computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0};conflictActions=[];markerRows=[];conflictActionCache=new Map;constructor(e={theme:r.DEFAULT_THEMES},t,n=!1){super(void 0,t,n),this.options=e,this.setOptions(e)}setOptions(e){if(null==e)return;if(null!=e.onMergeConflictAction&&null!=e.onMergeConflictResolve)throw Error("UnresolvedFile: onMergeConflictAction and onMergeConflictResolve are mutually exclusive. Use only one callback.");this.options=e,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e));let t=this.options.hunkSeparators??"line-info";this.interactionManager.setOptions(R(this.options,"function"==typeof t||"line-info"===t||"line-info-basic"===t?this.expandHunk:void 0,this.getLineIndex,this.handleMergeConflictActionClick))}createHunksRenderer(e){return new tE(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getHunksRendererOptions(e){var t;return t=e,{...this.options,...t,hunkSeparators:"function"==typeof t?.hunkSeparators?"custom":t?.hunkSeparators,mergeConflictActionsType:"function"==typeof t?.mergeConflictActionsType?"custom":t?.mergeConflictActionsType}}applyPreNodeAttributes(e,t){super.applyPreNodeAttributes(e,t,{"data-has-merge-conflict":""})}cleanUp(){this.clearMergeConflictActionCache(),this.computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0},this.conflictActions=[],super.cleanUp()}getOrComputeDiff({file:e,fileDiff:t,actions:n,markerRows:i}){let{maxContextLines:r,onMergeConflictAction:o}=this.options;t:if(null!=o){let o=null!=t;if(o!==(null!=n)||o!==(null!=i))throw Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows must be passed together");if(null!=t&&null!=n&&null!=i){this.computedCache={file:e??this.computedCache.file,fileDiff:t,actions:n,markerRows:i};break t}if(null!=e||null!=this.computedCache.file){if(null!=e&&null!=this.computedCache.file&&!(0,ef.areFilesEqual)(e,this.computedCache.file)&&null!=this.computedCache.fileDiff&&null!=this.computedCache.actions)throw Error("UnresolvedFile.getOrComputeDiff: file can only be used to initialize unresolved state once. Pass fileDiff and actions for subsequent updates.");if(null==(e??=this.computedCache.file))throw Error("UnresolvedFile.getOrComputeDiff: file is null, should be impossible");if(!(0,ef.areFilesEqual)(e,this.computedCache.file)||null==this.computedCache.fileDiff||null==this.computedCache.actions){let t=eO(e,r);this.computedCache={file:e,fileDiff:t.fileDiff,actions:t.actions,markerRows:t.markerRows}}t=this.computedCache.fileDiff,n=this.computedCache.actions,i=this.computedCache.markerRows;break t}t=this.computedCache.fileDiff,n=this.computedCache.actions,i=this.computedCache.markerRows;break t}else{if(null!=t||null!=n||null!=i)throw Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows are only usable in controlled mode, you must pass in `onMergeConflictAction`");if(null!=e&&null!=this.computedCache.file&&!(0,ef.areFilesEqual)(e,this.computedCache.file))throw Error("UnresolvedFile.getOrComputeDiff: uncontrolled unresolved files parse the file only once. Later updates must come from the cached diff state.");if(this.computedCache.file??=e,null==this.computedCache.fileDiff&&null!=this.computedCache.file){let e=eO(this.computedCache.file,r);this.computedCache.fileDiff=e.fileDiff,this.computedCache.actions=e.actions,this.computedCache.markerRows=e.markerRows}t=this.computedCache.fileDiff,n=this.computedCache.actions,i=this.computedCache.markerRows;break t}if(null!=t&&null!=n&&null!=i)return{fileDiff:t,actions:n,markerRows:i}}hydrate(e){let{file:t,fileDiff:n,actions:i,markerRows:r,lineAnnotations:o,fileContainer:a,prerenderedHTML:s,preventEmit:l=!1}=e,d=this.getOrComputeDiff({file:t,fileDiff:n,actions:i,markerRows:r});null!=d&&(this.hydrateElements(a,s),this.setActiveMergeConflictState(d.actions,d.markerRows),null==this.pre?this.render({...e,preventEmit:!0}):this.hydrationSetup({fileDiff:d.fileDiff,lineAnnotations:o}),this.renderMergeConflictActionSlots(),l||this.emitPostRender())}rerender(){this.enabled&&null!=this.fileDiff&&this.render({forceRender:!0,renderRange:this.renderRange})}render(e={}){let{file:t,fileDiff:n,actions:i,markerRows:r,lineAnnotations:o,preventEmit:a=!1,...s}=e,l=this.getOrComputeDiff({file:t,fileDiff:n,actions:i,markerRows:r});if(null==l)return!1;this.setActiveMergeConflictState(l.actions,l.markerRows);let d=super.render({...s,fileDiff:l.fileDiff,lineAnnotations:o,preventEmit:!0});return d&&(this.renderMergeConflictActionSlots(),a||this.emitPostRender()),d}resolveConflict(e,t,n=this.computedCache.fileDiff){var i;let r,o,a=this.conflictActions[e];if(null==n||null==a)return;if(a.conflictIndex!==e)throw console.error({conflictIndex:e,action:a}),Error("UnresolvedFile.resolveConflict: conflictIndex and conflictAction don't match");let s=function(e,t){let{resolution:n,hunkIndex:i,startContentIndex:r,endContentIndex:o,indexesToDelete:a=new Set}=t,s=e.hunks[i];if(null==s)throw console.error({diff:e,hunkIndex:i}),Error(`resolveRegion: Invalid hunk index: ${i}`);if(r<0||o>=s.hunkContent.length||r>o)throw Error(`resolveRegion: Invalid content range, ${r}, ${o}`);let{hunks:l,additionLines:d,deletionLines:h}=e,f={...e,hunks:[],deletionLines:[],additionLines:[],splitLineCount:0,unifiedLineCount:0,cacheKey:null!=e.cacheKey?`${e.cacheKey}:${n[0]}-${i}:${r}-${o}`:void 0},c={nextAdditionLineIndex:0,nextDeletionLineIndex:0,nextAdditionStart:1,nextDeletionStart:1,splitLineCount:0,unifiedLineCount:0},u=i===l.length-1&&o===s.hunkContent.length-1,p=!e.isPartial;for(let[t,s]of l.entries()){var m,g,v,b,C,x,S;m=e,g=f,v=c,b=s.deletionLineIndex-s.collapsedBefore,C=s.additionLineIndex-s.collapsedBefore,x=s.collapsedBefore,S=p,x<=0||(S&&(tR(g,m.deletionLines,m.additionLines,b,C,x),v.nextAdditionLineIndex+=x,v.nextDeletionLineIndex+=x),v.nextAdditionStart+=x,v.nextDeletionStart+=x,v.splitLineCount+=x,v.unifiedLineCount+=x);let l={...s,hunkContent:[],additionStart:c.nextAdditionStart,deletionStart:c.nextDeletionStart,additionLineIndex:c.nextAdditionLineIndex,deletionLineIndex:c.nextDeletionLineIndex,additionCount:0,deletionCount:0,deletionLines:0,additionLines:0,splitLineStart:c.splitLineCount,unifiedLineStart:c.unifiedLineCount,splitLineCount:0,unifiedLineCount:0};for(let[e,u]of s.hunkContent.entries())if(t!==i||e<r||e>o){tD(u,f,h,d);let e={...u,additionLineIndex:c.nextAdditionLineIndex,deletionLineIndex:c.nextDeletionLineIndex};l.hunkContent.push(e),tH(e,c,l)}else if(a.has(e))l.hunkContent.push({type:"context",lines:0,deletionLineIndex:c.nextDeletionLineIndex,additionLineIndex:c.nextAdditionLineIndex});else if("context"===u.type){tD(u,f,h,d);let e={...u,deletionLineIndex:c.nextDeletionLineIndex,additionLineIndex:c.nextAdditionLineIndex};l.hunkContent.push(e),tH(e,c,l)}else{var y=n,L=u,k=f,E=h,w=d;if("deletions"===y||"both"===y)for(let e=0;e<L.deletions;e++){let t=E[L.deletionLineIndex+e];if(null==t)throw console.error({deletionLines:E,content:L,i:e}),Error("pushResolveLinesToDiff: Deletion line does not exist");k.deletionLines.push(t),k.additionLines.push(t)}if("additions"===y||"both"===y)for(let e=0;e<L.additions;e++){let t=w[L.additionLineIndex+e];if(null==t)throw console.error({additionLines:w,content:L,i:e}),Error("pushResolveLinesToDiff: Addition line does not exist");k.deletionLines.push(t),k.additionLines.push(t)}let e={type:"context",lines:"deletions"===n?u.deletions:"additions"===n?u.additions:u.deletions+u.additions,deletionLineIndex:c.nextDeletionLineIndex,additionLineIndex:c.nextAdditionLineIndex};l.hunkContent.push(e),tH(e,c,l)}if(t===i&&u){let e="deletions"===n?s.noEOFCRDeletions:s.noEOFCRAdditions;l.noEOFCRAdditions=e,l.noEOFCRDeletions=e}f.hunks.push(l)}let A=l.at(-1);return null==A||e.isPartial||tR(f,h,d,A.deletionLineIndex+A.deletionCount,A.additionLineIndex+A.additionCount,Math.min(h.length-(A.deletionLineIndex+A.deletionCount),d.length-(A.additionLineIndex+A.additionCount))),f.splitLineCount=c.splitLineCount,f.unifiedLineCount=c.unifiedLineCount,f}(n,{resolution:"accept"===(o="string"==typeof t?t:t.type)||"incoming"===o?"additions":"reject"===o||"current"===o?"deletions":"both",hunkIndex:a.hunkIndex,startContentIndex:a.startContentIndex,endContentIndex:a.endContentIndex,indexesToDelete:(i=a,r=new Set,null!=i.baseContentIndex&&r.add(i.baseContentIndex),i.endMarkerContentIndex!==i.endContentIndex&&r.add(i.endMarkerContentIndex),r)}),l=this.computedCache.file,{file:d,actions:h,markerRows:f}=function({fileDiff:e,previousActions:t,resolvedConflictIndex:n,previousFile:i,resolution:r}){var o,a,s,l,d,h;let f,c,u,p=t[n];if(null==p)throw Error("rebuildFileAndActions: missing resolved action for unresolved file rebuild");let m=(o=t,a=n,s=p,l=r,u=(d=s.conflict,h=l,f=(d.baseMarkerLineIndex??d.separatorLineIndex)-d.startLineIndex-1,c=d.endLineIndex-d.separatorLineIndex-1,("current"===h?f:"incoming"===h?c:f+c)-(d.endLineIndex-d.startLineIndex+1)),o.map((e,t)=>{if(t!==a&&null!=e){var n,i;return e.conflict.startLineIndex>s.conflict.endLineIndex?{...e,conflict:(n=e.conflict,i=u,{...n,startLineIndex:n.startLineIndex+i,startLineNumber:n.startLineNumber+i,separatorLineIndex:n.separatorLineIndex+i,separatorLineNumber:n.separatorLineNumber+i,endLineIndex:n.endLineIndex+i,endLineNumber:n.endLineNumber+i,baseMarkerLineIndex:null!=n.baseMarkerLineIndex?n.baseMarkerLineIndex+i:void 0,baseMarkerLineNumber:null!=n.baseMarkerLineNumber?n.baseMarkerLineNumber+i:void 0})}:e}})),g=eQ(e,m);return{file:function({resolvedAction:e,resolvedConflictIndex:t,previousFile:n,fileDiff:i,resolution:r}){var o,a,s;let l,d,h=(0,er.splitFileContents)(n?.contents??""),{conflict:f}=e,c=(o=h,a=f,s=r,l=o.slice(a.startLineIndex+1,a.baseMarkerLineIndex??a.separatorLineIndex),d=o.slice(a.separatorLineIndex+1,a.endLineIndex),"current"===s?l:"incoming"===s?d:[...l,...d]),u=[...h.slice(0,f.startLineIndex),...c,...h.slice(f.endLineIndex+1)].join("");return{name:n?.name??i.name,contents:u,cacheKey:n?.cacheKey!=null?`${n.cacheKey}:mc-${t}-${r}`:void 0}}({fileDiff:e,resolvedAction:p,resolvedConflictIndex:n,previousFile:i,resolution:r}),actions:m,markerRows:g}}({fileDiff:s,previousActions:this.conflictActions,resolvedConflictIndex:e,previousFile:l,resolution:t});return{file:d,fileDiff:s,actions:h,markerRows:f}}resolveConflictAndRender(e,t){let n=this.conflictActions[e];if(null==n)return;if(n.conflictIndex!==e)throw console.error({conflictIndex:e,action:n}),Error("UnresolvedFile.resolveConflictAndRender: conflictIndex and conflictAction don't match");let i={resolution:t,conflict:n.conflict},{file:r,fileDiff:o,actions:a,markerRows:s}=this.resolveConflict(e,t)??{};null!=r&&null!=o&&null!=a&&null!=s&&(this.computedCache={file:r,fileDiff:o,actions:a,markerRows:s},this.setActiveMergeConflictState(a,s),null!=this.workerManager?this.hunksRenderer.renderDiff(o):this.render({forceRender:!0}),this.options.onMergeConflictResolve?.(r,i))}setActiveMergeConflictState(e=this.conflictActions,t=this.markerRows){this.conflictActions=e,this.markerRows=t,null!=this.computedCache.fileDiff&&this.hunksRenderer instanceof tE&&this.hunksRenderer.setConflictState("none"===this.options.mergeConflictActionsType?[]:e,t,this.computedCache.fileDiff)}handleMergeConflictActionClick=e=>{let t=this.conflictActions[e.conflictIndex];if(null==t)return;if(t.conflictIndex!==e.conflictIndex)throw console.error({conflictIndex:e.conflictIndex,action:t}),Error("UnresolvedFile.handleMergeConflictActionClick: conflictIndex and conflictAction don't match");let n={resolution:e.resolution,conflict:t.conflict};null!=this.options.onMergeConflictAction?this.options.onMergeConflictAction(n,this):this.resolveConflictAndRender(e.conflictIndex,e.resolution)};renderMergeConflictActionSlots(){let{fileDiff:e}=this.computedCache;if(this.isContainerManaged||null==this.fileContainer||"function"!=typeof this.options.mergeConflictActionsType||0===this.conflictActions.length||null==e)return void this.clearMergeConflictActionCache();let t=new Map(this.conflictActionCache);for(let o=0;o<this.conflictActions.length;o++){var n,i,r;let a=this.conflictActions[o];if(null==a)continue;if(a.conflictIndex!==o)throw console.error({conflictIndex:o,action:a}),Error("UnresolvedFile.renderMergeConflictActionSlots: conflictIndex and conflictAction don't match");let s=eF(a,e);if(null==s)continue;let l=a.conflictIndex,d=eP({hunkIndex:s.hunkIndex,lineIndex:s.lineIndex,conflictIndex:l}),h=`${o}-${d}`,f=this.conflictActionCache.get(h);if(null==f||(n=f.action,!(n.hunkIndex===a.hunkIndex&&n.startContentIndex===a.startContentIndex&&n.endContentIndex===a.endContentIndex&&n.currentContentIndex===a.currentContentIndex&&n.baseContentIndex===a.baseContentIndex&&n.incomingContentIndex===a.incomingContentIndex&&n.endMarkerContentIndex===a.endMarkerContentIndex&&n.conflictIndex===a.conflictIndex&&(i=n.conflict,r=a.conflict,i.conflictIndex===r.conflictIndex&&i.startLineIndex===r.startLineIndex&&i.startLineNumber===r.startLineNumber&&i.separatorLineIndex===r.separatorLineIndex&&i.separatorLineNumber===r.separatorLineNumber&&i.endLineIndex===r.endLineIndex&&i.endLineNumber===r.endLineNumber&&i.baseMarkerLineIndex===r.baseMarkerLineIndex&&i.baseMarkerLineNumber===r.baseMarkerLineNumber)))){f?.element.remove();let e=this.renderMergeConflictAction(a);if(null==e)continue;let t=ep(d);t.appendChild(e),this.fileContainer.appendChild(t),f={element:t,action:a},this.conflictActionCache.set(h,f)}t.delete(h)}for(let[e,{element:n}]of t.entries())this.conflictActionCache.delete(e),n.remove()}renderMergeConflictAction(e){if("function"!=typeof this.options.mergeConflictActionsType)return;let t=this.options.mergeConflictActionsType(e,this);if(null!=t){if(t instanceof HTMLElement)return t;if("u">typeof DocumentFragment&&t instanceof DocumentFragment){let e=document.createElement("div");return e.style.display="contents",e.appendChild(t),e}}}clearMergeConflictActionCache(){for(let{element:e}of this.conflictActionCache.values())e.remove();this.conflictActionCache.clear()}};let tF="u"<typeof window?y.useEffect:y.useLayoutEffect;function tO({options:e,onMergeConflictAction:t,hasConflictUtility:n,hasCustomHeader:r,hasGutterRenderUtility:o}){return{...e,onMergeConflictAction:t,hunkSeparators:e?.hunkSeparators==="custom"?i:e?.hunkSeparators,mergeConflictActionsType:n||e?.mergeConflictActionsType==="custom"?i:e?.mergeConflictActionsType,renderCustomHeader:r?i:void 0,renderGutterUtility:o?i:void 0}}e.s([],63821),e.i(63821),e.s(["File",0,function({file:e,lineAnnotations:t,selectedLines:n,options:i,metrics:o,className:d,style:h,renderAnnotation:f,renderCustomHeader:c,renderHeaderPrefix:u,renderHeaderMetadata:p,prerenderedHTML:m,renderGutterUtility:g,renderHoverUtility:v,disableWorkerPool:b=!1}){let{ref:C,getHoveredLine:x}=eH({file:e,options:i,metrics:o,lineAnnotations:t,selectedLines:n,prerenderedHTML:m,hasGutterRenderUtility:null!=g||null!=v,hasCustomHeader:null!=c,disableWorkerPool:b});return(0,a.jsx)(r.DIFFS_TAG_NAME,{ref:C,className:d,style:h,children:l(s({file:e,renderAnnotation:f,renderCustomHeader:c,renderHeaderPrefix:u,renderHeaderMetadata:p,renderGutterUtility:g,renderHoverUtility:v,lineAnnotations:t,getHoveredLine:x}),m)})},"FileDiff",0,function({fileDiff:e,options:t,metrics:n,lineAnnotations:i,selectedLines:o,className:s,style:d,prerenderedHTML:h,renderAnnotation:f,renderCustomHeader:c,renderHeaderPrefix:u,renderHeaderMetadata:p,renderGutterUtility:m,renderHoverUtility:g,disableWorkerPool:v=!1}){let{ref:b,getHoveredLine:C}=tL({fileDiff:e,options:t,metrics:n,lineAnnotations:i,selectedLines:o,prerenderedHTML:h,hasGutterRenderUtility:null!=m||null!=g,hasCustomHeader:null!=c,disableWorkerPool:v});return(0,a.jsx)(r.DIFFS_TAG_NAME,{ref:b,className:s,style:d,children:l(eJ({fileDiff:e,renderCustomHeader:c,renderHeaderPrefix:u,renderHeaderMetadata:p,renderAnnotation:f,renderGutterUtility:m,lineAnnotations:i,renderHoverUtility:g,getHoveredLine:C}),h)})},"GutterUtilitySlotStyles",0,t,"MergeConflictSlotStyles",0,n,"MultiFileDiff",0,function({oldFile:e,newFile:t,options:n,metrics:i,lineAnnotations:o,selectedLines:s,className:d,style:h,prerenderedHTML:f,renderAnnotation:c,renderCustomHeader:u,renderHeaderPrefix:p,renderHeaderMetadata:m,renderGutterUtility:g,renderHoverUtility:v,disableWorkerPool:b=!1}){let C=(0,y.useMemo)(()=>tg(e,t,n?.parseDiffOptions),[e,t,n?.parseDiffOptions]),{ref:x,getHoveredLine:S}=tL({fileDiff:C,options:n,metrics:i,lineAnnotations:o,selectedLines:s,prerenderedHTML:f,hasGutterRenderUtility:null!=g||null!=v,hasCustomHeader:null!=u,disableWorkerPool:b});return(0,a.jsx)(r.DIFFS_TAG_NAME,{ref:x,className:d,style:h,children:l(eJ({fileDiff:C,renderCustomHeader:u,renderHeaderPrefix:p,renderHeaderMetadata:m,renderAnnotation:c,lineAnnotations:o,renderGutterUtility:g,renderHoverUtility:v,getHoveredLine:S}),f)})},"PatchDiff",0,function({patch:e,options:t,metrics:n,lineAnnotations:i,selectedLines:o,className:s,style:d,prerenderedHTML:h,renderAnnotation:f,renderCustomHeader:c,renderHeaderPrefix:u,renderHeaderMetadata:p,renderGutterUtility:m,renderHoverUtility:g,disableWorkerPool:v=!1}){var b;let C=(b=e,(0,y.useMemo)(()=>(function(e){let t=function(e,t=!1){let n=[];for(let i of e.split(r.COMMIT_METADATA_SPLIT))try{n.push(function(e,t,n=!1){let i,o=r.GIT_DIFF_FILE_BREAK_REGEX.test(e),a=e.split(o?r.GIT_DIFF_FILE_BREAK_REGEX:r.UNIFIED_DIFF_FILE_BREAK_REGEX),s=[];for(let e of a){if(o&&!r.GIT_DIFF_FILE_BREAK_REGEX.test(e)||!o&&!r.UNIFIED_DIFF_FILE_BREAK_REGEX.test(e)){if(null==i)i=e;else if(n)throw Error("parsePatchContent: unknown file blob");else console.error("parsePatchContent: unknown file blob:",e);continue}let a=ts(e,{cacheKey:null!=t?`${t}-${s.length}`:void 0,isGitDiff:o,throwOnError:n});null!=a&&s.push(a)}return{patchMetadata:i,files:s}}(i,void 0,t))}catch(e){if(t)throw e;console.error(e)}return n}(e);if(1!==t.length)throw console.error(t),Error("PatchDiff: Provided patch must include only 1 patch, with 1 diff");let{files:n}=t[0];if(1!==n.length)throw console.error(n),Error("FileDiff: Provided patch must contain exactly 1 file diff");return n[0]})(b),[b])),{ref:x,getHoveredLine:S}=tL({fileDiff:C,options:t,metrics:n,lineAnnotations:i,selectedLines:o,prerenderedHTML:h,hasGutterRenderUtility:null!=m||null!=g,hasCustomHeader:null!=c,disableWorkerPool:v});return(0,a.jsx)(r.DIFFS_TAG_NAME,{ref:x,className:s,style:d,children:l(eJ({fileDiff:C,renderCustomHeader:c,renderHeaderPrefix:u,renderHeaderMetadata:p,renderAnnotation:f,lineAnnotations:i,renderGutterUtility:m,renderHoverUtility:g,getHoveredLine:S}),h)})},"UnresolvedFile",0,function({file:e,options:t,lineAnnotations:n,selectedLines:i,className:o,style:s,prerenderedHTML:d,renderAnnotation:h,renderCustomHeader:f,renderHeaderPrefix:c,renderHeaderMetadata:u,renderGutterUtility:p,renderHoverUtility:m,renderMergeConflictUtility:g,disableWorkerPool:v=!1}){let{ref:b,getHoveredLine:C,fileDiff:x,actions:S,getInstance:L}=function({file:e,options:t,lineAnnotations:n,selectedLines:i,prerenderedHTML:r,hasConflictUtility:o,hasGutterRenderUtility:a,hasCustomHeader:s,disableWorkerPool:l}){let[{fileDiff:d,actions:h,markerRows:f},c]=(0,y.useState)(()=>{let{fileDiff:n,actions:i,markerRows:r}=eO(e,t?.maxContextLines);return{fileDiff:n,actions:i,markerRows:r}}),u=w((e,t)=>{c(n=>{let{fileDiff:i,actions:r,markerRows:o}=t.resolveConflict(e.conflict.conflictIndex,e.resolution,n.fileDiff)??{};return null==i||null==r||null==o?n:{fileDiff:i,actions:r,markerRows:o}})}),p=(0,y.useContext)(E.WorkerPoolContext),m=(0,y.useRef)(null),g=w(e=>{if(null!=e){if(null!=m.current)throw Error("useUnresolvedFileInstance: An instance should not already exist when a node is created");m.current=new tP(tO({hasConflictUtility:o,hasCustomHeader:s,hasGutterRenderUtility:a,onMergeConflictAction:u,options:t}),!l?p:void 0,!0),m.current.hydrate({fileDiff:d,actions:h,markerRows:f,fileContainer:e,lineAnnotations:n,prerenderedHTML:r})}else{if(null==m.current)throw Error("useUnresolvedFileInstance: A UnresolvedFile instance should exist when unmounting");m.current.cleanUp(),m.current=null}});return tF(()=>{if(null==m.current)return;let e=m.current,r=tO({hasConflictUtility:o,hasCustomHeader:s,hasGutterRenderUtility:a,onMergeConflictAction:u,options:t}),l=!eI(e.options,r);e.setOptions(r),e.render({fileDiff:d,actions:h,markerRows:f,lineAnnotations:n,forceRender:l}),void 0!==i&&e.setSelectedLines(i)}),{ref:g,getHoveredLine:(0,y.useCallback)(()=>m.current?.getHoveredLine(),[]),fileDiff:d,actions:h,markerRows:f,getInstance:(0,y.useCallback)(()=>m.current??void 0,[])}}({file:e,options:t,lineAnnotations:n,selectedLines:i,prerenderedHTML:d,hasConflictUtility:null!=g,hasGutterRenderUtility:null!=p||null!=m,hasCustomHeader:null!=f,disableWorkerPool:v});return(0,a.jsx)(r.DIFFS_TAG_NAME,{ref:b,className:o,style:s,children:l(eJ({fileDiff:x,renderCustomHeader:f,renderHeaderPrefix:c,renderHeaderMetadata:u,renderAnnotation:h,renderGutterUtility:p,renderHoverUtility:m,lineAnnotations:n,getHoveredLine:C,actions:S,renderMergeConflictUtility:g,getInstance:L}),d)})},"Virtualizer",0,function({children:e,config:t,className:n,style:i,contentClassName:r,contentStyle:o}){let[s]=(0,y.useState)(()=>"u">typeof window?new x(t):void 0),l=(0,y.useCallback)(e=>{null!=e?s?.setup(e):s?.cleanUp()},[s]);return(0,a.jsx)(L.Provider,{value:s,children:(0,a.jsx)("div",{className:n,style:i,ref:l,children:(0,a.jsx)("div",{className:r,style:o,children:e})})})},"VirtualizerContext",0,L,"WorkerPoolContext",()=>E.WorkerPoolContext,"WorkerPoolContextProvider",()=>E.WorkerPoolContextProvider,"noopRender",0,i,"renderDiffChildren",0,eJ,"renderFileChildren",0,s,"templateRender",0,l,"useFileDiffInstance",0,tL,"useFileInstance",0,eH,"useStableCallback",0,w,"useVirtualizer",0,k,"useWorkerPool",()=>E.useWorkerPool],15126)},1980,e=>{e.n(e.i(15126))}]);