azdiffs 0.0.0-stage → 0.1.0

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 (118) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -2
  3. package/THIRD_PARTY_NOTICES.md +4514 -0
  4. package/dist/cli.js +4768 -0
  5. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId-D7saE-jO.js +1 -0
  6. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.commits._commitId-DOwGbBTQ.js +1 -0
  7. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.commits.index-DzGjUdAz.js +1 -0
  8. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.conflicts-Cjr34xFt.js +1 -0
  9. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.files-BjjJ4Yb8.js +1 -0
  10. package/dist/web/assets/_organization.___git._repository.pullrequest._pullRequestId.index-iY62N_zR.js +1 -0
  11. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId-CrHRklAE.js +1 -0
  12. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.commits._commitId-WC7fEryq.js +1 -0
  13. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.commits.index-DzGjUdAz.js +1 -0
  14. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.conflicts-BhUkafpV.js +1 -0
  15. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.files-_RVmv4sD.js +1 -0
  16. package/dist/web/assets/_organization._project.___git._repository.pullrequest._pullRequestId.index-BJrgfbSD.js +1 -0
  17. package/dist/web/assets/_organization.index-hKcWlBrk.js +1 -0
  18. package/dist/web/assets/bat-qdxAdBWQ.js +1 -0
  19. package/dist/web/assets/bicep-CUHmPFLl.js +1 -0
  20. package/dist/web/assets/c-B0t_Dlza.js +1 -0
  21. package/dist/web/assets/cmake-Bj61d0ZC.js +1 -0
  22. package/dist/web/assets/commit-diff-view-CQeZylif.js +1 -0
  23. package/dist/web/assets/commits-view-B_TQ6AnD.js +13 -0
  24. package/dist/web/assets/conflicts-view-CnGEkjaP.js +8 -0
  25. package/dist/web/assets/core-D5Wev6DN.js +12 -0
  26. package/dist/web/assets/core-DfsS1UI1.js +12 -0
  27. package/dist/web/assets/cpp-DGR_3gb-.js +1 -0
  28. package/dist/web/assets/csharp-dmMxLVLW.js +1 -0
  29. package/dist/web/assets/css-CBDjU9xM.js +1 -0
  30. package/dist/web/assets/dart-CHZY9Xhz.js +1 -0
  31. package/dist/web/assets/dev.diff-DH1qvnWe.js +1 -0
  32. package/dist/web/assets/diff-woXpYk--.js +1 -0
  33. package/dist/web/assets/docker-IyjqRm3v.js +1 -0
  34. package/dist/web/assets/dotenv-CuH5my32.js +1 -0
  35. package/dist/web/assets/engine-javascript-C4Jk_eU2.js +141 -0
  36. package/dist/web/assets/engine-javascript-DpLLfDIa.js +141 -0
  37. package/dist/web/assets/engine-oniguruma-BfcA8yDp.js +1 -0
  38. package/dist/web/assets/engine-oniguruma-D--T0LcV.js +1 -0
  39. package/dist/web/assets/file-header-keBlejWu.js +49 -0
  40. package/dist/web/assets/files-view-Bu3bjrNf.js +1460 -0
  41. package/dist/web/assets/fsharp-D13ZGOAj.js +1 -0
  42. package/dist/web/assets/go-rLFTqkRN.js +1 -0
  43. package/dist/web/assets/grammars-DmFYBwmS.js +2 -0
  44. package/dist/web/assets/graphql-Br4JsJsw.js +1 -0
  45. package/dist/web/assets/groovy-CacY0gHj.js +1 -0
  46. package/dist/web/assets/hcl-Dh228itO.js +1 -0
  47. package/dist/web/assets/highlights-BJb1-tzP.js +1 -0
  48. package/dist/web/assets/highlights-CIgHM7EF-ByjlShdO.js +1 -0
  49. package/dist/web/assets/home-page-Y5jGxOav.js +1 -0
  50. package/dist/web/assets/html-Cyo-BRss.js +1 -0
  51. package/dist/web/assets/inbox-jP8QPtzZ.js +1 -0
  52. package/dist/web/assets/index-B297yCgq.js +11 -0
  53. package/dist/web/assets/index-CjZUV4-4.css +1 -0
  54. package/dist/web/assets/ini-B5eOa1yu.js +1 -0
  55. package/dist/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  56. package/dist/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  57. package/dist/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  58. package/dist/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  59. package/dist/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  60. package/dist/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  61. package/dist/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  62. package/dist/web/assets/java-r7y4bhRH.js +1 -0
  63. package/dist/web/assets/javascript-anBMbNY-.js +1 -0
  64. package/dist/web/assets/json-qhed-kSA.js +1 -0
  65. package/dist/web/assets/json5-BR5RXkoi.js +1 -0
  66. package/dist/web/assets/jsonc-CYpm1nAK.js +1 -0
  67. package/dist/web/assets/jsx-Bz0zcwM4.js +1 -0
  68. package/dist/web/assets/kotlin-DhhofPvG.js +1 -0
  69. package/dist/web/assets/langs_worker-Dyqdnub0.js +1 -0
  70. package/dist/web/assets/less-DVTAwKKz.js +1 -0
  71. package/dist/web/assets/lib-C2gVWm_O.js +1 -0
  72. package/dist/web/assets/lib-rf_jxHx0.js +1 -0
  73. package/dist/web/assets/lineChanges-Dw4ZXwVU.js +9 -0
  74. package/dist/web/assets/loader-BljfpPoZ.js +1 -0
  75. package/dist/web/assets/loader-C-ieOA_A.js +1 -0
  76. package/dist/web/assets/lua-mGgFNKt2.js +1 -0
  77. package/dist/web/assets/makefile-Dixweg8N.js +1 -0
  78. package/dist/web/assets/markdown-BYOwaDjH.js +1 -0
  79. package/dist/web/assets/overview-view-cEOsI9TY.js +2 -0
  80. package/dist/web/assets/php-DTciGFRO.js +1 -0
  81. package/dist/web/assets/pierre-dark-DMS-zpcK.js +1 -0
  82. package/dist/web/assets/pierre-light-BHq6aQNU.js +1 -0
  83. package/dist/web/assets/powershell-QtSnmXcu.js +1 -0
  84. package/dist/web/assets/properties-CHTuaqAW.js +1 -0
  85. package/dist/web/assets/proto-DB4EqR-F.js +1 -0
  86. package/dist/web/assets/pull-request-layout-DsDKURcq.js +35 -0
  87. package/dist/web/assets/python-gzcpVVnB.js +1 -0
  88. package/dist/web/assets/razor-3kKIP6Di.js +1 -0
  89. package/dist/web/assets/rolldown-runtime-BLXQ4ufn.js +1 -0
  90. package/dist/web/assets/routes-BruvNNp9.js +1 -0
  91. package/dist/web/assets/rust-DpiIf5JO.js +1 -0
  92. package/dist/web/assets/scala-BiFt_7mu.js +1 -0
  93. package/dist/web/assets/scss-DC8XIxmG.js +1 -0
  94. package/dist/web/assets/shellscript-CLZ0U2zV.js +1 -0
  95. package/dist/web/assets/shiki-DueA5xDi.js +1 -0
  96. package/dist/web/assets/shiki-DxP4sN1Z-caEk3oPG.js +1 -0
  97. package/dist/web/assets/shortcut-help-Cb0be4f3.js +1 -0
  98. package/dist/web/assets/sql-CEbI0hMM.js +1 -0
  99. package/dist/web/assets/stream-tokenizer-7LLwu37w-C37tUWGx.js +12 -0
  100. package/dist/web/assets/stream-tokenizer-B5Ok5N3S.js +4 -0
  101. package/dist/web/assets/svelte-iJTmbwM3.js +1 -0
  102. package/dist/web/assets/swift-CyEgAFGc.js +1 -0
  103. package/dist/web/assets/terraform-DswuEJGm.js +1 -0
  104. package/dist/web/assets/themes-BKc5vU6v.js +1 -0
  105. package/dist/web/assets/themes-SQq_asFq.js +1 -0
  106. package/dist/web/assets/toml-CcmNWLt0.js +1 -0
  107. package/dist/web/assets/tsx-udAQXfEw.js +1 -0
  108. package/dist/web/assets/typescript-bsJCZSQ-.js +1 -0
  109. package/dist/web/assets/utils-Tkdy0sOA.js +1 -0
  110. package/dist/web/assets/vb-DOwzaHZ0.js +1 -0
  111. package/dist/web/assets/vue-Dz_q6gML.js +1 -0
  112. package/dist/web/assets/wasm-C7N7kd8H.js +1 -0
  113. package/dist/web/assets/worker-B--T_fs_.js +7 -0
  114. package/dist/web/assets/xml-Bz5Z3pZJ.js +1 -0
  115. package/dist/web/assets/yaml-rwi0_p6S.js +1 -0
  116. package/dist/web/favicon.svg +5 -0
  117. package/dist/web/index.html +16 -0
  118. package/package.json +41 -4
@@ -0,0 +1,1460 @@
1
+ import{r as e}from"./rolldown-runtime-BLXQ4ufn.js";import{$ as t,Bn as n,Fn as r,G as i,K as a,M as o,Rt as s,bn as c,gn as l,ht as u,mn as d,nt as f,q as p,un as m,yn as h,yt as g,z as _,zn as v}from"./index-B297yCgq.js";import{$t as y,An as b,Bt as x,C as S,Cn as C,Ct as w,Dn as T,Dt as E,En as D,Et as O,F as k,Fn as A,Ft as j,Gt as M,Ht as N,I as ee,In as P,It as F,Jt as I,L as te,Ln as ne,Lt as re,Mn as ie,Mt as ae,Nn as oe,Nt as se,On as L,Ot as ce,Pn as le,Pt as ue,Qt as R,Rn as de,Rt as fe,Sn as pe,St as me,Tn as he,Tt as ge,Ut as _e,W as ve,Wt as ye,Xt as be,Yt as xe,Zt as Se,_n as Ce,_t as z,at as we,bn as Te,bt as Ee,ct as De,dt as Oe,en as ke,fn as Ae,ft as je,gn as Me,gt as Ne,hn as Pe,ht as Fe,it as Ie,jn as Le,jt as Re,k as ze,kn as Be,kt as Ve,ln as He,lt as Ue,mn as We,mt as Ge,pn as B,pt as Ke,qt as qe,r as Je,rn as Ye,rt as Xe,s as Ze,t as Qe,tn as $e,ut as et,vn as tt,vt as nt,wn as rt,wt as it,xn as at,xt as ot,y as V,yn as H,yt as st,zn as ct,zt as lt}from"./pull-request-layout-DsDKURcq.js";import{r as ut,t as dt}from"./utils-Tkdy0sOA.js";import{i as ft,n as pt,r as mt,t as ht}from"./lineChanges-Dw4ZXwVU.js";import{i as gt,o as _t,s as vt}from"./commits-view-B_TQ6AnD.js";import{A as yt,C as bt,E as xt,M as St,O as Ct,S as wt,T as Tt,_ as Et,a as Dt,b as Ot,c as kt,g as At,i as jt,j as Mt,k as Nt,n as Pt,p as Ft,r as It,s as Lt,w as Rt,x as zt,y as Bt}from"./file-header-keBlejWu.js";import{g as Vt,n as Ht}from"./inbox-jP8QPtzZ.js";import{t as Ut}from"./grammars-DmFYBwmS.js";import{n as Wt,t as Gt}from"./shortcut-help-Cb0be4f3.js";var U=e(n(),1);function Kt(e){let t=(0,U.useRef)(e);return(0,U.useInsertionEffect)(()=>void(t.current=e)),(0,U.useCallback)((...e)=>t.current(...e),[])}var W=v(),qt=(0,U.createContext)(void 0);function Jt(){return(0,U.useContext)(qt)}var Yt={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},Xt={display:`contents`};function Zt(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function Qt({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function $t(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:en(n,e.startContentIndex)}}function en(e,t){let n=e.unifiedLineStart;for(let r=0;r<t;r++){let t=e.hunkContent[r];n+=t.type===`context`?t.lines:t.deletions+t.additions}return n}function tn({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,renderGutterUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d,getAnnotationSlotName:f=Zt}){let p=n?.(e),m=r?.(e),h=i?.(e),g=a?.(e);return(0,W.jsxs)(W.Fragment,{children:[p==null?(0,W.jsxs)(W.Fragment,{children:[m!=null&&(0,W.jsx)(`div`,{slot:`header-prefix`,children:m}),h!=null&&(0,W.jsx)(`div`,{slot:`header-filename-suffix`,children:h}),g!=null&&(0,W.jsx)(`div`,{slot:`header-metadata`,children:g})]}):(0,W.jsx)(`div`,{slot:Ce,children:p}),o!=null&&l?.map((t,n)=>(0,W.jsx)(`div`,{slot:f(t),children:o(t,e)},n)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=nn(t,e);return(0,W.jsx)(`div`,{slot:n,style:Xt,children:c(t,d)},n)}),s!=null&&(0,W.jsx)(`div`,{slot:`gutter-utility-slot`,style:Yt,children:s(u)})]})}function nn(e,t){let n=$t(e,t);return n==null?void 0:Qt({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}function rn({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,lineAnnotations:o,renderGutterUtility:s,getHoveredLine:c,getAnnotationSlotName:l=Zt}){let u=t?.(e),d=n?.(e),f=r?.(e),p=i?.(e);return(0,W.jsxs)(W.Fragment,{children:[u==null?(0,W.jsxs)(W.Fragment,{children:[d!=null&&(0,W.jsx)(`div`,{slot:`header-prefix`,children:d}),f!=null&&(0,W.jsx)(`div`,{slot:`header-filename-suffix`,children:f}),p!=null&&(0,W.jsx)(`div`,{slot:`header-metadata`,children:p})]}):(0,W.jsx)(`div`,{slot:Ce,children:u}),a!=null&&o?.map((t,n)=>(0,W.jsx)(`div`,{slot:l(t),children:a(t,e)},n)),s!=null&&(0,W.jsx)(`div`,{slot:`gutter-utility-slot`,style:Yt,children:s(c)})]})}function an(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function on(e,t){let n=sn(e),r=sn(t);return Se(e?.theme??rt,t?.theme??rt)&&an(e,t,[`theme`,`parseDiffOptions`,`searchOptions`])&&an(cn(e),cn(t))&&an(n,r,[`defaults`])&&an(n?.defaults,r?.defaults)}function sn(e){if(e!=null&&`searchOptions`in e)return e.searchOptions}function cn(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}function ln(e){if(e.type===`diff`){let{instance:t,item:n}=e;return t.__getNextRenderData({fileDiff:t.fileDiff??n.fileDiff,lineAnnotations:void 0})}let{instance:t,item:n}=e;return t.__getNextRenderData({file:t.file??n.file,lineAnnotations:void 0})}var un=new WeakMap;function dn(e){return un.get(e)??e}function fn(e){return e.start.line===e.end.line&&e.start.character===e.end.character}function pn(e){let{start:t,end:n,direction:r}=e;return r===-1?t:n}function mn(e,t){if(t==null)return``;let n=fn(t)?hn(e,t):t,r=e.getText(n);return r.includes(`
2
+ `)?``:r}function hn(e,t){let{line:n,character:r}=t.start,i=e.getLineText(n),a=gn(i,Math.max(0,Math.min(r,i.length)));return a===void 0?t:{start:{line:n,character:a.start},end:{line:n,character:a.end},direction:1}}function gn(e,t){let n=dt({granularity:`word`});if(n!==void 0){for(let r of n.segment(e)){if(r.isWordLike!==!0)continue;let e=r.index,n=e+r.segment.length;if(t>=e&&t<=n)return{start:e,end:n}}return}let r=/[\p{Alphabetic}\p{Number}_]+/gu,i;for(;(i=r.exec(e))!==null;){let e=i.index,n=e+i[0].length;if(t>=e&&t<=n)return{start:e,end:n}}}var _n=new Set,vn=null;function yn(e){_n.add(e),vn??=requestAnimationFrame(xn)}function bn(e){_n.delete(e)&&_n.size===0&&vn!=null&&(cancelAnimationFrame(vn),vn=null)}function xn(e){let t=new Set(_n);_n.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}vn=_n.size>0?requestAnimationFrame(xn):null}var Sn=void 0,Cn=void 0,wn=void 0;function Tn(){return Sn??=/macOS|MacIntel|iPhone|iPad|iPod/i.test(On())}function En(){return Cn??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Dn(){return wn??=/\bFirefox\//.test(navigator.userAgent)}function On(){let e=globalThis.navigator;return e?.platform??e?.userAgentData?.platform??`unknown`}function kn({metaKey:e,ctrlKey:t},n=Tn()){return n?e&&!t:t&&!e}var An=new WeakMap;jn([{bindings:{Tab:`indent`,"shift+Tab":`outdent`,"cmdOrCtrl+[":`indentLess`,"cmdOrCtrl+]":`indentMore`,"cmdOrCtrl+z":`undo`,"cmdOrCtrl+shift+z":`redo`,"cmdOrCtrl+a":`selectAll`,"cmdOrCtrl+d":`findNextMatch`,"cmdOrCtrl+f":`openSearchPanel`,"cmdOrCtrl+alt+f":`openSearchReplacePanel`,"alt+ArrowUp":`moveLineUp`,"alt+ArrowDown":`moveLineDown`,"shift+alt+ArrowUp":`copyLineUp`,"shift+alt+ArrowDown":`copyLineDown`,Escape:`simplifySelection`,"cmdOrCtrl+Enter":`insertBlankLine`,"cmdOrCtrl+/":`toggleComment`,"shift+alt+a":`toggleBlockComment`,"cmdOrCtrl+Home":`moveCursorToDocStart`,"cmdOrCtrl+End":`moveCursorToDocEnd`,"cmdOrCtrl+shift+Home":`expandSelectionDocStart`,"cmdOrCtrl+shift+End":`expandSelectionDocEnd`}},{platform:`mac`,bindings:{"ctrl+k":`deleteHardLineForward`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`,"cmd+ArrowUp":`moveCursorToDocStart`,"cmd+ArrowDown":`moveCursorToDocEnd`,"cmd+shift+ArrowUp":`expandSelectionDocStart`,"cmd+shift+ArrowDown":`expandSelectionDocEnd`}},{platform:`windows`,bindings:{"ctrl+y":`redo`}},{platform:`linux`,bindings:{"ctrl+y":`redo`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`}}]);function jn(e){let t=An.get(e);if(t===void 0){t={mac:new Map,windows:new Map,linux:new Map};for(let n of e)for(let e of Object.keys(n.bindings)){let r=n.bindings[e];if(r===void 0)continue;let i=e.split(`+`),a=i.pop();for(let e of[`mac`,`windows`,`linux`]){if(n.platform!==void 0&&n.platform!==e)continue;let o=0;for(let t of i)t===`alt`?o|=1:t===`ctrl`?o|=2:t===`cmd`?o|=4:t===`shift`?o|=8:t===`cmdOrCtrl`&&(o|=e===`mac`?4:2);let s=t[e].get(o);s===void 0&&(s=new Map,t[e].set(o,s)),s.set(a,r)}}An.set(e,t)}return t}function Mn(e,t=Tn()){if(!kn(e,t))return;let n=e.key.length===1?e.key.toLowerCase():e.key;return!e.shiftKey&&(n===`f`||e.code===`KeyF`)?e.altKey?`replace`:`find`:Nn(e,t)}function Nn(e,t=Tn()){if(!e.altKey&&kn(e,t)&&((e.key.length===1?e.key.toLowerCase():e.key)===`g`||e.code===`KeyG`))return e.shiftKey?`previous`:`next`}var Pn=new Map,Fn=new Map,In=0;function Ln(e){let{data:t}=e;if(typeof t!=`string`||!t.startsWith(`diffs-background-task:`))return;let n=Number(t.slice(22)),r=Pn.get(n);r!=null&&(zn(r),r())}function Rn(e){if(Fn.has(e))return;Pn.size===0&&globalThis.addEventListener(`message`,Ln);let t=++In;Pn.set(t,e),Fn.set(e,t),globalThis.postMessage(`diffs-background-task:${t}`)}function zn(e){let t=Fn.get(e);t!=null&&(Fn.delete(e),Pn.delete(t),Pn.size===0&&globalThis.removeEventListener(`message`,Ln))}var Bn=`@layer base,theme,rendered,unsafe;@layer base{:host{--diffs-font-fallback:"SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "Courier New", monospace;--diffs-header-font-fallback:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;--diffs-mixer:light-dark(#000,#fff);--diffs-gap-fallback:8px;--diffs-scrollbar-gutter-fallback:6px;--diffs-scrollbar-gutter:var(--diffs-scrollbar-gutter-override,var(--diffs-scrollbar-gutter-measured,var(--diffs-scrollbar-gutter-fallback)));--diffs-added-light:#0dbe4e;--diffs-added-dark:#5ecc71;--diffs-modified-light:#009fff;--diffs-modified-dark:#69b1ff;--diffs-deleted-light:#ff2e3f;--diffs-deleted-dark:#ff6762;--diffs-warning-light:#d5a910;--diffs-warning-dark:#ffd452;color-scheme:light dark;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);font-feature-settings:var(--diffs-font-features);--diffs-bg:light-dark(var(--diffs-light-bg,#fff),var(--diffs-dark-bg,#000));--diffs-bg-buffer:var(--diffs-bg-buffer-override,light-dark(color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))));--diffs-bg-context:var(--diffs-bg-context-override,light-dark(color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))));--diffs-bg-context-gutter:var(--diffs-bg-context-gutter-override,light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)),color-mix(in lab, var(--diffs-bg-context) 45%, var(--diffs-bg))));--diffs-bg-separator:var(--diffs-bg-separator-override,light-dark(color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))));--diffs-fg:light-dark(var(--diffs-light,#000),var(--diffs-dark,#fff));--diffs-fg-number:var(--diffs-fg-number-override,light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)),color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))));--diffs-fg-conflict-marker:var(--diffs-fg-conflict-marker-override,var(--diffs-fg-number));--diffs-deletion-base:var(--diffs-deletion-color-override,light-dark(var(--diffs-light-deletion-color,var(--diffs-deletion-color,var(--diffs-deleted-light))),var(--diffs-dark-deletion-color,var(--diffs-deletion-color,var(--diffs-deleted-dark)))));--diffs-addition-base:var(--diffs-addition-color-override,light-dark(var(--diffs-light-addition-color,var(--diffs-addition-color,var(--diffs-added-light))),var(--diffs-dark-addition-color,var(--diffs-addition-color,var(--diffs-added-dark)))));--diffs-modified-base:var(--diffs-modified-color-override,light-dark(var(--diffs-light-modified-color,var(--diffs-modified-color,var(--diffs-modified-light))),var(--diffs-dark-modified-color,var(--diffs-modified-color,var(--diffs-modified-dark)))));--diffs-bg-deletion:var(--diffs-bg-deletion-override,light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)),color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))));--diffs-bg-deletion-emphasis:var(--diffs-bg-deletion-emphasis-override,light-dark(rgb(from var(--diffs-deletion-base) r g b / .15),rgb(from var(--diffs-deletion-base) r g b / .2)));--diffs-bg-addition:var(--diffs-bg-addition-override,light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)),color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))));--diffs-bg-addition-emphasis:var(--diffs-bg-addition-emphasis-override,light-dark(rgb(from var(--diffs-addition-base) r g b / .15),rgb(from var(--diffs-addition-base) r g b / .2)));--diffs-selection-base:var(--diffs-modified-base);--diffs-selection-number-fg:light-dark(color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)));--diffs-search-text-color:var(--diffs-fg-search-match-override,light-dark(var(--diffs-light-fg-search-match-theme,var(--diffs-fg-search-match-theme,#000)),var(--diffs-dark-fg-search-match-theme,var(--diffs-fg-search-match-theme,#000))));--diffs-search-current-text-color:var(--diffs-fg-search-match-current-override,light-dark(var(--diffs-light-fg-search-match-current-theme,var(--diffs-fg-search-match-current-theme,#fff)),var(--diffs-dark-fg-search-match-current-theme,var(--diffs-fg-search-match-current-theme,#000))));--diffs-search-match-color:var(--diffs-bg-search-match-override,light-dark(var(--diffs-light-bg-search-match-theme,var(--diffs-bg-search-match-theme,#ffff54)),var(--diffs-dark-bg-search-match-theme,var(--diffs-bg-search-match-theme,#ffff54))));--diffs-search-current-color:var(--diffs-bg-search-match-current-override,light-dark(var(--diffs-light-bg-search-match-current-theme,var(--diffs-bg-search-match-current-theme,#0067b1)),var(--diffs-dark-bg-search-match-current-theme,var(--diffs-bg-search-match-current-theme,#009fff))));background-color:var(--diffs-bg);color:var(--diffs-fg);display:block}pre,code,[data-error-wrapper]{isolation:isolate;font-family:var(--diffs-font-family,var(--diffs-font-fallback));outline:none;margin:0;padding:0;display:block}pre,code{background-color:var(--diffs-bg)}code{contain:content}input,button{font-family:inherit;font-size:inherit;line-height:inherit}*,:before,:after{box-sizing:border-box}[data-icon-sprite]{display:none}[data-diffs-header],[data-separator]{font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback))}[data-diffs-header][data-sticky]{z-index:1;background-color:var(--diffs-bg);position:sticky;top:0}[data-file-info]{color:var(--fg);background-color:color-mix(in lab, var(--bg) 98%, var(--fg));border-block:1px solid color-mix(in lab, var(--bg) 95%, var(--fg));padding:10px;font-weight:700}[data-diff],[data-file]{--diffs-grid-number-column-width:minmax(min-content, max-content);--diffs-code-grid:var(--diffs-grid-number-column-width) 1fr;&[data-dehydrated]{--diffs-code-grid:var(--diffs-grid-number-column-width) minmax(0, 1fr)}&:hover [data-code]::-webkit-scrollbar-thumb{background-color:var(--diffs-bg-context)}}@supports (-webkit-touch-callout:none){:host{--diffs-scrollbar-gutter-fallback:0px}}[data-line] span,[data-edit-prediction-suffix] span{color:light-dark(var(--diffs-token-light,var(--diffs-light)),var(--diffs-token-dark,var(--diffs-dark)));background-color:light-dark(var(--diffs-token-light-bg,inherit),var(--diffs-token-dark-bg,inherit))}[data-line],[data-gutter-buffer],[data-column-number],[data-line-annotation],[data-no-newline],[data-merge-conflict],[data-merge-conflict-actions],[data-editor-overlay]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-computed-diff-line-bg:var(--diffs-computed-decoration-bg);--diffs-computed-selected-line-bg:var(--diffs-computed-diff-line-bg);--diffs-computed-editor-active-line-bg:var(--diffs-computed-selected-line-bg);--diffs-computed-hovered-line-bg:var(--diffs-computed-editor-active-line-bg);--diffs-hover-mix-target:var(--diffs-bg-hover-override,var(--diffs-mixer));--diffs-line-bg:var(--diffs-computed-hovered-line-bg);color:var(--diffs-fg);background-color:var(--diffs-line-bg,var(--diffs-bg))}[data-line],[data-no-newline]{&[data-decoration-bg]{--mix-deco-light:92%;--mix-deco-dark:85%;&[data-decoration-bg-depth="2"]{--mix-deco-light:88%;--mix-deco-dark:80%}&[data-decoration-bg-depth="3"]{--mix-deco-light:85%;--mix-deco-dark:78%}--diffs-hover-mix-target:var(--diffs-decoration-bg);--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) var(--mix-deco-light), var(--diffs-decoration-bg)),color-mix(in lab, var(--diffs-bg) var(--mix-deco-dark), var(--diffs-decoration-bg)))}}[data-line-annotation],[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context);--diffs-computed-decoration-bg:var(--diffs-annotation-bg);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-merge-conflict-actions],[data-gutter-buffer=merge-conflict-action],[data-gutter-buffer=merge-conflict-marker-base],[data-gutter-buffer=merge-conflict-marker-separator],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator]{--diffs-computed-decoration-bg:var(--diffs-bg-context);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-gutter-buffer=merge-conflict-marker-start],[data-merge-conflict=marker-start]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))));--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-gutter-buffer=merge-conflict-marker-end],[data-merge-conflict=marker-end]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))));--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-has-merge-conflict] [data-line-annotation],[data-has-merge-conflict] [data-gutter-buffer=annotation]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}:where([data-background]){& [data-gutter-buffer],& [data-column-number]{--mix-light:91%;--mix-dark:85%}& [data-line],& [data-no-newline]{--mix-light:88%;--mix-dark:80%}& [data-gutter-buffer],& [data-column-number],& [data-line],& [data-no-newline]{--diffs-diff-line-mix-target:var(--diffs-bg);&[data-line-type=change-deletion]{--diffs-diff-line-mix-target:var(--diffs-bg-deletion-override,var(--diffs-deletion-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-line-type=change-addition]{--diffs-diff-line-mix-target:var(--diffs-bg-addition-override,var(--diffs-addition-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-merge-conflict=current]{--diffs-diff-line-mix-target:var(--conflict-bg-current-override,var(--diffs-addition-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-merge-conflict=incoming]{--diffs-diff-line-mix-target:var(--conflict-bg-incoming-override,var(--diffs-modified-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}}& [data-gutter-buffer][data-line-type=change-deletion],& [data-column-number][data-line-type=change-deletion]{color:var(--diffs-fg-number-deletion-override,var(--diffs-deletion-base));--diffs-diff-line-mix-target:var(--diffs-bg-deletion-number-override,var(--diffs-deletion-base))}& [data-gutter-buffer][data-line-type=change-addition],& [data-column-number][data-line-type=change-addition]{color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--diffs-bg-addition-number-override,var(--diffs-addition-base))}& [data-gutter-buffer][data-merge-conflict=current],& [data-column-number][data-merge-conflict=current]{color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--conflict-bg-current-number-override,var(--diffs-addition-base))}& [data-gutter-buffer][data-merge-conflict=incoming],& [data-column-number][data-merge-conflict=incoming]{color:var(--diffs-modified-base);--diffs-diff-line-mix-target:var(--conflict-bg-incoming-number-override,var(--diffs-modified-base))}}[data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline],[data-editor-overlay]{--diffs-selection-mix-target:var(--diffs-bg-selection-override,var(--diffs-selection-base));--diffs-selection-emphasis-mix-target:var(--diffs-selection-mix-target);&:where([data-editor-overlay]),&[data-selected-line]:where([data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline]){--mix-selection-light:82%;--mix-selection-dark:75%;--diffs-hover-mix-target:var(--diffs-selection-mix-target)}&[data-selected-line]:where([data-gutter-buffer],[data-column-number]),&[data-editor-active-line]:where([data-column-number]){--mix-selection-light:75%;--mix-selection-dark:60%;--diffs-selection-mix-target:var(--diffs-bg-selection-number-override,var(--diffs-selection-base));--diffs-hover-mix-target:var(--diffs-selection-mix-target)}&:where([data-line][data-selected-line]):is([data-line-type=change-addition],[data-line-type=change-deletion]){--diffs-selection-emphasis-mix-target:light-dark(color-mix(in lab, var(--diffs-diff-line-mix-target,var(--diffs-selection-mix-target)) var(--mix-selection-light), var(--diffs-selection-mix-target)),var(--diffs-selection-mix-target))}&:where([data-editor-overlay]),&[data-selected-line]{--diffs-computed-selected-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-light), var(--diffs-selection-mix-target)),color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-dark), var(--diffs-selection-mix-target)))}}[data-line][data-editor-active-line],[data-column-number][data-editor-active-line]{--diffs-computed-editor-active-line-bg:color-mix(in lab, var(--diffs-computed-selected-line-bg) var(--diffs-editor-active-line-source-mix,100%), var(--diffs-selection-emphasis-mix-target))}@media (pointer:fine){[data-line][data-hovered],[data-gutter-buffer][data-hovered],[data-column-number][data-hovered],[data-line-annotation][data-hovered],[data-no-newline][data-hovered],[data-merge-conflict][data-hovered],[data-merge-conflict-actions][data-hovered],[data-editor-overlay][data-hovered]{--diffs-computed-hovered-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-editor-active-line-bg) 97%, var(--diffs-hover-mix-target)),color-mix(in lab, var(--diffs-computed-editor-active-line-bg) 91%, var(--diffs-hover-mix-target)))}}[data-gutter-buffer][data-selected-line],[data-column-number]:is([data-selected-line],[data-editor-active-line]){color:var(--diffs-selection-number-fg)}[data-no-newline]{user-select:none;& span{opacity:.6}}[data-diff-type=split][data-overflow=scroll]{grid-template-columns:1fr 1fr;display:grid;& [data-additions]{border-left:1px solid var(--diffs-bg)}& [data-deletions]{border-right:1px solid var(--diffs-bg)}}[data-code]{grid-auto-flow:dense;grid-template-columns:var(--diffs-code-grid);overflow:var(--diffs-overflow-override,scroll) clip;overscroll-behavior-x:none;tab-size:var(--diffs-tab-size,2);padding-top:var(--diffs-gap-block,var(--diffs-gap-fallback));padding-bottom:max(0px, calc(var(--diffs-gap-block,var(--diffs-gap-fallback)) - var(--diffs-scrollbar-gutter)));scrollbar-gutter:stable;align-self:flex-start;display:grid}[data-diffs-scrollbar-measure]{opacity:0;pointer-events:none;scrollbar-gutter:auto;grid-template-columns:none;width:100px;height:100px;padding:0;position:absolute;top:-200px;left:-200px}[data-container-size]{container-type:inline-size}[data-code]::-webkit-scrollbar{width:0;height:var(--diffs-scrollbar-gutter)}[data-code]::-webkit-scrollbar-track{background:0 0}[data-code]::-webkit-scrollbar-thumb{background-color:#0000;background-clip:content-box;border:1px solid #0000;border-radius:3px}[data-code]::-webkit-scrollbar-corner{background-color:#0000}@supports ((-moz-appearance:none)){[data-code]{scrollbar-width:thin;scrollbar-color:var(--diffs-bg-context) transparent;padding-bottom:var(--diffs-gap-block,var(--diffs-gap-fallback))}}[data-diffs-header]~[data-diff],[data-diffs-header]~[data-file]{& [data-code],&[data-overflow=wrap],&[data-dehydrated][data-diff-type=split][data-overflow=scroll]{padding-top:0}}[data-gutter]{grid-template-rows:subgrid;grid-template-columns:subgrid;z-index:3;background-color:var(--diffs-bg);grid-column:1;display:grid;position:relative;& [data-gutter-buffer],& [data-column-number]{border-right:var(--diffs-gap-style,2px solid var(--diffs-bg))}}[data-content]{grid-template-rows:subgrid;grid-template-columns:subgrid;background-color:var(--diffs-bg);grid-column:2;min-width:0;display:grid}[data-overflow=scroll]:not([data-dehydrated],[data-custom-styles],:has(>[data-code]>[contenteditable],>[data-code]>*>:is([data-line-annotation],[data-separator],[data-merge-conflict],[data-merge-conflict-actions])))>[data-code]{display:flex;&>[data-gutter]{flex-shrink:0;display:block}&>[data-content]{flex:1 0 max-content;display:block}}[data-diff-type=split][data-overflow=wrap],[data-dehydrated][data-diff-type=split][data-overflow=scroll]{grid-auto-flow:dense;grid-template-columns:repeat(2, var(--diffs-code-grid));padding-block:var(--diffs-gap-block,var(--diffs-gap-fallback));display:grid;& [data-code]{display:contents}& [data-deletions]{& [data-gutter]{grid-column:1}& [data-content]{border-right:1px solid var(--diffs-bg);grid-column:2}}& [data-additions]{& [data-gutter]{border-left:1px solid var(--diffs-bg);grid-column:3}& [data-content]{grid-column:4}}}[data-dehydrated][data-diff-type=split][data-overflow=scroll] [data-content]{overflow:clip}[data-overflow=scroll] [data-gutter]{position:sticky;left:0}[data-interactive-lines] [data-line]{cursor:pointer}[data-interactive-line-numbers] [data-column-number]{cursor:pointer;touch-action:none}[data-content-buffer],[data-gutter-buffer]{user-select:none;min-height:1lh;position:relative}[data-gutter-buffer]{padding-left:2ch;padding-right:1ch;&:before{content:"";min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));display:block}}[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context-gutter);min-height:0}[data-gutter-buffer=buffer]{--diffs-line-bg:var(--diffs-bg-context-gutter)}[data-content-buffer]{background-position:5px 0;background-size:8px 8px;background-origin:border-box;background-image:repeating-linear-gradient(-45deg, transparent, transparent calc(3px * 1.414), var(--diffs-bg-buffer) calc(3px * 1.414), var(--diffs-bg-buffer) calc(4px * 1.414));grid-column:1}[data-separator]{box-sizing:content-box;background-color:var(--diffs-bg)}[data-separator=simple]{min-height:4px}[data-separator=line-info],[data-separator=line-info-basic],[data-separator=metadata],[data-separator=simple]{background-color:var(--diffs-bg-separator)}[data-separator=line-info],[data-separator=line-info-basic],[data-separator=metadata]{height:32px;position:relative}[data-separator-wrapper]{user-select:none;fill:currentColor;background-color:var(--diffs-bg);align-items:center;height:100%;display:flex;position:absolute;inset-inline:0}[data-content] [data-separator-wrapper]{display:none}[data-separator=metadata] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;color:var(--diffs-fg-number);white-space:nowrap;text-overflow:ellipsis;min-width:min-content;padding-inline:1ch;inset-inline:100% auto;overflow:hidden}[data-separator=line-info]{margin-block:var(--diffs-gap-block,var(--diffs-gap-fallback));& [data-separator-wrapper]{min-width:16px}}[data-separator=line-info-basic],[data-separator=metadata]{margin-block:0}[data-separator=line-info][data-separator-first]{margin-top:0}[data-separator=line-info][data-separator-last]{margin-bottom:0}[data-expand-index] [data-separator-wrapper]{grid-template-columns:32px auto;display:grid}[data-expand-index] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:32px 32px auto}[data-expand-line]{vertical-align:-.1lh;width:1.1lh;height:.6lh;font:inherit;color:var(--diffs-bg);background-color:var(--diffs-fg);opacity:.75;cursor:pointer;-webkit-user-select:none;user-select:none;border:0;border-radius:6px;margin-inline:.5ch;padding:0;display:inline-block;&:hover{opacity:1}&[data-search-match]{color:var(--diffs-search-text-color);background-color:var(--diffs-search-match-color)}&[data-search-match=current]{color:var(--diffs-search-current-text-color);background-color:var(--diffs-search-current-color)}& svg{fill:currentColor;width:.8lh;height:.5lh;margin:auto;display:block}&:focus-visible{outline-offset:-1px;outline:1px solid}}[data-expand-button],[data-separator-content]{background-color:var(--diffs-bg-separator);flex:none;align-items:center;display:flex}[data-expand-index] [data-separator-content]:hover{cursor:pointer;text-decoration:underline}[data-expand-button]{cursor:pointer;min-width:32px;color:var(--diffs-fg-number);border-right:2px solid var(--diffs-bg);flex-shrink:0;justify-content:center;align-self:stretch;&:hover{color:var(--diffs-fg)}&[data-expand-all-button]{display:none}}[data-expand-down] [data-icon]{transform:scaleY(-1)}[data-separator-content]{height:100%;color:var(--diffs-fg-number);flex:auto;justify-content:flex-start;padding:0 1ch;overflow:hidden}[data-separator=line-info],[data-separator=line-info-basic]{& [data-separator-content]{user-select:none;height:100%;overflow:clip}}[data-unmodified-lines]{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;display:block;overflow:hidden}@supports (width:1cqi){[data-unified]{& [data-separator=line-info] [data-separator-wrapper]{padding-inline:var(--diffs-gap-inline,var(--diffs-gap-fallback));width:100cqi;& [data-separator-content]{border-radius:6px}}& [data-separator=line-info][data-expand-index] [data-separator-wrapper] [data-separator-content]{border-top-left-radius:unset;border-bottom-left-radius:unset}}[data-gutter]{& [data-separator=line-info] [data-separator-wrapper]{padding-left:var(--diffs-gap-inline,var(--diffs-gap-fallback))}& [data-separator=line-info] [data-separator-content]{border-top-left-radius:6px;border-bottom-left-radius:6px}& [data-separator=line-info][data-expand-index] [data-separator-content]{border-top-left-radius:unset;border-bottom-left-radius:unset}}[data-additions]{& [data-content] [data-separator=line-info]{background-color:var(--diffs-bg);& [data-separator-wrapper]{display:none}}& [data-gutter] [data-separator=line-info] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);border-top-right-radius:6px;border-bottom-right-radius:6px;height:100%;display:block;& [data-separator-content],& [data-expand-button]{display:none}}}[data-overflow=scroll] [data-additions] [data-gutter] [data-separator=line-info] [data-separator-wrapper]{width:calc(100cqi - var(--diffs-gap-inline,var(--diffs-gap-fallback)))}[data-overflow=wrap] [data-additions] [data-content] [data-separator=line-info] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;margin-right:var(--diffs-gap-inline,var(--diffs-gap-fallback));border-top-right-radius:6px;border-bottom-right-radius:6px;display:block;& [data-separator-content],& [data-expand-button]{display:none}}[data-separator=line-info] [data-separator-wrapper]{& [data-expand-both],& [data-expand-down],& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}}@media (pointer:fine){[data-separator=line-info] [data-separator-wrapper]{&[data-separator-multi-button]{& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:unset}& [data-expand-down]{border-bottom-left-radius:6px;border-top-left-radius:unset}}}}}@media (pointer:coarse){[data-separator=line-info-basic] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:34px 34px auto;& [data-separator-content]{grid-column:unset;grid-row:unset}}@supports (width:1cqi){[data-separator=line-info] [data-separator-wrapper]{& [data-expand-both],& [data-expand-down],& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}&[data-separator-multi-button]{& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}& [data-expand-down]{border-bottom-left-radius:unset;border-top-left-radius:unset}}}}}@media (pointer:fine){[data-separator-wrapper][data-separator-multi-button]{grid-template-rows:50% 50%;display:grid;& [data-separator-content]{grid-area:1/2/-1;min-width:min-content}& [data-expand-button]{grid-column:1}}[data-separator=line-info] [data-separator-wrapper],[data-separator=line-info] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:34px auto}[data-separator=line-info-basic][data-expand-index] [data-separator-wrapper]{grid-template-columns:100% auto}[data-separator=line-info],[data-separator=line-info-basic]{& [data-separator-multi-button]{& [data-expand-up]{border-bottom:1px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg)}& [data-expand-down]{border-top:1px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg)}}}}[data-additions] [data-gutter] [data-separator-wrapper],[data-additions] [data-separator=line-info-basic] [data-separator-wrapper],[data-content] [data-separator-wrapper]{display:none}[data-line-annotation]{min-height:var(--diffs-annotation-min-height,0);z-index:2}[data-merge-conflict-actions]{z-index:2}[data-separator=custom]{grid-template-columns:subgrid;display:grid}[data-line],[data-column-number],[data-no-newline]{padding-inline:1ch;position:relative}[data-indicators=classic] [data-line]{padding-inline-start:2ch}[data-indicators=classic]{& [data-line][data-line-type=change-addition]:before,& [data-line][data-line-type=change-deletion]:before,& [data-no-newline][data-line-type=change-addition]:before,& [data-no-newline][data-line-type=change-deletion]:before{user-select:none;width:1ch;height:1lh;display:inline-block;position:absolute;top:0;left:0}& [data-line][data-line-type=change-addition]:before,& [data-no-newline][data-line-type=change-addition]:before{content:"+";color:var(--diffs-addition-base)}& [data-line][data-line-type=change-deletion]:before,& [data-no-newline][data-line-type=change-deletion]:before{content:"-";color:var(--diffs-deletion-base)}}[data-indicators=bars]{& [data-column-number][data-line-type=change-deletion]:before,& [data-column-number][data-line-type=change-addition]:before{content:"";user-select:none;contain:strict;width:4px;height:100%;display:block;position:absolute;top:0;left:0}& [data-column-number][data-line-type=change-deletion]:before{background-image:linear-gradient(0deg, var(--diffs-bg-deletion) 50%, var(--diffs-deletion-base) 50%);background-repeat:repeat;background-size:2px 2px;background-size:calc(1lh / round(1lh / 2px)) calc(1lh / round(1lh / 2px))}& [data-column-number][data-line-type=change-addition]:before{background-color:var(--diffs-addition-base)}}[data-overflow=wrap]{& [data-line]{white-space:pre-wrap;word-break:break-word}& [data-annotation-content]{word-break:break-word}}[data-overflow=scroll] [data-line]{white-space:pre;min-height:1lh}[data-overflow=scroll] [data-column-number]{min-height:1lh}[data-column-number]{box-sizing:content-box;text-align:right;user-select:none;color:var(--diffs-fg-number);padding-left:2ch}[data-line-number-content]{min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));z-index:1;display:inline-block;position:relative}[data-disable-line-numbers]{& [data-gutter-buffer],& [data-column-number]{min-width:4px;padding:0;&:before{min-width:0}}& [data-line-number-content]{display:none}& [data-gutter-utility-slot]{right:unset;justify-content:flex-start;left:0}&[data-indicators=bars] [data-gutter-utility-slot]{left:6px}}[data-file][data-disable-line-numbers]{& [data-gutter-buffer],& [data-column-number]{border-right:0;min-width:0}}[data-diff-span]{box-decoration-break:clone;border-radius:3px}::highlight(diffs-search-match){color:var(--diffs-search-text-color);background-color:var(--diffs-search-match-color)}::highlight(diffs-search-current){color:var(--diffs-search-current-text-color);background-color:var(--diffs-search-current-color)}[data-line-type=change-addition] [data-diff-span]{background-color:var(--diffs-bg-addition-emphasis)}[data-line-type=change-deletion] [data-diff-span]{background-color:var(--diffs-bg-deletion-emphasis)}[data-merge-conflict=marker-start],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator],[data-merge-conflict=marker-end]{color:var(--diffs-fg);padding-left:1ch}[data-merge-conflict=marker-start],[data-merge-conflict=marker-end]{align-items:center;display:flex}[data-merge-conflict=marker-start]:after,[data-merge-conflict=marker-end]:after{color:var(--diffs-fg-conflict-marker);font-size:.75rem;font-style:normal;line-height:1.25rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));padding-left:1ch}[data-merge-conflict=marker-start]:after{content:"(Current Change)"}[data-merge-conflict=marker-end]:after{content:"(Incoming Change)"}[data-merge-conflict-actions-content]{min-height:1.75rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));color:var(--diffs-fg);align-items:center;gap:.25rem;padding-inline:.5rem;font-size:.75rem;line-height:1.2;display:flex}[data-merge-conflict-action]{appearance:none;color:var(--diffs-fg-number);font:inherit;cursor:pointer;background:0 0;border:0;padding:0;font-style:normal}[data-merge-conflict-action]:hover{color:var(--diffs-fg)}[data-merge-conflict-action=current]:hover{color:var(--diffs-addition-base)}[data-merge-conflict-action=incoming]:hover{color:var(--diffs-modified-base)}[data-merge-conflict-action-separator]{color:var(--diffs-fg-number);opacity:.6;user-select:none}[data-diffs-header=default]{background-color:var(--diffs-bg);justify-content:space-between;align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));min-height:calc(1lh + (var(--diffs-gap-block,var(--diffs-gap-fallback)) * 3));z-index:2;flex-direction:row;padding-inline:16px;display:flex;position:relative;top:0}[data-header-content]{align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));white-space:nowrap;flex-direction:row;min-width:0;display:flex}[data-header-content] [data-prev-name],[data-header-content] [data-title]{text-overflow:ellipsis;white-space:nowrap;direction:rtl;min-width:0;overflow:hidden}[data-prev-name]{opacity:.7}[data-rename-icon]{fill:currentColor;flex-grow:0;flex-shrink:0}[data-diffs-header=default] [data-metadata]{white-space:nowrap;align-items:center;gap:1ch;display:flex}[data-diffs-header=default] [data-additions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-addition-base)}[data-diffs-header=default] [data-deletions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-deletion-base)}[data-change-icon]{fill:currentColor;flex-shrink:0}[data-change-icon=change],[data-change-icon=rename-pure],[data-change-icon=rename-changed]{color:var(--diffs-modified-base)}[data-change-icon=new]{color:var(--diffs-addition-base)}[data-change-icon=deleted]{color:var(--diffs-deletion-base)}[data-change-icon=file]{opacity:.6}[data-annotation-content]{z-index:2;isolation:isolate;white-space:normal;align-self:flex-start;min-width:0;display:flow-root;position:relative}[data-overflow=scroll] [data-annotation-content],[data-overflow=scroll] [data-merge-conflict-actions-content]{width:var(--diffs-column-content-width,auto);left:var(--diffs-column-number-width,0);position:sticky}[data-annotation-slot]{text-wrap-mode:wrap;word-break:normal;white-space-collapse:collapse}[data-gutter-utility-slot]{touch-action:none;justify-content:flex-end;display:flex;position:absolute;top:0;bottom:0;right:0}[data-utility-button]{appearance:none;cursor:pointer;width:1lh;height:1lh;font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);background-color:var(--diffs-modified-base);color:var(--diffs-bg);fill:currentColor;z-index:4;touch-action:none;border:none;border-radius:4px;justify-content:center;align-items:center;margin-right:calc(-1lh + 1ch);padding:0;display:flex;position:relative;&:before{content:"";display:block;position:absolute;inset:0 0 0 -4px}}[data-decoration-bar-stack]{pointer-events:none;isolation:isolate;z-index:1;background-color:var(--diffs-decoration-bar-color,transparent);box-sizing:content-box;border-left:2px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg);width:6px;position:absolute;top:0;bottom:0;right:-2px;[data-decoration-bar-depth="1"] &{background-color:color-mix(in lab, var(--diffs-bg) 20%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="2"] &{background-color:color-mix(in lab, var(--diffs-bg) 45%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="3"] &{background-color:color-mix(in lab, var(--diffs-bg) 65%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-start] &{border-top-left-radius:5px;border-top-right-radius:5px}[data-decoration-bar-end] &{z-index:3;border-bottom-right-radius:5px;border-bottom-left-radius:5px}}[data-placeholder]{contain:strict}[data-error-wrapper]{padding:var(--diffs-gap-block,var(--diffs-gap-fallback)) var(--diffs-gap-inline,var(--diffs-gap-fallback));scrollbar-width:none;max-height:400px;overflow:auto;& [data-error-message]{color:var(--diffs-deletion-base);font-size:18px;font-weight:700}& [data-error-stack]{color:var(--diffs-fg-number)}}}@layer theme,rendered,unsafe;
3
+ `,Vn;function Hn(e){if(Vn!=null)return Vn;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(L,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),Vn=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),Vn}function Un(e){let t=e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`;return`${T}: ${t};`}var Wn=`@layer base, theme, rendered, unsafe;`,Gn=RegExp(`${Yn(T)}\\s*:\\s*[^;]+;`);function Kn(e){return`${Wn}
4
+ @layer unsafe {
5
+ ${e}
6
+ }`}function qn(e,t=`system`,n){let r=t===`system`?``:`
7
+ color-scheme: ${t};`,i=Un(n);return`${Wn}
8
+ @layer base {
9
+ ${(t===`system`?[`light`,`dark`]:[t]).map(e=>{let n=`
10
+ [data-line] span, [data-edit-prediction-suffix] span {
11
+ font-weight: var(--diffs-token-${e}-font-weight, inherit);
12
+ font-style: var(--diffs-token-${e}-font-style, inherit);
13
+ text-decoration: var(--diffs-token-${e}-text-decoration, inherit);
14
+ }`;return t===`system`&&e===`dark`?`@media (prefers-color-scheme: dark) {${n}\n}`:n}).join(`
15
+ `)}
16
+ }
17
+ @layer rendered {
18
+ :host {${r}
19
+ ${i}
20
+ ${e}
21
+ }
22
+ }`}function Jn(e,t){let n=Un(t);return e.replace(Gn,n)}function Yn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var Xn;function Zn(e,t){if(Xn==null)try{e.getComposedRanges({shadowRoots:[t]}),Xn=!0}catch{Xn=!1}return Xn?e.getComposedRanges({shadowRoots:[t]})?.[0]:e.getComposedRanges(t)?.[0]}function Qn(e){let t=e.getSelection?.();if(t==null||t.rangeCount===0)return;let n=t.getRangeAt(0);return{collapsed:n.collapsed,startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset}}function $n(e){let t=document.getSelection();if(t!=null)return typeof t.getComposedRanges==`function`?Zn(t,e):Qn(e)}function er(e,t,n){if(e==null)return;let r=e.hunks.at(-1),i,a;e:for(let o of e.hunks){let e=n===`deletions`?o.deletionStart:o.additionStart,s=n===`deletions`?o.deletionCount:o.additionCount,c=We(e,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(t<c){let e=c-t;i=Math.max(u-e,0),a=Math.max(l-e,0);break}if(t>=c+s){if(o===r){let e=t-(c+s);i=u+o.unifiedLineCount+e,a=l+o.splitLineCount+e;break}}else{for(let e of o.hunkContent)if(e.type===`context`){if(t<c+e.lines){let e=t-c;a=l+e,i=u+e;break e}c+=e.lines,l+=e.lines,u+=e.lines}else{let r=n===`deletions`?e.deletions:e.additions;if(t<c+r){let r=t-c;i=u+(n===`additions`?e.deletions:0)+r,a=l+r;break e}c+=r,l+=Math.max(e.deletions,e.additions),u+=e.deletions+e.additions}break}}if(i!=null&&a!=null)return[i,a]}var tr=/\{(\w+)\s*,\s*plural\s*,((?:\s*\w+\s*\{[^{}]*\})+)\s*\}/,nr=/(\w+)\s*\{([^{}]*)\}/g,rr=/\{(\w+)\}/g,ir=new Set([`zero`,`one`,`two`,`few`,`many`,`other`]);function ar(e){return ir.has(e)}function or(e,t){let n=t?.[e];if(n==null)throw Error(`i18n: message argument "${e}" was not provided`);return n}function sr(e,t,n){let r=tr.exec(e),i=r==null?e:e.slice(0,r.index),a=r==null?``:e.slice(r.index+r[0].length);if(/[{}]/.test((i+a).replace(rr,``)))throw Error(`i18n: unsupported syntax in "${e}"`);if(r==null)return t=>cr(e,t,n);let[,o,s]=r,c=new Map;for(let[,t,n]of s.matchAll(nr)){if(!ar(t))throw Error(`i18n: unknown plural category "${t}" in "${e}"`);if(c.has(t))throw Error(`i18n: duplicate plural category "${t}" in "${e}"`);c.set(t,n)}let l=c.get(`other`);if(l==null)throw Error(`i18n: plural block needs an "other" branch in "${e}"`);return e=>{let r=or(o,e);if(typeof r!=`number`)throw Error(`i18n: plural argument "${o}" must be a number`);let s=c.get(t.select(r))??l;return cr(i+s.replaceAll(`#`,n.format(r))+a,e,n)}}function cr(e,t,n){return e.replace(rr,(e,r)=>{let i=or(r,t);return typeof i==`number`?n.format(i):i})}function lr(e){return Object.hasOwn(at,e)}function ur(e){let t={...at};if(e==null)return t;for(let[n,r]of Object.entries(e)){if(!lr(n))throw Error(`i18n: unknown message "${n}"`);r!=null&&(t[n]=r)}return t}function dr(e,t,n){let r=new Intl.PluralRules(t),i=new Map;for(let[t,a]of Object.entries(e))i.set(t,sr(a,r,n));return i}var G=new class{#e=`en`;#t=at;#n=new Intl.NumberFormat(`en`);#r=dr(at,`en`,this.#n);#i=new Set;#a=0;get version(){return this.#a}set({locale:e=`en`,messages:t}={}){let n=ur(t);if(e===this.#e&&an(n,this.#t))return;let r=new Intl.NumberFormat(e);this.#r=dr(n,e,r),this.#n=r,this.#e=e,this.#t=n,this.#a++;for(let e of this.#i)e.onMessagesChange()}t(e,t){let n=this.#r.get(e);if(n==null)throw Error(`i18n: unknown message "${e}"`);return n(t)}formatNumber(e){return this.#n.format(e)}subscribe(e){return this.#i.add(e),()=>{this.unsubscribe(e)}}unsubscribe(e){this.#i.delete(e)}__clearSubscribers(){this.#i.clear()}};function fr(e,t){if(e.length<=t||e.length-pr(e)<=t)return;let n=e.charCodeAt(t-1);return n>=55296&&n<=56319?t-1:t}function pr(e){let t=e.length;return e.charCodeAt(t-1)===10?e.charCodeAt(t-2)===13?2:1:0}function mr(e,t,n){for(let r of e.children){if(n===0)break;if(r.type===`text`){if(r.value.length<=n)t.children.push(r),n-=r.value.length;else return t.children.push({type:`text`,value:r.value.slice(0,n)}),0}else if(r.type===`element`){let e={...r,children:[]};n=mr(r,e,n),t.children.push(e)}}return n}var hr=class{#e=1/0;#t=new WeakMap;#n={additions:new Set,deletions:new Set};#r=!1;get expandedLines(){return this.#n}get hasCutRows(){return this.#r}startLayout(){this.#r=!1}setLimit(e){e!==this.#e&&(this.#e=e,this.#t=new WeakMap)}expand({additionLineNumber:e,deletionLineNumber:t}){let{additions:n,deletions:r}=this.#n;e!=null&&n.add(e),t!=null&&r.add(t)}clear(){let{additions:e,deletions:t}=this.#n;e.clear(),t.clear()}additionRow(e,t,n,r,i){return this.#i(e,t.lineText(n),`additions`,r,i)}deletionRow(e,t,n,r,i){return this.#i(e,t.diff.deletionLines[n]??``,`deletions`,r,i)}#i(e,t,n,r,i){let a=fr(t,this.#e);if(a==null||this.#n[n].has(r))return e;this.#r=!0;let o=n===`additions`?r:i,s=n===`deletions`?r:i,c=G.version,l=this.#t.get(e);if(l!=null&&l.messagesVersion===c&&l.additionLineNumber===o&&l.deletionLineNumber===s)return l.row;let u={...e,children:[]};return mr(e,u,a),u.children.push({type:`element`,tagName:`button`,children:[F({name:`diffs-icon-ellipsis`})],properties:{type:`button`,"data-expand-line":``,"data-addition-line-number":o,"data-deletion-line-number":s,"aria-label":G.t(`expandLine`)}}),this.#t.set(e,{row:u,additionLineNumber:o,deletionLineNumber:s,messagesVersion:c}),u}},gr=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`;function _r(e){if(!(e.text.length===0||yr(e.text,e.regex)))try{return xr(e.text,e.regex,e.caseSensitive)}catch{return}}function vr(e,t,n,r){e.lastIndex=0;let i;for(;(i=e.exec(t))!=null;){let a=i.index,o=i[0].length;if(o===0){e.lastIndex=wr(t,a);continue}let s=a+o;if((!n||Cr(t,a,s))&&r(a,s))return!0;a===e.lastIndex&&(e.lastIndex=wr(t,a))}return!1}function yr(e,t){return e.includes(`
23
+ `)||e.includes(`\r`)||t&&/\\[nr]/.test(e.replaceAll(`\\\\`,``))}function br(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function xr(e,t,n){let r=t?e:br(e);return new RegExp(r,`g${n?``:`i`}${t?`m`:``}`)}function Sr(e){if(e<=32||e===127)return!0;let t=String.fromCharCode(e);return gr.includes(t)}function Cr(e,t,n){return(t===0||Sr(e.charCodeAt(t-1)))&&(n===e.length||Sr(e.charCodeAt(n)))}function wr(e,t){if(t+1<e.length){let n=e.charCodeAt(t),r=e.charCodeAt(t+1);if(n>=55296&&n<=56319&&r>=56320&&r<=57343)return t+2}return t+1}var Tr=65536,Er=class{contents;side;offsets=[0];ended=!1;lineFeed;carriageReturn=-1;checkedTo=0;nextLine=0;constructor(e,t){this.contents=e,this.side=t}readLine(e){let{contents:t,offsets:n}=this;for(;e>=n.length&&!this.ended;)this.readNewLine();let r=n[e];if(r==null)throw Error(`CodeViewSearchTextCursor.readLine: line index ${e} is out of range`);if(e===n.length-1&&!this.ended)return this.readNewLine();let i=n[e+1]??t.length;for(;i>r;){let e=t.charCodeAt(i-1);if(e!==10&&e!==13)break;i--}return t.slice(r,i)}walk(e){let{offsets:t,side:n}=this;for(;this.nextLine<t.length;){let r=this.nextLine++;if(e(r===t.length-1&&!this.ended?this.readNewLine():this.readLine(r),n,r+1,r))return!1}return!0}readNewLine(){let{contents:e,offsets:t}=this,n=t[t.length-1],{lineFeed:r}=this;(r==null||r!==-1&&r<n)&&(r=e.indexOf(`
24
+ `,n),this.lineFeed=r);let i=r===-1?e.length:r,a=this.findCarriageReturn(n,i);return a===-1?(r===-1?this.ended=!0:t.push(r+1),e.slice(n,i)):(t.push(r!==-1&&a===i-1?r+1:a+1),e.slice(n,a))}findCarriageReturn(e,t){let{contents:n,checkedTo:r}=this;if(this.carriageReturn<e&&r<t){let i=Math.max(r,e),a=Math.min(n.length,Math.max(t,i+Tr)),o=n.slice(i,a).indexOf(`\r`);this.carriageReturn=o===-1?-1:i+o,this.checkedTo=o===-1?a:i+o+1}let{carriageReturn:i}=this;return i>=e&&i<t?i:-1}},Dr=class{regex;diff;additions;diffStyle;additionsOnly;rows;nextSide=`deletions`;constructor(e,t){this.regex=t;let{fileDiff:n,additionContents:r,diffStyle:i,additionsOnly:a}=e;this.diff=n,this.additions=r==null?void 0:new Er(r,`additions`),this.diffStyle=i,this.additionsOnly=a,this.rows=new Ue({diff:n,diffStyle:i,expandedHunks:!0})}walk(e){let{diff:t,additions:n,diffStyle:r,additionsOnly:i,rows:a}=this;if(this.nextSide===`additions`&&(this.nextSide=`deletions`,this.visitAddition(e)))return!1;if(i){for(;a.next();)if(this.visitAddition(e))return!1;return!0}if(r===`unified`){let{additionLines:n}=t;for(;a.next();)if(a.hasAddition&&n[a.additionLineIndex]!=null?this.visitAddition(e):this.visitDeletion(e))return!1;return!0}for(;a.next();)if(n==null&&a.type!==`change`){if(this.visitUnchanged(e))return!1}else if(this.nextSide=`additions`,this.visitDeletion(e)||(this.nextSide=`deletions`,this.visitAddition(e)))return!1;return!0}visitUnchanged(e){let{diff:t,rows:n,regex:r}=this,{deletionLineIndex:i,additionLineIndex:a}=n,o=t.deletionLines[i];return o==null||o!==t.additionLines[a]?(this.nextSide=`additions`,this.visitDeletion(e)?!0:(this.nextSide=`deletions`,this.visitAddition(e))):e(r?kr(o):o,`deletions`,n.deletionLineNumber,i,n.additionLineNumber,a)}visitDeletion(e){let{diff:t,rows:n,regex:r}=this;if(!n.hasDeletion)return!1;let i=n.deletionLineIndex,a=t.deletionLines[i];return a!=null&&e(r?kr(a):a,`deletions`,n.deletionLineNumber,i)}visitAddition(e){let{diff:t,additions:n,rows:r,regex:i}=this;if(!r.hasAddition)return!1;let{additionLineIndex:a,additionLineNumber:o}=r;if(n!=null)return e(n.readLine(a),`additions`,o,a);let s=t.additionLines[a];return s!=null&&e(i?kr(s):s,`additions`,o,a)}},Or=class e{itemCount;getItem;limit;startingItemIndex;static findEntryIndex(e,t){let n=e.at(-1);if(n==null||n.position<t)return e.length;let r=0,i=e.length;for(;r<i;){let n=Math.floor((r+i)/2);e[n].position<t?r=n+1:i=n}return r}pattern;wholeWord;regex;beforeStart=[];afterStart=[];progress=new Map;unsearched;matchCount=0;scannedCharacters=0;deadline;matches;constructor(e,t,n,r,i=0){this.itemCount=t,this.getItem=n,this.limit=r,this.startingItemIndex=i,this.pattern=_r(e),this.wholeWord=e.wholeWord,this.regex=e.regex,this.unsearched=t>0?[{start:0,end:t}]:[]}get atLimit(){let{matchCount:e,limit:t}=this;return e>=t}get finished(){let{pattern:e,atLimit:t,unsearched:n}=this;return e==null||t||n.length===0}rescanItem(e){this.dropItemProgress(e),this.dropItemMatches(e),this.markUnsearched(e)}addItems(e){let{itemCount:t,unsearched:n}=this,r=n.at(-1);r?.end===t?r.end+=e:e>0&&n.push({start:t,end:t+e}),this.itemCount=t+e}removeItem(t){this.dropItemMatches(t),this.dropItemProgress(t);let{progress:n,beforeStart:r,afterStart:i,unsearched:a,startingItemIndex:o,itemCount:s}=this,c=new Map;for(let[e,r]of n){let n=e>t?e-1:e;r.position=n,c.set(n,r)}this.progress=c;for(let n of[r,i]){let r=e.findEntryIndex(n,t+1);for(let e=r;e<n.length;e++)n[e].position--}let l=this.findUnsearchedRangeIndex(t);for(let e=l;e<a.length;e++){let n=a[e];n.start>t&&n.start--,n.end--}let u=a[l];u!=null&&u.start===u.end&&a.splice(l,1),t<o&&(this.startingItemIndex=o-1),this.itemCount=s-1}advance(e,t=this.startingItemIndex){let{pattern:n,progress:r}=this;if(this.finished||n==null)return!1;let i=!1;for(this.deadline=e==null?void 0:performance.now()+e,this.scannedCharacters=0;!this.finished;){let e=this.getNextPosition(t),a=r.get(e);a??=(this.dropItemMatches(e)&&(i=!0),this.prepareItem(n,e));let{cursor:o,visitLine:s}=a,c=o.walk(s),{atLimit:l}=this;if(c||l){if(this.recordItemMatches(a)&&(i=!0),r.delete(e),c&&this.markSearched(e),l){let{matchCount:e}=this;for(let t of r.values())e-=t.matches.length;this.matchCount=e,r.clear()}}else return r.set(e,a),i}return!0}getMatches(){let{beforeStart:e,afterStart:t,matches:n}=this;if(n!=null)return n;let r=[];for(let n of[t,e])for(let e of n){e.startIndex=r.length;for(let t of e.matches)r.push(t)}return this.matches=r,r}getMatchIndex(e,t){this.getMatches();let n=this.getEntry(e);if(n==null)return;let{matches:r,startIndex:i}=n,a=this.findItemMatchIndex(n,t.lineNumber,t.startCharacter,t.side??`additions`);if(a!=null&&Ar(r[a],t))return i+a}getFirstMatchedEntryAtOrAfter(t){let{beforeStart:n,afterStart:r,startingItemIndex:i}=this,a=t<i?n:r;return a[e.findEntryIndex(a,t)]??(t<i?r[0]:void 0)}hasPendingItems(e,t){let{finished:n,unsearched:r}=this,i=r[this.findUnsearchedRangeIndex(e)];return!n&&i!=null&&Math.max(e,i.start)<t}isItemPending(e){return!this.finished&&this.isUnsearched(e)}getItemMatches(e){return this.getEntry(e)?.matches}getLineMatches(e,t,n=`additions`){let r=this.getEntry(e),i=n===`deletions`?r?.deletionLines:r?.additionLines;if(i==null)return;let a=i[this.findLineIndex(i,t)];return a?.lineNumber===t?a:void 0}getFirstMatchAtOrAfter(e,t,n,r=`additions`){let i=this.getEntry(e);if(i==null)return;let a=this.findItemMatchIndex(i,t,n,r);return a==null?void 0:i.matches[a]}findLineIndex(e,t){let n=0,r=e.length;for(;n<r;){let i=Math.floor((n+r)/2);e[i].lineNumber<t?n=i+1:r=i}return n}findItemMatchIndex(e,t,n,r){let{matches:i,additionLines:a,deletionLines:o}=e,s=r===`deletions`?o:a;if(s==null)return;let c=this.findLineIndex(s,t),l=s[c];if(l==null)return;if(l.lineNumber>t)return l.startIndex;let u=l.startIndex,d=l.endIndex;for(;u<d;){let e=Math.floor((u+d)/2);i[e].startCharacter<n?u=e+1:d=e}return u<l.endIndex?u:s[c+1]?.startIndex}isUnsearched(e){let t=this.unsearched[this.findUnsearchedRangeIndex(e)];return t!=null&&t.start<=e}findUnsearchedRangeIndex(e){let{unsearched:t}=this,n=0,r=t.length;for(;n<r;){let i=Math.floor((n+r)/2);t[i].end<=e?n=i+1:r=i}return n}getNextPosition(e){let{unsearched:t}=this,n=this.findUnsearchedRangeIndex(e);return n<t.length?Math.max(t[n].start,e):t[0].start}markUnsearched(e){let{unsearched:t}=this,n=this.findUnsearchedRangeIndex(e),r=t[n];if(r!=null&&r.start<=e)return;let i=t[n-1];i!=null&&i.end===e?(i.end++,r!=null&&r.start===i.end&&(i.end=r.end,t.splice(n,1))):r!=null&&r.start===e+1?r.start--:t.splice(n,0,{start:e,end:e+1})}markSearched(e){let{unsearched:t}=this,n=this.findUnsearchedRangeIndex(e),r=t[n];e===r.start?(r.start++,r.start===r.end&&t.splice(n,1)):e+1===r.end?r.end--:t.splice(n,1,{start:r.start,end:e},{start:e+1,end:r.end})}dropItemProgress(e){let{progress:t,matchCount:n}=this,r=t.get(e);r!=null&&(this.matchCount=n-r.matches.length,t.delete(e))}getEntry(t){let{beforeStart:n,afterStart:r,startingItemIndex:i}=this,a=t<i?n:r,o=a[e.findEntryIndex(a,t)];return o?.position===t?o:void 0}dropItemMatches(t){let{beforeStart:n,afterStart:r,startingItemIndex:i,matchCount:a}=this,o=t<i?n:r,s=e.findEntryIndex(o,t),c=o[s];return c?.position===t&&(this.matchCount=a-c.matches.length,o.splice(s,1),this.matches=void 0,!0)}recordItemMatches(t){let{position:n,matches:r,additionLines:i,deletionLines:a}=t;if(r.length===0)return!1;let{beforeStart:o,afterStart:s,startingItemIndex:c}=this,l=n<c?o:s,u=e.findEntryIndex(l,n);return l.splice(u,0,{position:n,startIndex:0,matches:r,additionLines:i,deletionLines:a}),this.matches=void 0,!0}prepareItem(e,t){let{getItem:n,wholeWord:r,regex:i,limit:a}=this,o=n(t),{type:s,itemId:c}=o,{lineCuts:l}=o,u=l?.cutLength??1/0,d=s===`file`?new Er(o.contents):o.additionContents!=null&&o.additionsOnly?new Er(o.additionContents,`additions`):new Dr(o,i),f=[],p,m=0,h=0,g=(e,t,n)=>(f.push({itemId:c,itemType:s,side:p,lineNumber:m,lineIndex:h,startCharacter:e,endCharacter:t,cutOff:n}),++this.matchCount>=a),_=t=>{let n=fr(t,u);n==null||l?.expandedLines[p??`additions`].has(m)===!0?vr(e,t,r,g):vr(e,t,r,(e,t)=>t<=n?g(e,t):(g(e,t,!0),!0))},v=(e,t,n)=>{let r=f.length;(p===`deletions`?y.deletionLines??=[]:y.additionLines??=[]).push({lineNumber:m,startIndex:e,endIndex:r});let{atLimit:i}=this;if(i||t==null||n==null)return i;p=`additions`,m=t,h=n;let a=!1;for(let t=e;t<r;t++){let{startCharacter:e,endCharacter:n,cutOff:r}=f[t];if(g(e,n,r)){a=!0;break}}return(y.additionLines??=[]).push({lineNumber:t,startIndex:r,endIndex:f.length}),a},y={position:t,cursor:d,matches:f,additionLines:void 0,deletionLines:void 0,visitLine:(t,n,i,a,o,s)=>{p=n,m=i,h=a;let c=f.length;t.length<=u?vr(e,t,r,g):_(t);let l=f.length>c&&v(c,o,s),{deadline:d}=this;return d==null||(this.scannedCharacters+=t.length+1,this.scannedCharacters<65536)?l:(this.scannedCharacters=0,l||performance.now()>=d)}};return y}};function kr(e){let t=e.length;for(;t>0;){let n=e.charCodeAt(t-1);if(n!==10&&n!==13)break;t--}return t===e.length?e:e.slice(0,t)}function Ar(e,t){return e.itemId===t.itemId&&e.itemType===t.itemType&&e.side===t.side&&e.lineNumber===t.lineNumber&&e.lineIndex===t.lineIndex&&e.startCharacter===t.startCharacter&&e.endCharacter===t.endCharacter}function jr(e,t){return e===void 0||t===void 0?e===t:Ar(e,t)}var Mr=900001;function Nr(e){let t=e.startContainer.parentElement?.closest(`[data-code]`);if(t==null||t.clientWidth===0)return!1;if(t.scrollWidth<=t.clientWidth)return!0;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=t.querySelector(`:scope > [data-gutter]`),a=Math.max(r.left+t.clientLeft,i?.getBoundingClientRect().right??r.left),o=r.left+t.clientLeft+t.clientWidth,s=n.left<a||n.width>o-a?n.left-a:Math.max(0,n.right-o);return t.scrollTo({left:t.scrollLeft+s,behavior:`instant`}),!0}function Pr(e,t,n,r){let i=e.findIndex(e=>e.row===t);if(i<0)return;let a=e.length;for(;i<a;){let o=Math.floor((i+a)/2),s=e[o];if(s.row!==t){a=o;continue}let c=s.range.getClientRects();if(c.length===0)return;let l=c[0],u=c[c.length-1];if(r>=u.bottom||r>=u.top&&n>=u.right)i=o+1;else if(r<l.top||r<l.bottom&&n<l.left)a=o;else{for(let e of c)if(n>=e.left&&n<e.right&&r>=e.top&&r<e.bottom)return s;return}}}var Fr=new WeakMap;function Ir(e){return`highlightsFromPoint`in e}function Lr(e){return e instanceof Error&&e.name===`InvalidModificationError`}var Rr=class e{highlights;static create(t){let n=t.defaultView;if(n?.CSS?.highlights==null||typeof n.Highlight!=`function`||typeof n.CSS.registerProperty!=`function`)return;let r=Fr.get(t);if(r==null){for(let e of[`--diffs-search-match-color`,`--diffs-search-current-color`,`--diffs-search-text-color`])try{n.CSS.registerProperty({name:e,syntax:`<color>`,inherits:!0,initialValue:`transparent`})}catch(e){if(!Lr(e))throw e}r={match:new n.Highlight,current:new n.Highlight},r.current.priority=1,n.CSS.highlights.set(`diffs-search-match`,r.match),n.CSS.highlights.set(`diffs-search-current`,r.current),Fr.set(t,r)}return new e(r)}static getLineNumber(e){return Number(e.dataset.line)}static getLineSide(e){return e.dataset.lineType===`change-deletion`||e.closest(`[data-deletions]`)!=null?`deletions`:`additions`}ranges=[];markedButtons=[];currentRange;constructor(e){this.highlights=e}clear(){let{ranges:e,markedButtons:t}=this;for(let e of t)e.removeAttribute(`data-search-match`);t.length=0;for(let{range:t,highlight:n}of e)n.delete(t);e.length=0,this.currentRange=void 0}get currentMatchRange(){return this.currentRange}getMatchStartAtPoint(e,t,n){let{ranges:r,highlights:i}=this,a=e.ownerDocument.defaultView?.CSS.highlights;if(a==null||!Ir(a))return Pr(r,e,t,n)?.startCharacter;let o=e.getRootNode(),s=a.highlightsFromPoint(t,n,{shadowRoots:o instanceof ShadowRoot?[o]:[]});for(let{highlight:t,ranges:n}of s)if(t===i.match||t===i.current)for(let t of n){let n=r.find(n=>n.range===t&&n.row===e);if(n!=null)return n.startCharacter}}paint(t,n){for(let r of t.querySelectorAll(`[data-line][data-line-type]`)){let t=n(e.getLineNumber(r),e.getLineSide(r));t!=null&&this.paintLine(r,t)}}paintLine(e,t){let{highlights:n,ranges:r}=this,i=e.ownerDocument,a=i.createTreeWalker(e,NodeFilter.SHOW_TEXT),o=0,s=0,c,l;for(;(l=a.nextNode())!=null&&s<t.length;){let a=o+(l.textContent?.length??0);for(;s<t.length;){let u=t[s];if(u.startCharacter>=a||(c??(c=i.createRange(),c.setStart(l,u.startCharacter-o)),u.endCharacter>a))break;c.setEnd(l,u.endCharacter-o);let d=u.current?n.current:n.match;d.add(c),r.push({range:c,highlight:d,row:e,startCharacter:u.startCharacter}),u.current&&(this.currentRange??=c),c=void 0,s++}o=a}if(s<t.length){let n=e.querySelector(`[data-expand-line]`);if(n==null)return;let{current:r}=t[s];if(n.setAttribute(`data-search-match`,r?`current`:``),this.markedButtons.push(n),r){let e=i.createRange();e.selectNode(n),this.currentRange??=e}}}},zr=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
25
+ <symbol id="diffs-editor-icon-close" viewBox="0 0 16 16">
26
+ <path fill="currentColor" d="M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z"></path>
27
+ </symbol>
28
+ <symbol id="diffs-editor-icon-loader" viewBox="0 0 16 16">
29
+ <path d="M7.25 4V1a.75.75 0 0 1 1.5 0v3a.75.75 0 0 1-1.5 0"/><path d="M4.641 5.702 2.521 3.58A.75.75 0 1 1 3.58 2.52l2.121 2.121a.75.75 0 0 1-1.06 1.06" opacity=".8"/><path d="M1 7.25h3a.75.75 0 0 1 0 1.5H1a.75.75 0 0 1 0-1.5" opacity=".6"/><path d="m2.52 12.42 2.121-2.122a.75.75 0 1 1 1.061 1.06L3.581 13.48a.75.75 0 0 1-1.061-1.06" opacity=".5"/><path d="M7.25 15v-3a.75.75 0 0 1 1.5 0v3a.75.75 0 0 1-1.5 0" opacity=".4"/><path d="m12.42 13.48-2.122-2.121a.75.75 0 0 1 1.06-1.061l2.122 2.121a.75.75 0 1 1-1.06 1.061" opacity=".3"/><path d="M12 7.25h3a.75.75 0 0 1 0 1.5h-3a.75.75 0 0 1 0-1.5" opacity=".2"/><path d="M10.298 4.641 12.42 2.52a.75.75 0 1 1 1.061 1.06l-2.121 2.122a.75.75 0 1 1-1.06-1.06" opacity=".1"/>
30
+ </symbol>
31
+ <symbol id="diffs-editor-icon-arrow-up" viewBox="0 0 16 16">
32
+ <path fill="currentColor" transform="rotate(-90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
33
+ </symbol>
34
+ <symbol id="diffs-editor-icon-arrow-down" viewBox="0 0 16 16">
35
+ <path fill="currentColor" transform="rotate(90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
36
+ </symbol>
37
+ <symbol id="diffs-editor-icon-case" viewBox="0 0 16 16">
38
+ <path fill="currentColor" d="M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z"></path>
39
+ <path fill="currentColor" d="M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z"></path>
40
+ </symbol>
41
+ <symbol id="diffs-editor-icon-chevron" viewBox="0 0 16 16">
42
+ <path fill="currentColor" d="M1.46967 4.46967C1.76256 4.17678 2.23744 4.17678 2.53033 4.46967L8 9.93934L13.4697 4.46967C13.7626 4.17678 14.2374 4.17678 14.5303 4.46967C14.8232 4.76256 14.8232 5.23744 14.5303 5.53033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L1.46967 5.53033C1.17678 5.23744 1.17678 4.76256 1.46967 4.46967Z"></path>
43
+ </symbol>
44
+ <symbol id="diffs-editor-icon-whole-word" viewBox="0 0 16 16">
45
+ <path fill="currentColor" d="M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z"></path>
46
+ <path fill="currentColor" d="M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z"></path>
47
+ <path fill="currentColor" d="M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z"></path>
48
+ </symbol>
49
+ <symbol id="diffs-editor-icon-regex" viewBox="0 0 16 16">
50
+ <path fill="currentColor" d="M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z"></path>
51
+ <path fill="currentColor" d="M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z"></path>
52
+ </symbol>
53
+ <symbol id="diffs-editor-icon-replace" viewBox="0 0 16 16">
54
+ <path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M5.28033 5.71967C5.57322 6.01256 5.57322 6.48744 5.28033 6.78033L3.56066 8.5H11.75C12.7165 8.5 13.5 7.7165 13.5 6.75V2.75C13.5 2.33579 13.8358 2 14.25 2C14.6642 2 15 2.33579 15 2.75V6.75C15 8.54493 13.5449 10 11.75 10H3.56066L5.28033 11.7197C5.57322 12.0126 5.57322 12.4874 5.28033 12.7803C4.98744 13.0732 4.51256 13.0732 4.21967 12.7803L1.21967 9.78033C0.926777 9.48744 0.926777 9.01256 1.21967 8.71967L4.21967 5.71967C4.51256 5.42678 4.98744 5.42678 5.28033 5.71967Z"></path>
55
+ </symbol>
56
+ <symbol id="diffs-editor-icon-replace-all" viewBox="0 0 16 16">
57
+ <path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967L14.7803 3.21967C15.0732 3.51256 15.0732 3.98744 14.7803 4.28033L11.7803 7.28033C11.4874 7.57322 11.0126 7.57322 10.7197 7.28033C10.4268 6.98744 10.4268 6.51256 10.7197 6.21967L12.4393 4.5H4.25C3.2835 4.5 2.5 5.2835 2.5 6.25V6.875C2.5 7.28921 2.16421 7.625 1.75 7.625C1.33579 7.625 1 7.28921 1 6.875V6.25C1 4.45507 2.45508 3 4.25 3H12.4393L10.7197 1.28033C10.4268 0.987437 10.4268 0.512563 10.7197 0.21967ZM5.28033 8.71967C5.57322 9.01256 5.57322 9.48744 5.28033 9.78033L3.56066 11.5H11.75C12.7165 11.5 13.5 10.7165 13.5 9.75V9.125C13.5 8.71079 13.8358 8.375 14.25 8.375C14.6642 8.375 15 8.71079 15 9.125V9.75C15 11.5449 13.5449 13 11.75 13H3.56066L5.28033 14.7197C5.57322 15.0126 5.57322 15.4874 5.28033 15.7803C4.98744 16.0732 4.51256 16.0732 4.21967 15.7803L1.21967 12.7803C0.926777 12.4874 0.926777 12.0126 1.21967 11.7197L4.21967 8.71967C4.51256 8.42678 4.98744 8.42678 5.28033 8.71967Z"></path>
58
+ </symbol>
59
+ </svg>`,Br=(e,t=16)=>`<svg width="${t}" height="${t}" aria-hidden="true" focusable="false">
60
+ <use href="#diffs-editor-icon-${e}"></use>
61
+ </svg>`;function Vr(){let e=document.createElement(`style`);return e.setAttribute(ct,``),e}var Hr=`@layer base,theme,rendered,unsafe;@layer base{:host{--diffs-search-panel-fg:var(--diffs-fg,light-dark(var(--diffs-light,#000),var(--diffs-dark,#fff)));--diffs-search-panel-bg:var(--diffs-bg,light-dark(var(--diffs-light-bg,#fff),var(--diffs-dark-bg,#000)));--diffs-search-panel-modified:var(--diffs-modified-base,var(--diffs-modified-color-override,light-dark(var(--diffs-light-modified-color,var(--diffs-modified-color,var(--diffs-modified-light,#009fff))),var(--diffs-dark-modified-color,var(--diffs-modified-color,var(--diffs-modified-dark,#69b1ff))))));top:var(--diffs-search-panel-inset-top,16px);right:var(--diffs-search-panel-inset-right,16px);z-index:100;box-sizing:border-box;contain:layout size style;justify-content:flex-end;width:100%;height:0;display:flex;position:sticky}:host([data-search-panel-overlay]){--diffs-fg:initial;--diffs-bg:initial;--diffs-modified-base:initial;--diffs-modified-color:initial;--diffs-light-modified-color:initial;--diffs-dark-modified-color:initial;color-scheme:light dark;pointer-events:none}[data-search-panel]{flex-direction:column;justify-content:flex-end;width:100%;height:fit-content;display:flex;container:search-panel/inline-size}[data-editor-widget]{--diffs-widget-fg:var(--diffs-search-panel-fg);--diffs-widget-bg:color-mix(in lab, var(--diffs-search-panel-fg) 4%, var(--diffs-search-panel-bg));--diffs-widget-border:color-mix(in lab, var(--diffs-search-panel-fg) 20%, transparent);--diffs-widget-shadow:inset 0 0 0 1px var(--diffs-search-panel-bg), 0 4px 8px #00000013, 0 6px 18px #00000013;--diffs-search-panel-padding:4px;z-index:100;width:fit-content;padding:var(--diffs-search-panel-padding);min-width:260px;max-width:100%;margin-inline:auto var(--diffs-search-panel-inset-right,16px);border:1px solid var(--diffs-widget-border);background-color:var(--diffs-widget-bg);box-shadow:var(--diffs-widget-shadow);font-family:var(--diffs-header-font-fallback,system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);background-clip:padding-box;border-radius:9px;flex-shrink:0;align-items:stretch;gap:8px;font-size:14px;display:flex;position:relative}:host([data-search-panel-overlay]) [data-editor-widget]{pointer-events:auto}svg{fill:currentColor;width:12px;height:12px;display:block}[data-search-grid]{--diffs-search-panel-column-gap:6px;align-items:center;gap:4px var(--diffs-search-panel-column-gap);grid-template-columns:auto auto auto;grid-template-areas:"find toggles nav";width:100%;display:grid}[data-search-grid][data-can-replace]{grid-template-columns:auto auto auto auto;grid-template-areas:"toggle find toggles nav"}[data-search-grid][data-mode=replace]{grid-template-areas:"toggle find toggles nav"".replace actions."}[data-input-box][data-find]{box-sizing:border-box;color:var(--diffs-search-panel-fg);background-color:var(--diffs-search-panel-bg);border:1px solid color-mix(in lab, var(--diffs-search-panel-fg) 12%, var(--diffs-search-panel-bg));border-radius:6px;grid-area:find}[data-search-nav]{grid-area:nav}[data-input-box][data-replace]{grid-area:replace}[data-replace-actions]{grid-area:actions}[data-search-grid][data-mode=find] [data-replace-cell]{display:none}@container search-panel (width<400px){[data-editor-widget]{--diffs-search-panel-padding:10px}[data-search-grid]{grid-template-columns:auto 1fr auto;grid-template-areas:"find find find""nav toggles toggles"}[data-search-grid][data-can-replace]{grid-template-columns:auto auto 1fr auto;grid-template-areas:"toggle find find find"".nav toggles toggles"}[data-search-grid][data-mode=replace]{grid-template-areas:"toggle find find find"".replace replace replace"".nav toggles actions"}[data-replace-actions]{justify-self:end}[data-search-grid] [data-input-box]{width:auto}}[data-input-box]{align-items:center;width:200px;display:flex;position:relative}[data-input-box] input{box-sizing:border-box;width:100%;min-width:0;color:var(--diffs-search-panel-fg);background-color:var(--diffs-search-panel-bg);border:1px solid color-mix(in lab, var(--diffs-search-panel-fg) 12%, var(--diffs-search-panel-bg));border-radius:6px;outline:none;flex-grow:1;padding-block:4px;padding-inline:6px;font-size:13px;line-height:16px}[data-input-box] input:focus-visible{outline:1px solid var(--diffs-search-panel-modified);outline-offset:-1px}[data-input-box][data-find] input{background:0 0;border:0}[data-input-box] [data-search-icon]{--diffs-search-icon-size:20px}[data-input-box][data-find]:focus-within{outline:1px solid var(--diffs-search-panel-modified);outline-offset:-1px}[data-input-box][data-find] input:focus-visible{outline:none}[data-search-toggles]{grid-area:toggles;justify-content:flex-end;align-items:center;gap:1px;display:flex;position:relative}[data-search-toggles]:after{content:"";background-color:var(--diffs-widget-border);flex-shrink:0;width:1px;height:16px;margin-inline-start:4px;display:block}[data-matches]{contain:layout paint style;font-variant-numeric:tabular-nums;white-space:nowrap;color:color-mix(in lab, var(--diffs-search-panel-fg) 50%, var(--diffs-search-panel-bg));flex-shrink:0;padding-inline-end:6px;font-size:12px;font-weight:500;line-height:20px}[data-matches][data-no-matches]{color:color-mix(in lab, var(--diffs-search-panel-fg) 30%, var(--diffs-search-panel-bg))}[data-matches][data-searching]{align-items:center;display:flex}[data-matches][data-searching]>svg{--spokes:8;transform-origin:50%;width:16px;height:16px;animation:search-spinner-turn .96s steps(var(--spokes), end) infinite;display:inline-block}@keyframes search-spinner-turn{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){[data-matches][data-searching]>svg{animation:none}}[data-replace-actions],[data-search-nav]{align-items:center;display:flex}[data-search-icon]{appearance:none;width:var(--diffs-search-icon-size,24px);height:var(--diffs-search-icon-size,24px);color:color-mix(in lab, var(--diffs-search-panel-fg) 65%, var(--diffs-search-panel-bg));border-radius:var(--diffs-search-icon-radius,4px);cursor:pointer;background:0 0;border:0;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;display:flex}[data-search-icon]>svg{pointer-events:none}[data-search-icon]:disabled{opacity:.25;cursor:default}[data-search-icon]:not(:disabled,[aria-pressed=true]):hover{color:var(--diffs-search-panel-fg)}[data-search-icon]:focus-visible{outline:1px solid var(--diffs-search-panel-modified)}[data-search-icon][aria-pressed=true]{color:var(--diffs-search-panel-modified)}[data-replace-toggle][hidden]{display:none}[data-replace-toggle]{--diffs-search-icon-size:16px;height:auto;grid-area:toggle;align-self:stretch;margin-inline-end:calc(var(--diffs-search-panel-padding) - var(--diffs-search-panel-column-gap));&[aria-expanded=false] svg{transform:rotate(-90deg)}}[data-search-close]{--diffs-search-icon-size:20px;--diffs-search-icon-radius:50%;color:var(--diffs-widget-bg);background-color:color-mix(in lab, var(--diffs-widget-fg) 50%, var(--diffs-search-panel-bg));position:absolute;top:0;right:0;transform:translate(50%,-50%);box-shadow:0 1px 3px #00000040}[data-search-close]:not(:disabled):hover{opacity:1;color:var(--diffs-widget-bg);background-color:var(--diffs-widget-fg)}}@layer theme,rendered,unsafe;
62
+ `,Ur=class{#e;#t;#n;#r;#i;#a;#o;#s;#c=!1;#l;#u;#d;#f;#p;#m;#h;constructor(e){let{containerElement:t,themeCSS:n,unsafeCSS:r,defaultQuery:i,defaults:a,mode:o=`find`,search:s,scrollToMatch:c,currentMatchNeedsReveal:l,replace:u,onQueryChange:d,onUpdate:f,onStateChange:p,onBeforeNavigate:m,onClose:h}=e,g=u,_=o,v=e=>g==null?`find`:e,y={text:i,replaceText:``,caseSensitive:a?.caseSensitive===!0,wholeWord:a?.wholeWord===!0,regex:a?.regex===!0},b={all:[],currentIndex:void 0},x=()=>({...y}),S=()=>{p==null||this.#c||p({...x(),mode:v(_),canReplace:g!=null,matchCount:b.all.length,searching:C,currentMatchIndex:b.currentIndex})},C=i!==``,w=ut(`div`,{dataset:{matches:``}}),T,E=()=>{T=void 0,delete w.dataset.searching,w.removeAttribute(`aria-label`)},D=()=>{if(C){if(T===G.version)return;T??(w.dataset.searching=``,w.innerHTML=Br(`loader`,16));let e=G.t(`searching`);w.ariaLabel!==e&&(w.ariaLabel=e),T=G.version}else E(),w.textContent=G.t(`noSearchResults`);w.toggleAttribute(`data-no-matches`,!C)};D();let O=e=>{E(),w.textContent=e==null?G.t(`searchResultCount`,{count:b.all.length}):G.t(`searchResultPosition`,{index:e+1,count:b.all.length}),b.currentIndex=e},k=!1,A=e=>{k=!0;let t=y.text===``?{matches:[]}:s(x());b.all=t.matches,C=t.searching===!0,fe.disabled=C,pe.disabled=C;let n=b.all.length===0;se.disabled=n,L.disabled=n,n?(D(),b.currentIndex=void 0,f(t,e)):(delete w.dataset.noMatches,O(f(t,e))),S()};this.#l=A;let j=(e,t)=>{y[e]!==t&&d?.(),y[e]=t,A()},M=(e=!1,t=!1)=>{if(m?.(),this.#c)return;let{all:n,currentIndex:r}=b;if(n.length>0){let i;i=r==null?e?n.length-1:0:l?.()===!0?r:(r+(e?-1:1)+n.length)%n.length,O(i),c(n[i],t)}else b.currentIndex=void 0;S()};this.#f=e=>M(e,!0);let N=()=>{let e=g;if(C||e===void 0||y.text===``||b.all.length===0)return;let t=b.currentIndex??0;b.currentIndex??M(!1,!0);let n=b.all[t],r=e.replaceMatch(n,x());r!==void 0&&c(r,!0),b.currentIndex=void 0,A()},ee=()=>{let e=g;C||e===void 0||y.text===``||b.all.length===0||(e.replaceAll(b.all.slice(),x()),b.currentIndex=void 0,A())},P=()=>{h(),this.cleanup()};this.#h=P;let F=new Map,I=e=>{let t=ut(`button`,{type:`button`,dataset:{searchIcon:``,...e.dataset},innerHTML:Br(e.icon,e.size??16),onclick:e.onClick});return F.set(t,e.label),t},te=(e,t,n)=>{let r=I({icon:e,label:t,size:14,onClick:()=>{let e=!y[n];r.ariaPressed=String(e),j(n,e)}});return r.ariaPressed=String(y[n]),r},ne=te(`case`,`matchCase`,`caseSensitive`),re=te(`whole-word`,`wholeWord`,`wholeWord`),ie=te(`regex`,`regularExpression`,`regex`);this.#n=ut(`input`,{type:`text`,dataset:`search`,value:i,oninput:e=>{b.currentIndex=void 0,j(`text`,e.target.value)},onkeydown:e=>{if(e.isComposing||e.keyCode===229)return;let t=Mn(e);e.key===`Escape`?(e.preventDefault(),P()):e.key===`Enter`?(e.preventDefault(),M(e.shiftKey,!0)):t===`next`||t===`previous`?(e.preventDefault(),M(t===`previous`,!0)):t!=null&&(e.preventDefault(),ve(t))}}),this.#p=e=>{this.#n.value!==e&&(this.#n.value=e,b.currentIndex=void 0,j(`text`,e))};let ae=ut(`div`,{dataset:`searchToggles`,children:[ne,re,ie]}),oe=ut(`div`,{dataset:{inputBox:``,find:``},children:[this.#n,w]}),se=I({icon:`arrow-up`,label:`previousMatch`,onClick:()=>{M(!0)}}),L=I({icon:`arrow-down`,label:`nextMatch`,onClick:()=>{M()}});se.disabled=!0,L.disabled=!0;let ce=ut(`div`,{dataset:`searchNav`,children:[se,L]}),le=I({icon:`close`,label:`closeSearch`,onClick:P,dataset:{searchClose:``}}),ue=ut(`input`,{type:`text`,dataset:`replace`,value:``,oninput:e=>{y.replaceText=e.target.value,S()},onkeydown:e=>{if(e.isComposing||e.keyCode===229)return;let t=Nn(e);e.key===`Escape`?(e.preventDefault(),P()):e.key===`Enter`?(e.preventDefault(),N()):t!==void 0&&(e.preventDefault(),M(t===`previous`,!0))}}),R=ut(`div`,{dataset:{inputBox:``,replace:``,replaceCell:``},children:[ue]}),fe=I({icon:`replace`,label:`replaceMatch`,onClick:N}),pe=I({icon:`replace-all`,label:`replaceAllMatches`,onClick:ee}),me=ut(`div`,{dataset:{replaceActions:``,replaceCell:``},children:[fe,pe]}),he=I({icon:`chevron`,label:`toggleReplace`,dataset:{replaceToggle:``},onClick:()=>{ge.dataset.mode===`replace`?ve(`find`):(ve(`replace`),ue.focus())}}),ge=ut(`div`,{dataset:{searchGrid:``,mode:v(o)},children:[he,oe,R,me,ae,ce,le]}),_e=()=>{let e=g!=null,t=v(_);ge.dataset.mode=t,ge.toggleAttribute(`data-can-replace`,e),he.hidden=!e,he.ariaExpanded=String(t===`replace`)};_e(),this.#m=()=>g!=null,this.#d=e=>{g=e,_e(),S()};let ve=e=>{_=e,_e(),this.#n.focus(),this.#n.select(),S()};this.#u=ve,this.#e=ut(`div`,{dataset:`searchPanel`});let ye=this.#e.attachShadow({mode:`open`}),be=document.createElement(`div`);be.innerHTML=zr;let xe=be.firstElementChild;xe instanceof SVGElement&&ye.appendChild(xe),ut(`style`,{textContent:Hr},ye),this.#r=ut(`style`,{textContent:n??``},ye),this.#r.setAttribute(de,``),this.setUnsafeCSS(r),this.#t=ut(`div`,{dataset:`editorWidget`,children:[ge]}),ut(`div`,{dataset:`searchPanel`,children:[this.#t]},ye),this.#a=()=>{k||this.#c||A()};let Se=()=>{this.#n.placeholder=G.t(`searchPlaceholder`),ue.placeholder=G.t(`replacePlaceholder`);for(let[e,t]of F)e.title=G.t(t),e.ariaLabel=e.title;b.all.length>0?O(b.currentIndex):D()};this.#o=()=>{this.#c||(Se(),this.#s??=G.subscribe({onMessagesChange:Se}),t.before(this.#e),this.#n.select(),S(),yn(this.#a))}}mount(){this.#o?.()}getHostElement(){return this.#e}getBounds(){return this.#t.getBoundingClientRect()}setThemeCSS(e){let t=e??``;this.#r.textContent!==t&&(this.#r.textContent=t)}setUnsafeCSS(e){e?(this.#i??(this.#i=Vr(),this.#r.after(this.#i)),this.#i.textContent=Kn(e)):(this.#i?.remove(),this.#i=void 0)}hasQuery(){return this.#n.value!==``}hasReplaceHandlers(){return this.#m?.()===!0}focus(){this.#n.focus()}navigate(e){this.#a(),this.#c||this.#f?.(e)}setQuery(e){this.#p?.(e)}updateMatches(e){this.#l?.(e)}setMode(e){this.#u?.(e)}setReplaceHandlers(e){this.#d?.(e)}close(){this.#h?.()}cleanup(){this.#c=!0,this.#s?.(),bn(this.#a),this.#e.remove()}},Wr=class{view;state={originalViewport:void 0,matchViewport:void 0,scope:void 0,matches:[],scan:void 0,pendingNavigation:void 0,current:void 0,centerNavigation:!1,pendingHorizontalReveal:!1,currentPosition:void 0};panel;renderedThemeCSS;themeDirty=!0;matchesDirty=!1;highlighter;constructor(e){this.view=e}open(e){let{view:t}=this,{container:n}=t,r=t.getContainerElement();if(r==null||n==null)return;let{mode:i=`replace`,scope:a=`focused`,query:o}=e??{};this.setScope(this.resolveScope(a));let{panel:s}=this;s==null?(this.highlighter??=Rr.create(n.ownerDocument),s=new Ur({containerElement:t.getHeaderElement()??n,themeCSS:this.renderedThemeCSS,unsafeCSS:t.options.unsafeCSS,defaultQuery:o??this.getQueryFromScope(),defaults:t.options.searchOptions?.defaults,mode:i,replace:this.getReplaceHandlers(),onStateChange:e=>{if(this.matchesDirty)return;let{onSearchStateChange:n}=t.options;n?.(e)},onQueryChange:()=>{this.panel?.hasQuery()===!1&&this.restoreViewport(),this.invalidateScan(),this.setResults(this.state.matches,void 0),this.state.pendingNavigation=void 0,this.state.centerNavigation=!1},search:e=>this.search(e),scrollToMatch:e=>{this.forgetViewport(),this.state.pendingNavigation=void 0,this.scrollToMatch(e)},currentMatchNeedsReveal:()=>{let{current:e,pendingNavigation:t}=this.state;return t===`reveal`&&e!=null&&!this.isMatchInView(e)},onUpdate:this.updateResults,onBeforeNavigate:this.settleCutOffMatch,onClose:()=>{this.close()}}),this.panel=s,s.hasQuery()&&(this.state.pendingNavigation=`jump`),s.mount(),this.panel===s&&(r.addEventListener(`click`,this.handleMatchClick),r.ownerDocument.addEventListener(`focusin`,this.handleFocusIn),s.getHostElement().addEventListener(`focusout`,this.handlePanelBlur),s.getHostElement().dataset.searchPanelOverlay=``,s.focus())):(o!=null&&s.setQuery(o),s.setMode(i),s.focus())}close(){this.restoreViewport(),this.closeInPlace()}closeInPlace(){let{panel:e}=this,t=this.isPanelFocused(),{scope:n}=this.state;if(this.removeListeners(),this.panel=void 0,this.resetState(),e==null)return;e.cleanup(),t&&this.view.restoreFocus(n?.itemId);let{onSearchStateChange:r}=this.view.options;r?.(void 0)}isOpen(){return this.panel!=null}navigate(e){this.flushMatches(),this.panel?.navigate(e===`previous`)}handleKeyDown=e=>{if(e.defaultPrevented||e.isComposing||e.keyCode===229)return;if(e.key===`Escape`&&this.panel!==void 0){e.preventDefault(),e.stopPropagation(),this.close();return}let t=Mn(e);if(t===`next`||t===`previous`){if(this.panel==null)return;e.preventDefault(),e.stopPropagation(),this.navigate(t)}else t!=null&&this.view.options.searchOptions?.disableShortcuts!==!0&&(e.preventDefault(),e.stopPropagation(),this.open())};ownsEvent(e){let t=this.panel?.getHostElement();return t!=null&&e.composedPath().includes(t)}userScrolled(){this.state.pendingHorizontalReveal=!1,this.keepView()}addItems(e){let{scan:t,scope:n}=this.state;n??t?.addItems(e),this.markMatchesDirty()}removeItem(e){let{scan:t}=this.state,n=this.getItemPosition(e);n!=null&&t?.removeItem(n)}renameItem(e,t){let{state:n}=this;n.scope?.itemId===e&&(n.scope={itemId:t}),n.originalViewport=Gr(n.originalViewport,e,t),n.matchViewport=Gr(n.matchViewport,e,t),this.invalidateScan(),this.markMatchesDirty()}optionsChanged(e,t){e.unsafeCSS!==t.unsafeCSS&&this.panel?.setUnsafeCSS(t.unsafeCSS),Jr(e,t)&&(this.invalidateScan(),this.markMatchesDirty())}invalidateTheme(){this.themeDirty=!0}clearTheme(){this.renderedThemeCSS=void 0,this.themeDirty=!0}flushPendingTheme(){if(!this.themeDirty)return;let e=this.view.getTheme(),t=R({theme:e});if(t==null)return;let n=typeof e==`string`?t.getTheme(e).type:void 0;this.renderedThemeCSS=qn(M({theme:e,highlighter:t}),n??this.view.options.themeType??`system`),this.themeDirty=!1,this.panel?.setThemeCSS(this.renderedThemeCSS)}editorRendered(e){this.queueHighlightPaint(),this.state.scope?.itemId===e&&this.panel?.hasReplaceHandlers()===!1&&this.markMatchesDirty()}isPanelFocused(){return this.panel?.getHostElement().shadowRoot?.activeElement!=null}setScope(e){this.state.scope?.itemId!==e?.itemId&&(this.invalidateScan(),this.state.scope=e,this.state.pendingNavigation=void 0,this.state.centerNavigation=!1,this.markMatchesDirty())}handleFocusIn=e=>{this.view.shouldFixContainerFocus&&e.composedPath()[0]===this.view.getContainerElement()||this.syncFocus()};handlePanelBlur=()=>{yn(this.syncFocus)};syncFocus=()=>{this.panel==null||this.isPanelFocused()||this.setScope(this.view.focusedEditor==null?void 0:{itemId:this.view.focusedEditor.id})};handleMatchClick=e=>{let{highlighter:t,state:n,view:r}=this,{current:i,matches:a,scan:o}=n;if(o==null||t==null||this.ownsEvent(e))return;let s=Kr(e);if(s==null)return;let c=s.getRootNode();if(!(c instanceof ShadowRoot)||$n(c)?.collapsed===!1)return;let l=r.getRenderedItems().find(({element:e})=>e===c.host),u=l==null?void 0:this.getItemPosition(l.id);if(u==null)return;let d=t.getMatchStartAtPoint(s,e.clientX,e.clientY);if(d==null)return;let f=Rr.getLineNumber(s),p=o.getFirstMatchAtOrAfter(u,f,d,Rr.getLineSide(s));p?.lineNumber!==f||p.startCharacter!==d||jr(p,i)||(bn(this.revealCurrentMatch),this.forgetViewport(),n.pendingNavigation=void 0,n.pendingHorizontalReveal=!1,this.setResults(a,p),this.matchesDirty=!0,this.flushMatches())};removeListeners(){let{view:e,panel:t}=this,n=e.getContainerElement();bn(this.syncFocus),n?.removeEventListener(`click`,this.handleMatchClick),n?.ownerDocument.removeEventListener(`focusin`,this.handleFocusIn),t?.getHostElement().removeEventListener(`focusout`,this.handlePanelBlur)}resolveScope(e){if(e===`all`)return;if(e===`focused`)return this.isPanelFocused()?this.state.scope:this.view.focusedEditor==null?void 0:{itemId:this.view.focusedEditor.id};let t=this.view.idToItem.get(e.itemId);return t!=null&&this.view.isItemInEditMode(t)?{itemId:e.itemId}:void 0}getQueryFromScope(){let{scope:e}=this.state;if(e==null)return this.getSelectedLineText();let t=this.view.getEditor(e.itemId),n=t?.getEditState()?.document;return t==null||n==null?``:mn(n,t.getViewState().selections?.at(-1))}getSelectedLineText(){let{firstIndex:e,lastIndex:t}=this.view.renderState;for(let n=e;n>=0&&n<=t;n++){let e=this.view.items[n]?.element?.shadowRoot;if(e==null)continue;let t=$n(e);if(t==null||t.collapsed)continue;let r=qr(t.startContainer);if(r==null||!e.contains(r)||r!==qr(t.endContainer))continue;let i=document.createRange();i.setStart(t.startContainer,t.startOffset),i.setEnd(t.endContainer,t.endOffset);let a=i.toString();return a.includes(`
63
+ `)?``:a}return``}resetState(){bn(this.flushMatches),bn(this.paintHighlights),bn(this.revealCurrentMatch),this.highlighter?.clear(),this.forgetViewport(),this.state.scope=void 0,this.state.matches=[],this.invalidateScan(),this.state.pendingNavigation=void 0,this.state.current=void 0,this.state.centerNavigation=!1,this.matchesDirty=!1,this.state.pendingHorizontalReveal=!1,this.state.currentPosition=void 0}rememberViewport(){let{state:e}=this;e.originalViewport!=null&&this.isAtMatchViewport()||(e.originalViewport=this.getViewport(),e.matchViewport=void 0)}getViewport(){let{view:e}=this,t=e.getScrollTop();return t>0?e.getScrollAnchor(t):`top`}forgetViewport(){let{state:e}=this;e.originalViewport=void 0,e.matchViewport=void 0}recordMatchViewport(){let{state:e}=this;e.originalViewport!=null&&(e.matchViewport=this.getViewport())}isAtViewport(e){let{view:t}=this;return e===`top`?t.getScrollTop()<=0:e!=null&&t.isAtScrollAnchor(e)}isAtMatchViewport(){let{state:e,view:t}=this,{pendingScrollTarget:n}=t;return n?.type===`line`&&n.searchMatch===!0||this.isAtViewport(e.matchViewport)}restoreViewport(){let{state:e,view:t}=this,{originalViewport:n}=e,r=this.isAtMatchViewport();if(this.forgetViewport(),n==null||!r)return;let i=t.options.searchOptions?.scrollBehavior??`instant`;n===`top`?t.requestScroll({type:`position`,position:0,behavior:i}):t.scrollToAnchor(n,i)}isMatchInView(e){let t=this.view.idToItem.get(e.itemId);if(t==null)return!1;let n=t.item.collapsed===!0?{top:t.top,height:t.height}:this.view.getScrollTargetRect({type:`line`,id:e.itemId,lineNumber:e.lineNumber,side:e.side,align:`nearest`});if(n==null)return!1;let r=this.view.getItemTopOffset()+n.top,i=r+n.height,a=this.view.getScrollTop(),o=a+this.view.getStickyHeaderOffset(),s=a+this.view.getHeight();return r>=o&&i<=s||r<=o&&i>=s}scrollToMatch(e){this.state.pendingHorizontalReveal=!0,this.state.current=e,this.view.render();let t=this.view.idToItem.get(e.itemId);if(t!=null&&this.isMatchHidden(t,e))this.revealMatch(t,e);else{this.paintRanges();let t=this.measureCurrentMatch();if((t==null?this.isMatchInView(e):this.isMatchRectVisible(t))&&!this.state.centerNavigation){this.view.clearPendingScroll(),this.recordMatchViewport();return}}this.state.centerNavigation=!0;let n={type:`line`,id:e.itemId,lineNumber:e.lineNumber,side:e.side,align:`center`,offset:-this.getTopInset()/2,behavior:this.view.options.searchOptions?.scrollBehavior??`instant`,searchMatch:!0};this.view.requestScroll(n,()=>this.recordMatchViewport())}keepView(){let{state:e,view:t}=this,{pendingScrollTarget:n}=t;e.pendingNavigation===`jump`?e.pendingNavigation=`select`:n?.type===`line`&&n.searchMatch===!0&&(e.pendingNavigation=`reveal`)}isMatchHidden(e,t){return e.item.collapsed===!0||e.type===`diff`&&e.instance.isLineInCollapsedContext(t.lineNumber,t.side)}revealMatch(e,t){let{item:n}=e;if(n.collapsed===!0){let e={...n,collapsed:!1,version:(n.version??0)+1};this.view.updateItem(e);let{onItemCollapsedChange:t}=this.view.options;t?.(n,e)}e.type===`diff`&&e.instance.isLineInCollapsedContext(t.lineNumber,t.side)&&e.instance.revealLine(t.lineNumber,t.side)}getTopInset(){let{panel:e,view:t}=this,n=t.getContainerElement(),r=t.getStickyHeaderOffset();if(n==null||e==null)return r;let i=e.getBounds().bottom-n.getBoundingClientRect().top-n.clientTop;return Math.max(r,i)}measureCurrentMatch(){this.state.currentPosition=void 0;let{panel:e,view:t}=this,n=t.getContainerElement(),{current:r}=this.state,i=r==null?void 0:t.idToItem.get(r.itemId),a=e?.getBounds();if(n==null||i==null||a==null||a.width===0||a.height===0)return;let o=this.highlighter?.currentMatchRange?.getBoundingClientRect();if(o==null)return;let s=n.getBoundingClientRect().top+n.clientTop;return this.state.currentPosition={top:o.top-s+n.scrollTop+t.scrollPageOffset-t.getItemTopOffset()-i.top,height:o.height},o}isMatchRectVisible(e){let{panel:t,view:n}=this,r=n.getContainerElement();if(r==null||t==null)return!1;let i=r.getBoundingClientRect().top+r.clientTop;if(e.top<i+n.getStickyHeaderOffset()||e.bottom>i+r.clientHeight)return!1;let a=t.getBounds();return!(e.top<a.bottom&&e.bottom>a.top&&e.left<a.right&&e.right>a.left)}getReplaceHandlers(){let e=this.state.scope,t=e==null?void 0:this.view.getEditor(e.itemId),n=t?.getEditState()?.document;if(t==null||n==null)return;let r=e=>[n.offsetAt({line:e.lineIndex,character:e.startCharacter}),n.offsetAt({line:e.lineIndex,character:e.endCharacter})];return{replaceMatch:(e,i)=>{this.forgetViewport();let a=t.replaceSearchMatches([r(e)],i);if(a==null)return;let o=n.positionAt(a[1]);return{...e,lineIndex:o.line,lineNumber:o.line+1,startCharacter:o.character,endCharacter:o.character}},replaceAll:(e,n)=>{this.forgetViewport(),t.replaceSearchMatches(e.map(r),n)}}}markMatchesDirty(){let{advanceScan:e,state:t,panel:n,view:r}=this,{idToItem:i,focusedEditor:a}=r,{scope:o}=t;zn(e);let s=o==null?void 0:i.get(o.itemId);if(a!=null){let e=i.get(a.id);e!=null&&r.isItemInEditMode(e)||(r.focusedEditor=void 0)}o!=null&&(s?.item.edit!==!0||s.item.collapsed===!0)&&(this.invalidateScan(),t.scope=void 0,t.pendingNavigation=void 0,t.centerNavigation=!1);let c=n?.hasQuery()===!0;c&&(this.matchesDirty=!0),n?.setReplaceHandlers(this.getReplaceHandlers()),c&&r.render()}settleCutOffMatch=()=>{let{scan:e,current:t}=this.state;if(e==null||t?.cutOff!==!0)return;let n=this.getItemPosition(t.itemId);if(n!=null){for(;e.isItemPending(n)&&!e.finished;)e.advance(1,n)&&(this.matchesDirty=!0);this.flushMatches()}};flushMatches=()=>{bn(this.flushMatches),this.matchesDirty&&(this.matchesDirty=!1,this.panel!==void 0&&this.panel.updateMatches({skipNavigation:!0}))};setResults(e,t){let n=!jr(this.state.current,t);this.state.matches=e,this.state.current=t,t??(this.state.pendingHorizontalReveal=!1),n&&(this.state.currentPosition=void 0),n?this.view.render():e.length===0&&this.highlighter?.clear()}updateResults=(e,t)=>{let{matches:n,searching:r}=e,{state:i}=this,{current:a,scan:o,scope:s,pendingNavigation:c}=i,l=t?.skipNavigation===!0||c===`select`?c:`jump`,u=l===`jump`||l===`select`,d=a!=null&&a.itemId===s?.itemId&&a.startCharacter===a.endCharacter?a:void 0,f;if(u&&o!=null){if(d!=null){let e=this.getItemPosition(d.itemId);e!=null&&!o.isItemPending(e)&&(f=o.getFirstMatchAtOrAfter(e,d.lineNumber,d.endCharacter))}else f=this.getStartingMatch(o)}u&&(i.pendingNavigation=f==null?r===!0?l:void 0:l===`select`?`reveal`:void 0);let p=f??a,m=p==null?void 0:this.getItemPosition(p.itemId),h=p!=null&&m!=null?o?.getMatchIndex(m,p):void 0,g=h==null?void 0:n[h],_=f==null&&m!=null&&o?.isItemPending(m)===!0;return this.setResults(n,_?a:g),f!=null&&l===`jump`?(d??this.rememberViewport(),this.scrollToMatch(f)):a?.cutOff===!0&&g!=null&&g.cutOff!==!0&&yn(this.revealCurrentMatch),h};revealCurrentMatch=()=>{let{current:e}=this.state;e!=null&&(this.rememberViewport(),this.scrollToMatch(e))};queueHighlightPaint=()=>{this.panel!=null&&yn(this.paintHighlights)};paintHighlights=()=>{if(bn(this.paintHighlights),this.paintRanges(),this.state.pendingHorizontalReveal){let e=this.highlighter?.currentMatchRange;this.state.pendingHorizontalReveal=e==null||!Nr(e)}};paintRanges(){let{highlighter:e}=this;if(e==null||(e.clear(),this.state.matches.length===0))return;let{firstIndex:t,lastIndex:n}=this.view.renderState,{scan:r}=this.state;for(let i=t;i>=0&&i<=n;i++){let t=this.view.items[i],n=t.element?.shadowRoot,a=this.getItemPosition(t.item.id),o=a==null?void 0:r?.getItemMatches(a);n!=null&&r!=null&&a!=null&&o!=null&&e.paint(n,(e,t)=>{let n=r.getLineMatches(a,e,t);if(n==null)return;let i=[],{current:s}=this.state;for(let e=n.startIndex;e<n.endIndex;e++){let t=o[e];i.push({startCharacter:t.startCharacter,endCharacter:t.endCharacter,current:s!=null&&Ar(t,s)})}return i})}}getItemPosition(e){let{state:t,view:n}=this,{idToItem:r}=n,{scope:i}=t,a=r.get(e);return a!=null&&(i==null||i.itemId===e)?i==null?a.index:0:void 0}getSearchItem=e=>{let{state:t,view:n}=this,{items:r,idToItem:i,options:a}=n,{scope:o}=t,s=o==null?r[e]:i.get(o.itemId);if(s==null)throw Error(`CodeViewSearchManager.getSearchItem: position ${e} does not exist`);let{id:c}=s.item,l=(n.getEditor(c)?.getEditState()?.document)?.getText(),u=s.instance.getLineCutsForSearch();return s.type===`file`?{itemId:c,type:`file`,lineCuts:u,contents:l??s.item.file.contents}:{itemId:c,type:`diff`,lineCuts:u,fileDiff:this.getSearchDiff(s),additionContents:l,diffStyle:a.diffStyle??`split`,additionsOnly:o?.itemId===c}};getSearchDiff(e){let{view:t}=this,{id:n,fileDiff:r}=e.item;return t.getEditor(n)?.getEditState()?.document==null?r:e.instance.getDiffForSearch()??r}invalidateScan(){zn(this.advanceScan);let{state:e}=this;e.scan=void 0}rescanItem(e){let{scan:t}=this.state,n=this.getItemPosition(e);n!=null&&t?.rescanItem(n),this.markMatchesDirty()}hasPendingRenderedItems(e){let{state:t,view:n}=this,{renderState:r}=n,{firstIndex:i,lastIndex:a}=r;return t.scope==null?e.hasPendingItems(i,a+1):e.isItemPending(0)}runSlice(e){let{state:t,view:n}=this,{renderState:r}=n,{firstIndex:i}=r;return t.scope==null?e.advance(1,i):e.advance(1)}advanceScan=()=>{let{scan:e}=this.state;if(e==null)throw Error(`CodeViewSearchManager.advanceScan: queued scan is missing`);let t=this.hasPendingRenderedItems(e),n=this.runSlice(e);e.finished||Rn(this.advanceScan),n&&(this.matchesDirty=!0,t?this.view.render():yn(this.flushMatches))};search(e){let{state:t,view:n,getSearchItem:r}=this,{items:i,idToItem:a,renderState:o}=n,{scope:s}=t,c=s==null?i.length:+!!a.has(s.itemId),{scan:l}=t;if(l==null){let{firstIndex:i}=o;l=new Or(e,c,r,Mr,s==null?Math.max(0,i):0),t.scan=l,this.runSlice(l),n.render()}else this.hasPendingRenderedItems(l)&&this.runSlice(l);return l.finished||Rn(this.advanceScan),{matches:l.getMatches(),searching:!l.finished}}getStartingMatch(e){let{state:t,view:n}=this,{idToItem:r}=n,{scope:i}=t,a=n.getScrollAnchor(n.getScrollTop()),o=a==null?void 0:r.get(a.id),s=i==null?void 0:r.get(i.itemId),c=s==null?o?.index??0:+(o!=null&&o.index>s.index),l=e.getFirstMatchedEntryAtOrAfter(c);if(l==null)return e.finished?e.getFirstMatchedEntryAtOrAfter(0)?.matches[0]:void 0;if(!e.hasPendingItems(c,l.position+1)){if(a?.type===`line`&&o!=null&&l.matches[0].itemId===a.id){let t=this.findMatchAtAnchor(o,l.matches,a);if(t!=null)return t;let n=e.getFirstMatchedEntryAtOrAfter(l.position+1);return n==null?e.finished?e.getFirstMatchedEntryAtOrAfter(0)?.matches[0]:void 0:e.hasPendingItems(l.position+1,n.position+1)?void 0:n.matches[0]}return l.matches[0]}}findMatchAtAnchor(e,t,n){let{options:r}=this.view,i=e.type===`diff`?this.getSearchDiff(e):void 0,a=r.diffStyle===`unified`?0:1,o=n.lineNumber;if(i!=null){let e=er(i,n.lineNumber,n.side??`additions`);if(e==null)throw Error(`CodeViewSearchManager.findMatchAtAnchor: anchor row is missing`);o=e[a]}let s=0,c=t.length;for(;s<c;){let e=Math.floor((s+c)/2),n=t[e],r=n.lineNumber;if(i!=null){let e=er(i,n.lineNumber,n.side??`additions`);if(e==null)throw Error(`CodeViewSearchManager.findMatchAtAnchor: matched row is missing`);r=e[a]}r<o?s=e+1:c=e}return t[s]}};function Gr(e,t,n){return e!=null&&e!==`top`&&e.id===t?{...e,id:n}:e}function Kr(e){for(let t of e.composedPath()){if(t instanceof HTMLButtonElement)return;if(t instanceof HTMLElement&&t.matches(`[data-line][data-line-type]`))return t}}function qr(e){return(e instanceof Element?e:e.parentElement)?.closest(`[data-line]`)??void 0}function Jr(e,t){return e.tokenizeMaxLineLength!==t.tokenizeMaxLineLength||(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Yr(e,t){return e==null||t==null?e===t:e.header!==t.header||e.footer!==t.footer?!1:Xr(e.items,t.items)}function Xr(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.instance!==i.instance||r.version!==i.version)return!1}return!0}function Zr(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Qr(e,t,n){let r=document.createElement(`div`);return r.style.display=`flow-root`,e===`header`?(r.setAttribute(Me,``),t.before(r)):(r.setAttribute(Pe,``),t.after(r)),n?.observe(r),r}function $r({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:r=!1,fitPerfectlyOverscroll:i=0,overscrollSize:a}){let o=n+a*2,s=r?n+i*2:o;if(t=Math.max(t,s),o>=t||r){let n=Math.max(e-i,0),r=Math.min(e+s,t);return{top:n,bottom:Math.max(r,n)}}let c=e+n/2-o/2,l=c+o;return c<0&&(c=0),l>t&&(l=t),c=Math.floor(Math.max(c,0)),{top:c,bottom:Math.ceil(Math.max(Math.min(l,t),c))}}function ei(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}var ti=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `]);function ni(e){return e.defaultPrevented?!1:e.type!==`keydown`||`key`in e&&typeof e.key==`string`&&ti.has(e.key)}function ri(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function ii(e,t){return e?.getPreferredHighlighter()??t.preferredHighlighter}function ai(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}function oi(e){let t=/\r\n|\r|\n/.exec(e)?.[0];return t===`\r
64
+ `||t===`\r`?t:`
65
+ `}function si(e){if(!e.includes(`\r`))return e;let t=oi(e);return e.replace(/\r\n|\r|\n/g,t)}function ci(e){return e.lineDelta!==0||e.changes.some(e=>e.range.start.line!==e.range.end.line||e.text.includes(`
66
+ `))}function li(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function ui(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(let[n,r]of e)if(t.get(n)!==r)return!1;return!0}function di(e){return e?.some(e=>e.lineNumber===0)??!1}function fi(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function pi(e){return e.startingLine===0&&e.totalLines>0}var mi=class{#e=new Map;#t=new Map;get(e){return this.#e.get(e)}set(e,t){let n=this.#e.get(e);n!==t&&(n!=null&&(n.removeEventListener(`scroll`,this.#n),this.#t.delete(n),this.#e.delete(e)),t!=null&&(t.addEventListener(`scroll`,this.#n,{passive:!0}),this.#t.set(t,t.isConnected?t.scrollLeft:0),this.#e.set(e,t)))}cleanUp(){for(let e of[...this.#e.keys()])this.set(e,void 0)}get scrollLeft(){let e=0;for(let t of this.#t.values())e=Math.max(e,t);return e}setScrollLeft(e){for(let t of this.#t.keys())t.scrollLeft=e,this.#t.set(t,t.scrollLeft)}#n=e=>{let{currentTarget:t}=e;t instanceof HTMLElement&&this.#t.set(t,t.scrollLeft)}},hi=class{#e;#t;#n=new Map;#r=new WeakMap;#i;#a=!1;constructor(e,t){this.#e=e,this.#t=t}replaceAll(e){this.#e.innerHTML=ft(e.map(e=>e.gutter)),this.#t.innerHTML=ft(e.map(e=>e.content)),this.#n.clear(),this.#i={specs:e,trusted:!0},this.#a=!0}adopt(e){return this.#t.childElementCount!==e.length||this.#e.childElementCount!==e.length?!1:(this.#n.clear(),this.#i={specs:e,trusted:!1},this.#a=!0,!0)}elementFor(e){return this.#l(),this.#n.get(e)}removeStale(e){if(!this.#a)return;this.#l();let t=new Set;for(let n of e)t.add(n.key);for(let[e,n]of this.#n)t.has(e)||(n.gutter.remove(),n.content.remove(),this.#n.delete(e))}reconcile(e,t){return this.#a?(this.#l(),t==null?this.#s(e):this.#o(t)):(this.replaceAll(e),{changed:new Set(e.map(e=>e.key)),attributesReset:!0,gutterRewritten:!0})}#o(e){let t={changed:new Set,attributesReset:!1,gutterRewritten:!1};for(let n of e){let e=this.#n.get(n.key);e!=null&&this.#c(e,n,t)}return t}#s(e){let t=this.#e,n=this.#t,r=this.#n,i={changed:new Set,attributesReset:!1,gutterRewritten:!1},{changed:a}=i,o=new Set;for(let t of e){if(o.has(t.key))throw Error(`ColumnReconciler: duplicate row key "${t.key}"`);o.add(t.key)}let s=n.firstElementChild,c=t.firstElementChild,l=()=>{s=s?.nextElementSibling??null,c=c?.nextElementSibling??null},u=()=>{let e=this.#u(s),t=s?.nextElementSibling??null,n=c?.nextElementSibling??null;s?.remove(),c?.remove(),r.delete(e),s=t,c=n},d=[],f=()=>{if(d.length===0)return;let e=gi(t,c,d.map(e=>e.gutter)),o=gi(n,s,d.map(e=>e.content));for(let t=0;t<d.length;t++){let n=d[t],i={gutter:e[t],content:o[t],spec:n};r.set(n.key,i),this.#r.set(i.content,n.key),a.add(n.key)}i.attributesReset=!0,d=[]};for(let a of e){for(;s!=null&&!o.has(this.#u(s));)u();let e=r.get(a.key);e==null?d.push(a):(f(),e.content===s?l():(t.insertBefore(e.gutter,c),n.insertBefore(e.content,s)),this.#c(e,a,i))}for(f();s!=null;)u();return i}#c(e,t,n){let r=e.spec;if(r?.content!==t.content){let i=_i(e.content,r?.content,t.content);i.element!==e.content&&(e.content=i.element,this.#r.set(i.element,t.key)),n.attributesReset||=i.reset,n.changed.add(t.key)}if(r?.gutter!==t.gutter){let i=_i(e.gutter,r?.gutter,t.gutter);e.gutter=i.element,n.attributesReset||=i.reset,n.gutterRewritten=!0,n.changed.add(t.key)}e.spec=t}#l(){let e=this.#i;if(e==null)return;this.#i=void 0;let{specs:t,trusted:n}=e,r=this.#e.firstElementChild,i=this.#t.firstElementChild;for(let e of t){if(!(r instanceof HTMLElement)||!(i instanceof HTMLElement))throw Error(`ColumnReconciler: the columns have fewer rows than their specs`);this.#n.set(e.key,{gutter:r,content:i,spec:n?e:void 0}),this.#r.set(i,e.key),r=r.nextElementSibling,i=i.nextElementSibling}if(r!=null||i!=null)throw Error(`ColumnReconciler: the columns have more rows than their specs`)}#u(e){let t=e==null?void 0:this.#r.get(e);if(t==null)throw Error(`ColumnReconciler: a row on screen has no key`);return t}};function gi(e,t,n){let r=t==null?e.lastElementChild:t.previousElementSibling,i=ft([...n]);t==null?e.insertAdjacentHTML(`beforeend`,i):t.insertAdjacentHTML(`beforebegin`,i);let a=Array(n.length),o=t==null?e.lastElementChild:t.previousElementSibling;for(let e=n.length-1;e>=0;e--){if(!(o instanceof HTMLElement))throw Error(`ColumnReconciler: a row cell did not parse to an element`);a[e]=o,o=o.previousElementSibling}if(o!==r)throw Error(`ColumnReconciler: a row cell did not parse to one element`);return a}function _i(e,t,n){if(e.tagName.toLowerCase()!==n.tagName.toLowerCase()){e.insertAdjacentHTML(`beforebegin`,ft(n));let t=e.previousElementSibling;if(e.remove(),!(t instanceof HTMLElement))throw Error(`ColumnReconciler: a row cell did not parse to an element`);return{element:t,reset:!0}}let r=!1;return t!=null&&vi(e,t,n)||(yi(e,n),r=!0),(t==null||t.children!==n.children)&&(e.innerHTML=ft(n.children)),{element:e,reset:r}}function vi(e,t,n){let r=new Set;for(let t in n.properties){let i=mt(t,n.properties[t]);if(i===void 0)return!1;i!==null&&(r.add(i.name),e.getAttribute(i.name)!==i.value&&e.setAttribute(i.name,i.value))}for(let n in t.properties){let i=mt(n,t.properties[n]);if(i===void 0)return!1;i!=null&&!r.has(i.name)&&e.removeAttribute(i.name)}return!0}function yi(e,t){let n=document.createElement(`template`);n.innerHTML=ft({...t,children:[]});let r=n.content.firstElementChild;if(r==null)throw Error(`ColumnReconciler: a row cell did not parse to an element`);for(let t of e.getAttributeNames())r.hasAttribute(t)||e.removeAttribute(t);for(let t of r.getAttributeNames()){let n=r.getAttribute(t)??``;e.getAttribute(t)!==n&&e.setAttribute(t,n)}}function bi(e){return!e.includes(`:`)}function xi(e){return{gutter:e.map(e=>e.gutter),content:e.map(e=>e.content)}}function Si(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function Ci(){return j({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[F({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function wi(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var Ti=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;markedSelectedElements;markedEditorActiveElements;selectionAnchor;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){an(this.options,e)||(this.options=e,this.pre!=null&&this.setup(this.pre))}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),bn(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.markedSelectedElements=void 0,this.markedEditorActiveElements=void 0,this.setSelectionDirty()}setup(e){let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let n=!(e===this.selectedRange||Zr(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;(this.isSelectionDirty()||n||i)&&(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;(this.isSelectionDirty()||r||i)&&(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onLineExpand:t,onHunkExpand:n,onLineClick:r,onLineNumberClick:i,onTokenClick:a,onMergeConflictActionClick:o}=this.options;t==null&&n==null&&r==null&&i==null&&o==null&&a==null||this.options.onGutterUtilityClick!=null&&wi(e.composedPath())||this.handlePointerEvent({eventType:`click`,event:e})};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;(t!==`disabled`||o||n!=null||r!=null||i!=null||a!=null)&&(e.buttons!==0&&this.pointerSession.mode===`idle`?wi(e.composedPath())||this.endHover(e):this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;(this.hoveredLine!=null||this.hoveredToken!=null)&&this.endHover(e)};endHover(e){if(this.hoveredLine==null&&this.hoveredToken==null)return;let{onTokenLeave:t,onLineLeave:n}=this.options;this.hoveredToken!=null&&(t?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(n?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()}handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath(),i=this.resolvePointerTarget(r),{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onLineExpand:f,onHunkExpand:p,onMergeConflictActionClick:m}=this.options;switch(e){case`move`:{let e=Ai(i)&&this.hoveredLine?.lineElement===i.lineElement;ki(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),ki(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Ai(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(Ni(i)&&m!=null){m(i);break}if(ji(i)){f?.(i.expansion);break}if(Mi(i)&&p!=null){p(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Ai(i))break;ki(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onLineExpand:u,onHunkExpand:d,onMergeConflictActionClick:f,enableGutterUtility:p=!1,enableLineSelection:m=!1,onGutterUtilityClick:h}=this.options,g=h!=null,_=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f!=null||p||m||g;_&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0):!_&&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=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,y=this.pointerSession.mode===`gutterSelecting`;(!m&&v||!g&&y)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();wi(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}else if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners()}else this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(Si(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=ft(Ci());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);Oi(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){this.placeUtilityFromSelection()||(this.hoveredLine==null?this.hideUtility():this.showUtilityOnLine(this.hoveredLine))}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){let{gutterUtilityContainer:t}=this;t!=null&&(this.gutterUtilityLine=e,t.style.visibility=``,t.parentNode!==e.numberElement&&e.numberElement.appendChild(t))}hideUtility(){let{gutterUtilityContainer:e}=this;e!=null&&(e.style.visibility=`hidden`),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(Ii(t));if(Oi(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(Oi(n)&&(!t||n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(Oi(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&wi(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=Ii(e);if(t&&wi(n))return;let r=Li(e);return r==null?this.pathFromAnnotationSlot(e):Ii(r)}pathFromAnnotationSlot(e){let t=Ri(e)?.previousElementSibling;if(t instanceof HTMLElement&&(t.hasAttribute(`data-line`)||t.hasAttribute(`data-column-number`)))return Ii(t);let n=Bi(zi(e));if(n==null)return;let r=this.targetForSelectionPoint(n);return r==null?void 0:Ii(r.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=Vi(t)?t:Vi(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}Zr(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,yn(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{bn(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!Ui(this.renderedSelectedLinesState,n),i=!Ui(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);r&&(this.clearMarks(`data-selected-line`,this.markedSelectedElements),this.markedSelectedElements=[]),i&&(this.clearMarks(`data-editor-active-line`,this.markedEditorActiveElements),this.markedEditorActiveElements=[]);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;this.markSelected(u,e),n.lineNumberOnly||(this.markSelected(l,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,this.markSelected(l,`first`)):h===d?e=``:h===f&&this.markSelected(l,``),this.markSelected(l.nextSibling,e),this.markSelected(u.nextSibling,e)))}o&&h===m&&(this.markEditorActive(u),t.lineNumberOnly||this.markEditorActive(l))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};clearMarks(e,t){let n=t??this.pre?.querySelectorAll(`[${e}]`)??[];for(let t of n)t.removeAttribute(e)}markSelected(e,t){e.setAttribute(`data-selected-line`,t),this.markedSelectedElements?.push(e)}markEditorActive(e){e.setAttribute(`data-editor-active-line`,``),this.markedEditorActiveElements?.push(e)}notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d,f;for(let p of e){if(!(p instanceof HTMLElement))continue;if(f==null&&p.hasAttribute(`data-merge-conflict-action`)){let e=p.getAttribute(`data-merge-conflict-action`)??void 0,t=p.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);Pi(e)&&Number.isFinite(n)&&(f={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&p.hasAttribute(`data-char`)){s=p;let e=p.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=p.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?p.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=p,d=Number.parseInt(e,10),t=!0,n=Gi(p),a=p.getAttribute(`data-line-index`)??void 0;continue}let m=i==null?p.getAttribute(`data-line`)??void 0:void 0;if(m!=null){i=p,d=Number.parseInt(m,10),n=Gi(p),a=p.getAttribute(`data-line-index`)??void 0;continue}if(p.hasAttribute(`data-expand-line`)){let{additionLineNumber:e,deletionLineNumber:t}=p.dataset;u={additionLineNumber:e==null?void 0:Number(e),deletionLineNumber:t==null?void 0:Number(t)};continue}if(l==null&&(p.hasAttribute(`data-expand-button`)||p.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:p.hasAttribute(`data-expand-up`)?`up`:p.hasAttribute(`data-expand-down`)?`down`:`both`,all:p.hasAttribute(`data-expand-all-button`)};continue}let h=l==null?void 0:p.getAttribute(`data-expand-index`)??void 0;if(l!=null&&h!=null){let e=Number.parseInt(h,10);Number.isNaN(e)||(l.hunkIndex=e)}else if(r==null&&p.hasAttribute(`data-code`)){r=p;break}}if(f!=null)return f;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:Fi(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:Fi(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||d==null||Number.isNaN(d))return;let p=this.parseLineIndex(i,this.isSplitDiff());return u==null?c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:d,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:p}:{kind:`line`,lineType:n,lineElement:i,lineNumber:d,numberColumn:t,numberElement:o,side:Wi(n,r),splitLineIndex:p}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:d,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:p,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:d,numberColumn:t,numberElement:o,side:Wi(n,r),splitLineIndex:p,...c}:{kind:`expand-line`,lineType:n,lineElement:i,lineNumber:d,numberColumn:t,numberElement:o,side:this.mode===`file`?void 0:Wi(n,r),splitLineIndex:p,expansion: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));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Ei({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x,S){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:Di({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onLineExpand:y,onHunkExpand:b,onMergeConflictActionClick:S,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:x}}function Di({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function Oi(e){return e!=null&&`kind`in e&&e.kind===`line`}function ki(e){return e!=null&&`kind`in e&&e.kind===`token`}function Ai(e){return Oi(e)||ki(e)||ji(e)}function ji(e){return e!=null&&`kind`in e&&e.kind===`expand-line`}function Mi(e){return`type`in e&&e.type===`line-info`}function Ni(e){return`kind`in e&&e.kind===`merge-conflict-action`}function Pi(e){return e===`current`||e===`incoming`||e===`both`}function Fi(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Ii(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Li(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function Ri(e){let t=e.closest(`[slot^="annotation-"]`),n=(t instanceof HTMLElement&&t.assignedSlot!=null?t.assignedSlot:e.tagName===`SLOT`?e:void 0)?.closest(`[data-line-annotation]`);return n instanceof HTMLElement?n:void 0}function zi(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function Bi(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function Vi(e){return e!=null&&typeof e.elementFromPoint==`function`}function Hi(e,t){return e===t||Zr(e??void 0,t??void 0)}function Ui(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&Hi(e?.range??null,t.range)}function Wi(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function Gi(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}var Ki=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),Yi(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){if(c.type!==`annotations`)throw Error(`ResizeManager.setup: an annotation child is observed as a code node`);this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);let e=a.getBoundingClientRect().height,t=s.getBoundingClientRect().height;(e!==c.column1.childHeight||t!==c.column2.childHeight)&&(c.column1.childHeight=e,c.column2.childHeight=t,r.add({child1:a,child2:s,item:c,newHeight:Math.max(e,t)}));continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}let s=new Set;for(let e of this.observedNodes.values())e.type===`annotations`&&(s.add(e.column1.container),s.add(e.column2.container));for(let[e,t]of o)this.unobserve(e),t.type===`code`?Qi(t):$i(t,s);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null)console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);else if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:qi(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:Ji(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;(i||a)&&(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&Xi(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function qi(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function Ji(e){return Math.max(Math.ceil(e),0)}function Yi(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?Xi(e,{codeWidthChanged:!0,numberWidthChanged:!0}):Zi(e))}function Xi(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function Zi(e){e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`)}function Qi(e){e.codeElement.isConnected&&Zi(e)}function $i(e,t){for(let{container:n}of[e.column1,e.column2])n.isConnected&&!t.has(n)&&n.style.removeProperty(`--diffs-annotation-min-height`)}function ea(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function ta(e,t){return j({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function na(e){return j({tagName:`div`,children:[j({tagName:`div`,children:e.annotations?.map(e=>j({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}var ra=class{#e=new WeakMap;#t=new Map;#n=new Map;line(e,t,n,r,i,a=!1){let o=this.#e.get(e);if(o!=null&&o.lineNumber===n&&o.altLineNumber===r&&o.lineIndexText===i&&o.readOnly===a&&sa(o.contentProperties,t))return o.row;let s={...e.properties,"data-line":n,"data-alt-line":r,"data-line-type":t?.[`data-line-type`]??e.properties[`data-line-type`],"data-line-index":i,...t};a&&(s.contenteditable=`false`);let c={...e,properties:s};return this.#e.set(e,{contentProperties:t,lineNumber:n,altLineNumber:r,lineIndexText:i,readOnly:a,row:c}),c}gutter(e,t,n,r,i={}){let a=this.#t.get(e);if(a!=null&&a.lineType===t&&a.lineNumber===n&&a.lineIndexText===r&&sa(a.properties,i))return a.cell;let o=se(t,n,r,i);return a!=null&&a.lineNumber===n&&(o.children=a.cell.children),this.#t.set(e,{lineType:t,lineNumber:n,lineIndexText:r,properties:i,cell:o}),o}fixedRow(e,t,n,r){let i=this.#n.get(t),a=G.version;(i==null||i.signature!==n||i.messagesVersion!==a)&&(i={signature:n,messagesVersion:a,...r()},this.#n.set(t,i)),aa(e,{key:t,gutter:i.gutter,content:i.content})}forgetLines(e){for(let t of e)this.#t.delete(`a${t}`),this.#n.delete(`ann:a${t}`),this.#n.delete(`buf:a${t}`),this.#n.delete(`buf:ann:a${t}`)}};function ia(){return{specs:[],lastKey:void 0}}function aa(e,t){e.specs.push(t),e.lastKey=t.key}function oa(e){return{...e,properties:{...e.properties,contenteditable:`false`}}}function sa(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=0;for(let r in e){if(e[r]!==t[r])return!1;n++}for(let e in t)n--;return n===0}function ca(e,t){return e.model===t.model&&e.rows===t.rows&&e.annotations===t.annotations&&e.annotationSlotName===t.annotationSlotName&&ea(e.renderRange,t.renderRange)}var la=class{lineCuts;#e=new ra;#t;#n;constructor(e){this.lineCuts=e}markLines(e){let t=this.#n??=new Set;for(let n of e)t.add(n)}layout(e){let t=this.#n;this.#n=void 0;let n=this.#t;if(t!=null&&n!=null&&ca(n.input,e))return this.#r(n,t,e);let{model:r,renderRange:i,annotations:a}=e,o=ia(),s=new Map,c=0;this.lineCuts.startLayout();let l=t=>t.map(t=>e.annotationSlotName(t)),u=(e,t)=>{this.#e.fixedRow(o,`ann:${e}`,`context|${t.hunkIndex},${t.lineIndex}|${t.annotations.join(`,`)}`,()=>({gutter:ae(`context`,`annotation`,1),content:oa(na(t))})),c++},d=pi(i)?fi(a):void 0;d!=null&&u(`file`,{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:l(d)});let f=r.lineCount,p=Math.min(i.startingLine+i.totalLines,f);for(let t=i.startingLine;t<p;t++){let n=t+1,i=`a${r.lineId(t)}`;s.set(i,o.specs.length),aa(o,this.#i(e,t,i)),c++;let d=a[n];d!=null&&d.length>0&&u(i,{type:`annotation`,hunkIndex:0,lineIndex:n,annotations:l(d)})}let m={column:o.specs,patched:void 0,rowCount:c,totalLines:f};return this.#t={input:e,result:m,positions:s},m}#r(e,t,n){let{model:r}=n,i=e.result.column.slice(),a=[];for(let o of t){if(o<0||o>=r.lineCount)continue;let t=`a${r.lineId(o)}`,s=e.positions.get(t);if(s==null)continue;let c=this.#i(n,o,t);i[s]=c,a.push(c)}let o={...e.result,column:i,patched:a};return this.#t={input:n,result:o,positions:e.positions},o}#i({model:e,rows:t},n,r){let i=n+1,a=`${n}`,o=t.additionRow(e,n),s=this.#e.line(this.lineCuts.additionRow(o,e,n,i),{"data-line-type":`context`},i,void 0,a);return{key:r,gutter:this.#e.gutter(r,`context`,i,a),content:s}}forgetLines(e){this.#e.forgetLines(e)}invalidateLines(){this.#t=void 0,this.#n=void 0}};function ua(e,t){let n=t.changedLineChanges?.some(([,,e])=>e!==0)===!0?[[t.startLine,t.endLine]]:t.changedLineRanges,r=new Map;for(let[t,i]of n){let n=Math.min(i,e.lineCount-1);if(n<t)continue;if(n===t){r.set(t,e.getLineText(t,!0));continue}let a=n+1<e.lineCount?{line:n+1,character:0}:{line:n,character:e.getLineText(n).length},o=e.getText({start:{line:t,character:0},end:a}),s=ye(o);for(let e=t;e<=n;e++)r.set(e,s[e-t])}return r}function da(e){let t=[],n=0;for(let r=0;r<e.lineCount;r++){let i=e.getLineText(r,!0);t.push(i),n+=i.length}return{lines:t,characterCount:n}}var fa=class{#e;#t;#n;constructor(e){if(e<1)throw Error(`LineMap: a document has at least one line`);this.#e=Array.from({length:e},(e,t)=>t),this.#t=e}get lineCount(){return this.#e.length}ids(){return this.#e.slice()}idAt(e){let t=this.#e[e];if(t==null)throw Error(`LineMap.idAt: line ${e} is out of range`);return t}lineOf(e){let t=this.#n;if(t==null){t=new Map;for(let[e,n]of this.#e.entries())t.set(n,e);this.#n=t}return t.get(e)}applyChange(e){let t=ht(e);t.some(([,,e])=>e!==0)&&(this.#n=void 0);let n=pt(this.#e,t,()=>this.#t++);if(this.#e=n.entries,this.#e.length!==e.lineCount)throw Error(`LineMap.applyChange: the document has ${e.lineCount} lines but the map has ${this.#e.length}`);return n.removed}},pa=class e{file;static fromFile(t){return new e(t,ye(t.contents),void 0)}static startEditSession(t,n){let r=n??t,i=si(r.contents),a={name:r.name,lang:r.lang,contents:i},o=ye(i);return new e(a,o,new fa(o.length))}#e;#t;constructor(e,t,n){this.file=e,this.#e=t,this.#t=n}get live(){return this.#t!=null}get lineCount(){return this.#e.length}get lines(){return this.#e}lineText(e){return this.#e[e]??``}lineId(e){return this.#t?.idAt(e)??e}lineOf(e){return this.#t?.lineOf(e)??(e<this.#e.length?e:void 0)}lineIds(){return this.#t?.ids()??this.#e.map((e,t)=>t)}applyChange(e,t){let n=this.#t;if(n==null)throw Error(`FileModel.applyChange: the model is not live`);let r=n.applyChange(e),i=[];if(e.lineDelta===0)for(let[n,r]of ua(t,e))this.#e[n]!==r&&(this.#e[n]=r,i.push(n));else{this.#e=da(t).lines;for(let t=e.startLine;t<=e.endLine;t++)i.push(t)}return this.file.contents=this.#e.join(``),{changedLines:i,removedLineIds:r,lineDelta:e.lineDelta}}},ma=class{#e=[];#t=[];#n=[];#r;#i=new Map;#a=new WeakMap;#o=new Map;#s=new Map;constructor(e){this.setHighlightRows(e)}setHighlightRows({deletionRows:e,additionRows:t,additionLines:n,lineIds:r}){if(this.#e=e,r!=null){let e=new Map;for(let i=0;i<n.length;i++){let a=t[i];a?.type===`element`&&e.set(r[i],{row:a,text:n[i]})}this.#r=e,this.#t=[],this.#n=[]}else this.#r=void 0,this.#t=t,this.#n=n}setTokens(e,t){let n=this.#i.get(e);if(n!=null&&ha(n.tokens,t))return!1;let r=``;for(let e of t)r+=e[2];return this.#i.set(e,{tokens:t,text:r}),this.#o.delete(e),!0}hasTokens(e){return this.#i.has(e)}forgetTokens(){this.#i.clear()}forgetLines(e){for(let t of e)this.#i.delete(t),this.#o.delete(t),this.#r?.delete(t)}deletionRow(e,t){let n=this.#e[t];if(n?.type===`element`)return n;let r=N(e.diff.deletionLines[t]??``),i=this.#s.get(t);if(i!=null&&i.text===r)return i.row;let a=re(r);return this.#s.set(t,{text:r,row:a}),a}additionRow(e,t){let n=e.lineId(t),r=e.lineText(t),i=N(r),a=this.#i.get(n);if(a!=null&&a.text===i){let e=this.#a.get(a.tokens);return e??(e=lt(a.tokens),this.#a.set(a.tokens,e)),e}let o=this.#r;if(o!=null){let e=o.get(n);if(e!=null&&e.text===r)return e.row}else{let e=this.#t[t];if(e?.type===`element`&&this.#n[t]===r)return e}let s=this.#o.get(n);if(s!=null&&s.text===i)return s.row;let c=re(i);return this.#o.set(n,{text:i,row:c}),c}};function ha(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let[r,i,a]=e[n],[o,s,c]=t[n];if(r!==o||i!==s||a!==c)return!1}return!0}function ga(e,t){for(let n of Object.keys(t)){let r=Number(n);r in e||(e[r]=t[r])}}function _a(e){switch(e){case`file`:return`diffs-icon-file-code`;case`change`:return`diffs-icon-symbol-modified`;case`new`:return`diffs-icon-symbol-added`;case`deleted`:return`diffs-icon-symbol-deleted`;case`rename-pure`:case`rename-changed`:return`diffs-icon-symbol-moved`}}function va({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return j({tagName:`div`,children:[t===`custom`?j({tagName:`slot`,properties:{name:Ce}}):ya({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[ba(r)]],properties:i})}function ya({name:e,prevName:t,iconType:n}){let r=[j({tagName:`slot`,properties:{name:A}}),F({name:_a(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(j({tagName:`div`,children:[j({tagName:`bdi`,children:[fe(t)]})],properties:{"data-prev-name":``}})),r.push(F({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(j({tagName:`div`,children:[j({tagName:`bdi`,children:[fe(e)]})],properties:{"data-title":``}})),r.push(j({tagName:`slot`,properties:{name:oe}})),j({tagName:`div`,children:r,properties:{"data-header-content":``}})}function ba(e){let t=[];if(e!=null&&(e.type!==`new`||e.additionCharacterCount>0)){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(j({tagName:`span`,children:[fe(`-${G.formatNumber(r)}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(j({tagName:`span`,children:[fe(`+${G.formatNumber(n)}`)],properties:{"data-additions-count":``}}))}return t.push(j({tagName:`slot`,properties:{name:le}})),j({tagName:`div`,children:t,properties:{"data-metadata":``}})}function xa(e){return j({tagName:`pre`,properties:Sa(e)})}function Sa({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}function Ca(e,{theme:t,preferredHighlighter:n}){return{langs:Array.isArray(e)?e:[e??`text`],themes:Ye(t),preferredHighlighter:Ae(n)}}function wa(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}var Ta=-1,Ea=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`file-renderer:${++Ta}`;file;renderCache;pendingHighlightResult;computedLang=`text`;annotationList=[];lineAnnotations={};lineCuts=new hr;editSessionActive=!1;model;rowSource;layout;get fileCache(){return this.renderCache?.file}constructor(e={theme:rt},t=Zt,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r}expandLine(e){this.lineCuts.expand(e),this.layout?.invalidateLines()}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){let{annotationList:t}=this;if(!(e===t||e.length===0&&t.length===0)){this.annotationList=e,this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}}cleanUp(){this.endEditSession(),this.recycle(),this.lineCuts.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.file=void 0,this.editSessionActive?(this.workerManager?.cancelLocalThemeRender(this),this.renderCache!=null&&(this.renderCache.renderRange=void 0),this.pendingHighlightResult=void 0):this.clearRenderCache(),this.workerManager?.cleanUpTasks(this)}startEditSession(e,t){let n=pa.startEditSession(e,t),{rowSource:r,model:i}=this,a=this.promoteReadyResult(e)??this.renderCache;this.editSessionActive=!0,this.model=n,this.file=n.file,this.pendingHighlightResult=void 0;let{options:o}=this.getRenderOptions(n.file);if(!(i!=null&&i.live&&a?.file===i.file)&&a?.result!=null&&a.highlighted&&a.file.contents===n.file.contents&&li(a.file,e)&&xe(a.options,o)){let{result:e}=a,t={ids:n.lineIds(),texts:n.lines.slice()};this.renderCache={file:n.file,options:o,highlighted:!0,result:e,renderRange:a.renderRange,lines:t},r!=null&&r.result===e?(r.source.setHighlightRows({deletionRows:[],additionRows:e.code,additionLines:t.texts,lineIds:t.ids}),this.layout?.invalidateLines(),r.model=n):this.rowSource=void 0}else a!=null&&a.options.useTokenTransformer!==!0&&n.file.name,this.renderCache=void 0,this.rowSource=void 0;return n.file}promoteReadyResult(e){let{options:t}=this.getRenderOptions(e),n=this.getReadyRenderResult(e,t);return n==null?void 0:{...n,file:e,renderRange:void 0}}applyChange(e,t,n){let r=this.requireSession(),i=r.applyChange(e,t);return i.removedLineIds.length>0&&(this.editSessionRows(r).source.forgetLines(i.removedLineIds),this.layout?.forgetLines(i.removedLineIds)),i.lineDelta!==0||i.removedLineIds.length>0?this.layout?.invalidateLines():this.layout?.markLines(i.changedLines),n!=null&&this.setTokens(n),i}setTokens(e){let t=this.requireSession(),n=this.editSessionRows(t).source,r=[];for(let[i,a]of e)n.setTokens(t.lineId(i),a)&&r.push(i);return this.layout?.markLines(r),r}lineKey(e){let t=this.requireSession();return e>=0&&e<t.lineCount?`a${t.lineId(e)}`:void 0}lineOfKey(e){let t=this.requireSession();return e.startsWith(`a`)?t.lineOf(Number(e.slice(1))):void 0}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0,this.file??this.clearRenderCache()}requireSession(){let{model:e}=this;if(!this.editSessionActive||e==null||!e.live)throw Error(`FileRenderer: no edit session is active`);return e}editSessionRows(e){let{rowSource:t}=this;if(t!=null&&t.model===e)return t;let n=new ma({deletionRows:[],additionRows:[],additionLines:[],lineIds:[]});return this.rowSource={result:{code:[],themeStyles:``,baseThemeType:void 0},source:n,model:e}}editorRenderReady(){let{renderCache:e,rowSource:t}=this;return e?.options.useTokenTransformer===!0&&e.highlighted&&e.result!=null&&t?.result===e.result}waitForLocalTheme(e){let{workerManager:t,onRenderUpdate:n}=this;return n!=null&&t?.renderWhenLocalThemeLoads(this,n,e)===!0}clearRenderCache(){this.workerManager?.cancelLocalThemeRender(this),this.renderCache=void 0,this.pendingHighlightResult=void 0,this.layout=void 0,this.editSessionActive?this.rowSource?.source.forgetTokens():(this.rowSource=void 0,this.model=void 0)}hydrate(e){this.file=e;let{options:t}=this.getRenderOptions(e),n=Da(this.getLineCount(e),this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!xe(t,r.options)&&(r=void 0),this.renderCache??={file:e,hydrated:!0,options:t,highlighted:!n&&!qe(e),result:n?void 0:r?.result,renderRange:void 0};let i=this.getHighlightWorkerManager(e);i==null?this.options.deferHydrationHighlight!==!0&&R({theme:this.getLocalHighlightTheme()})==null&&(this.computedLang=e.lang??I(e.name),this.initializeHighlighter().catch(e=>{e instanceof He||this.onHighlightError(e)})):this.renderCache.result==null&&!n&&i.highlightFileAST(this,e)}awaitsPoolHighlight(e){let t=this.getHighlightWorkerManager(e);if(t==null||e.cacheKey==null||t.didHighlightFail(e))return!1;let n=t.getFileRenderOptions();return n.useTokenTransformer===!0&&e.contents.length>0&&!qe(e)&&!Da(this.getLineCount(e),this.getTokenizeMaxLength())&&!this.hasHighlightedRenderCache(e,n)&&this.getReadyRenderResult(e,n)==null}getHighlightWorkerManager(e){let{editSessionActive:t,workerManager:n}=this;return!t&&n?.isWorkingPool()===!0&&!n.shouldHighlightOnMainThread(e)?n:void 0}cacheHighlightResult(e,t){let{editSessionActive:n,workerManager:r}=this;!n&&r?.isWorkingPool()===!0&&r.setFileResultCache(e.cacheKey,t)}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??rt}getLineCutLength(e=this.options){if(this.editSessionActive)return 1/0;let{tokenizeMaxLineLength:t=1e3}=this.getEffectiveCodeOptions(e);return t>0?t:1/0}getEffectiveCodeOptions(e=this.options){let t=this.workerManager?.getFileRenderOptions();return{theme:t?.theme??this.options.theme??rt,tokenizeMaxLineLength:t?.tokenizeMaxLineLength??e.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager!=null){let e=this.workerManager.getFileRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{tokenizeMaxLineLength:e=1e3}=this.options;return{theme:this.getLocalHighlightTheme(),useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:e}})(),{renderCache:n}=this;return n?.result==null||!li(e,n.file)||!xe(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getFileForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null)return e;let{renderCache:n}=this;if(n==null)return e;if(li(n.file,e))return n.file;let r=e.contents.length===0||qe(e)||Da(this.getLineCount(e),this.getTokenizeMaxLength());return this.canRenderFile(e,t,r)?e:n.file}canRenderFile(e,t,n){let{renderCache:r}=this;return r==null||li(r.file,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0&&!this.workerManager.shouldHighlightOnMainThread(e)||R({theme:t.theme})!=null:r.result==null&&r.hydrated!==!0?!0:this.getHighlightWorkerManager(e)==null?R({theme:t.theme})!=null:!r.highlighted}getLineCount(e){let{model:t}=this;return t!=null&&t.file===e?t.lineCount:this.editSessionActive?_e(e.contents)+1:this.modelFor(e).lineCount}modelFor(e){let{model:t}=this;if(t!=null&&t.file===e)return t;if(this.editSessionActive)throw Error(`FileRenderer: only the session file renders during an edit session`);return this.model=pa.fromFile(e)}renderCollapsed(e){this.workerManager?.cancelLocalThemeRender(this),this.file=e;let{renderCache:t}=this;t!=null&&(!li(t.file,e)||t.hydrated===!0&&t.result==null)&&this.clearRenderCache();let n=this.getLocalHighlightTheme(),r=R({theme:n});if(r==null){this.initializeHighlighter(`text`).then(()=>this.onRenderUpdate?.()).catch(e=>{e instanceof He||this.onHighlightError(e)});return}let{disableFileHeader:i=!1}=this.options;return{headerAST:i?void 0:this.renderHeader(e),themeStyles:M({theme:n,highlighter:r}),baseThemeType:typeof n==`string`?r.getTheme(n).type:void 0}}renderFile(e=this.file,t=pe){if(this.file=e,e==null){this.pendingHighlightResult=void 0;return}let{options:n,forceHighlight:r}=this.getRenderOptions(e),i=this.getReadyRenderResult(e,n);this.pendingHighlightResult=void 0,i!=null&&(this.renderCache={...i,file:e,renderRange:void 0,lines:this.lineSnapshot(this.modelFor(e))},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=!li(e,this.renderCache.file),o=a?e:this.renderCache.file,s=this.modelFor(o),c=e.contents.length>0,l=!c||qe(e)||Da(s.lineCount,this.getTokenizeMaxLength()),u=this.canRenderFile(e,n,l),d=!ea(this.renderCache.renderRange,t),f=this.getHighlightWorkerManager(e);if(f!=null){let i=this.renderCache.result==null&&this.renderCache.highlighted&&!l&&!a&&wa(t);if(u&&!i&&(l||this.renderCache.result==null||!this.renderCache.highlighted&&(a||d))){if(this.renderCache.file=o,this.renderCache.options=n,this.renderCache.highlighted=!1,this.renderCache.result==null||a||d||r){let n=f.getPlainFileAST(e,t.startingLine,t.totalLines,s.lines);n??this.waitForLocalTheme();let{result:i}=this.renderCache,o=n;i!=null&&n!=null&&!a&&!r&&(ga(i.code,n.code),o=i),o!==i&&(this.renderCache.lines=this.lineSnapshot(s)),this.renderCache.result=o}this.renderCache.renderRange=t}!l&&c&&(!this.renderCache.highlighted||r)&&f.highlightFileAST(this,e)}else{this.computedLang=e.lang??I(e.name);let i=R(),a=i!=null&&$e(n.theme,i),c=i!=null&&be(this.computedLang,i),d=!l&&c,f=Number.isFinite(t.totalLines);if(u&&i!=null&&a&&(r||!this.renderCache.highlighted&&d||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,i,l||!c,f);this.renderCache={file:o,options:n,highlighted:d,result:t,renderRange:void 0,lines:this.lineSnapshot(s)},d&&this.cacheHighlightResult(e,{result:t,options:n})}if(!a||!l&&!c){if(this.renderCache.result==null&&!this.renderCache.highlighted&&!this.editSessionActive&&this.waitForLocalTheme(l||c?[]:[this.computedLang]))return;this.asyncHighlight(e,f).then(({result:t,options:n})=>{l||this.cacheHighlightResult(e,{result:t,options:n}),this.applyHighlightResult(e,t,n,!l)}).catch(e=>{e instanceof He||this.onHighlightError(e)})}}if(this.renderCache.result!=null)return this.workerManager?.cancelLocalThemeRender(this),this.layoutResult(this.renderCache.file,t,this.renderCache.result,this.renderCache.lines);if(!this.editSessionActive)return;let{result:p}=this.editSessionRows(this.requireSession());return this.layoutResult(this.renderCache.file,t,p,{ids:[],texts:[]})}async asyncRender(e,t=pe){this.file=e;let{result:n}=await this.asyncHighlight(e,Number.isFinite(t.totalLines));return this.layoutResult(e,t,n,this.lineSnapshot(this.modelFor(e)))}async asyncHighlight(e,t=!1){let n=Da(this.getLineCount(e),this.getTokenizeMaxLength());this.computedLang=n?`text`:e.lang??I(e.name);let r=R(),i=r!=null&&$e(this.getLocalHighlightTheme(),r),a=n||r!=null&&be(this.computedLang,r);return r!=null&&i&&a||(r=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,r,n,t)}renderFileWithHighlighter(e,t,n=!1,r=!1){let{options:i}=this.getRenderOptions(e);return{result:Ve(e,t,i,{forcePlainText:n,lazyLineAST:r}),options:i}}lineSnapshot(e){return e.live&&e===this.model?{ids:e.lineIds(),texts:e.lines.slice()}:void 0}getRowSource(e,t,n){let{rowSource:r}=this;if(r!=null&&r.result===e)return r.source;if(t.live&&n==null)throw Error(`FileRenderer: a highlight result for an edited file has no line snapshot`);let i={deletionRows:[],additionRows:e.code,additionLines:n?.texts??t.lines,lineIds:n?.ids};if(r!=null&&t.live&&r.model===t)return r.source.setHighlightRows(i),this.layout?.invalidateLines(),r.result=e,r.source;let a=new ma(i);return this.rowSource={result:e,source:a,model:t},a}layoutInput(e,t,n){return this.lineCuts.setLimit(this.getLineCutLength()),{model:e,rows:t,renderRange:n,annotations:this.lineAnnotations,annotationSlotName:this.annotationSlotName}}layoutResult(e,t,n,r){let{themeStyles:i,baseThemeType:a}=n,{disableFileHeader:o=!1}=this.options,s=this.layout??=new la(this.lineCuts),c=this.modelFor(e),l=this.rowSource?.result,u=this.getRowSource(n,c,r),{column:d,patched:f,rowCount:p,totalLines:m}=s.layout(this.layoutInput(c,u,t));return{file:e,column:d,allRowsChanged:l!==n,patched:f,preAST:this.createPreElement(m),headerAST:o?void 0:this.renderHeader(e),totalLines:m,rowCount:p,themeStyles:i,baseThemeType:a,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return va({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return ft(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(j({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=xi(e.column),n=ue();return n.children=t.gutter,n.properties.style=`grid-row: span ${e.rowCount}`,[n,ta(t.content,e.rowCount)]}initializeHighlighter(e=this.computedLang){return y(Ca(e,{theme:this.getLocalHighlightTheme(),preferredHighlighter:ii(this.workerManager,this.options)}))}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{file:i,renderCache:a}=this;i!=null&&a!=null&&li(e,i)&&xe(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&xe(a.options,n)&&li(a.file,i)||(this.pendingHighlightResult={file:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.()))}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getFileResultCache(e);if(n!=null&&xe(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&li(n.file,e)&&xe(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{file:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&li(e,n.file)&&xe(t,n.options)}onHighlightError(e){console.error(e)}onLocalFallback(){this.onRenderUpdate?.()}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return xa({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function Da(e,t){return e>t}function Oa(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function ka(e,t){return e==null||t==null?e===t:ja(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}var Aa={};function ja(e=Aa,t=Aa){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function Ma(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function Na(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}var Pa=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
67
+ <symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
68
+ <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"/>
69
+ </symbol>
70
+ <symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
71
+ <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"/>
72
+ </symbol>
73
+ <symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
74
+ <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"/>
75
+ </symbol>
76
+ <symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
77
+ <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"/>
78
+ </symbol>
79
+ <symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
80
+ <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"/>
81
+ </symbol>
82
+ <symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
83
+ <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"/>
84
+ </symbol>
85
+ <symbol id="diffs-icon-ellipsis" viewBox="0 0 16 16">
86
+ <path d="M4 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0M10 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0M16 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0"/>
87
+ </symbol>
88
+ <symbol id="diffs-icon-expand" viewBox="0 0 16 16">
89
+ <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"/>
90
+ </symbol>
91
+ <symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
92
+ <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"/>
93
+ </symbol>
94
+ <symbol id="diffs-icon-eye-slash" viewBox="0 0 16 16">
95
+ <path d="m13.47 1.47-12 12 1.06 1.06 12-12zM8 14c-.92 0-1.802-.208-2.624-.547l1.173-1.174c.476.142.963.221 1.451.221 1.66 0 3.307-.949 4.626-2.196a10.4 10.4 0 0 0 1.494-1.751A5 5 0 0 0 14.443 8a5 5 0 0 0-.323-.553 10 10 0 0 0-1.238-1.5l1.061-1.062C15.222 6.173 16 7.511 16 8c0 1.05-3.582 6-8 6"/><path d="M8 11q-.084 0-.167-.005l3.162-3.162q.006.083.005.167a3 3 0 0 1-3 3M5.005 8.167l3.162-3.162a3 3 0 0 0-3.162 3.162"/><path d="M8 3.5c.485 0 .97.081 1.445.227l1.168-1.169C9.794 2.212 8.915 2 8 2 3.582 2 0 6.8 0 8c0 .555.766 1.88 2.027 3.144l1.06-1.06a9.5 9.5 0 0 1-1.203-1.461 4.3 4.3 0 0 1-.345-.617L1.536 8l.003-.006c.064-.149.176-.359.345-.617a9.8 9.8 0 0 1 1.482-1.73C4.675 4.427 6.326 3.5 8 3.5"/>
96
+ </symbol>
97
+ <symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
98
+ <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"/>
99
+ </symbol>
100
+ <symbol id="diffs-icon-loader" viewBox="0 0 16 16">
101
+ <path d="M7.25 4V1a.75.75 0 0 1 1.5 0v3a.75.75 0 0 1-1.5 0"/><path d="M4.641 5.702 2.521 3.58A.75.75 0 1 1 3.58 2.52l2.121 2.121a.75.75 0 0 1-1.06 1.06" opacity=".8"/><path d="M1 7.25h3a.75.75 0 0 1 0 1.5H1a.75.75 0 0 1 0-1.5" opacity=".6"/><path d="m2.52 12.42 2.121-2.122a.75.75 0 1 1 1.061 1.06L3.581 13.48a.75.75 0 0 1-1.061-1.06" opacity=".5"/><path d="M7.25 15v-3a.75.75 0 0 1 1.5 0v3a.75.75 0 0 1-1.5 0" opacity=".4"/><path d="m12.42 13.48-2.122-2.121a.75.75 0 0 1 1.06-1.061l2.122 2.121a.75.75 0 1 1-1.06 1.061" opacity=".3"/><path d="M12 7.25h3a.75.75 0 0 1 0 1.5h-3a.75.75 0 0 1 0-1.5" opacity=".2"/><path d="M10.298 4.641 12.42 2.52a.75.75 0 1 1 1.061 1.06l-2.121 2.122a.75.75 0 1 1-1.06-1.06" opacity=".1"/>
102
+ </symbol>
103
+ <symbol id="diffs-icon-plus" viewBox="0 0 16 16">
104
+ <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"/>
105
+ </symbol>
106
+ <symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
107
+ <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"/>
108
+ </symbol>
109
+ <symbol id="diffs-icon-symbol-added-duo" viewBox="0 0 16 16">
110
+ <path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><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"/>
111
+ </symbol>
112
+ <symbol id="diffs-icon-symbol-added-fill" viewBox="0 0 16 16">
113
+ <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m0 4a.75.75 0 0 0-.75.75v2.5h-2.5a.75.75 0 0 0 0 1.5h2.5v2.5a.75.75 0 0 0 1.5 0v-2.5h2.5a.75.75 0 0 0 0-1.5h-2.5v-2.5A.75.75 0 0 0 8 4" clip-rule="evenodd"/>
114
+ </symbol>
115
+ <symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
116
+ <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"/>
117
+ </symbol>
118
+ <symbol id="diffs-icon-symbol-deleted-duo" viewBox="0 0 16 16">
119
+ <path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><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"/>
120
+ </symbol>
121
+ <symbol id="diffs-icon-symbol-deleted-fill" viewBox="0 0 16 16">
122
+ <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M4.75 7.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5z" clip-rule="evenodd"/>
123
+ </symbol>
124
+ <symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
125
+ <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"/>
126
+ </symbol>
127
+ <symbol id="diffs-icon-symbol-diffstat-duo" viewBox="0 0 16 16">
128
+ <path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><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"/>
129
+ </symbol>
130
+ <symbol id="diffs-icon-symbol-diffstat-fill" viewBox="0 0 16 16">
131
+ <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5zM8 3.546a.75.75 0 0 0-.75.75V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2V4.296a.75.75 0 0 0-.75-.75" clip-rule="evenodd"/>
132
+ </symbol>
133
+ <symbol id="diffs-icon-symbol-extracted" viewBox="0 0 16 16">
134
+ <path d="M8.25 4.25a.75.75 0 0 1 0 1.5H6.81l3.302 3.302a1.5 1.5 0 1 1-1.06 1.06L5.75 6.811V8.25a.75.75 0 0 1-1.5 0V5A.75.75 0 0 1 5 4.25z"/><path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m0 1.5c-1.613 0-2.807.089-3.704.288-.88.196-1.382.477-1.706.802-.325.324-.606.826-.802 1.706C1.588 5.193 1.5 6.387 1.5 8s.089 2.807.288 3.704c.196.88.477 1.382.802 1.706.324.325.826.606 1.706.802.897.2 2.091.288 3.704.288s2.807-.089 3.704-.288c.88-.196 1.382-.477 1.706-.802.325-.324.606-.826.802-1.706.2-.897.288-2.091.288-3.704s-.089-2.807-.288-3.704c-.196-.88-.477-1.382-.802-1.706-.324-.325-.826-.606-1.706-.802C10.807 1.588 9.613 1.5 8 1.5" clip-rule="evenodd"/>
135
+ </symbol>
136
+ <symbol id="diffs-icon-symbol-extracted-duo" viewBox="0 0 16 16">
137
+ <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8" clip-rule="evenodd" opacity=".2"/><path d="M8.25 4.25a.75.75 0 0 1 0 1.5H6.81l3.302 3.302a1.5 1.5 0 1 1-1.06 1.06L5.75 6.811V8.25a.75.75 0 0 1-1.5 0V5A.75.75 0 0 1 5 4.25z"/>
138
+ </symbol>
139
+ <symbol id="diffs-icon-symbol-extracted-fill" viewBox="0 0 16 16">
140
+ <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M5 4.25a.75.75 0 0 0-.75.75v3.25a.75.75 0 0 0 1.5 0V6.81l3.302 3.302a1.5 1.5 0 1 0 1.06-1.06L6.811 5.75H8.25a.75.75 0 0 0 0-1.5z" clip-rule="evenodd"/>
141
+ </symbol>
142
+ <symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
143
+ <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"/>
144
+ </symbol>
145
+ <symbol id="diffs-icon-symbol-ignored-duo" viewBox="0 0 16 16">
146
+ <path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M11.53 4.47a.75.75 0 0 1 0 1.06l-6 6a.75.75 0 0 1-1.06-1.06l6-6a.75.75 0 0 1 1.06 0"/>
147
+ </symbol>
148
+ <symbol id="diffs-icon-symbol-ignored-fill" viewBox="0 0 16 16">
149
+ <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m3.53 4.47a.75.75 0 0 0-1.06 0l-6 6a.75.75 0 1 0 1.06 1.06l6-6a.75.75 0 0 0 0-1.06" clip-rule="evenodd"/>
150
+ </symbol>
151
+ <symbol id="diffs-icon-symbol-inlined" viewBox="0 0 16 16">
152
+ <path d="M7.75 11.75a.75.75 0 0 1 0-1.5h1.44L5.887 6.948a1.5 1.5 0 1 1 1.06-1.06l3.302 3.301V7.75a.75.75 0 0 1 1.5 0V11a.75.75 0 0 1-.75.75z"/><path fill-rule="evenodd" d="M8 16c-6.588 0-8-1.412-8-8s1.412-8 8-8 8 1.412 8 8-1.412 8-8 8m0-1.5c1.613 0 2.807-.089 3.704-.288.88-.196 1.382-.477 1.706-.802.325-.324.606-.826.802-1.706.2-.897.288-2.091.288-3.704s-.089-2.807-.288-3.704c-.196-.88-.477-1.382-.802-1.706-.324-.325-.826-.606-1.706-.802C10.807 1.588 9.613 1.5 8 1.5s-2.807.089-3.704.288c-.88.196-1.382.477-1.706.802-.325.324-.606.826-.802 1.706C1.588 5.193 1.5 6.387 1.5 8s.089 2.807.288 3.704c.196.88.477 1.382.802 1.706.324.325.826.606 1.706.802.897.2 2.091.288 3.704.288" clip-rule="evenodd"/>
153
+ </symbol>
154
+ <symbol id="diffs-icon-symbol-inlined-duo" viewBox="0 0 16 16">
155
+ <path fill-rule="evenodd" d="M8 16c-6.588 0-8-1.412-8-8s1.412-8 8-8 8 1.412 8 8-1.412 8-8 8" clip-rule="evenodd" opacity=".2"/><path d="M7.75 11.75a.75.75 0 0 1 0-1.5h1.44L5.887 6.948a1.5 1.5 0 1 1 1.06-1.06l3.302 3.301V7.75a.75.75 0 0 1 1.5 0V11a.75.75 0 0 1-.75.75z"/>
156
+ </symbol>
157
+ <symbol id="diffs-icon-symbol-inlined-fill" viewBox="0 0 16 16">
158
+ <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8M5.5 4a1.5 1.5 0 1 0 .388 2.948l3.301 3.302H7.75a.75.75 0 0 0 0 1.5H11a.75.75 0 0 0 .75-.75V7.75a.75.75 0 0 0-1.5 0v1.44L6.948 5.887A1.5 1.5 0 0 0 5.5 4" clip-rule="evenodd"/>
159
+ </symbol>
160
+ <symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
161
+ <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"/>
162
+ </symbol>
163
+ <symbol id="diffs-icon-symbol-modified-duo" viewBox="0 0 16 16">
164
+ <path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0"/>
165
+ </symbol>
166
+ <symbol id="diffs-icon-symbol-modified-fill" viewBox="0 0 16 16">
167
+ <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m0 5a3 3 0 1 0 0 6 3 3 0 0 0 0-6" clip-rule="evenodd"/>
168
+ </symbol>
169
+ <symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
170
+ <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"/>
171
+ </symbol>
172
+ <symbol id="diffs-icon-symbol-moved-duo" viewBox="0 0 16 16">
173
+ <path d="M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8" opacity=".2"/><path d="M8.496 4.695a.75.75 0 0 0-.051 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-.051 1.06L6.49 8.003 4.693 9.998a.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"/>
174
+ </symbol>
175
+ <symbol id="diffs-icon-symbol-moved-fill" viewBox="0 0 16 16">
176
+ <path fill-rule="evenodd" d="M8 0c6.588 0 8 1.412 8 8s-1.412 8-8 8-8-1.412-8-8 1.412-8 8-8m1.555 4.745a.75.75 0 0 0-1.11 1.01L10.486 8l-2.04 2.245a.75.75 0 0 0 1.109 1.01l2.5-2.75a.75.75 0 0 0 0-1.01zm-4 0a.75.75 0 0 0-1.11 1.01l2.043 2.248-1.796 1.995a.75.75 0 0 0 1.116 1.004l2.25-2.5a.75.75 0 0 0-.003-1.007z" clip-rule="evenodd"/>
177
+ </symbol>
178
+ <symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
179
+ <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"/>
180
+ </symbol>
181
+ </svg>`,Fa=new WeakMap;function Ia(){let e=Fa.get(document);if(e==null){let t=document.createElement(`div`);t.innerHTML=Pa;let n=t.firstChild;if(!(n instanceof SVGElement))return;n.remove(),e=n,Fa.set(document,e)}return e.cloneNode(!0)}function La(e){if(!e.hasAttribute(`data-icon-sprite-partial`))return e;let t=Ia();return t==null?e:(e.replaceWith(t),t)}function Ra(e,t,n){let r=new Map;for(let i of e){let e=dn(i);r.set(e,n?.slotNames.get(e)??t(i))}return{provided:e,current:e,slotNames:r}}function za(e,t,n){for(let r of t){let t=dn(r);e.slotNames.has(t)||e.slotNames.set(t,n(r))}e.provided=t,e.current=t}function Ba(e,t,n){if(e==null)return n(t);let r=dn(t),i=e.slotNames.get(r);return i??(i=n(t),e.slotNames.set(r,i)),i}function Va(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function Ha(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,deferHydrationHighlight:e?.deferHydrationHighlight,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Va(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function Ua({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function Wa(e,t){let n=e?.offsetHeight??0;if(e==null||n===0)t();else{e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}}function Ga({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``)t?.remove();else return t??=Ka(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function Ka(){let e=document.createElement(`style`);return e.setAttribute(de,``),e}function qa(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function Ja(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(Bn)),t.adoptedStyleSheets=[e]}connectedCallback(){Hn(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(Be,t)}var Ya=-1,Xa=class{options;workerManager;requestOwnerRender;static LoadedCustomComponent=!0;__id=`file:${++Ya}`;type=`file`;fileContainer;spriteSVG;pre;codeColumns=new mi;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;columnReconcilers=new WeakMap;changedRowKeys=[];mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;get lineAnnotations(){return this.renderedData?.lineAnnotations??b}managersDirty=!1;appliedManagerSetup;file;editSession;renderedData;pendingData;pendingAttach;forceRenderOverride;renderRange;enabled=!0;editor;constructor(e={theme:rt},t,n){this.options=e,this.workerManager=t,this.requestOwnerRender=n,this.fileRenderer=new Ea(e,this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager),this.resizeManager=new Ki,this.interactionManager=new Ti(`file`,Ei(e,this.expandLine))}subscribeToChanges(){this.workerManager?.subscribeToThemeChanges(this),G.subscribe(this)}getAnnotationSlotName=e=>Ba(this.editSession?.annotations,e,Zt);handleHighlightRender=()=>{this.rerender()};expandLine=e=>{this.fileRenderer.expandLine(e),this.rerender()};rerender(){let e=this.getInputFile();this.enabled&&e!=null&&(this.requestRender()||this.render({file:e,forceRender:!0,renderRange:this.renderRange}))}requestRender(){let{requestOwnerRender:e}=this;return this.editSession!=null||e==null?!1:(this.forceRenderOverride=!0,e(),!0)}get isComponentManaged(){return this.requestOwnerRender!=null}getTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??rt}getInputFile(){return this.file}getWorkingFile(e=this.file){return this.editSession?.file??e}getRenderedFile(){return this.renderedData?.file}__getNextRenderData({file:e,lineAnnotations:t}){let n=this.editSession?.annotations;if(n!=null)return{file:e,lineAnnotations:t!=null&&this.isNewAnnotations(t)?t:n.provided};let r=this.getWorkingFile(e)??e,i=this.getFileForNextRender(r);return{file:i,lineAnnotations:t!=null&&li(i,r)?t:this.getAnnotationsForFile(i)}}getFileForNextRender(e){let{collapsed:t=!1}=this.options;return t?e:this.fileRenderer.getFileForNextRender(e)}getLatestAnnotations(){return this.pendingData?.lineAnnotations??this.editSession?.annotations?.current??this.lineAnnotations}getAnnotationsForFile(e){let{pendingData:t}=this;return t!=null&&li(e,t.file)?t.lineAnnotations:this.lineAnnotations}adoptRenderData(e){let{pendingData:t}=this,n=t!=null&&li(e,t.file);this.renderedData={file:e,lineAnnotations:n?t.lineAnnotations:this.lineAnnotations},n&&(this.pendingData=void 0)}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.getLatestAnnotations()?!1:t==null||e!==t.provided&&e!==t.current}updateInputFile(e,t){if(li(this.getInputFile(),e))return!1;this.editor?.__assertOutsideChangeCallback(`File.render`),this.fileRenderer.lineCuts.clear();let n=this.getLatestAnnotations();this.file=e;let{editSession:r}=this;return r?.annotations!=null&&t!=null&&(r.annotations=Ra(t,Zt,r.annotations)),r!=null&&this.replaceEditSession(e,r.annotations?.current??t??n),this.pendingData={file:this.editSession?.file??e,lineAnnotations:this.editSession?.annotations?.current??t??n},!0}replaceEditSession(e,t){let{editor:n,editSession:r}=this;this.installEditSession(e),n!=null&&r!=null&&n.__replaceDocument(e,!1,t)}installEditSession(e,t){let n=this.fileRenderer.startEditSession(e,t),r=this.editSession?.annotations??Ra(this.getLatestAnnotations(),Zt);this.editSession={file:n,inputFile:e,annotations:r},this.pendingData={file:n,lineAnnotations:r.current}}onMessagesChange(){this.rerender()}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(e.unsafeCSS!==this.options.unsafeCSS&&this.editor?.__setSearchPanelUnsafeCSS(e.unsafeCSS),this.options=e,this.fileRenderer.setOptions(Ha(e)),this.cachedHeaderHTML=void 0,this.syncInteractionOptions(),this.managersDirty=!0)}syncInteractionOptions(){this.interactionManager.setOptions(Ei(this.options,this.expandLine))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.editSession==null?this.applyCachedThemeState(e):this.onThemeChange())}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!Se(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){let t=this.editSession?.annotations;if(t!=null){if(!this.isNewAnnotations(e))return;za(t,e,Zt)}let n=this.getWorkingFile();n!=null&&(this.pendingData={file:n,lineAnnotations:e})}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.renderedData!=null&&(this.renderedData.lineAnnotations=e),this.pendingData=void 0,this.fileRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}get code(){return this.codeColumns.get(`code`)}set code(e){this.codeColumns.set(`code`,e)}getCodeScrollLeft(){return this.codeColumns.scrollLeft}setCodeScrollLeft(e){this.codeColumns.setScrollLeft(e)}applyChange(e,t,n={}){if(this.editSession==null)throw Error(`File.applyChange: requires an active edit session`);let{tokens:r,lineAnnotations:i}=n,{lineDelta:a,removedLineIds:o}=this.fileRenderer.applyChange(t,e,r);i!=null&&this.syncEditSessionAnnotationsFromEditor(i);let s=a!==0||o.length>0;return this.renderChange(s),this.fileContainer==null||this.editSession==null?{rebuiltLines:[]}:(s&&this.interactionManager.setSelectionDirty(),{rebuiltLines:this.takeRebuiltLines()})}renderChange(e){this.fileContainer!=null&&this.rerender()}applyTokens(e){this.editSession!=null&&this.fileRenderer.setTokens(e).some(e=>this.lineElement(e)!=null)&&this.rerender()}recordRowsWritten({changed:e,attributesReset:t,gutterRewritten:n}){for(let t of e)this.changedRowKeys.push(t),bi(t)||(this.managersDirty=!0);t&&this.interactionManager.setSelectionDirty(),(t||n)&&(this.managersDirty=!0)}lineElement(e){let{code:t}=this;if(t==null||this.editSession==null)return;let n=this.fileRenderer.lineKey(e);return n==null?void 0:this.columnReconcilers.get(t)?.elementFor(n)?.content}takeRebuiltLines(){let{changedRowKeys:e}=this;this.changedRowKeys=[];let t=[];for(let n of e){let e=this.fileRenderer.lineOfKey(n);e!=null&&t.push(e)}return t}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions(),themeType:this.options.themeType}}flushManagers(){if(this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options,t={overflow:e,disableAnnotations:e===`wrap`,columnVariables:this.shouldApplyColumnVariables(e)?`apply`:`measure`};(this.managersDirty||!an(t,this.appliedManagerSetup))&&(this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t.disableAnnotations,columnVariables:t.columnVariables}),this.appliedManagerSetup=t,this.managersDirty=!1)}shouldApplyColumnVariables(e){return e===`scroll`&&this.lineAnnotations.length>0}cleanUp(e=!1){let t=this.editor;bn(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),G.unsubscribe(this),this.renderRange=void 0,this.isComponentManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.renderedData=void 0,this.pendingData=void 0,this.pendingAttach=void 0),this.clearAuxiliaryNodes(),this.pre?.remove(),this.pre=void 0,this.codeColumns.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement?.remove(),this.headerElement=void 0,this.clearHeaderSlots(),this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0,this.editSession=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;if(!this.enabled)throw Error(`File.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`File.hydrate: hydrate can only be called before the instance has rendered or hydrated`);this.hydrateElements(t,n);let o=this.editor!=null;o||Za(this.pre,i,this.options.collapsed)||Qa(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,forceRender:o||e.forceRender,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),qa(e,t);for(let t of Array.from(e.shadowRoot?.children??[]))t instanceof SVGElement?this.spriteSVG=La(t):t instanceof HTMLElement&&(t instanceof HTMLPreElement?(this.pre=t,this.appliedPreAttributes=void 0):t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)?this.themeCSSStyle=t:t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)?(this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent):`diffsHeader`in t.dataset&&(this.headerElement=t,this.lastRenderedHeaderHTML=void 0));this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer??this.subscribeToChanges(),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.renderedData={file:e,lineAnnotations:t??this.getLatestAnnotations()},this.pendingData=void 0,this.file=e,this.fileRenderer.setOptions(Ha(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}syncRenderViewToEditor(){let{editor:e,fileContainer:t,renderRange:n}=this,r=this.getLatestAnnotations(),i=this.getWorkingFile();if(e==null||t==null||i==null)return;let a=a=>{this.enabled&&this.editor===e&&this.fileContainer===t&&this.getWorkingFile()===i&&e.__syncRenderView({highlighter:a,fileContainer:t,columns:this.editorColumns(),file:i,lineAnnotations:r,renderRange:n,domCurrent:this.fileRenderer.editorRenderReady()})},o=this.getTheme(),s=i.lang??I(i.name),c=R({theme:o,lang:s});c==null?y({themes:Ye(o),langs:Array.from(new Set([`text`,s])),preferredHighlighter:ii(this.workerManager,this.options)}).then(a).catch(e=>{e instanceof He||console.error(e)}):a(c)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(){}isReadyToEdit(){let e=this.getInputFile();return e!=null&&!this.fileRenderer.awaitsPoolHighlight(e)}async prepareForEditing(){if(this.isReadyToEdit())return;let e=this.__prepareForEditing();if(e==null)throw Error(`File.prepareForEditing: a file is required before editing`);if(await e,!this.isReadyToEdit())throw Error(`File.prepareForEditing: the file is not ready to edit`)}__prepareForEditing(){let e=this.getInputFile();if(e==null||this.isReadyToEdit())return;let{pendingAttach:t}=this;if(t?.file===e)return t.promise;let n={file:e,promise:this.awaitPoolHighlight(e)};return this.pendingAttach=n,n.promise=n.promise.finally(()=>{this.pendingAttach===n&&(this.pendingAttach=void 0)}),n.promise}async awaitPoolHighlight(e){await this.primeHighlightCache(e),this.enabled&&this.getInputFile()===e&&!this.fileRenderer.awaitsPoolHighlight(e)&&this.rerender()}__attachEditor(e){if(this.editor!=null)throw Error(`File.__attachEditor: an editor is already attached`);if(!this.isReadyToEdit())throw Error(`File.__attachEditor: the component is not ready to edit; await prepareForEditing() first`);this.editor=e;let t=()=>{this.editor=void 0,this.fileRenderer.endEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`File.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){if(this.editSession==null){let t=this.getInputFile();if(t==null)throw Error(`File.__attachEditor: a file is required before editing`);this.installEditSession(t,e.__getDocumentContents(t))}let t=this.editSession?.file;this.fileRenderer.editorRenderReady()?(t!=null&&this.fileRenderer.fileCache===t&&this.adoptRenderData(t),this.canAdoptEditorRows()?this.syncRenderViewToEditor():this.rerender()):this.rerender()}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n}=this;if(n==null)return;let{file:r,inputFile:i,annotations:a}=n,o=a?.provided??this.lineAnnotations;if(this.editor!=null)throw Error(`File.__completeEditSession: detach the editor before completing the session`);let s=a?.current,c,l=!1,u;if(t==null)throw Error(`File.__completeEditSession: editor is required for completion`);let d={...r},f={file:d,editor:t,originalFile:i,lineAnnotations:s,originalLineAnnotations:o};Object.freeze(f);try{if(t.__emitEditComplete(f),this.options.onEditComplete?.(f)===`accept`){if(d.cacheKey!=null&&d.cacheKey===i.cacheKey)throw Error(`File.__completeEditSession: an accepted file must not reuse the replaced file cacheKey`);c=d}}catch(e){l=!0,u=e}let p=e&&c!=null?c:i,m=e&&c!=null?s??o:o;if(e&&c!=null&&this.fileRenderer.lineCuts.clear(),this.editSession=void 0,this.file=p,this.pendingData={file:p,lineAnnotations:m},li(this.getRenderedFile(),p)&&this.adoptRenderData(p),this.fileContainer!=null&&(e?this.rerender():yn(this.handleEditSessionRender)),l)throw u}handleEditSessionRender=()=>{this.rerender()};render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);n=this.forceRenderOverride??n,this.forceRenderOverride=void 0,this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.hasThemeChanged(),f=o!=null&&(o.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(o),p=!li(this.getInputFile(),e);p&&this.updateInputFile(e,o);let m=this.getWorkingFile(e)??e;if(!c&&!n&&ea(u,this.renderRange)&&!p&&!f&&!d){let e=this.applyCachedThemeState(l);return e&&this.finalizeRender(),e}this.renderRange=u,p&&(this.cachedHeaderHTML=void 0),this.fileRenderer.setOptions(Ha(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),f&&(this.managersDirty=!0);let h=this.getFileForNextRender(m);this.fileRenderer.setLineAnnotations(this.getAnnotationsForFile(h));let{disableErrorHandling:g=!1,disableFileHeader:_=!1}=this.options;if(_&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.ensureSpriteSVG(t),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.fileRenderer.renderCollapsed(m);e!=null&&this.applyThemeState(t,e.themeStyles,l,e.baseThemeType),e?.headerAST!=null&&this.applyHeaderToDOM(e.headerAST,t,m),this.adoptRenderData(m),this.injectUnsafeCSS()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return this.finalizeRender(),r||this.emitPostRender(),!0}let v=this.editor?.__prepareRender(u);v!=null&&this.fileRenderer.setTokens(v);try{let e=this.getOrCreatePreNode(t),n=this.fileRenderer.renderFile(m,u);if(n==null)return!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t,n.file),this.applyRowsToDOM(n,e),this.applyBuffers(e,u),this.injectUnsafeCSS(),this.adoptRenderData(n.file),this.renderAnnotations(),this.renderGutterUtility(),a||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.codeColumns.cleanUp(),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}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.editor?.__captureFocusForDOMReplacement(),this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.setPlaceholderHeight(e)}setPlaceholderHeight(e){return this.placeHolder!=null&&(this.placeHolder.style.setProperty(`height`,`${e}px`),!0)}async primeHighlightCache(e=this.getInputFile()){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||qe(e))return;let n=this.options.tokenizeMaxLength??1e5;this.fileRenderer.getLineCount(e)>n||await t.primeFileHighlightCache(e).catch(e=>{ce(e)||console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeColumns.cleanUp(),this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isComponentManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,{renderedData:n}=this;if(t!=null&&n!=null){let{file:r,lineAnnotations:i}=n;for(let[n,a]of i.entries()){let i=this.getAnnotationSlotName(a),o=`${n}-${i}`,s=this.annotationCache.get(o);if(s==null||s.file!==r||!Oa(a,s.annotation)){s?.element.remove();let e=t(a,r);if(e==null)continue;s={element:Ma(i),annotation:a,file:r},s.element.appendChild(e),this.fileContainer.appendChild(s.element),this.annotationCache.set(o,s)}e.delete(o)}}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=Na();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options;this.pre?.toggleAttribute(`data-custom-styles`,!!e);let t=this.fileContainer?.shadowRoot;t!=null&&(e==null||e===``?(this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0):(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=Vr(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Kn(e),this.appliedUnsafeCSS=e))}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=Hn(i);this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c?this.appliedThemeCSS.theme=s:this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i?(this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}):(this.themeCSSStyle=Ga({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:qn(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c})}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=Jn(this.themeCSSStyle.textContent??``,Hn(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&En()}applyRowsToDOM(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e),this.changedRowKeys=[];let n=this.code=Ua({code:this.code});this.editor?.__captureFocusForDOMReplacement();let r=()=>{this.writeColumn(n,e),t.contains(n)||(t.replaceChildren(n),this.managersDirty=!0)};this.shouldGuardRebuildScroll()?Wa(t,r):r(),this.lastRowCount=e.rowCount}writeColumn(e,{column:t,patched:n,rowCount:r,allRowsChanged:i}){let a=this.getColumnPair(e);a==null?(a=this.createColumns(e,r),this.managersDirty=!0):r!==this.lastRowCount&&(a.gutter.style.setProperty(`grid-row`,`span ${r}`),a.content.style.setProperty(`grid-row`,`span ${r}`));let o=this.columnReconcilers.get(e);if(o??(o=new hi(a.gutter,a.content),this.columnReconcilers.set(e,o),!i&&a.content.childElementCount>0&&o.adopt(t)),i){o.replaceAll(t);for(let e of t)this.changedRowKeys.push(e.key);this.interactionManager.setSelectionDirty(),this.managersDirty=!0}else this.recordRowsWritten(o.reconcile(t,n))}canAdoptEditorRows(){let{code:e,columnReconcilers:t,fileRenderer:n}=this;return e==null||t.has(e)&&!n.lineCuts.hasCutRows}createColumns(e,t){let n=ue();n.properties.style=`grid-row: span ${t}`,e.innerHTML=ft([n,ta([],t)]);let r=this.getColumnPair(e);if(r==null)throw Error(`File.createColumns: the columns did not parse`);return r}editorColumns(){let e=this.codeColumns.get(`code`),t=e==null?void 0:this.getColumnPair(e);if(e!=null&&t!=null)return{code:e,gutter:t.gutter,content:t.content,deletions:void 0}}getColumnPair(e){let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&t.dataset.gutter!=null&&n.dataset.content!=null)return{gutter:t,content:n}}applyBuffers(e,t){t==null||this.shouldDisableVirtualizationBuffers()?(this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)):(t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0))}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??ft(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isComponentManaged)return;let{renderHeaderPrefix:i,renderHeaderFilenameSuffix:a,renderCustomHeader:o,renderHeaderMetadata:s}=this.options;if(o!=null){let e=o(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Ce,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=a?.(n)??void 0,o=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,A,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,oe,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,le,o),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),n??this.subscribeToChanges(),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:ei(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):ei(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});this.spriteSVG??=Ia(),this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeColumns.cleanUp(),t.appendChild(this.pre),this.managersDirty=!0):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0,this.managersDirty=!0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.codeColumns.cleanUp();for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};ka(i,this.appliedPreAttributes)||(Ja(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Za(e,t,n=!1){return!n&&e==null&&t!=null}function Qa(e,t,n=!1){return e==null&&t!=null&&!n}var $a=5e3,eo=new Map,to=-1;function no(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS}var ro=class extends Xa{virtualizer;metrics;__id=`virtualized-file:${++to}`;renderType=`virtualized`;top;height=0;unmeasured=!1;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0,ghostTextRows:eo};pendingRender;isVisible=!1;isSetup=!1;layoutDirty=!0;currentCollapsed;constructor(e,t,n=D,r,i){super(e,r,i),this.virtualizer=t,this.metrics=n}getLineCutsForSearch(){let{fileRenderer:e,options:t}=this;return{cutLength:e.getLineCutLength(t),expandedLines:e.lineCuts.expandedLines}}setMetrics(e,t=!1){let n=st(e);(t||!an(this.metrics,n))&&(this.metrics=n,this.resetMeasurements(),this.invalidateLayout())}setLineAnnotations(e){this.syncLineAnnotations(e)&&(this.forceRenderOverride=!0)}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),this.managersDirty=!0,!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.forceRenderOverride=!0,!0):!1}hasLineAnnotations(){return this.getLayoutAnnotations().some(e=>e.lineNumber>0)}hasUniformLineHeights(){let{overflow:e=`scroll`}=this.options;return e===`scroll`&&!this.hasLineAnnotations()&&this.cache.heights.size===0&&this.cache.ghostTextRows.size===0}currentGhostTextRows(){return this.editor?.__getGhostTextRows()??eo}getLineHeight(e,t=!1){let{cache:n}=this,r=n.heights.get(e);if(n.ghostTextRows.size===0)return r??this.metrics.lineHeight*(t?2:1);let{lineHeight:i}=this.metrics;return(r??i*(t?2:1))+(n.ghostTextRows.get(e)??0)*i}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!on(t,e),r=no(t,e);super.setOptions(e),r&&(this.resetMeasurements(),this.invalidateLayout({forceSimpleRecompute:!0})),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetMeasurements(){this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.ghostTextRows=eo}invalidateLayout({forceSimpleRecompute:e=!1,resetRenderRange:t=!0}={}){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.renderRange!=null&&t&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){let e=!1;if(this.unmeasured=!1,this.fileContainer==null||this.getLayoutFile()==null)return this.height!==0&&(e=!0),this.height=0,e;let{overflow:t=`scroll`}=this.options;this.top=this.getVirtualizedTop();let n=this.currentGhostTextRows();ui(n,this.cache.ghostTextRows)||(e=!0),this.cache.ghostTextRows=n;let r=t!==`scroll`||this.lineAnnotations.length>0||typeof process<`u`&&!1;if(this.placeHolder!=null||!r&&this.cache.heights.size===0&&this.cache.fileAnnotationHeight===0)return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let{lineHeight:i}=this.metrics;if(this.code==null)return e;let a=this.code.children[1];if(!(a instanceof HTMLElement))return e;for(let t of a.children){if(!(t instanceof HTMLElement))continue;let n=t.dataset.lineIndex;if(n==null)continue;let a=Number(n),o=this.cache.heights.get(a);if(!r&&o==null)continue;let s=t.getBoundingClientRect().height;if(s===0){this.unmeasured=!0;break}let c=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(c=!0),s+=t.nextElementSibling.getBoundingClientRect().height);let l=o??i*(c?2:1);s!==l&&(e=!0,s===this.metrics.lineHeight*(c?2:1)?this.cache.heights.delete(a):this.cache.heights.set(a,s))}if(!this.unmeasured&&this.renderRange!=null&&pi(this.renderRange)){let t=io(a)??0;t!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=t,e=!0)}return e&&this.computeApproximateSize(!0),e}onRender=e=>{let t=this.getInputFile();return this.fileContainer==null||t==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:t}))};updateCodeViewLayout(e,t,n,r){let i=!li(this.getInputFile(),e);i&&this.updateInputFile(e,r);let{pendingRenderFile:a,layoutFileChanged:o,renderedFileChanged:s,annotationsChanged:c}=this.updatePendingRender(e,r),l=n?.resetFileLayoutCache===!0||o;n?.metrics!=null&&(this.metrics=n.metrics,l=!0);let{collapsed:u=!1}=this.options;return this.currentCollapsed!==u&&(this.currentCollapsed=u,l=!0),l&&(this.resetMeasurements(),this.invalidateLayout()),i&&(this.layoutDirty=!0),!this.forceRenderOverride&&(i||s||c)&&(this.forceRenderOverride=!0),this.top=t,this.computeApproximateSize(!1,a),this.height}getLayoutFile(){return this.pendingRender?.file??this.getRenderedFile()}getLayoutAnnotations(){let{pendingRender:e}=this;return e==null?this.lineAnnotations:this.getAnnotationsForFile(e.file)}getLinePosition(e){let t=this.getLayoutFile();if(t==null||e<1)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options,i=this.fileRenderer.getLineCount(t)-1;if(r)return{top:Ee(this.metrics,n),height:0};let a=ot(this.metrics,n);if(i<0)return{top:a,height:0};let o=Math.min(Math.max(e-1,0),i),{lineHeight:s}=this.metrics;if(a+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())return{top:a+o*s,height:s};let c=this.getLayoutCheckpointBeforeLineIndex(o);a=c?.top??a;for(let e=c?.lineIndex??0;e<o;e++)a+=this.getLineHeight(e,!1);return{top:a,height:this.getLineHeight(o,!1)}}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}scrollToLine(e,t,n){let{virtualizer:r}=this;r.type===`advanced`?r.scrollToInstanceLine(this,e,t,n):r.scrollSpanIntoView({align:t,onDone:n,resolveSpan:()=>{let t=this.getLinePosition(e);return t==null?void 0:{top:this.getVirtualizedTop()+t.top,height:t.height}}})}cancelScroll(e){this.virtualizer.cancelScroll(e)}getRenderedBounds(){let e=this.renderRange;if(!(!this.enabled||e==null||e.totalLines<=0))return{top:ot(this.metrics,this.options.disableFileHeader??!1)+(e.startingLine===0?this.cache.fileAnnotationHeight:e.bufferBefore),bottom:this.height-me(this.metrics)-e.bufferAfter}}getNumericScrollAnchor(e){let t=this.getLayoutFile();if(t==null||this.renderRange==null)return;let{disableFileHeader:n=!1,collapsed:r=!1}=this.options;if(r||this.renderRange.totalLines<=0)return;let i=this.fileRenderer.getLineCount(t)-1;if(i<0)return;let a=ot(this.metrics,n),o=Math.min(this.renderRange.startingLine,i),s=Math.min(o+this.renderRange.totalLines-1,i);if(s<o)return;let{fileAnnotationHeight:c}=this.cache;if(this.hasUniformLineHeights()){let{lineHeight:t}=this.metrics,n=a+(o===0?c:this.renderRange.bufferBefore),r=o+Math.max(Math.ceil((e-n)/t),0);return r>s?void 0:{lineNumber:r+1,top:a+c+r*t}}let l=a+(o===0?c:this.renderRange.bufferBefore);for(let t=o;t<=s;t++){if(l>=e)return{lineNumber:t+1,top:l};l+=this.getLineHeight(t)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutFile();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!li(this.getRenderedFile(),this.getWorkingFile()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetMeasurements(),this.invalidateLayout()),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.getLayoutFile()){if(!e&&!this.layoutDirty)return;if(this.height,this.height=0,this.cache.checkpoints=[],t==null){this.layoutDirty=!1;return}this.cache.ghostTextRows=this.currentGhostTextRows();let{disableFileHeader:n=!1,collapsed:r=!1}=this.options,{lineHeight:i}=this.metrics,a=this.fileRenderer.getLineCount(t);if(r){this.height+=Ee(this.metrics,n),this.layoutDirty=!1;return}let o=ot(this.metrics,n),s=me(this.metrics);if(this.height+=o,this.height+=this.cache.fileAnnotationHeight,this.hasUniformLineHeights())this.height+=a*i;else for(let e=0;e<a;e++)this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1);a>0&&(this.height+=s),this.layoutDirty=!1}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.getInputFile()==null)return;let e=this.getWorkingFile(),t=e==null?void 0:this.getFileForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.isSimpleMode()&&this.requestRender()||this.virtualizer.instanceChanged(this,!li(this.getRenderedFile(),t))}get isComponentManaged(){return this.getAdvancedVirtualizer()?.isComponentManaged??super.isComponentManaged}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}renderChange(e){e?(this.getSimpleVirtualizer()?.markDOMDirty(),this.invalidateLayout({forceSimpleRecompute:this.isSimpleMode(),resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)):this.rerender()}applyChange(e,t,n){return ci(t)&&this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyChange(e,t,n)}render({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:r,...i}){let a=!li(this.getInputFile(),t);a&&(this.updateInputFile(t,r),this.cachedHeaderHTML=void 0);let{pendingRenderFile:o,layoutFileChanged:s,renderedFileChanged:c,annotationsChanged:l}=this.pendingRender!=null&&this.pendingRender.workingFile===(this.getWorkingFile(t)??t)?{pendingRenderFile:this.pendingRender.file,layoutFileChanged:!1,renderedFileChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(t,r),{forceRenderOverride:u,isSetup:d}=this;if(this.forceRenderOverride=void 0,s&&(this.resetMeasurements(),this.invalidateLayout()),e=this.getOrCreateFileContainerNode(e),d)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,o));else{this.computeApproximateSize(!1,o);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFile.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!a||!d))return this.renderPlaceholder(this.height);let f=this.virtualizer.getWindowSpecs(),p=this.top??0,m=this.computeRenderRangeFromWindow(o,p,f);return super.render({file:t,fileContainer:e,renderRange:m,lineAnnotations:r,forceRender:(u??n)||l||c||a,...i})}finalizeRender(){if(this.getRenderedFile()!==this.pendingRender?.file)throw Error(`VirtualizedFile.render: rendered a different file than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getWorkingFile(e)??e,r=this.getRenderedFile(),i=this.pendingRender?.file??r,a=this.getFileForNextRender(n);return this.pendingRender={workingFile:n,file:a},{pendingRenderFile:a,annotationsChanged:this.syncLineAnnotations(t),layoutFileChanged:!li(i,a),renderedFileChanged:!li(r,a)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}addLayoutCheckpoint(e,t){e%$a===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFile: invalid checkpoint index`);if(n.lineIndex%t===0)return n}}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1}=this.options,{hunkLineCount:a,lineHeight:o}=this.metrics,s=this.fileRenderer.getLineCount(e),c=this.height,l=ot(this.metrics,i),u=s>0?me(this.metrics):0,{fileAnnotationHeight:d}=this.cache,f=l+d,p=Math.max(0,c-l-d-u),m=di(this.getLayoutAnnotations()),h=t+l,g=d>0&&m&&h<r&&h+d>n;if(t<n-c||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};if(s<=a)return{startingLine:0,totalLines:a,bufferBefore:0,bufferAfter:0};let _=Math.ceil(Math.max(r-n,0)/o),v=Math.ceil(_/a)*a+a,y=v/a,b=(n+r)/2;if(this.hasUniformLineHeights()){let e=t+f,i=e+p;if(!g&&!(e<r&&i>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u};let m=g&&b<e?0:(b-e)/(o*a),h=Math.round(m-y/2),_=Math.ceil(s/a),x=Math.max(0,Math.min(h,_))*a,S=h<0?v+h*a:v,C=x===0?0:d+x*o,w=Math.min(S,s-x);return{startingLine:x,totalLines:S,bufferBefore:C,bufferAfter:Math.max(0,(s-x-w)*o)}}let x=y,S=[],C=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-v*o*2),a),w=t+(C?.top??f),T=C?.lineIndex??0,E,D,O=C?.lineIndex??0;for(let e=O;e<s;e++){let i=T%a===0,o=Math.floor(T/a);if(i&&(S[o]=w-(t+f),D!=null)){if(D<=0)break;D--}let s=this.getLineHeight(e,!1);w>n-s&&w<r&&(E??=o),D==null&&w>=r&&i&&(D=x),T++,w+=s}if(E==null){if(g)E=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-l-u}}let k=Math.max(0,Math.ceil(s/a)-y),A=Math.min(E,k),j=A*a,M=S[A]??0,N=j===0?0:d+M,ee=A+y,P=ee<S.length?p-S[ee]:p-(w-t-f);return{startingLine:j,totalLines:v,bufferBefore:N,bufferAfter:Math.max(0,P)}}};function io(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===`-1,-1`&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}async function ao(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function oo({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s,includeTrailingNewline:c=!1,showNoNewlineMarkers:l=!0}){let u=ot(t,n),d=u,f=i?!0:a,p=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=et({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:f,hunkIndex:n,collapsedContextThreshold:o}),m=(a.fromStart+a.fromEnd)*t.lineHeight;if(u+=m,d+=m,a.collapsedLines>0){let e=je({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;u+=e,d+=e}if(u+=i.splitLineCount*t.lineHeight,d+=i.unifiedLineCount*t.lineHeight,l){let e=so(i);u+=e.split*t.lineHeight,d+=e.unified*t.lineHeight}let h=n===p?Fe({fileDiff:e,hunkIndex:n,expandedHunks:f,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(h!=null){let e=(h.fromStart+h.fromEnd)*t.lineHeight;if(u+=e,d+=e,h.collapsedLines>0){let e=Ne({type:r,metrics:t})?.totalHeight??0;u+=e,d+=e}}else if(n===p&&e.isPartial&&s){let e=Ne({type:r,metrics:t})?.totalHeight??0;u+=e,d+=e}c&&n===p&&(h?.collapsedLines??0)===0&&w(e,`additions`)&&(u+=t.lineHeight,d+=t.lineHeight)}if(e.hunks.length>0){let e=me(t);u+=e,d+=e}return{splitHeight:u,unifiedHeight:d}}function so(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type===`context`){let e=+(t.lines>0);return{split:e,unified:e}}return co(e,t)}function co(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}function lo({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function uo(e){return e.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))}))}function fo(e){return{...e,hunks:uo(e.hunks),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}var po=1;function mo(e,...t){return`ck${po}:${JSON.stringify([e,...t])}`}function ho(e){return e===``?[]:e.split(ne)}function go(e,t,n,r={}){let i=e===`clone`?fo(t):t;if(!i.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(i.type){case`change`:case`rename-changed`:return _o(i,yo(i,n),bo(i,n),r);case`rename-pure`:{let e=bo(i,n);xo(i,n);let t=ho(e.contents);return i.isPartial=!1,i.deletionLines=t,i.additionLines=t,i.deletionCharacterCount=e.contents.length,i.additionCharacterCount=e.contents.length,Co(i,null,e,r),i}}throw Error(`hydratePartialDiff: ${i.type} diffs cannot be hydrated from loaded files`)}function _o(e,t,n,r){let i=ho(t.contents),a=ho(n.contents),{hunks:o,splitLineCount:s,unifiedLineCount:c}=vo(e.hunks,a.length);return e.hunks=o,e.splitLineCount=s,e.unifiedLineCount=c,e.isPartial=!1,e.deletionLines=i,e.additionLines=a,e.deletionCharacterCount=t.contents.length,e.additionCharacterCount=n.contents.length,Co(e,t,n,r),e}function vo(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent)e.type===`context`?(p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines):(p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions);let m=Math.max(We(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=B(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=B(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function yo(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function bo(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function xo(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function So(e,t,n,r){return e.cacheKey==null?wo(t,n,r):`${e.cacheKey}:hydrated`}function Co(e,t,n,r){let i=So(e,t,n,r);i==null?delete e.cacheKey:e.cacheKey=i}function wo(e,t,n){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?mo(n.disableLineMatching===!0?`hydrated-files-raw`:`hydrated-files`,e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}var To=new TextEncoder,Eo=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Do=[`ignoreWhitespace`,`stripTrailingCr`,`context`,`headerOptions`],Oo,ko,Ao,jo,Mo,No,Po=32<<20,Fo;function Io(e){Oo=e,ko=void 0}function Lo(){let e=ko??Oo(),{exports:t}=new WebAssembly.Instance(e,{});ko=e,Ao=t.memory,jo=t.diff,Go();try{crypto.getRandomValues(Mo.subarray(1016,1024)),Mo[1016]|=1}catch{}}function Ro(e,t,n){return Vo(n,`diffChars`),Ho(1,e,t)}function zo(e,t,n){return Vo(n,`diffWordsWithSpace`),Ho(2,e,t)}function Bo(e,t,n,r,i,a,o){if(o?.newlineIsToken??!1)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);Vo(o,`createTwoFilesPatch`,Do);let s=o?.headerOptions,c=o?.context,l=c===void 0?4:c===null||c===!1?0:c;if(!(Number.isInteger(l)&&l>=0)&&l!==1/0)throw Error(`options.context must be a non-negative integer`);return Ho(3,n,r,o,Math.min(l,0xfffffff),(s?(s.includeIndex??!1?1:0)|(s.includeUnderline??!1?2:0)|(s.includeFileHeaders??!1?4:0):7)|(e===void 0?0:8)|(t===void 0?0:16),[e===void 0?``:String(e),t===void 0?``:String(t),i?String(i):``,a?String(a):``])}function Vo(e,t,n){if(typeof e==`function`)throw Error(`callbacks are not supported by @pierre/patches`);if(e!=null){for(let[r,i]of Object.entries(e))if(i!=null&&i!==!1&&!(n?.includes(r)??!1))throw Error(`options.${r} is not supported by @pierre/patches ${t}`)}}function Ho(e,t,n,r,i=0,a=0,o){if(typeof t!=`string`||typeof n!=`string`)throw TypeError(`expected the texts to diff to be strings`);if((r?.stripTrailingCr??!1)&&(t=t.replaceAll(`\r
182
+ `,`
183
+ `),n=n.replaceAll(`\r
184
+ `,`
185
+ `)),t.length>=268435456||n.length>=268435456)throw Error(`out of memory`);ko===void 0&&Lo();let s=65600+(t.length+n.length)*3;if(o!==void 0)for(let e of o)s+=e.length*3;if(s>Mo.length){try{Ao.grow(Math.ceil((s-Mo.length)/65536))}catch{throw Error(`out of memory`)}Go()}Fo=!1;let c=Uo(t,65536),l=Uo(n,65536+c);if(o!==void 0){let e=65536+c+l;for(let t=0;t<4;t++){let n=Uo(o[t],e);No.setUint32(28+t*4,n,!0),e+=n}}No.setUint32(0,e|a<<16|(c===t.length?1<<24:0)|(l===n.length?2<<24:0)|(r?.ignoreWhitespace??!1?4<<24:0),!0),No.setUint32(4,c,!0),No.setUint32(8,l,!0),No.setUint32(24,i,!0),jo(),Mo.length===0&&Go();let u=No.getUint32(16,!0);if(Mo[1]===0){let e=Eo.decode(Mo.subarray(u,u+No.getUint32(12,!0)));throw Ko(),Error(e)}let d;if(e===3){let e=Mo.subarray(u,u+No.getUint32(20,!0));d=``;let t=0;if(Fo)for(let n=e.indexOf(237);n!==-1;n=e.indexOf(237,n+1))e[n+1]<160||(d+=Eo.decode(e.subarray(t,n))+String.fromCharCode(53248|(e[n+1]&63)<<6|e[n+2]&63),t=n+3);d+=Eo.decode(e.subarray(t))}else{let e=No.getUint32(12,!0);d=Array(e);for(let r=0;r<e;r++,u+=16){let e=Mo[u]===1;d[r]={count:No.getUint32(u+4,!0),added:Mo[u]===2,removed:e,value:(e?t:n).slice(No.getUint32(u+8,!0),No.getUint32(u+12,!0))}}}return Ko(),d}function Uo(e,t){if(e.length<256)return Wo(e,t);let n=To.encodeInto(e,Mo.subarray(t)).written;return n===e.length||(e.isWellFormed?.()??!1)?n:Wo(e,t)}function Wo(e,t){let n=t;for(let t=0;t<e.length;t++){let r=e.codePointAt(t);r<128?Mo[n++]=r:(r<2048?Mo[n++]=192|r>>6:(r<65536?(Mo[n++]=224|r>>12,(r&63488)==55296&&(Fo=!0)):(Mo[n++]=240|r>>18,Mo[n++]=128|r>>12&63,t++),Mo[n++]=128|r>>6&63),Mo[n++]=128|r&63)}return n-t}function Go(){Mo=new Uint8Array(Ao.buffer),No=new DataView(Ao.buffer)}function Ko(){if(Mo.length>Po)try{Lo()}catch{}}var qo=`AGFzbQEAAAABRgtgA39/fwF/YAF/AX9gAABgAn9/AX9gBX9/f39/AX9gAn9/AGAEf39/fwF/YAV/f39/fwBgAAF/YAZ/f39/f38Bf2ABfwADFBMCAQEDAAUEAQMGAAAHBAgJAAoCBQMBAAIGWxJ/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAt/AUEAC38BQQALfwFBAAsHEQIGbWVtb3J5AgAEZGlmZgASDAEECvMpExUAQQEkAEEMQQ02AgBBEEGACDYCAAs+ACAAQQFrQRB2QQFqPwBrIgBBAEoEQCAAPwBBAnZqQABBf0YEQCAAQABBf0YEQEEADwsLCz8AQRB0JAJBAQs5AQF/IwFBB2pBeHEiASAAaiIAIwFJBEAQAEEADwsgACMCSwRAIAAQAUUEQBAAQQAPCwsgACQBIAELPAEBf0G7CCECA0AgAkEBayICIAFBCnBBMGo6AAAgAUEKbiIBDQALIAAgAkG7CCACayIB/AoAACAAIAFqC2YAIAJBCEkEQCAAKQMAIAEpAwCFQn9BCCACa0EDdK2Ig1APCyAAIAJqQQhrIQIDQCAAKQMAIAEpAwBRBEAgAUEIaiEBIAIgAEEIaiIASw0BIAIpAwAgASACIABraikDAFEPCwtBAAuDAQECfwJAIAAtAAAiAkHCAWtBMksNACABIAJBGHRBf3NnIgEgAGpJDQAgACgCACEDIAEkBCACQf8AIAF2cSECA0AgA0EIdiIDQcABcUGAAUcNASADQT9xIAJBBnRyIQIgAUEBayIBQQFLDQALIAIkAw8LIAAtAABBgIDEAGokA0EBJAQLxAECAn8BeyAAIAEgAkECdGooAgBqIQUgACABIAIgA2pBAnRqKAIAaiEAIAQEQCAAIAVrDwsDQCAAIAVLBEBB//8DIQEgACAFayICQRBJBEBBASACdEEBayEBCyAGIAX9AAQAIgf9DMDAwMDAwMDAwMDAwMDAwMD9Tv0MgICAgICAgICAgICAgICAgP0j/WRB//8DcyABcWkgB/0M8PDw8PDw8PDw8PDw8PDw8P0s/WQgAXFpamohBiAFQRBqIQUMAQsLIAYLQwEBfyAAQaABRiAAQYAtRnIgAEGAQGoiAUEKTSABQShrQQFNcnIgAUEvRiABQd8ARnIgAEGA4ABGIABB//0DRnJycgsvAQF/IAAtAAAiAkGAAUkEQEEBJAQgAkEgRiACQQlrQQRNcg8LIAAgARAFIwMQBwupAgIEfwJ7IAAhBANAAkADQAJAIARBEGogAUsNACAE/QAEACII/WQNACADIAZBAnQiB2oiBSAI/YkBIgn9qQH9CwQAIAUgCf2qAf0LBBAgBSAI/YoBIgj9qQH9CwQgIAUgCP2qAf0LBDAgAiAHaiIFQUBrIQcgBCAAa/0R/QwAAAAAAQAAAAIAAAADAAAA/a4BIQgDQCAFIAj9CwQAIAj9DAQAAAAEAAAABAAAAAQAAAD9rgEhCCAHIAVBEGoiBUsNAAsgBkEQaiEGIARBEGohBAwBCwsgAiAGQQJ0aiAEIABrNgIAIAEgBE0NACAELQAAIgVBgAFJBEAgBSQDQQEkBAUgBCABEAULIAMgBkECdGojAzYCACAGQQFqIQYgBCMEaiEEDAELCyAGC8kBAQZ/IAAhBCACIQVBAyEHA0AgASAESwRAIAUgBCAAazYCACAELQAAIgZBgAFJBH8gBEEBaiEEIAYtAEAFIAQgARAFIAQjBGohBCMDIgNBIHJB9wFHIANBwAFrQZcETXEgA0HHBUdxIANBrQFGciADQd4Fa0EhTSADQYA8a0H/AU1yciADEAdBAXRyCyEDIAUgAyAIIAZBCkZxckUgAyAHR3JBAnRqIQUgAyEHIAZBDUYhCAwBCwsgBSABIABrNgIAIAUgAmtBAnYL0QEBBH8gACEEIAIiBUEANgIAA0AgASAESwRAIAT9AAQA/QwKCgoKCgoKCgoKCgoKCgoK/SP9ZCAE/QAEEP0MCgoKCgoKCgoKCgoKCgoKCv0j/WRBEHRyIQMgASAEayIGQSBJBEAgA0EBIAZ0QQFrcSEDCwNAIAMEQCAFQQRqIgUgBCAAa0EgaiADQQAgA2txZ2s2AgAgAyADQQFrcSEDDAELCyAEQSBqIQQMAQsLIAEgAGsiACAFKAIARwRAIAVBBGoiBSAANgIACyAFIAJrQQJ2C4UEAgZ/BH4gASEJIAFBBGohCCAEBEAgAyEJIAJBAnQQAiIIRQRADwsDQCACIAdLBEAgACABIAdBAnRqIgQoAgBqIQYgACAEKAIEaiEEA0AgBCAGSwRAIAYgBBAIBEAgBiMEaiEGDAILCwsDQAJAIAQgBk0NACAEIQUDQCAFQQFrIgUtAABBwAFxQYABRg0ACyAFIAQQCEUNACAFIQQMAQsLIAdBAnQiBSADaiAGIABrNgIAIAUgCGogBCAAazYCACAHQQFqIQcMAQsLCyMFIQojBiEHA0AgAgRAIAJBAWshAiAAIAgoAgBqIAAgCSgCAGoiAWshBSADAn8gASgCAEEBIAVBA3R0QQFrcSAFQRh0ciAFQQRJDQAaQgAhCyAFrSEMQfgHKQMAIQ0gASIEIAVBAWtBeHFqIQYDQCAEIAZJBEAgDCAEKQMAhSANfkIgiiALIQwhCyAEQQhqIQQMAQsLIAcgDCAGKQMAQn9BACAFa0EHcUEDdK2Ig4UgDX4gC4UiC0IgiCALhaciBEEQdiAEc3EhBANAAkAgCiAEQQN0aiIGKAIARQRAIAYgATYCACAGIAU2AgQMAQsgBigCBCAFRgRAIAYoAgAgASAFEAQNAQsgBEEBaiAHcSEEDAELCyAEQYCAgIB4cgs2AgAgCUEEaiEJIAhBBGohCCADQQRqIQMMAQsLC98DAQd/IxAgACAEayABakkEQCAAJAFBCBACIglFBEBBAA8LIwIhCiAJIgAgBGshCwNAIAIgA00EQCACKAIAQYCBgoR4RwRAIAJBBGoiBigCACEFA0ACQCAFRQRAIAZBADYCAAwBCyAFQXxxIgcoAgAiCEEDcUEDRgRAIAYgCEF8cTYCAAwBCyAKIABrQQhJBEAgACQBQQgQAkUEQEEADwsjAiEKCyAGIAAgC2siBjYCACAHIAZBA3I2AgAgBUEedEEBciAHKAIEIAVBA3EbIQYgCCEFA0ACQCAFRQ0AIAVBHnRBAXIgBUF8cSIIKAIEIAVBA3EbIgcgBnNBHnYNACAIKAIAIgVBA3FBA0YEQCAAIAVBfHEgC2oiBSgCADYCACAAIAYgBSgCBEH/////A3FqNgIEIABBCGohAAwDBSAGIAdB/////wNxaiEGDAILAAsLIAAgBjYCBCAAIgZBCGohAAwBCwsLIAJBCGohAgwBCwsgBCAJIAAgCWsiAvwKAAAgAiAEaiEAQYCAgAIgAkEBdCICIAJBgICAAk0bJBALIAEjAiAAa0sEQCAAJAEgARACRQRAQQAPCwsjAiQRIAEgBCMQaiAAayICSSACIwIgAGtJcQRAIAAgAmokEQsgAAv7BQIVfwF7QYCAgIABJBAjDCIOIw0iD2oiDEH8////AEsEQBAAQQAPCyAMQQJqQQR0IgpBEGoQAiIERQRAQQAPCyAEIAxBA3RqIgYhByAEIApqIQIjAiEQIAZBgIGChHg2AgAgBkGAgYKEeDYCECMKQQRqIRIjC0EEaiETQYCAgIB8IQRBgICAgAQhCkF/IQMDQCASIANBAnRqIgAoAgAgEyADIAFrQQJ0aiIRKAIARgRAIAAhCyAAIA4gA2tBAWsiDSAPIANrIAFqQQFrIhRKBH8gFAUgDQtBAnRqIg0DfyAAIA1JBH8gAP0ABAAgEf0ABAD9NyIV/aMBBH8gAEEQaiEAIBFBEGohEQwCBSAAQfwAaiAV/aQBIgBBAWogAEF/c3FnQQJ0awsFIAALCyIAIAAgDUsbIAtrQQJ2IgAEfyAAIANqIQMgAiAINgIAIAIgADYCBCACIghBCGoFIAILIQILIAMgAWtBAWogD04hCyADQQFqIA5OBEAgCwRAIAIkASAIDwsgCUEARyABQQFrIgAgCkhxBH8gACIKBSAFCyEFCyAHIAM2AgggByAINgIMIAsEQCAJQQBHIAFBAWoiACAESnEEQCAAIQQLCyABQQJqIQEDQCABIAVKBEAgCUEBaiIJIAxKBEAACyAGIAlBA3QiBWtBgIGChHg2AgAgBSAGakGAgYKEeDYCECAEQQAgCWsiAUoEQCAEIQELIAogCSIFSARAIAohBQsgCUEBakEEdCIAIBAgAmtLBEAgAiAAIAYgAUEDdGogBiAFQQN0akEQaiAGIAxBA3RqQSBqEA0iAkUEQEEADwsjESEQCwwBCyAGIAFBA3RqIgcoAgAhACAHQYCBgoR4NgIAIAcoAhAiCCABayAPSSILIABBAWogDkkiA3JFBEAgB0GAgYKEeDYCCCABQQJqIQEMAQsLIAggAEEBaiADRSALIAAgCEhxciIAGyEDIAIgByAAQQR0aigCBDYCACACIABBAWpqIQggAkEEaiECDAALAAvtAgEDfyAAIAE2AgACfyAAQQRqIgdBAWohAEEBIQgDQCADIAZLBEACfwJAIAIgBmotAAAiAUEHa0EGTQRAIAFBowhqLQAAIQEMAQsgAUEiRiABQdwARnINACABQSBrQd4ATQRAIAAgAToAACAAQQFqDAILQQAhCCABQe0BRiACIAZqLQABQaABT3EEQCAAQtzm1LnDy8ybNzcDACAAQdzk3KkDNgIIIAZBAmohBiAAQQxqDAILIABB3AA6AAAgACABQQZ2QTBqOgABIAAgAUEDdkEHcUEwajoAAiAAIAFBB3FBMGo6AAMgAEEEagwBC0EAIQggACABQQh0QdwAcjsBACAAQQJqCyEAIAZBAWohBgwBCwsgCARAIAcgAiAD/AoAACADIAdqDAELIAdBIjoAACAAQSI6AAAgAEEBagshACAFBEAgAEEJOgAAIABBAWoiACAEIAX8CgAAIAAgBWohAAsgAEEKOgAAIABBAWoLHAAgACABIAJFaxADIgBBLDoAACAAQQFqIAIQAwvhBgEXfyMPIgtBBGpBBnQjDCMNakEFdGpBBCgCAEEIKAIAampBJCgCAEEoKAIAakEcKAIAQSAoAgBqQQVsamoQAiIMRQRADwsgDCEBQSAoAgAhBEEkKAIAIQdBKCgCACEKIwdBCCgCAGoiBUEcKAIAIgJqIQZBAi0AACIJQRlxQRlGBEAgBSAGIAIQBCACIARGcQRAIAFCydyRq4bPjpAgNwMAIAFBB2oiASAFIAL8CgAAIAEgAmoiAUEKOgAAIAFBAWohAQsLIAlBAnEEQCABQT1BwwD8CwAgAUEKOgBDIAFBxABqIQELIAlBHHFBHEYEfyABQa3atIECIAUgAiAEIAZqIgEgBxAPQavWrIECIAYgBCABIAdqIAoQDwUgAQshAkEBIQVBASEGA0AgCCALTARAQQAhBCAIIAtIBEAjDiAIQQJ0aigCACEECyAEQf////8DcSEBIARBHnYEQCANRQRAQQEhDSADIAAgAyAAIANIGyIDayEWIAUgA2shDiAGIANrIQ8gCEEBayESCyAEQQBIBEAgASAGaiEGBSABIAVqIQULBSANIAggC0EBa0ggASAAQQF0THFFcQRAQQAhDSACQcCAgekCNgIAIAJBBGogDiAAIAEgACABSBsiEyAFIA5rahAQIgNBoNYAOwEAIANBAmogDyAGIA9rIBNqEBAiA0GggIHSADYCACADQQRqIQIgEiEDIBYhBCAOQQFrIQkgD0EBayEKA0BBACEHIAMgC0kEQCMOIANBAnRqKAIAIQcLIBMgB0H/////A3EgAyAIRhshF0GAgAQjByAHQQF0QQBIIhAbIRQDQCAEIBdIBEAgAkEtQStBICAHQQBIGyAQGzoAACMIIAlBAnRqIwkgCkECdGogEBsiESgCBCARKAIAayEVIAJBAWoiAiAUIBEoAgBqIBX8CgAAIAIgFWohAiAUIBEoAgRqQQFrLQAAQQpHBEAgAkGNCEEd/AoAACACQR1qIQILIAkgB0EATmohCSAKIBBFaiEKIARBAWohBAwBCwsgAyAIRwRAQQAhBCADQQFqIQMMAQsLCyABIAVqIQUgASAGaiEGCyABIQMgCEEBaiEIDAELCyACIAxGBEAgAkEKOgAAIAJBAWohAgtBECAMNgIAQRQgAiAMazYCAAvhBgENf0EAJABBAC0AACIEQQNGBEBBHCgCAEEgKAIAakEkKAIAQSgoAgBqaiEFCyAFQQgoAgAiAEEEKAIAIgJBgIAEaiIBaiIDakEgaiQBIAEkBwJAIwEQAUUgACACciAFckGAgICAAU9yBEAQAAwBCyACQQJqQQJ0EAIkCCAAQQJqQQJ0EAIkCSAEQQFGBEAgAkEBakECdBACJAogAEEBakECdBACJAsjAA0BQYCABCABIwgjChAJJAwgASADIwkjCxAJJA0FIwANASAEQQJGBEBBgIAEIAEjCBAKJAwgASADIwkQCiQNBUGAgAQgASMIEAskDCABIAMjCRALJA0LAn8jDCMNaiIAQYCAgMAASwRAEABBAAwBC0EBQSAgAEEBdEEBa0EPcmdrdCIAQQN0IgIQAiQFQQAjBUUNABojBUEAIAL8CwAgAEEBayQGQQELRQ0BIwxBAnQQAiQKIw1BAnQQAiQLIwANAUGAgAQjCCMMIwpBAy0AAEEEcSIAEAwgASMJIw0jCyAAEAwjAA0BC0EAIQAQDiICIQEDQCABBEAgAEEBaiEAIAFBfHEoAgAhAQwBCwsgAEEBakECdBACIgEEQCABIABBAnRqIgMiAEF/NgIAIAIhAQNAIAEEQCABQR50QQFyIAFBfHEoAgQgAUEDcRsiAiAAKAIAc0EedgRAIABBBGsiACACNgIABSAAIAAoAgAgAkH/////A3FqNgIACyABQXxxKAIAIQEMAQsLIAAkDiADIABrQQJ2JA8LIwANACAEQQNGBEBBGCgCABARBQJAQQAhAkEAIQAjD0EEdBACIgVFDQBBAy0AACEIIAUhAwNAIw8gCUsEQCMOIAlBAnRqKAIAIgFB/////wNxIQYgAUEediIHIAhBBHFyRSEKIAIhASAAIQQgB0ECRwRAQYCABCMIIAsgBiAIQQNBASAKG3EQBiABaiEBIAYgC2ohCwsgB0EBRwRAIAAgASACayMHIwkgDCAGIAogCEECcXIQBiAKG2ohBCAGIAxqIQwLIAMgBzYCACADIAY2AgQgAyACIAAgB0EBRiIAGzYCCCADIAEgBCAAGzYCDCABIQIgBCEAIANBEGohAyAJQQFqIQkMAQsLQQwjDzYCAEEQIAU2AgALCwtBASMARToAAAsLogEEAEH4Bws5FXxKf7l5N55vdXQgb2YgbWVtb3J5ClwgTm8gbmV3bGluZSBhdCBlbmQgb2YgZmlsZQphYnRudmZyAEHJAAsEAgACAgBB4AALAQIAQfAAC0sBAQEBAQEBAQEBAAAAAAAAAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAAAAAEAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE=`;Io(()=>{let e=atob(qo),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return new WebAssembly.Module(t)});var Jo={jsdiff:{createTwoFilesPatch:gt,diffChars:vt,diffWordsWithSpace:_t},"@pierre/patches":{createTwoFilesPatch:Bo,diffChars:Ro,diffWordsWithSpace:zo}},Yo;function Xo(e){if(e===`jsdiff`)return e;if(Yo===void 0)try{Ro(``,``),Yo=!0}catch(e){console.error(e),Yo=!1}return Yo?e:`jsdiff`}var Zo=new TextEncoder,Qo=new TextDecoder(`utf-8`,{ignoreBOM:!0}),$o=/[\uD800-\uDFFF]/,es=1024,ts=new Uint8Array(es);function ns(){ts.length!==es&&(ts=new Uint8Array(es))}function rs(e){if(e.length===0)return e;if($o.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;ts.length<t&&(ts=new Uint8Array(t));let{written:n}=Zo.encodeInto(e,ts);return Qo.decode(ts.subarray(0,n))}var is=new TextDecoder(`utf-8`,{ignoreBOM:!0}),as={'"':`"`,"\\":`\\`,a:`\x07`,b:`\b`,t:` `,n:`
186
+ `,v:`\v`,f:`\f`,r:`\r`};function os(e){if(e[0]!==`"`)return;let t=``,n=1;for(;n<e.length;){let r=e[n];if(r===`"`)return{fileName:t,rawLength:n+1};if(r!==`\\`){t+=r,n++;continue}let i=as[e[n+1]];if(i!=null){t+=i,n+=2;continue}let a=[];do{let t=ss(e,n+1);if(t==null)return;a.push(t),n+=4}while(e[n]===`\\`&&e[n+1]>=`0`&&e[n+1]<=`7`);t+=is.decode(new Uint8Array(a))}}function ss(e,t){let n=e.charCodeAt(t)-48,r=e.charCodeAt(t+1)-48,i=e.charCodeAt(t+2)-48;if(n>=0&&n<=3&&r>=0&&r<=7&&i>=0&&i<=7)return n*64+r*8+i}var cs=4096,ls=.5;function us(e){for(let t of e.hunks)for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=fs(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}}function ds(e,t,n){let{hunkContent:r}=e;for(let e=1;e<r.length;e++){let i=r[e],a=r[e-1];if(i.type!==`change`||i.additions>0&&i.deletions>0||a.type!==`context`)continue;let o=i.additions>0,s=o?t.additionLines:t.deletionLines,c=o?i.additionLineIndex:i.deletionLineIndex,l=o?i.additions:i.deletions,u=s[c]??``;if(u.trim()!==``)continue;let d=!0;for(let e=1;e<l;e++)if(s[c+e]!==u){d=!1;break}if(!d)continue;let f=0;for(;f<a.lines&&t.additionLines[a.additionLineIndex+a.lines-1-f]===u;)f++;if(f===0||e===1&&f===a.lines||n!=null&&(f=n(i,f),f===0))continue;i.additionLineIndex-=f,i.deletionLineIndex-=f;let p=i.additionLineIndex+i.additions,m=i.deletionLineIndex+i.deletions,h=r[e+1];h?.type===`context`?(h.lines+=f,h.additionLineIndex=p,h.deletionLineIndex=m):r.splice(e+1,0,{type:`context`,lines:f,additionLineIndex:p,deletionLineIndex:m}),a.lines-=f,a.lines===0&&(r.splice(e-1,1),e--)}}function fs(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>cs)return null;let c=[];for(let t=0;t<n;t++)c.push(ms(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(ms(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=hs(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*ls:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var ps=/\s+/g;function ms(e){return e.replace(ps,``)}function hs(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}var gs=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function _s(e,t){try{return vs(e,t)}finally{ns()}}function vs(e,{cacheKey:t,disableLineMatching:n=!1,isGitDiff:r=ie.test(e),oldFile:i,newFile:a,throwOnError:o=!1}={}){let s=0,c=Ds(e,`@@ `),l,u=i==null||a==null,d=0,f=0;for(let e of c){let n=xs(e),c=n[0];if(c==null){if(o)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=ws(c),m=0,h=0;if(p==null||l==null){if(l!=null){if(o)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}l={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:u,additionLines:!u&&i!=null&&a!=null?bs(a.contents):[],deletionLines:!u&&i!=null&&a!=null?bs(i.contents):[],additionCharacterCount:!u&&i!=null&&a!=null?a.contents.length:0,deletionCharacterCount:!u&&i!=null&&a!=null?i.contents.length:0,cacheKey:ks(t)},l.additionLines.length===1&&a?.contents===``&&(l.additionLines.length=0),l.deletionLines.length===1&&i?.contents===``&&(l.deletionLines.length=0);for(let e of n){if(e.startsWith(`diff --git`)){let t=e.trim().match(gs);if(t==null){if(o)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}let n=ys(t[1],!0),r=ys(t[2],!0);l.name=rs(r),n!==r&&(l.prevName=rs(n));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(Le):null;if(t!=null){let[,e,n]=t,i=ys(n,r);if(e===`---`&&i!==`/dev/null`){let e=rs(i);l.prevName=e,l.name=e}else e===`+++`&&i!==`/dev/null`&&(l.name=rs(i))}else if(r){if(e.startsWith(`new mode `)&&(l.mode=rs(e.slice(8).trim())),e.startsWith(`old mode `)&&(l.prevMode=rs(e.slice(8).trim())),e.startsWith(`new file mode`)&&(l.type=`new`,l.mode=rs(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(l.type=`deleted`,l.mode=rs(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?l.type=`rename-pure`:l.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(P)??[];t!=null&&(l.prevObjectId=rs(t)),n!=null&&(l.newObjectId=rs(n)),r!=null&&(l.mode=rs(r))}(e.startsWith(`rename from `)||e.startsWith(`copy from `))&&(l.prevName=rs(ys(e.slice(e.startsWith(`rename`)?12:10)))),(e.startsWith(`rename to `)||e.startsWith(`copy to `))&&(l.name=rs(ys(e.slice(e.startsWith(`rename`)?10:8))))}}continue}let g,_;for(;n.length>0&&(n[n.length-1]===`
187
+ `||n[n.length-1]===`\r`||n[n.length-1]===`\r
188
+ `||n[n.length-1]===``);)n.pop();let{additionStart:v,deletionStart:y}=p;d=u?d:y-1,f=u?f:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:d,additionLineIndex:f,hunkContent:[],hunkContext:ks(p.hunkContext),hunkSpecs:rs(c),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<n.length;e++){let t=n[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(!Ss(t)||Cs(t))break;if(o)throw Error(`parsePatchContent: hunk has more lines than expected`)}let r=t[0];if(r!==`+`&&r!==`-`&&r!==` `&&r!==`\\`){if(o)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${r}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let i=As(r);if(i===`addition`){if(o&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=js(t);(g==null||g.type!==`change`)&&(g=Ms(`change`,d,f),b.hunkContent.push(g)),f++,x++,u&&(l.additionLines.push(e),l.additionCharacterCount+=e.length),g.additions++,m++,_=`addition`}else if(i===`deletion`){if(o&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=js(t);(g==null||g.type!==`change`)&&(g=Ms(`change`,d,f),b.hunkContent.push(g)),d++,S++,u&&(l.deletionLines.push(e),l.deletionCharacterCount+=e.length),g.deletions++,h++,_=`deletion`}else if(i===`context`){if(o&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=js(t);(g==null||g.type!==`context`)&&(g=Ms(`context`,d,f),b.hunkContent.push(g)),f++,d++,x++,S++,u&&(l.deletionLines.push(e),l.additionLines.push(e),l.deletionCharacterCount+=e.length,l.additionCharacterCount+=e.length),g.lines++,_=`context`}else if(i===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),u&&(_===`addition`||_===`context`)){let e=l.additionLines.length-1;if(e>=0){let t=l.additionLines[e],n=N(t);l.additionLines[e]=n,l.additionCharacterCount+=n.length-t.length}}if(u&&(_===`deletion`||_===`context`)){let e=l.deletionLines.length-1;if(e>=0){let t=l.deletionLines[e],n=N(t);l.deletionLines[e]=n,l.deletionCharacterCount+=n.length-t.length}}}}if(x!==b.additionCount||S!==b.deletionCount){if(o)throw Error(`parsePatchContent: hunk line count mismatch`);console.error(`parsePatchContent: hunk line count mismatch: "${c.trimEnd()}", declared old/new ${b.deletionCount}/${b.additionCount}, parsed old/new ${S}/${x}`);let e=We(b.additionStart,b.additionCount)+(x===0?0:1),t=We(b.deletionStart,b.deletionCount)+(S===0?0:1);if(!u){let n=e-b.additionStart,r=t-b.deletionStart;b.additionLineIndex+=n,b.deletionLineIndex+=r;for(let e of b.hunkContent)e.additionLineIndex+=n,e.deletionLineIndex+=r}b.additionStart=e,b.deletionStart=t,b.additionCount=x,b.deletionCount=S}b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(We(b.additionStart,b.additionCount)-s,0),l.hunks.push(b),s=B(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=l.splitLineCount+b.collapsedBefore,b.unifiedLineStart=l.unifiedLineCount+b.collapsedBefore,l.splitLineCount+=b.collapsedBefore+b.splitLineCount,l.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(l!=null){if(o&&u&&!r&&l.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(l.hunks.length>0&&!u&&l.additionLines.length>0&&l.deletionLines.length>0){let e=l.hunks[l.hunks.length-1],t=B(e.additionStart,e.additionCount),n=l.additionLines.length,r=Math.max(n-t,0);l.splitLineCount+=r,l.unifiedLineCount+=r}return r||(l.prevName!=null&&l.name!==l.prevName?l.hunks.length>0?l.type=`rename-changed`:l.type=`rename-pure`:(i==null||i.contents===``)&&a!=null&&a.contents!==``?l.type=`new`:i!=null&&i.contents!==``&&(a==null||a.contents===``)&&(l.type=`deleted`)),l.type!==`rename-pure`&&l.type!==`rename-changed`&&(l.prevName=void 0),n||us(l),l}}function ys(e,t=!1){let n=e.trim(),r=n.startsWith(`"`)?os(n)?.fileName??n:n;return t&&(r.startsWith(`a/`)||r.startsWith(`b/`))?r.slice(2):r}function bs(e){let t=xs(e);for(let e=0;e<t.length;e++)t[e]=rs(t[e]);return t}function xs(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
189
+ `,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function Ss(e){let t=e[0];return t===`+`||t===`-`||t===` `}function Cs(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
190
+ `&&n!==`\r`)return!1}return!0}function ws(e){if(!e.startsWith(`@@ -`))return;let t=4,n=Ts(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=Ts(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=Ts(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=Ts(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=Es(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function Ts(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function Es(e){return e.endsWith(`\r
191
+ `)?e.slice(0,-2):e.endsWith(`
192
+ `)?e.slice(0,-1):e}function Ds(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:Os(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=Os(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function Os(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function ks(e){return e==null?e:rs(e)}function As(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function js(e){let t=e.slice(1);return rs(t===``?`
193
+ `:t)}function Ms(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var Ns=`/dev/null`;function Ps(e,t,{preferredDiffLib:n=`jsdiff`,disableLineMatching:r,...i}={},a=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let o=e??Fs(),s=t??Fs(),c=[o.name,s.name,o.contents,s.contents,o.header,s.header,i],l=a?n:Xo(n),u;try{u=Jo[l].createTwoFilesPatch(...c)}catch(e){if(a||l===`jsdiff`)throw e;console.error(e),u=Jo.jsdiff.createTwoFilesPatch(...c)}let d=_s(u,{cacheKey:(()=>{let n=e?.cacheKey,i=t?.cacheKey;return n!=null&&i!=null?mo(r===!0?`diff-raw`:`diff`,n,i):void 0})(),oldFile:o,newFile:s,disableLineMatching:r,throwOnError:a});if(d==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(d.type=`new`,d.prevName=void 0):t===null&&(d.type=`deleted`,d.prevName=void 0);let f=t?.lang??(t===null?e?.lang:void 0);return f!=null&&(d.lang=f),d}function Fs(){return{name:Ns,contents:``}}var Is=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&=(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));n==null||t==null?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,behavior:`instant`}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft,behavior:`instant`}))}};function Ls(e,t){let n=Ps({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:e.deletionLines,additionCharacterCount:n.additionCharacterCount,deletionCharacterCount:n.deletionCharacterCount,type:n.type}}function Rs(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function zs(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function Bs(e,t){return t.length>0&&t.length<e.deletionLines.length&&zs(t)}function Vs(e,t,n,r){let i=e.deletionLines.join(``),a=Rs(t.length,i),o=Ps({name:e.prevName??e.name,contents:i},{name:e.name,contents:a,lang:e.lang},r);return{hunks:o.hunks,splitLineCount:o.splitLineCount,unifiedLineCount:o.unifiedLineCount,additionLines:t,deletionLines:e.deletionLines,additionCharacterCount:n,deletionCharacterCount:o.deletionCharacterCount,type:o.type}}function Hs(e,t){return Vs(e,[``],0,t)}function Us(e,t){return e.additionLines.length===0?Hs(e,t):Bs(e,e.additionLines)?Vs(e,e.additionLines,e.additionCharacterCount,t):Ls(e,t)}function Ws(e,t){let n=e.hunks[t];n!=null&&(n.noEOFCRAdditions=Gs(e.additionLines,n.additionLineIndex,n.additionCount),n.noEOFCRDeletions=Gs(e.deletionLines,n.deletionLineIndex,n.deletionCount))}function Gs(e,t,n){let r=e.at(-1);return t>=0&&t+n===e.length&&r!=null&&r!==``&&!r.endsWith(`
194
+ `)}function Ks(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function qs(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function Js(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(We(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,qs(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=B(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-B(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var Ys=new WeakMap;function Xs(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function Zs(e,t,n){let r=e.hunks,i=cc(r,oc(e,t,n),e.deletionLines.length);if(e.hunks=dc(e,i),e.editSessionDirty=!0,xc(e),mc(r,e.hunks))return{regions:i.map(e=>e.previousSpan)}}function Qs(e,t,n,r){let i=new Set(t),a=Array.from(i).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(a.length===0)return;let o=t=>i.has(t)?r?.get(t):e.additionLines[t],{hunks:s}=e,c,l=0;for(let t of a){for(;l<s.length;){let e=s[l];if(t<_c(e)+e.additionCount)break;l++}let r=s[l],i=r==null?void 0:_c(r);if(i==null||t<i||c!=null&&c!==l)return Zs(e,n,o);c=l}if(c!=null){if($s(e,a,c,r,n))e.editSessionDirty=!0;else return Zs(e,n,o)}}function $s(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=ec(e),o=e.hunks[n];if(o.hunkContent.some(tc))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function ec(e){let{deletionLines:t}=e,n=Ys.get(t);return n??(n=new Set(t),Ys.set(t,n)),n}function tc(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function nc(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function rc(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=et({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=vc(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=Fe({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=vc(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function ic(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=vc(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,vc(i)+i.deletionCount,e.deletionLines.length),n}function ac(e,t){return e.editSessionDirty===!0&&(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?Ls(e,t):Us(e,t)),!0)}function oc(e,t,n){if(Xs(e.deletionLines,e.additionLines)==null)return[];let r=Ps({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),i,a=(t,a)=>{i??=sc(e.hunks);for(let e=0;e<=a;e++){let o=i.get(t.deletionLineIndex-e);if(o!=null&&o.additions===t.additions&&o.deletions===t.deletions){if(t.additions>0&&n!=null){for(let e=0;e<t.additions;e++)if(n(o.additionLineIndex+e)!==r.additionLines[t.additionLineIndex+e])return a}return e}}return a},o=[],s=0,c=0;for(let e of r.hunks){ds(e,r,a);let t=e.additionCount>0?e.additionLineIndex-s:e.deletionLineIndex-c;s+=t,c+=t;for(let t of e.hunkContent){if(t.type===`context`){s+=t.lines,c+=t.lines;continue}let e=Ks(t,0,0);e.additions===0&&(e.additionLineIndex=s),e.deletions===0&&(e.deletionLineIndex=c),o.push(e),s+=e.additions,c+=e.deletions}}return o}function sc(e){let t=new Map;for(let n of e)for(let e of n.hunkContent)e.type===`change`&&(e.additions===0||e.deletions===0)&&t.set(e.deletionLineIndex,e);return t}function cc(e,t,n){let r=e.map((e,t)=>{let n=vc(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&lc(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=uc(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function lc(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function uc(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function dc(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);pc(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);pc(s,c,i,r),r+=c,i+=c,n.push(fc(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function fc(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:yc(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:bc(t.additionStart,r),deletionStart:yc(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:bc(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${yc(t.deletionStart,i)},${i} +${yc(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return qs(s),s}function pc(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function mc(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(vc(r)!==vc(i)||r.deletionCount!==i.deletionCount||_c(r)!==_c(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!hc(r,i))return!0}return!1}function hc(e,t){let n=gc(e),r=gc(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*gc(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function _c(e){return We(e.additionStart,e.additionCount)}function vc(e){return We(e.deletionStart,e.deletionCount)}function yc(e,t){return t===0?e:e+1}function bc(e,t){return t===0?e-1:e}function xc(e){Js(e);for(let t=0;t<e.hunks.length;t++)Ws(e,t)}function Sc({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;r===o||r&&e.value.length===1&&!o?a[1]+=e.value:t.push([+!r,e.value])}var Cc=Object.freeze({deletion:Object.freeze([]),addition:Object.freeze([])});function wc(e,t,n,r,i=`jsdiff`){if(n===`none`||(e=N(e),t=N(t),e.length>r||t.length>r))return Cc;let{diffChars:a,diffWordsWithSpace:o}=Jo[Xo(i)],s=n===`char`?a(e,t):o(e,t);if(n===`word-line`)return Ec(s);let c=[],l=[],u=n===`word-alt`,d=s.at(-1);for(let e of s){let t=e===d;!e.added&&!e.removed?(Sc({item:e,arr:c,enableJoin:u,isNeutral:!0,isLastItem:t}),Sc({item:e,arr:l,enableJoin:u,isNeutral:!0,isLastItem:t})):e.removed?Sc({item:e,arr:c,enableJoin:u,isLastItem:t}):Sc({item:e,arr:l,enableJoin:u,isLastItem:t})}return{deletion:Tc(c),addition:Tc(l)}}function Tc(e){let t=[],n=0;for(let[r,i]of e)r===1&&t.push([n,n+i.length]),n+=i.length;return t}function Ec(e){let t=0,n=0,r=-1,i=0,a=-1,o=0;for(let{value:s,added:c,removed:l}of e)l?(r===-1&&(r=t),t+=s.length,i=t):c?(a===-1&&(a=n),n+=s.length,o=n):(t+=s.length,n+=s.length);return{deletion:r===-1?[]:[[r,i]],addition:a===-1?[]:[[a,o]]}}var Dc=Object.freeze([]),Oc=class{lineDiffType;maxLineDiffLength;preferredDiffLib;#e=new Map;constructor(e,t,n=`jsdiff`){this.lineDiffType=e,this.maxLineDiffLength=t,this.preferredDiffLib=n}get(e,t,n){let r=this.#e.get(e);if(r!=null&&r.deletionText===t&&r.additionText===n)return r.ranges;let i;try{i=wc(t,n,this.lineDiffType,this.maxLineDiffLength,this.preferredDiffLib)}catch(e){if(this.preferredDiffLib===`jsdiff`)throw e;console.error(e),this.preferredDiffLib=`jsdiff`,i=wc(t,n,this.lineDiffType,this.maxLineDiffLength,this.preferredDiffLib)}return this.#e.set(e,{deletionText:t,additionText:n,ranges:i}),i}};function kc(e,t,n,r){let i=e.pairFor(t,n);if(i==null)return Dc;let{deletionLines:a,additionLines:o}=e.diff,s=t===`deletions`?r.get(n,a[n],o[i]):r.get(i,a[i],o[n]);return t===`deletions`?s.deletion:s.addition}function Ac(e,t){if(t.length===0)return e;let n=[];if(Mc(e.children,n),n.length===0)throw Error(`markRow: an empty row has no text to mark`);let r={type:`element`,tagName:e.tagName,properties:{...e.properties},children:[]},i=t.map(([e,t])=>({start:{line:0,character:e},end:{line:0,character:t},properties:{"data-diff-span":``},alwaysWrap:!0})),a=0;for(let e of n)a+=e.text.length;let o=new x(r,i,0,a),s=0;for(let e of n){let{text:t}=e,n=s,r=n+t.length;for(;s<r;){o.moveTo(s);let i=Math.min(r,o.nextEdge);o.parent.children.push(jc(e,s===n&&i===r?t:t.slice(s-n,i-n))),s=i}}return o.moveTo(s),n.some(e=>e.char!=null)&&Re(r),r}function jc(e,t){if(e.properties==null)return{type:`text`,value:t};let n={...e.properties};return e.char!=null&&(n[`data-char`]=e.char),{type:`element`,tagName:`span`,properties:n,children:[{type:`text`,value:t}]}}function Mc(e,t){for(let n of e){if(n.type===`text`){if(n.value===`
195
+ `&&e.length===1)continue;t.push({text:n.value,properties:void 0,char:void 0});continue}if(n.type!==`element`||n.tagName===`br`)continue;if(n.tagName!==`span`)throw Error(`markRow: unexpected <${n.tagName}> in a base row`);if(n.properties[`data-diff-span`]!=null||n.children.some(e=>e.type!==`text`))throw Error(`markRow: a base row has no wrapper spans`);let r={...n.properties},i=r[`data-char`];delete r[`data-char`];let a=``;for(let e of n.children)e.type===`text`&&(a+=e.value);t.push({text:a,properties:r,char:typeof i==`number`?i:void 0})}}function Nc(e){return j({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function Pc(e){return j({tagName:`div`,children:[j({tagName:`span`,children:[fe(G.t(`noNewlineAtEndOfFile`))]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function Fc(e){return j({tagName:`div`,children:[F({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{role:`button`,"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function Ic({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(j({tagName:`div`,children:[fe(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(Fc(`up`)),s++),o||(e.push(Fc(`down`)),s++)):(e.push(Fc(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(j({tagName:`div`,children:[j({tagName:`span`,children:[fe(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(j({tagName:`div`,children:[fe(G.t(`expandAll`))],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(j({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(j({tagName:`slot`,properties:{name:i}})),j({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function Lc(e,t){return`hunk-separator-${e}-${t}`}function Rc(e){let t=e.at(-1);return t==null?0:Math.max(B(t.additionStart,t.additionCount),B(t.deletionStart,t.deletionCount))}function zc(e){let{splitLineIndex:t}=e,n,r;if(e.hasDeletion){let{deletionLineIndex:r,deletionLineNumber:i,deletionUnifiedLineIndex:a,deletionNoEOFCR:o}=e;n={lineIndex:r,lineNumber:i,unifiedLineIndex:a,splitLineIndex:t,noEOFCR:o}}if(e.hasAddition){let{additionLineIndex:n,additionLineNumber:i,additionUnifiedLineIndex:a,additionNoEOFCR:o}=e;r={lineIndex:n,lineNumber:i,unifiedLineIndex:a,splitLineIndex:t,noEOFCR:o}}if(n!=null)return r==null?{deletionLine:n}:{deletionLine:n,additionLine:r};if(r!=null)return{additionLine:r};throw Error(`DiffLayout: row has no lines`)}function Bc(e,t){return e.host===t.host&&e.model===t.model&&e.rows===t.rows&&e.expandedHunks===t.expandedHunks&&e.deletionAnnotations===t.deletionAnnotations&&e.additionAnnotations===t.additionAnnotations&&e.annotationSlotName===t.annotationSlotName&&e.includeTrailingNewline===t.includeTrailingNewline&&e.showNoNewlineMarkers===t.showNoNewlineMarkers&&ea(e.renderRange,t.renderRange)}var Vc=Object.freeze([]),Hc=class{options;lineCuts;#e;#t=new ra;#n=new WeakMap;#r=new Map;#i=new Map;#a;#o;constructor(e,t){this.options=e,this.lineCuts=t,this.#e=new Oc(e.lineDiffType,e.maxLineDiffLength,e.preferredDiffLib)}setOptions(e){let t=this.options;(e.lineDiffType!==t.lineDiffType||e.maxLineDiffLength!==t.maxLineDiffLength||e.preferredDiffLib!==t.preferredDiffLib)&&(this.#e=new Oc(e.lineDiffType,e.maxLineDiffLength,e.preferredDiffLib)),(e.diffStyle!==t.diffStyle||e.expandUnchanged!==t.expandUnchanged||e.expansionLineCount!==t.expansionLineCount||e.collapsedContextThreshold!==t.collapsedContextThreshold||e.hunkSeparators!==t.hunkSeparators||e.lineDiffType!==t.lineDiffType||e.maxLineDiffLength!==t.maxLineDiffLength||e.preferredDiffLib!==t.preferredDiffLib||e.canHydrateContext!==t.canHydrateContext)&&this.invalidateLines(),this.options=e}markLines(e){let t=this.#o??=new Set;for(let n of e)t.add(n)}forgetLines(e){this.#t.forgetLines(e);for(let t of e)this.#r.delete(`a${t}`)}invalidateLines(){this.#r.clear(),this.#i.clear(),this.#a=void 0,this.#o=void 0}newFileLines(e){let t=this.#a;if(t!=null&&Bc(t.input,e))return t.result.newFileLines;let{diffStyle:n,expandUnchanged:r,collapsedContextThreshold:i}=this.options,a,o,s=new Ue({diff:e.model.diff,diffStyle:n,startingLine:e.renderRange.startingLine,totalLines:e.renderRange.totalLines,expandedHunks:r?!0:e.expandedHunks,collapsedContextThreshold:i,includeTrailingNewline:e.includeTrailingNewline});for(;s.next();)if(s.hasAddition){let{additionLineNumber:e}=s;a??=e,o=e}return a==null||o==null?void 0:{first:a,last:o}}layout(e){let t=this.#o;this.#o=void 0;let n=this.#a;if(t!=null&&n!=null&&Bc(n.input,e))return this.#s(n,t,e);this.lineCuts.startLayout();let{host:r,model:i,renderRange:a,expandedHunks:o,includeTrailingNewline:s,showNoNewlineMarkers:c}=e,{diff:l}=i,{diffStyle:u,expandUnchanged:d,expansionLineCount:f,collapsedContextThreshold:p,hunkSeparators:m,canHydrateContext:h}=this.options,g=u===`unified`,_=!l.isPartial||h,v=this.options.lineDiffType!==`none`;this.#r.clear(),this.#i.clear();let y={unified:ia(),deletions:ia(),additions:ia()},b=[],x=0,S,C,w={size:0,side:void 0},T=()=>{if(g)return;let{size:e,side:t}=w;if(w.size=0,w.side=void 0,e<=0||t==null)return;let n=y[t];this.#t.fixedRow(n,Uc(n),`${e}`,()=>({gutter:ae(void 0,`buffer`,e),content:Nc(e)}))},E=e=>{T();let t=g?[`unified`]:[`deletions`,`additions`];for(let n of t)this.#c(y[n],n,e,m,f,b)&&n!==`additions`&&x++},D=(e,t,n,i)=>{this.#t.fixedRow(e,`ann:${t}`,`${i}|${n.hunkIndex},${n.lineIndex}|${n.annotations.join(`,`)}`,()=>({gutter:ae(i,`annotation`,1),content:oa(r.createAnnotationElement(n))}))};this.#f(e,y,D,()=>{x++});let O=Ge({fileDiff:l,errorPrefix:`DiffLayout.layout`}),k=new Ue({diff:l,diffStyle:u,startingLine:a.startingLine,totalLines:a.totalLines,expandedHunks:d?!0:o,collapsedContextThreshold:p,includeTrailingNewline:s});for(;k.next();){let{deletionLine:t,additionLine:n}=zc(k),{hunkIndex:a,hunk:o,collapsedBefore:s,collapsedAfter:u,type:d,splitLineIndex:f,unifiedLineIndex:p}=k;n!=null&&(S??=n.lineNumber,C=n.lineNumber),!g&&d!==`change`&&T(),s>0&&E({hunkIndex:a,collapsedLines:s,rangeSize:Math.max(o?.collapsedBefore??0,0),hunkSpecs:o?.hunkSpecs,isFirstHunk:a===0,isLastHunk:!1,isExpandable:_});let b=g?p:f,A={type:d,hunkIndex:a,lineIndex:b,unifiedLineIndex:p,splitLineIndex:f,deletionLine:t,additionLine:n},j=v&&d===`change`,M=n==null?`d${t.lineIndex}`:`a${i.lineId(n.lineIndex)}`,N=t==null?M:`d${t.lineIndex}`,ee=M;if(g){let i=r.getUnifiedInjectedRowsForLine?.(A);i?.before!=null&&(x+=Gc(y.unified,i.before,`${M}:before`));let o=d===`change`?n==null?`change-deletion`:`change-addition`:d,s=r.getUnifiedLineDecoration({type:d,lineType:o,additionLineIndex:n?.lineIndex,deletionLineIndex:t?.lineIndex}),c=`${p},${f}`;this.#l(e,y.unified,n==null?{column:`unified`,key:M,side:`deletions`,lineIndex:t.lineIndex,marked:j,contentProperties:s.contentProperties,lineNumber:t.lineNumber,altLineNumber:void 0,lineIndexText:c,gutterLineType:s.gutterLineType,gutterProperties:s.gutterProperties}:{column:`unified`,key:M,side:`additions`,lineIndex:n.lineIndex,marked:j,contentProperties:s.contentProperties,lineNumber:n.lineNumber,altLineNumber:d===`change`?void 0:t?.lineNumber,lineIndexText:c,gutterLineType:s.gutterLineType,gutterProperties:s.gutterProperties});let l=qc(e,t?.lineNumber,n?.lineNumber,a,b);l!=null&&(D(y.unified,M,l,o),x++),i?.after!=null&&(x+=Gc(y.unified,i.after,`${M}:after`))}else{let i=r.getSplitInjectedRowsForLine?.(A);i?.before!=null&&(x+=Kc(y,i.before,`${M}:before`,w,T));let o=r.getSplitLineDecoration({side:`deletions`,type:d,lineIndex:t?.lineIndex}),s=r.getSplitLineDecoration({side:`additions`,type:d,lineIndex:n?.lineIndex}),c=d===`change`?n==null?`additions`:t==null?`deletions`:void 0:void 0;c==null?d===`change`&&T():(w.side!=null&&w.side!==c&&T(),w.side=c,w.size+=1);let l=Jc(e,t?.lineNumber,n?.lineNumber,a,b);l!=null&&w.size>0&&T(),t!=null&&this.#l(e,y.deletions,{column:`deletions`,key:N,side:`deletions`,lineIndex:t.lineIndex,marked:j,contentProperties:o.contentProperties,lineNumber:t.lineNumber,altLineNumber:d===`change`?void 0:n?.lineNumber,lineIndexText:`${t.unifiedLineIndex},${f}`,gutterLineType:o.gutterLineType,gutterProperties:o.gutterProperties}),n!=null&&this.#l(e,y.additions,{column:`additions`,key:ee,side:`additions`,lineIndex:n.lineIndex,marked:j,contentProperties:s.contentProperties,lineNumber:n.lineNumber,altLineNumber:d===`change`?void 0:t?.lineNumber,lineIndexText:`${n.unifiedLineIndex},${f}`,gutterLineType:s.gutterLineType,gutterProperties:s.gutterProperties}),l!=null&&(D(y.deletions,N,l.deletionSpan,d===`change`?t==null?`context`:`change-deletion`:d),D(y.additions,ee,l.additionSpan,d===`change`?n==null?`context`:`change-addition`:d),x++),i?.after!=null&&(x+=Kc(y,i.after,`${M}:after`,w,T))}let P=!g&&o!=null&&f===o.splitLineStart+o.splitLineCount-1,F=a===l.hunks.length-1&&o!=null&&(g?p===o.unifiedLineStart+o.unifiedLineCount-1:f===o.splitLineStart+o.splitLineCount-1),I=(t?.noEOFCR??!1)||P&&o.noEOFCRDeletions,te=(n?.noEOFCR??!1)||P&&o.noEOFCRAdditions;if(c&&(te||I)){if(T(),I){let e=d===`context`||d===`context-expanded`?d:`change-deletion`;this.#t.fixedRow(g?y.unified:y.deletions,`eof:d`,e,()=>{let t=Pc(e);return{gutter:ae(e,`metadata`,1),content:e===`change-deletion`?oa(t):t}}),!g&&!te&&this.#t.fixedRow(y.additions,Uc(y.additions),`1`,()=>({gutter:ae(void 0,`buffer`,1),content:Nc(1)}))}if(te&&!(g&&I&&d!==`change`)){let e=d===`context`||d===`context-expanded`?d:`change-addition`;this.#t.fixedRow(g?y.unified:y.additions,`eof:a`,e,()=>({gutter:ae(e,`metadata`,1),content:Pc(e)})),!g&&!I&&this.#t.fixedRow(y.deletions,Uc(y.deletions),`1`,()=>({gutter:ae(void 0,`buffer`,1),content:Nc(1)}))}x++}m!==`simple`&&m!==`metadata`&&(u>0||F&&h)&&E({hunkIndex:d===`context-expanded`?a:a+1,collapsedLines:F&&h?`unknown`:u,rangeSize:O,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:_}),x++}T();let A=Math.max(Rc(l.hunks),i.lineCount,l.deletionLines.length),j=a.bufferBefore>0||a.bufferAfter>0,M=x>0||j,N=!g&&l.type!==`deleted`,ee=!g&&l.type!==`new`,P={columns:{unified:g&&M?y.unified.specs:void 0,deletions:ee&&M?y.deletions.specs:void 0,additions:N&&M?y.additions.specs:void 0},newFileLines:S==null||C==null?void 0:{first:S,last:C},patched:void 0,hunkData:b,rowCount:x,totalLines:A};return this.#a={input:e,result:P},P}#s(e,t,n){let{model:r}=n,i={...e.result.columns},a=new Set,o={unified:i.unified==null?void 0:[],deletions:i.deletions==null?void 0:[],additions:i.additions==null?void 0:[]},s=new Set,c=e=>{let t=this.#r.get(e),r=this.#i.get(e);if(t==null||r==null||s.has(e))return;s.add(e);let c=i[t.column];if(c==null)throw Error(`DiffLayout: a kept row is in a column that was not laid out`);a.has(t.column)||(c=c.slice(),i[t.column]=c,a.add(t.column));let l=this.#u(n,t);c[r]=l,o[t.column]?.push(l)};for(let e of t){if(e<0||e>=r.lineCount)continue;c(`a${r.lineId(e)}`);let t=r.pairFor(`additions`,e);t!=null&&c(`d${t}`)}let l={...e.result,columns:i,patched:o};return this.#a={input:n,result:l},l}#c(e,t,{hunkIndex:n,collapsedLines:r,rangeSize:i,hunkSpecs:a,isFirstHunk:o,isLastHunk:s,isExpandable:c},l,u,d){if(typeof r==`number`&&r<=0)return!1;if(l===`metadata`){if(a==null)return!1;let r=()=>Ic({type:`metadata`,content:a,isFirstHunk:o,isLastHunk:s});return this.#t.fixedRow(e,`sep:${t}:${n}`,`metadata|${a}|${o}|${s}`,()=>({gutter:r(),content:oa(r())})),!0}if(l===`simple`){if(n<=0)return!1;let r=()=>Ic({type:`simple`,isFirstHunk:o,isLastHunk:!1});return this.#t.fixedRow(e,`sep:${t}:${n}`,`simple|${o}`,()=>({gutter:r(),content:oa(r())})),!0}let f=Lc(t,n),p=i>u,m=c?n:void 0,h=typeof r==`number`?G.t(`unmodifiedLines`,{count:r}):G.t(`unknownUnmodifiedLines`),g=()=>Ic({type:l,content:h,expandIndex:m,chunked:p,slotName:f,isFirstHunk:o,isLastHunk:s});return this.#t.fixedRow(e,`sep:${f}`,`${l}|${h}|${m}|${p}|${o}|${s}`,()=>({gutter:g(),content:oa(g())})),d.push({slotName:f,hunkIndex:n,lines:typeof r==`number`?r:0,lineCountKnown:typeof r==`number`,type:t,expandable:c?{up:!o,down:!s,chunked:p}:void 0}),!0}#l(e,t,n){this.#r.set(n.key,n),this.#i.set(n.key,t.specs.length),aa(t,this.#u(e,n))}#u(e,t){let{model:n,rows:r}=e,i=t.side===`additions`?r.additionRow(n,t.lineIndex):r.deletionRow(n,t.lineIndex),a=t.marked?kc(n,t.side,t.lineIndex,this.#e):Vc,o=this.#d(i,a,t,e);return{key:t.key,gutter:this.#t.gutter(t.key,t.gutterLineType,t.lineNumber,t.lineIndexText,t.gutterProperties),content:o}}#d(e,t,n,{model:r}){let{side:i,lineIndex:a,lineNumber:o,altLineNumber:s,contentProperties:c,lineIndexText:l}=n,u=e;if(t.length>0){let n=this.#n.get(e);n!=null&&Yc(n.ranges,t)?u=n.row:(u=Ac(e,t),this.#n.set(e,{ranges:t,row:u}))}let{lineCuts:d}=this,f=i===`additions`?d.additionRow(u,r,a,o,s):d.deletionRow(u,r,a,o,s);return this.#t.line(f,c,o,s,l,n.column===`unified`&&i===`deletions`)}#f(e,t,n,r){let{model:i,renderRange:a,deletionAnnotations:o,additionAnnotations:s}=e;if(!pi(a))return;let{diff:c}=i,l=t=>t?.map(t=>e.annotationSlotName(t))??[],u=c.type===`new`?[]:l(fi(o)),d=c.type===`deleted`?[]:l(fi(s));(u.length!==0||d.length!==0)&&(this.options.diffStyle===`unified`?n(t.unified,`file`,{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:u.concat(d)},`context`):(n(t.deletions,`file`,{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:u},`context`),n(t.additions,`file`,{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:d},`context`)),r())}};function Uc(e){return`buf:${e.lastKey??`top`}`}function Wc(e,t,n){return e.id==null?`inj:${t}:${n}`:`inj:${e.id}`}function Gc(e,t,n){for(let[r,i]of t.entries())aa(e,{key:Wc(i,n,r),gutter:i.gutter,content:i.content});return t.length}function Kc(e,t,n,r,i){let a=0;for(let[o,{deletion:s,addition:c}]of t.entries()){if(s==null&&c==null)continue;let t=s!=null&&c!=null?void 0:s==null?`deletions`:`additions`;(t==null||r.side!==t)&&i(),s!=null&&aa(e.deletions,{key:Wc(s,n,o),gutter:s.gutter,content:s.content}),c!=null&&aa(e.additions,{key:Wc(c,n,o),gutter:c.gutter,content:c.content}),t!=null&&(r.side=t,r.size+=1),a++}return a}function qc(e,t,n,r,i){let a=[];if(t!=null)for(let n of e.deletionAnnotations[t]??[])a.push(e.annotationSlotName(n));if(n!=null)for(let t of e.additionAnnotations[n]??[])a.push(e.annotationSlotName(t));return a.length>0?{type:`annotation`,hunkIndex:r,lineIndex:i,annotations:a}:void 0}function Jc(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]},o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let n of e.deletionAnnotations[t]??[])a.annotations.push(e.annotationSlotName(n));if(n!=null)for(let t of e.additionAnnotations[n]??[])o.annotations.push(e.annotationSlotName(t));if(a.annotations.length!==0||o.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}function Yc(e,t){return e===t||e.length===t.length&&e.every((e,n)=>e[0]===t[n][0]&&e[1]===t[n][1])}var Xc=class e{static fromDiff(t){return new e(t,void 0)}static startEditSession(t,n={}){let{document:r,snapshot:i,parseDiffOptions:a}=n;if(t.isPartial)throw Error(`DiffModel.startEditSession: the diff must not be partial`);let o=si(t.additionLines.join(``)),s=r==null?void 0:si(r.contents),c=i!=null&&Zc(i,t);if(i!=null&&!c)throw Error(`DiffModel.startEditSession: the retained session was diffed against a different old file`);if(s!=null&&s!==o&&!c)throw Error(`DiffModel.startEditSession: retained edits are missing their diff session state`);let l={...t};delete l.cacheKey,o!==t.additionLines.join(``)&&(l.additionLines=ho(o),l.additionCharacterCount=o.length,Zs(l,a),l.editSessionDirty=!0);let u=r==null||r.name===t.name&&r.lang===t.lang&&s===o;r!=null&&!u&&(l.name=r.name,l.lang=r.lang),c&&i!=null&&s!=null&&(l.additionLines=ho(s),l.additionCharacterCount=s.length,l.type=i.type,l.hunks=i.hunks,l.editSessionDirty=!0,Js(l));let d=new e(l,new fa(_e(l.additionLines.join(``))+1));return l.additionLines.length===0&&(Object.assign(l,Hs(l,a)),l.editSessionDirty=!0),d}diff;#e;#t;#n;constructor(e,t){this.diff=e,this.#e=t,this.#t=e.additionLines}get live(){return this.#e!=null}get lineCount(){return this.#e?.lineCount??this.diff.additionLines.length}lineId(e){return this.#e?.idAt(e)??e}lineText(e){return this.diff.additionLines[e]??``}lineOf(e){return this.#e?.lineOf(e)??(e<this.diff.additionLines.length?e:void 0)}blockAt(e,t){let{starts:n,ends:r,blocks:i}=this.#i()[e],a=0,o=i.length;for(;a<o;){let e=a+o>>>1;r[e]<=t?a=e+1:o=e}return a<i.length&&n[a]<=t?i[a]:void 0}pairFor(e,t){let n=this.blockAt(e,t);if(n?.type!==`change`)return;let r=t-(e===`deletions`?n.deletionLineIndex:n.additionLineIndex);if(r>=Math.min(n.deletions,n.additions))return;let i=n.deletionLineIndex+r,a=n.additionLineIndex+r,{deletionLines:o,additionLines:s}=this.diff;if(o[i]!=null&&s[a]!=null)return e===`deletions`?a:i}editLineFor(e){for(let t of this.diff.hunks){let n=e-t.deletionStart;if(n<0||n>=t.deletionCount)continue;let r=t.deletionLineIndex+n,i=this.blockAt(`deletions`,r);if(i==null)throw Error(`DiffModel.editLineFor: old line ${e} is inside a hunk but outside its blocks`);return i.type===`context`?i.additionLineIndex+(r-i.deletionLineIndex):i.additionLineIndex}}applyChange(e,t,n={}){let r=this.#e;if(r==null)throw Error(`DiffModel.applyChange: the model is not live`);let i=r.applyChange(e),{diff:a}=this,{parseDiffOptions:o}=n,s=n.expandedHunks??new Map,c=e.lineDelta===0,{hunks:l}=a,u,d=!1;if(c){u=[];let n=new Map,r=a.additionLines.length;for(let[i,o]of ua(t,e)){let e=i>0&&i===t.lineCount-1&&o===``;if(i<0||i>r||i===r&&(e||t.lineCount!==r+1))continue;let s=a.additionLines[i]??``;(e||s!==o)&&(a.additionLines===this.#t&&(a.additionLines=a.additionLines.slice()),e?a.additionLines.pop():a.additionLines[i]=o,a.additionCharacterCount+=o.length-s.length,u.push(i),n.set(i,s))}if(u.length>0){if(Qc(a))this.#r(Hs(a,o)),d=!0;else if(Bs(a,a.additionLines))this.#r(Vs(a,a.additionLines,a.additionCharacterCount,o)),d=!0;else if(a.additionLines.length!==r){let e=Zs(a,o,e=>n.has(e)?n.get(e):a.additionLines[e]);s=$c(s,e),d=e!=null}else{let e=Qs(a,u,o,n);s=$c(s,e),d=e!=null}}}else{let n=a.additionLines,{lines:r,characterCount:i}=da(t);r.length>1&&r.at(-1)===``&&r.pop(),a.additionLines=r,a.additionCharacterCount=i,Qc(a)?this.#r(Hs(a,o)):Bs(a,r)?this.#r(Vs(a,r,i,o)):s=$c(s,Zs(a,o,e=>n[e])),d=!0,u=[];for(let[t,n]of e.changedLineRanges){let e=Math.min(n,a.additionLines.length-1);for(let n=t;n<=e;n++)u.push(n)}}return this.#n=void 0,{changedLines:u,hunksChanged:a.hunks!==l,removedLineIds:i,lineDelta:e.lineDelta,regionsChanged:d,expandedHunks:s}}lineIds(){return this.#e?.ids()??Array.from({length:this.lineCount},(e,t)=>t)}snapshot(){let{diff:e}=this;return{oldFile:e.type===`new`?null:{name:e.prevName??e.name,lines:[...e.deletionLines]},type:e.type,hunks:uo(e.hunks)}}get hasChanges(){return this.diff.editSessionDirty===!0}finish(e,t={}){let{diff:n}=this,{parseDiffOptions:r}=t,i=t.expandedHunks??new Map;if(n.editSessionDirty!==!0)return{changed:!1,expandedHunks:i};let a=rc(n,i,e);return ac(n,r),this.#n=void 0,{changed:!0,expandedHunks:ic(n,a)}}#r(e){let{diff:t}=this,n=t.type;Object.assign(t,e),t.type=n,t.editSessionDirty=!0,this.#n=void 0}#i(){let{hunks:e}=this.diff;if(this.#n?.hunks===e)return this.#n;let t={starts:[],ends:[],blocks:[]},n={starts:[],ends:[],blocks:[]};for(let r of e)for(let e of r.hunkContent){let r=e.type===`context`?e.lines:e.deletions,i=e.type===`context`?e.lines:e.additions;r>0&&(t.starts.push(e.deletionLineIndex),t.ends.push(e.deletionLineIndex+r),t.blocks.push(e)),i>0&&(n.starts.push(e.additionLineIndex),n.ends.push(e.additionLineIndex+i),n.blocks.push(e))}return this.#n={hunks:e,deletions:t,additions:n}}};function Zc(e,t){let{oldFile:n}=e;return n==null?t.type===`new`:t.type!==`new`&&n.name===(t.prevName??t.name)&&n.lines.length===t.deletionLines.length&&n.lines.every((e,n)=>e===t.deletionLines[n])}function Qc(e){return e.additionLines.length<=1&&e.additionLines.join(``)===``}function $c(e,t){return t==null?e:nc(e,t)}var el=-1,tl=class{options;annotationSlotName;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++el}`;diff;lineCuts=new hr;expandedHunks=new Map;annotationList=[];deletionAnnotations={};additionAnnotations={};computedLangs=[`text`];renderCache;pendingHighlightResult;layout;rowSource;model;editSessionActive=!1;constructor(e={theme:rt},t=Zt,n,r){this.options=e,this.annotationSlotName=t,this.onRenderUpdate=n,this.workerManager=r}cleanUp(){this.endEditSession(),this.recycle(),this.lineCuts.clear(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.diff=void 0,this.editSessionActive?(this.workerManager?.cancelLocalThemeRender(this),this.renderCache!=null&&(this.renderCache.renderRange=void 0),this.pendingHighlightResult=void 0):this.clearRenderCache(),this.annotationList=[],this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}startEditSession(e,t={}){let n=Xc.startEditSession(e,{...t,parseDiffOptions:this.options.parseDiffOptions}),{rowSource:r}=this,i=this.promoteReadyResult(e)??this.renderCache;this.editSessionActive=!0,this.model=n,this.diff=n.diff,this.pendingHighlightResult=void 0;let{options:a}=this.getRenderOptions(n.diff);if(i?.result!=null&&i.highlighted&&n.diff.additionLines===e.additionLines&&E(i.diff,e)&&ge(i.options,a)){let{result:e}=i,t={ids:n.lineIds(),texts:n.diff.additionLines.slice()};this.renderCache={diff:n.diff,options:a,highlighted:!0,result:e,renderRange:i.renderRange,lines:t},r!=null&&r.result===e?(r.source.setHighlightRows({deletionRows:e.code.deletionLines,additionRows:e.code.additionLines,additionLines:t.texts,lineIds:t.ids}),this.layout?.invalidateLines(),r.model=n):this.rowSource=void 0}else i!=null&&i.options.useTokenTransformer!==!0&&n.diff.name,this.renderCache=void 0,this.rowSource=void 0;return n.diff}promoteReadyResult(e){let{options:t}=this.getRenderOptions(e),n=this.getReadyRenderResult(e,t);return n==null?void 0:{...n,diff:e,renderRange:void 0}}applyChange(e,t,n){let r=this.requireSession(),i=r.applyChange(e,t,{parseDiffOptions:this.options.parseDiffOptions,expandedHunks:this.expandedHunks});return this.expandedHunks=i.expandedHunks,i.removedLineIds.length>0&&(this.editSessionRows(r).source.forgetLines(i.removedLineIds),this.layout?.forgetLines(i.removedLineIds)),i.lineDelta!==0||i.removedLineIds.length>0||i.regionsChanged||i.hunksChanged?this.layout?.invalidateLines():this.layout?.markLines(i.changedLines),n!=null&&this.setTokens(n),i}setTokens(e){let t=this.requireSession(),n=this.editSessionRows(t).source,r=[];for(let[i,a]of e)n.setTokens(t.lineId(i),a)&&r.push(i);return this.layout?.markLines(r),r}lineKey(e){let t=this.requireSession();return e>=0&&e<t.lineCount?`a${t.lineId(e)}`:void 0}lineOfKey(e){let t=this.requireSession();return e.startsWith(`a`)?t.lineOf(Number(e.slice(1))):void 0}editLineFor(e){return this.requireSession().editLineFor(e)}endEditSession(){let e=this.editSessionActive?this.model:void 0,t=!1;if(e!=null){let{collapsedContextThreshold:n}=this.getOptionsWithDefaults(),r=e.finish(n,{parseDiffOptions:this.options.parseDiffOptions,expandedHunks:this.expandedHunks});t=r.changed,this.expandedHunks=r.expandedHunks}return this.editSessionActive=!1,this.pendingHighlightResult=void 0,this.diff??this.clearRenderCache(),t}requireSession(){let{model:e}=this;if(!this.editSessionActive||e==null||!e.live)throw Error(`DiffHunksRenderer: no edit session is active`);return e}editSessionRows(e){let{rowSource:t}=this;if(t!=null&&t.model===e)return t;let n=new ma({deletionRows:[],additionRows:[],additionLines:[],lineIds:[]});return this.rowSource={result:{code:{additionLines:[],deletionLines:[]},themeStyles:``,baseThemeType:void 0},source:n,model:e}}editorRenderReady(){let{renderCache:e,rowSource:t}=this;return e?.options.useTokenTransformer===!0&&e.highlighted&&e.result!=null&&t?.result===e.result}includesTrailingNewline(){return this.editSessionActive}hasTrailingNewlineRow(e){return this.includesTrailingNewline()&&w(e,`additions`)}showsNoNewlineMarkers(){return!this.editSessionActive}refreshHighlightedResult(){let{diff:e,renderCache:t,workerManager:n}=this;return e==null||t==null||!E(t.diff,e)||it(e)||il(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&n?.isWorkingPool()===!0&&e.cacheKey!=null?(n.evictDiffFromCache(e.cacheKey),n.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,n.getDiffResultCache(e))}).catch(e=>{ce(e)||this.onHighlightError(e)})):this.asyncHighlight(e).then(t=>this.applyRefreshedResult(e,t)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){let{diff:n,renderCache:r}=this;if(t==null||n==null||r==null||!E(n,e)||!E(r.diff,e)||this.editSessionActive)return;let{options:i}=this.getRenderOptions(n);ge(i,t.options)&&(this.pendingHighlightResult={diff:n,options:t.options,highlighted:!0,result:t.result},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}waitForLocalTheme(e){let{workerManager:t,onRenderUpdate:n}=this;return n!=null&&t?.renderWhenLocalThemeLoads(this,n,e)===!0}clearRenderCache(){this.workerManager?.cancelLocalThemeRender(this),this.renderCache=void 0,this.pendingHighlightResult=void 0,this.layout=void 0,this.editSessionActive?this.rowSource?.source.forgetTokens():(this.rowSource=void 0,this.model=void 0)}expandLine(e){this.lineCuts.expand(e),this.layout?.invalidateLines()}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){this.expandedHunks.set(e,z(this.expandedHunks.get(e),t,n)),this.handleExpansionChange()}handleExpansionChange(){this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.layout?.invalidateLines()}getExpandedHunk(e){return this.expandedHunks.get(e)??Te}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e,this.handleExpansionChange()}setLineAnnotations(e){let{annotationList:t}=this;if(!(e===t||e.length===0&&t.length===0)){this.annotationList=e,this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement(e){return na(e)}getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=rt,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=he,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}initializeHighlighter(e=this.computedLangs){return y(Ca(e,{theme:this.getLocalHighlightTheme(),preferredHighlighter:ii(this.workerManager,this.options)}))}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=il(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!ge(t,r.options)&&(r=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!n&&!it(e),options:t,result:n?void 0:r?.result,renderRange:void 0};let i=this.getHighlightWorkerManager(e);i==null?this.options.deferHydrationHighlight!==!0&&R({theme:this.getLocalHighlightTheme()})==null&&(this.computedLangs=rl(e),this.initializeHighlighter().catch(e=>{e instanceof He||this.onHighlightError(e)})):this.renderCache.result==null&&!n&&i.highlightDiffAST(this,this.diff)}awaitsPoolHighlight(e){let t=this.getHighlightWorkerManager(e);if(t==null||e.cacheKey==null||t.didHighlightFail(e))return!1;let n=t.getDiffRenderOptions();return n.useTokenTransformer===!0&&(e.additionLines.length>0||e.deletionLines.length>0)&&!it(e)&&!il(e,this.getTokenizeMaxLength())&&!this.hasHighlightedRenderCache(e,n)&&this.getReadyRenderResult(e,n)==null}getHighlightWorkerManager(e){let{editSessionActive:t,workerManager:n}=this;return!t&&n?.isWorkingPool()===!0&&!n.shouldHighlightOnMainThread(e)?n:void 0}cacheHighlightResult(e,t){let{editSessionActive:n,workerManager:r}=this;!n&&r?.isWorkingPool()===!0&&r.setDiffResultCache(e.cacheKey,t)}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??rt}getLineCutLength(e=this.options){if(this.editSessionActive)return 1/0;let{tokenizeMaxLineLength:t=1e3}=this.getEffectiveCodeOptions(e);return t>0?t:1/0}getEffectiveCodeOptions(e=this.options){let t=this.workerManager?.getDiffRenderOptions();return{theme:t?.theme??this.options.theme??rt,tokenizeMaxLineLength:t?.tokenizeMaxLineLength??e.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager!=null){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,preferredDiffLib:this.options.parseDiffOptions?.preferredDiffLib,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!E(e,n.diff)||!ge(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){let{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if(E(this.renderCache.diff,e))return this.renderCache.diff;let n=!(e.additionLines.length>0||e.deletionLines.length>0)||it(e)||il(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,n)?e:this.renderCache.diff}canRenderDiff(e,t,n){let{renderCache:r}=this;return r==null||E(r.diff,e)?!0:n?r.result==null&&r.hydrated!==!0||this.workerManager?.isWorkingPool()===!0&&!this.workerManager.shouldHighlightOnMainThread(e)||R({theme:t.theme})!=null:r.result==null&&r.hydrated!==!0?!0:this.getHighlightWorkerManager(e)==null?R({theme:t.theme})!=null:!r.highlighted}renderCollapsed(e){this.workerManager?.cancelLocalThemeRender(this),this.diff=e;let{renderCache:t}=this;t!=null&&(!E(t.diff,e)||t.hydrated===!0&&t.result==null)&&this.clearRenderCache();let n=this.getLocalHighlightTheme(),r=R({theme:n});if(r==null){this.initializeHighlighter([`text`]).then(()=>this.onRenderUpdate?.()).catch(e=>{e instanceof He||this.onHighlightError(e)});return}let{disableFileHeader:i=!1}=this.options;return{headerElement:i?void 0:this.renderHeader(e),themeStyles:M({theme:n,highlighter:r}),baseThemeType:typeof n==`string`?r.getTheme(n).type:void 0}}renderDiff(e=this.diff,t=pe){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getReadyRenderResult(e,i);this.pendingHighlightResult=void 0,o!=null&&(this.renderCache={...o,diff:e,renderRange:void 0,lines:this.lineSnapshot(e)},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||it(e)||il(e,this.getTokenizeMaxLength()),l=this.canRenderDiff(e,i,c),u=!E(e,this.renderCache.diff),d=!ea(this.renderCache.renderRange,t),f=this.getHighlightWorkerManager(e);if(f!=null){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!u&&wa(t);if(l&&!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(u||d))){if(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,this.renderCache.result==null||u||d||a){let i=f.getPlainDiffAST(e,t.startingLine,t.totalLines,wa(t)||n?!0:this.expandedHunks,r);i??this.waitForLocalTheme();let{result:o}=this.renderCache,s=o!=null&&i!=null&&!u&&!a?nl(o,i):i;s!==o&&(this.renderCache.lines=this.lineSnapshot(e)),this.renderCache.result=s}this.renderCache.renderRange=t}!c&&s&&(!this.renderCache.highlighted||a)&&f.highlightDiffAST(this,e)}else{this.computedLangs=rl(e);let n=R(),r=n!=null&&$e(i.theme,n),o=n!=null&&be(this.computedLangs,n),s=!c&&o,u=Number.isFinite(t.totalLines);if(l&&n!=null&&r&&(a||!this.renderCache.highlighted&&s||this.renderCache.result==null)){let{result:t,options:r}=this.renderDiffWithHighlighter(e,n,c||!o,u);this.renderCache={diff:e,options:r,highlighted:s,result:t,renderRange:void 0,lines:this.lineSnapshot(e)},s&&this.cacheHighlightResult(e,{result:t,options:r})}if(!r||!c&&!o){if(this.renderCache.result==null&&!this.renderCache.highlighted&&!this.editSessionActive&&this.waitForLocalTheme(c||o?[]:this.computedLangs))return;this.asyncHighlight(e,u).then(({result:t,options:n})=>{c||this.cacheHighlightResult(e,{result:t,options:n}),this.applyHighlightResult(e,t,n,!c)}).catch(e=>{e instanceof He||this.onHighlightError(e)})}}if(this.renderCache.result!=null)return this.workerManager?.cancelLocalThemeRender(this),this.layoutResult(this.renderCache.diff,t,this.renderCache.result,this.renderCache.lines);if(!this.editSessionActive)return;let{result:p}=this.editSessionRows(this.requireSession());return this.layoutResult(this.renderCache.diff,t,p,{ids:[],texts:[]})}async asyncRender(e,t=pe){this.diff=e;let{result:n}=await this.asyncHighlight(e,Number.isFinite(t.totalLines));return this.layoutResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return xa({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e,t=!1){let n=il(e,this.getTokenizeMaxLength());this.computedLangs=n?[`text`]:rl(e);let r=R(),i=r!=null&&$e(this.getLocalHighlightTheme(),r),a=n||r!=null&&be(this.computedLangs,r);return r!=null&&i&&a||(r=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,r,n,t)}renderDiffWithHighlighter(e,t,n=!1,r=!1){let{options:i}=this.getRenderOptions(e),{collapsedContextThreshold:a}=this.getOptionsWithDefaults();return{result:De(e,t,i,{forcePlainText:n,lazyLineAST:r,expandedHunks:n?!0:void 0,collapsedContextThreshold:a}),options:i}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){let{diff:i,renderCache:a}=this;i!=null&&a!=null&&E(i,e)&&ge(n,this.getRenderOptions(i).options)&&(a.result!=null&&a.highlighted&&ge(a.options,n)&&E(a.diff,i)||(this.pendingHighlightResult={diff:i,options:n,highlighted:r,result:t},this.onRenderUpdate?.()))}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(n!=null&&ge(t,n.options))return n}getReadyRenderResult(e,t){let{pendingHighlightResult:n}=this;if(n!=null&&E(n.diff,e)&&ge(n.options,t))return n;let r=this.getMatchingWorkerResultCache(e,t);if(!(r==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...r}}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&E(e,n.diff)&&ge(t,n.options)}onHighlightError(e){console.error(e)}onLocalFallback(){this.onRenderUpdate?.()}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}layoutWithOptions(e){let{diffStyle:t,expandUnchanged:n,expansionLineCount:r,collapsedContextThreshold:i,hunkSeparators:a}=this.getOptionsWithDefaults(),{lineDiffType:o,maxLineDiffLength:s,preferredDiffLib:c}=this.getRenderOptions(e).options,l={diffStyle:t,expandUnchanged:n,expansionLineCount:r,collapsedContextThreshold:i,hunkSeparators:a,lineDiffType:o,maxLineDiffLength:s,preferredDiffLib:c,canHydrateContext:al(e,this.options.loadDiffFiles!=null)},u=this.layout??=new Hc(l,this.lineCuts);return u.setOptions(l),u}editorRenderRange(e,t){if(t==null||e==null||wa(t))return t;let n=this.model?.diff===e?this.model:this.model=Xc.fromDiff(e),r=this.rowSource?.source??new ma({deletionRows:[],additionRows:[],additionLines:[],lineIds:[]}),i=this.layoutWithOptions(e).newFileLines(this.layoutInput(n,r,t));return i==null?{...t,startingLine:0,totalLines:0}:{...t,startingLine:i.first-1,totalLines:i.last-i.first+1}}layoutInput(e,t,n){return this.lineCuts.setLimit(this.getLineCutLength()),{host:this,model:e,rows:t,renderRange:n,expandedHunks:this.expandedHunks,deletionAnnotations:this.deletionAnnotations,additionAnnotations:this.additionAnnotations,annotationSlotName:this.annotationSlotName,includeTrailingNewline:this.includesTrailingNewline(),showNoNewlineMarkers:this.showsNoNewlineMarkers()}}layoutResult(e,t,n,r){let{themeStyles:i,baseThemeType:a}=n,{disableFileHeader:o}=this.getOptionsWithDefaults(),s=this.layoutWithOptions(e),c=this.model?.diff===e?this.model:this.model=Xc.fromDiff(e),l=this.rowSource?.result,u=this.getRowSource(n,c,r),{columns:d,patched:f,hunkData:p,rowCount:m,totalLines:h}=s.layout(this.layoutInput(c,u,t));return{fileDiff:e,columns:d,allRowsChanged:l!==n,patched:f,hunkData:p,preNode:this.createPreElement(d.deletions!=null&&d.additions!=null,h),themeStyles:i,baseThemeType:a,headerElement:o?void 0:this.renderHeader(e),totalLines:h,rowCount:m,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter}}lineSnapshot(e){let{model:t}=this;if(t!=null&&t.diff===e&&t.live)return{ids:t.lineIds(),texts:e.additionLines.slice()}}getRowSource(e,t,n){let{rowSource:r}=this;if(r!=null&&r.result===e)return r.source;if(t.live&&n==null)throw Error(`DiffHunksRenderer: a highlight result for an edited diff has no line snapshot`);let i={deletionRows:e.code.deletionLines,additionRows:e.code.additionLines,additionLines:n?.texts??t.diff.additionLines,lineIds:n?.ids};if(r!=null&&t.live&&r.model===t)return r.source.setHighlightRows(i),this.layout?.invalidateLines(),r.result=e,r.source;let a=new ma(i);return this.rowSource={result:e,source:a,model:t},a}renderCodeAST(e,t){let n=t.columns[e];if(n==null)return;let r=xi(n),i=ue(r.gutter);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,ta(r.content,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(j({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(j({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(j({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return ft(this.renderFullAST(e,t))}renderPartialHTML(e,t){return ft(t==null?e:j({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return va({fileOrDiff:e,mode:t,stickyHeader:n})}};function nl(e,t){return ga(e.code.deletionLines,t.code.deletionLines),ga(e.code.additionLines,t.code.additionLines),e}function rl(e){if(e.lang!=null)return[e.lang];let t=I(e.prevName??e.name),n=I(e.name);return t===n?[n]:[t,n]}function il(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function al(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function ol(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function sl(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function cl(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,deferHydrationHighlight:e?.deferHydrationHighlight,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Va(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,parseDiffOptions:e?.parseDiffOptions,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function ll(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}function ul(e,t){if(e.isPartial||t.isPartial)throw Error(`FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated`);let n=e.lang??I(e.name),r=t.lang??I(t.name),i=e.type!==`new`,a=t.type!==`new`;return e.name!==t.name||n!==r||i!==a||e.deletionLines.length!==t.deletionLines.length||e.deletionLines.some((e,n)=>e!==t.deletionLines[n])}var dl=-1,fl=class{options;workerManager;requestOwnerRender;static LoadedCustomComponent=!0;__id=`file-diff:${++dl}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeColumns=new mi;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;get lineAnnotations(){return this.renderedData?.lineAnnotations??b}managersDirty=!1;appliedManagerSetup;deletionFile;additionFile;fileDiff;editSession;renderedData;pendingData;forceRenderOverride;renderRange;pendingFiles;pendingAttach;appliedPreAttributes;headerCache={lastRenderedHTML:void 0,html:void 0,fileDiff:void 0,messagesVersion:void 0};lastRowCount;columnReconcilers=new WeakMap;changedRowKeys=[];mounted=!1;enabled=!0;editor;constructor(e={theme:rt},t,n){this.options=e,this.workerManager=t,this.requestOwnerRender=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Ki,this.scrollSyncManager=new Is,this.interactionManager=new Ti(`diff`,Ei(e,this.expandLine,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.enabled=!0}subscribeToChanges(){this.workerManager?.subscribeToThemeChanges(this),G.subscribe(this)}handleHighlightRender=()=>{this.rerender()};getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??rt}getHunksRendererOptions(e){return cl(e)}createHunksRenderer(e){return new tl(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>this.getLineIndexForDiff(this.getDiffForLineIndex(),e,t);getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(e,t,n){return er(e,t,n)}setOptions(e){e!=null&&(e.unsafeCSS!==this.options.unsafeCSS&&this.editor?.__setSearchPanelUnsafeCSS(e.unsafeCSS),this.options=e,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions(),this.managersDirty=!0)}syncInteractionOptions(){this.interactionManager.setOptions(Ei(this.options,this.expandLine,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.editSession==null?this.applyCachedThemeState(e):this.onThemeChange())}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!Se(this.appliedThemeCSS.theme,this.getTheme())}getHoveredLine=()=>this.interactionManager.getHoveredLine();getAnnotationSlotName=e=>Ba(this.editSession?.annotations,e,Zt);getLatestAnnotations(){return this.pendingData?.lineAnnotations??this.editSession?.annotations?.current??this.lineAnnotations}getAnnotationsForDiff(e){let{pendingData:t}=this;return t!=null&&E(e,t.fileDiff)?t.lineAnnotations:this.lineAnnotations}isNewAnnotations(e){let t=this.editSession?.annotations;return e===this.getLatestAnnotations()?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){let t=this.editSession?.annotations;if(t!=null){if(!this.isNewAnnotations(e))return;za(t,e,Zt)}let n=this.getWorkingDiff();n!=null&&(this.pendingData={fileDiff:n,lineAnnotations:e})}syncEditSessionAnnotationsFromEditor(e){let t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.renderedData!=null&&(this.renderedData.lineAnnotations=e),this.pendingData=void 0,this.hunksRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushManagers(){if(this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options,n={overflow:t,diffStyle:e,disableAnnotations:t===`wrap`||this.lineAnnotations.length===0,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`};(this.managersDirty||!an(n,this.appliedManagerSetup))&&(this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:n.disableAnnotations,columnVariables:n.columnVariables}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.appliedManagerSetup=n,this.managersDirty=!1)}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.lineAnnotations.length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}get codeUnified(){return this.codeColumns.get(`unified`)}set codeUnified(e){this.codeColumns.set(`unified`,e)}get codeDeletions(){return this.codeColumns.get(`deletions`)}set codeDeletions(e){this.codeColumns.set(`deletions`,e)}get codeAdditions(){return this.codeColumns.get(`additions`)}set codeAdditions(e){this.codeColumns.set(`additions`,e)}getCodeScrollLeft(){return this.codeColumns.scrollLeft}setCodeScrollLeft(e){this.codeColumns.setScrollLeft(e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions(),themeType:this.options.themeType}}cleanUp(e=!1){let{editor:t}=this;t?.__assertOutsideChangeCallback(`FileDiff.cleanUp`),bn(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?`recycle`:`discard`),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),G.unsubscribe(this),this.renderRange=void 0,e||(this.pendingFiles=void 0,this.pendingAttach=void 0),this.isComponentManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.renderedData=void 0,this.pendingData=void 0),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre?.remove(),this.pre=void 0,this.codeColumns.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement?.remove(),this.headerElement=void 0,this.clearHeaderSlots(),this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,e||this.clearReusableHeader(),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=lo(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t);let l=this.editor!=null;l||_l(this.pre,hl({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||vl(this.headerElement,gl({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,forceRender:l||a.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),qa(e,t);for(let t of e.shadowRoot?.children??[])if(t instanceof SVGElement)this.spriteSVG=La(t);else if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)e instanceof HTMLElement&&e.tagName.toLowerCase()===`code`&&(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e))}else`diffsHeader`in t.dataset?this.headerElement=t:t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)?this.themeCSSStyle=t:t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent)}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer??this.subscribeToChanges(),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){let i=r??this.getLatestAnnotations();this.pendingData=void 0,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?Ps(t,n,this.options.parseDiffOptions):void 0),this.renderedData=this.fileDiff==null?void 0:{fileDiff:this.fileDiff,lineAnnotations:i},this.fileDiff!=null&&this.adoptRenderData(this.fileDiff),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}expandLine=e=>{this.hunksRenderer.expandLine(e),this.rerender()};rerender(){!this.enabled||this.getInputDiff()==null&&this.additionFile==null&&this.deletionFile==null||this.requestRender()||this.render({forceRender:!0,renderRange:this.renderRange})}requestRender(){let{requestOwnerRender:e}=this;return this.editSession!=null||e==null?!1:(this.forceRenderOverride=!0,e(),!0)}get isComponentManaged(){return this.requestOwnerRender!=null}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}onMessagesChange(){this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.loadFilesIfNecessary(),this.hunksRenderer.expandHunk(e,t,n),this.rerender()};loadFilesIfNecessary(){let e=this.getInputDiff(),{loadDiffFiles:t}=this.options;if(e==null||!ll(e)||this.pendingFiles?.fileDiff===e)return;if(t==null)throw Error(`FileDiff: loadDiffFiles is required to load full files for a partial diff`);let n=this.loadFilesForDiff(e,t),r=this.pendingFiles={fileDiff:e,promise:n};r.promise=n.finally(()=>{this.pendingFiles===r&&(this.pendingFiles=void 0)})}isReadyToEdit(){let e=this.getInputDiff();return e!=null&&!e.isPartial&&!this.hunksRenderer.awaitsPoolHighlight(e)}async prepareForEditing(){if(this.isReadyToEdit())return;let e=this.__prepareForEditing();if(e==null)throw Error(`FileDiff.prepareForEditing: a diff is required before editing`);if(await e,!this.isReadyToEdit())throw Error(`FileDiff.prepareForEditing: the diff is not ready to edit`)}__prepareForEditing(){let e=this.getInputDiff();if(e==null||this.isReadyToEdit())return;if(e.isPartial&&!ll(e))throw Error(`FileDiff: this partial diff cannot be hydrated; provide a complete diff to edit`);let{pendingAttach:t}=this;if(t?.fileDiff===e)return t.promise;let n={fileDiff:e,promise:this.prepareInputForEditing(e)};return this.pendingAttach=n,n.promise=n.promise.finally(()=>{this.pendingAttach===n&&(this.pendingAttach=void 0)}),n.promise}async prepareInputForEditing(e){e.isPartial&&(this.loadFilesIfNecessary(),await this.pendingFiles?.promise,!this.enabled||this.getInputDiff()!==e)||await this.awaitPoolHighlight(e)}async awaitPoolHighlight(e){this.hunksRenderer.awaitsPoolHighlight(e)&&(await this.primeHighlightCache(e),this.enabled&&this.getInputDiff()===e&&!this.hunksRenderer.awaitsPoolHighlight(e)&&this.rerender())}async loadFilesForDiff(e,t){try{let n=await t(e);if(this.getInputDiff()!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}}async handleFilesLoaded(e,t){this.getInputDiff()===e&&e.isPartial&&(go(`merge`,e,t,this.options.parseDiffOptions),this.setHydratedState(t),!this.installHydratedDiff(e)&&(await ao(()=>this.primeHighlightCache(e)),!this.enabled||this.getInputDiff()!==e)||this.rerender())}installHydratedDiff(e){return this.editSession==null||this.getInputDiff()!==e?!1:(this.replaceEditSession(e,this.getLatestAnnotations()),!0)}replaceEditSession(e,t){let{editor:n,editSession:r}=this,i=r?.diff;this.installEditSession(e),n!=null&&i!=null&&n.__replaceDocument(pl(e),ul(i,e),t)}updateInputDiff(e,t){if(E(this.getInputDiff(),e))return!1;this.editor?.__assertOutsideChangeCallback(`FileDiff.render`),this.hunksRenderer.lineCuts.clear();let n=this.getLatestAnnotations();this.fileDiff=e;let{editSession:r}=this;return r?.annotations!=null&&t!=null&&(r.annotations=Ra(t,Zt,r.annotations)),r!=null&&(e.isPartial?(r.inputDiff=e,this.loadFilesIfNecessary()):this.replaceEditSession(e,r.annotations?.current??t??n)),this.pendingData={fileDiff:this.editSession?.diff??e,lineAnnotations:this.editSession?.annotations?.current??t??n},!0}installEditSession(e,t,n){let r=this.hunksRenderer.startEditSession(e,{document:t,snapshot:n}),i=this.editSession?.annotations??Ra(this.getLatestAnnotations(),Zt);this.editSession={diff:r,inputDiff:e,annotations:i},this.pendingData={fileDiff:r,lineAnnotations:i.current}}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);n=this.forceRenderOverride??n,this.forceRenderOverride=void 0;let l=lo(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!ml(u,this.deletionFile)||!ml(d,this.additionFile)),y=e!=null&&!E(e,this.getInputDiff()),b=i!=null&&(i.length>0||this.getLatestAnnotations().length>0)&&this.isNewAnnotations(i);if(!f&&ea(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&!y||e==null&&!v)){let e=this.applyCachedThemeState(p);return e&&this.finalizeRender(),e}let x;e==null&&_&&(v||this.getInputDiff()==null)&&(x=Ps(l.oldFile,l.newFile,this.options.parseDiffOptions)),(e!=null&&y||x!=null)&&this.editor?.__assertOutsideChangeCallback(`FileDiff.render`),this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&y?this.updateInputDiff(e,i):x!=null&&(y=!0,this.updateInputDiff(x,i)),y&&this.clearReusableHeader(),i!=null&&this.setLineAnnotations(i),b&&(this.managersDirty=!0);let S=this.getWorkingDiff();if(S==null)return!1;S.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(ac(S,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.prepareRenderData(this.getDiffForNextRender(S));let{disableErrorHandling:C=!1,disableFileHeader:w=!1}=this.options;if(w&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.ensureSpriteSVG(a),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderCollapsed(S);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a,S),this.renderSeparators([]),this.adoptRenderData(S),this.injectUnsafeCSS()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return this.finalizeRender(),r||this.emitPostRender(),!0}let T=this.editor==null?void 0:this.hunksRenderer.editorRenderRange(S,h),D=this.editor?.__prepareRender(T);D!=null&&this.hunksRenderer.setTokens(D);try{let e=this.getOrCreatePreNode(a),n=this.hunksRenderer.renderDiff(S,h);if(n==null)return!1;this.applyThemeState(a,n.themeStyles,p,n.baseThemeType),n.headerElement!=null&&this.applyHeaderToDOM(n.headerElement,a,n.fileDiff);let{unified:r,deletions:i,additions:o}=n.columns;r!=null||i!=null||o!=null?this.applyHunksToDOM(e,n):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(n.hunkData),this.adoptRenderData(n.fileDiff),this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor(T)}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}getInputDiff(){return this.fileDiff}getWorkingDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedData?.fileDiff}__getNextRenderData({fileDiff:e,lineAnnotations:t}){let n=this.editSession?.annotations;if(n!=null)return{fileDiff:e,lineAnnotations:t!=null&&this.isNewAnnotations(t)?t:n.provided};let r=this.getWorkingDiff(e)??e,i=this.getDiffForNextRender(r);return{fileDiff:i,lineAnnotations:t!=null&&E(i,r)?t:this.getAnnotationsForDiff(i)}}getDiffForNextRender(e){let{collapsed:t=!1}=this.options;return t?e:this.hunksRenderer.getDiffForNextRender(e)}prepareRenderData(e){this.hunksRenderer.setLineAnnotations(this.getAnnotationsForDiff(e))}adoptRenderData(e){let{pendingData:t}=this,n=t!=null&&E(e,t.fileDiff);this.renderedData={fileDiff:e,lineAnnotations:n?t.lineAnnotations:this.lineAnnotations},n&&(this.pendingData=void 0)}syncRenderViewToEditor(e=this.hunksRenderer.editorRenderRange(this.getWorkingDiff(),this.renderRange)){let{editor:t,fileContainer:n}=this,r=this.getLatestAnnotations(),i=this.getWorkingDiff();if(t==null||n==null||i==null||i.isPartial)return;let a=a=>{this.enabled&&this.editor===t&&this.fileContainer===n&&this.getWorkingDiff()===i&&t.__syncRenderView({highlighter:a,fileContainer:n,columns:this.editorColumns(),fileDiff:i,lineAnnotations:r,renderRange:e,domCurrent:this.hunksRenderer.editorRenderReady()})},o=this.getTheme(),s=i.lang??I(i.name),c=R({theme:o,lang:s});c==null?y({themes:Ye(o),langs:[`text`,s],preferredHighlighter:ii(this.workerManager,this.options)}).then(a).catch(e=>{e instanceof He||console.error(e)}):a(c)}__acceptEditorChange(e){let{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){let{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(e=!0){let t=this.editSession?.diff;if(!(t==null||t.isPartial))return{diffSession:{oldFile:t.type===`new`?null:{name:t.prevName??t.name,lines:e?[...t.deletionLines]:t.deletionLines},type:t.type,hunks:e?uo(t.hunks):t.hunks},hasChanges:t.editSessionDirty===!0}}__attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw Error(`FileDiff.__attachEditor: an editor is already attached`);if(!this.isReadyToEdit())throw Error(`FileDiff.__attachEditor: the component is not ready to edit; await prepareForEditing() first`);let t=()=>{this.editor=void 0,this.endEditSession()};try{return this.resumeEditorRendering(e),t}catch(e){throw t(),e}}__resumeEditor(e){if(this.editor!==e)throw Error(`FileDiff.__resumeEditor: editor association changed`);this.resumeEditorRendering(e)}resumeEditorRendering(e){let t=this.getInputDiff(),n=this.editSession==null&&t!=null&&!t.isPartial?t:void 0;n!=null&&this.installEditSession(n,e.__getDocumentContents(pl(n)),e.__getDocumentSessionState()),this.editor=e,this.getInputDiff()?.isPartial===!0&&this.loadFilesIfNecessary();let r=this.editSession?.diff;r!=null&&this.hunksRenderer.editorRenderReady()&&this.hunksRenderer.diffCache===r&&this.adoptRenderData(r),this.renderChange(!0)}__completeEditSession(e,t){this.settleEditSession(t===`install`,e)}settleEditSession(e,t){let{editSession:n}=this;if(n==null)return;let{diff:r,inputDiff:i,annotations:a}=n,o=a?.provided??this.lineAnnotations;if(this.editor!=null)throw Error(`FileDiff.__completeEditSession: detach the editor before completing the session`);this.endEditSession();let s=a?.current,c,l=null,u=null,d=!1,f;if(t==null)throw Error(`FileDiff.__completeEditSession: editor is required for completion`);let p=fo(r),m={name:p.name,contents:p.additionLines.join(``)};p.lang!=null&&(m.lang=p.lang);let h={fileDiff:p,editor:t,originalFileDiff:i,oldFile:p.type===`new`?null:{name:p.prevName??p.name,contents:p.deletionLines.join(``)},newFile:m,lineAnnotations:s,originalLineAnnotations:o};Object.freeze(h);try{if(t.__emitEditComplete(h),this.options.onEditComplete?.(h)===`accept`){if(p.cacheKey!=null&&p.cacheKey===i.cacheKey)throw Error(`FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey`);c=p,l=h.oldFile,u=h.newFile}}catch(e){d=!0,f=e}if(e&&c!=null&&(this.hunksRenderer.lineCuts.clear(),this.additionFile!=null&&(this.deletionFile=l,this.additionFile=u)),this.editSession=void 0,this.fileDiff=e&&c!=null?c:i,this.pendingData={fileDiff:this.fileDiff,lineAnnotations:e&&c!=null?s??o:o},e&&this.fileContainer!=null&&this.rerender(),d)throw f}endEditSession(){this.editSession!=null&&(this.hunksRenderer.endEditSession()&&this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(`exit`))}applyChange(e,t,n={}){if(this.editSession==null)throw Error(`FileDiff.applyChange: requires an active edit session`);let{tokens:r,lineAnnotations:i}=n,{lineDelta:a,removedLineIds:o,regionsChanged:s,hunksChanged:c}=this.hunksRenderer.applyChange(t,e,r);i!=null&&this.syncEditSessionAnnotationsFromEditor(i);let l=a!==0||o.length>0||s;return this.renderChange(l||c),this.fileContainer==null||this.editSession==null?{rebuiltLines:[]}:(l&&this.interactionManager.setSelectionDirty(),{rebuiltLines:this.takeRebuiltLines()})}renderChange(e){this.fileContainer!=null&&this.rerender()}applyTokens(e){this.editSession!=null&&this.hunksRenderer.setTokens(e).some(e=>this.lineElement(e)!=null)&&this.rerender()}recordRowsWritten({changed:e,attributesReset:t,gutterRewritten:n}){for(let t of e)this.changedRowKeys.push(t),bi(t)||(this.managersDirty=!0);t&&this.interactionManager.setSelectionDirty(),(t||n)&&(this.managersDirty=!0)}lineElement(e){let t=this.codeAdditions??this.codeUnified;if(t==null||this.editSession==null)return;let n=this.hunksRenderer.lineKey(e);return n==null?void 0:this.columnReconcilers.get(t)?.elementFor(n)?.content}editLineFor(e){return this.editSession==null?void 0:this.hunksRenderer.editLineFor(e)}takeRebuiltLines(){let e=this.changedRowKeys;this.changedRowKeys=[];let t=[];for(let n of e){let e=this.hunksRenderer.lineOfKey(n);e!=null&&t.push(e)}return t}isLineInCollapsedContext(e,t=`additions`,n=this.hunksRenderer.getExpandedHunksMap()){let r=this.getRenderedDiff()??this.getWorkingDiff();if(r==null)return!1;let{expandUnchanged:i=!1,collapsedContextThreshold:a=1}=this.options;return nt({fileDiff:r,lineNumber:e,side:t,expandedHunks:i?!0:n,collapsedContextThreshold:a})}getNearestRenderableLine(e,t){let n=this.getRenderedDiff()??this.getWorkingDiff();if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return Ke({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e,t=`additions`){let n=this.getRenderedDiff()??this.getWorkingDiff(),{expandUnchanged:r=!1,collapsedContextThreshold:i=1,expansionLineCount:a=100}=this.options;if(n==null||n.isPartial||r)return!1;let o=this.hunksRenderer.getExpandedHunksMap();for(let[r,s]of n.hunks.entries()){let[c,l]=Oe(s,t);if(e<c){let t=et({isPartial:n.isPartial,rangeSize:s.collapsedBefore,expandedHunks:o,hunkIndex:r,collapsedContextThreshold:i}),l=c-t.rangeSize;if(t.renderAll||e<l+t.fromStart||e>=c-t.fromEnd)return!1;let u=e-(l+t.fromStart)+1,d=c-t.fromEnd-e;return u<=d?this.expandHunk(r,`up`,u+a):this.expandHunk(r,`down`,d+a),!0}if(e<l)return!1}let s=Fe({fileDiff:n,hunkIndex:n.hunks.length-1,expandedHunks:o,collapsedContextThreshold:i,errorPrefix:`FileDiff.revealLine`});if(s==null||s.renderAll)return!1;let c=n.hunks[n.hunks.length-1],[,l]=Oe(c,t);return e<l+s.fromStart||e>=l+s.rangeSize?!1:(this.expandHunk(n.hunks.length,`up`,e-(l+s.fromStart)+1+a),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(e){yn(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender()};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.codeDeletions?.remove(),this.codeAdditions?.remove(),this.codeColumns.cleanUp(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.editor?.__captureFocusForDOMReplacement(),this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.setPlaceholderHeight(e)}setPlaceholderHeight(e){return this.placeHolder!=null&&(this.placeHolder.style.setProperty(`height`,`${e}px`),!0)}async primeHighlightCache(e=this.getInputDiff()){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||it(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{ce(e)||console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeColumns.cleanUp(),this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isComponentManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!sl(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isComponentManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderedData:t,options:{renderAnnotation:n}}=this;if(n!=null&&t!=null){let{fileDiff:r,lineAnnotations:i}=t;for(let[t,a]of i.entries()){let i=this.getAnnotationSlotName(a),o=`${t}-${i}`,s=this.annotationCache.get(o);if(s==null||s.fileDiff!==r||!ol(a,s.annotation)){s?.element.remove();let e=n(a,r);if(e==null)continue;s={element:Ma(i),annotation:a,fileDiff:r},s.element.appendChild(e),this.fileContainer.appendChild(s.element),this.annotationCache.set(o,s)}e.delete(o)}}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=Na();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),n??this.subscribeToChanges(),this.fileContainer=r,n!=null&&i&&(this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:ei(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):ei(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});this.spriteSVG??=Ia(),this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeColumns.cleanUp(),t.appendChild(this.pre),this.managersDirty=!0):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0,this.managersDirty=!0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeColumns.cleanUp();for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t,n){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{headerCache:{fileDiff:r,html:i,lastRenderedHTML:a,messagesVersion:o}}=this,s=this.editSession?.diff,{version:c}=G,l=(n!==s&&o===c&&E(r,n)?i:void 0)??ft(e);if(this.headerCache.html=l,this.headerCache.fileDiff=n,this.headerCache.messagesVersion=c,l!==a){let e=document.createElement(`div`);e.innerHTML=l;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.headerCache.lastRenderedHTML=l}if(this.isComponentManaged)return;let{renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p}=this.options;if(u!=null){let e=u(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Ce,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let m=d?.(n)??void 0,h=f?.(n)??void 0,g=p?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,A,m),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,oe,h),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,le,g),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options;this.pre?.toggleAttribute(`data-custom-styles`,!!e);let t=this.fileContainer?.shadowRoot;t!=null&&(e==null||e===``?(this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0):(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=Vr(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Kn(e),this.appliedUnsafeCSS=e))}applyThemeState(e,t,n,r){if(t===``)return;let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.getTheme(),s=typeof o==`string`?o:{...o},c=Hn(i);this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c?this.appliedThemeCSS.theme=s:this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i?(this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}):(this.themeCSSStyle=Ga({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:qn(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c})}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=Jn(this.themeCSSStyle.textContent??``,Hn(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&En()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Wa(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}writeColumn(e,t,n,{rowCount:r,allRowsChanged:i}){let a=this.getColumnPair(e);a==null?(a=this.createColumns(e,r),this.managersDirty=!0):r!==this.lastRowCount&&(a.gutter.style.setProperty(`grid-row`,`span ${r}`),a.content.style.setProperty(`grid-row`,`span ${r}`));let o=this.columnReconcilers.get(e);if(o??(o=new hi(a.gutter,a.content),this.columnReconcilers.set(e,o),!i&&a.content.childElementCount>0&&o.adopt(t)),i){o.replaceAll(t);for(let e of t)this.changedRowKeys.push(e.key);this.interactionManager.setSelectionDirty(),this.managersDirty=!0}else this.recordRowsWritten(o.reconcile(t,n))}removeStaleRows(e,t){e!=null&&t!=null&&this.columnReconcilers.get(e)?.removeStale(t)}createColumns(e,t){let n=ue();n.properties.style=`grid-row: span ${t}`,e.innerHTML=ft([n,ta([],t)]);let r=this.getColumnPair(e);if(r==null)throw Error(`FileDiff.createColumns: the columns did not parse`);return r}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t),this.changedRowKeys=[];let a=!1,o=[],{unified:s,deletions:c,additions:l}=t.columns,{patched:u}=t;this.editor?.__captureFocusForDOMReplacement(),!t.allRowsChanged&&u==null&&(this.removeStaleRows(this.codeUnified,s),this.removeStaleRows(this.codeDeletions,c),this.removeStaleRows(this.codeAdditions,l)),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Ua({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.writeColumn(this.codeDeletions,c,u?.deletions,t),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Ua({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.writeColumn(this.codeAdditions,l,u?.additions,t),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeDeletions?.remove(),this.codeAdditions?.remove(),this.codeColumns.cleanUp()):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=Ua({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.writeColumn(this.codeUnified,s,u?.unified,t),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&(e.replaceChildren(...o),this.managersDirty=!0),this.lastRowCount=t.rowCount}editorColumns(){let e=this.codeAdditions??this.codeUnified,t=this.getColumnPair(e);if(e!=null&&t!=null)return{code:e,gutter:t.gutter,content:t.content,deletions:this.getColumnPair(this.codeDeletions)}}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&t.dataset.gutter!=null&&n.dataset.content!=null)return{gutter:t,content:n}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){t==null||this.shouldDisableVirtualizationBuffers()?(this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)):(t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0))}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{columns:t,totalLines:n},r){let{diffIndicators:i=`bars`,disableBackground:a=!1,disableLineNumbers:o=!1,overflow:s=`scroll`,diffStyle:c=`split`}=this.options,l={type:`diff`,diffIndicators:i,disableBackground:a,disableLineNumbers:o,overflow:s,split:c!==`unified`&&t.additions!=null&&t.deletions!=null,totalLines:n,customProperties:r};ka(l,this.appliedPreAttributes)||(Ja(e,l),this.appliedPreAttributes=l)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function pl(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join(``)}}function ml(e,t){return e==null||t==null?e==null&&t==null:O(e,t)}function hl({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function gl({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function _l(e,t,n=!1){return!n&&e==null&&t}function vl(e,t,n=!1){return e==null&&t&&!n}var yl=3e3,bl=new Map,xl=-1,Sl=class extends fl{__id=`little-virtualized-file-diff:${++xl}`;renderType=`virtualized`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:bl};highestMeasuredRow=-1;unmeasured=!1;isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;currentCollapsed;pendingHydratedDiff;pendingExpandedHunks;pendingRender;constructor(e,t,n,r,i){super(e,r,i),this.virtualizer=t,this.metrics=st(n)}setMetrics(e,t=!1){let n=st(e);(t||!an(this.metrics,n))&&(this.metrics=n,this.resetMeasurements(),this.invalidateLayout({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&(this.forceRenderOverride=!0)}syncLineAnnotations(e){return e==null||!this.isNewAnnotations(e)||e.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(e),this.managersDirty=!0,!0)}syncEditSessionAnnotationsFromEditor(e){return super.syncEditSessionAnnotationsFromEditor(e)?(this.forceRenderOverride=!0,!0):!1}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e){let t=this.getLayoutAnnotations();return di(t)?t.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1):!1}getLineHeight(e,t,n=!1){let{cache:r}=this,i=this.getEstimatedLineHeight(n)+(r.heightDeltas.get(e)??0);return t==null||r.ghostTextRows.size===0?i:i+(r.ghostTextRows.get(t)??0)*this.metrics.lineHeight}ghostTextRowsHeight(){let e=0;for(let t of this.cache.ghostTextRows.values())e+=t;return e*this.metrics.lineHeight}ghostTextRowsByIndex(e){let t=this.getDiffStyle(),n=new Map;for(let[r,i]of this.cache.ghostTextRows){let a=this.getLineIndexForDiff(e,r+1,`additions`);a!=null&&n.set(t===`split`?a[1]:a[0],i)}return n}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}hasNoNewlineMarker(e){return this.hunksRenderer.showsNoNewlineMarkers()&&(e.hasAddition&&e.additionNoEOFCR||e.hasDeletion&&e.deletionNoEOFCR)}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!on(t,e),r=n&&Al(t,e);super.setOptions(e),r&&(this.resetMeasurements(),this.invalidateLayout({forceSimpleRecompute:!0,includeEstimatedHeights:jl(t,e)})),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetMeasurements(){this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.highestMeasuredRow=-1,this.cache.ghostTextRows=bl}dropMeasurementsPastEnd(){let e=this.getRenderedDiff(),{heightDeltas:t}=this.cache;if(e==null||t.size===0)return;let n=this.getDiffStyle(),r=Math.max(this.getExpandedLineCount(e,n),n===`split`?e.splitLineCount:e.unifiedLineCount,e.additionLines.length,e.deletionLines.length);for(let e=this.highestMeasuredRow;e>=r;e--){let n=t.get(e);n!=null&&(t.delete(e),this.cache.measuredHeightDeltaTotal-=n)}this.highestMeasuredRow=Math.min(this.highestMeasuredRow,r-1)}invalidateLayout({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),t&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&n&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}applyGhostTextRows(e){if(this.cache.ghostTextRows===e)return!1;let t=!ui(e,this.cache.ghostTextRows);return this.cache.ghostTextRows=e,t}reconcileHeights(){let e=!1;this.unmeasured=!1;let{options:{overflow:t=`scroll`}}=this,n=this.placeHolder==null?this.getRenderedDiff():this.getLayoutDiff();if(this.fileContainer==null||n==null)return this.height!==0&&(e=!0),this.height=0,e;this.top=this.getVirtualizedTop(),e=this.applyGhostTextRows(this.editor?.__getGhostTextRows()??bl);let r=t!==`scroll`||this.lineAnnotations.length>0||typeof process<`u`&&!1;if(this.placeHolder!=null||!r&&this.cache.heightDeltas.size===0&&this.cache.fileAnnotationHeight===0)return e&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),e;let i=this.getDiffStyle(),a=i===`split`?[this.codeAdditions,this.codeDeletions]:[this.codeUnified],o=new Set;for(let t of a){if(t==null)continue;let n=t.children[1];if(!(n instanceof HTMLElement))continue;let a=i===`split`&&t===this.codeDeletions;for(let t of n.children){if(!(t instanceof HTMLElement))continue;let n=t.dataset.lineIndex;if(n==null)continue;let s=Fl(n,i);if(a){if(o.has(s))continue}else i===`split`&&o.add(s);let c=this.cache.heightDeltas.get(s)??0;if(!r&&c===0)continue;let l=t.getBoundingClientRect().height;if(l===0){this.unmeasured=!0;break}let u=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(u=!0),l+=t.nextElementSibling.getBoundingClientRect().height);let d=this.getEstimatedLineHeight(u),f=l-d;f!==c&&(e=!0,this.cache.measuredHeightDeltaTotal+=f-c,f===0?this.cache.heightDeltas.delete(s):(this.cache.heightDeltas.set(s,f),this.highestMeasuredRow=Math.max(this.highestMeasuredRow,s)))}if(this.unmeasured)break}if(!this.unmeasured&&this.renderRange!=null&&pi(this.renderRange)){let t=Cl(a)??0;this.setFileAnnotationHeight(t)&&(e=!0)}return e&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());renderChange(e){e?this.escalateEditSessionRender(`change`):this.rerender()}applyChange(e,t,n){return ci(t)&&this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyChange(e,t,n)}updateCodeViewLayout(e,t,n,r){let i=!1,a=!1,{pendingExpandedHunks:o,pendingHydratedDiff:s,options:{collapsed:c=!1}}=this;s!=null&&(this.pendingHydratedDiff=void 0,E(s.expectedDiff,e)&&(Object.assign(e,s.nextDiff),this.setHydratedState(s.files),this.installHydratedDiff(e),this.forceRenderOverride=!0,i=!0,a=!0)),o!=null&&(this.pendingExpandedHunks=void 0,this.hunksRenderer.setExpandedHunksMap(o),this.forceRenderOverride=!0,a=!0);let l=this.updateInputDiff(e,r),{pendingRenderDiff:u,layoutDiffChanged:d,renderedDiffChanged:f,annotationsChanged:p}=this.updatePendingRender(e,r);return!this.forceRenderOverride&&(l||f||p)&&(this.forceRenderOverride=!0),(n?.resetDiffLayoutCache===!0||d)&&(i=!0),(d||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(a=!0),n?.metrics!=null&&(this.metrics=st(n.metrics),i=!0,a=!0),this.currentCollapsed!==c&&(this.currentCollapsed=c,i=!0),i?(this.resetMeasurements(),this.invalidateLayout({includeEstimatedHeights:a})):a&&this.invalidateLayout({includeEstimatedHeights:!0}),this.top=t,this.computeApproximateSize(!1,u),this.height}getLinePosition(e,t=`additions`){let n=this.getLayoutDiff();if(n==null||e<1)return;let r=this.getLineIndexForDiff(n,e,t);if(r==null)return;let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options,c=this.getDiffStyle(),l=this.getHunkSeparatorType(),u=c===`split`?r[1]:r[0];this.approximateLayoutCheckpoints(n);let d=ot(this.metrics,i),f=this.getLayoutCheckpointBeforeLineIndex(u),p=f?.top??d+this.cache.fileAnnotationHeight;if(o)return{top:Ee(this.metrics,i),height:0};let m,h=new Ue({diff:n,diffStyle:c,startingLine:f?.renderedLineIndex??0,expandedHunks:a?!0:this.pendingExpandedHunks??this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,includeTrailingNewline:this.hunksRenderer.includesTrailingNewline()});for(;h.next();){let{hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r}=h,i=c===`split`?h.splitLineIndex:h.unifiedLineIndex;if(n>0){let r=je({type:l,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(p+=r.gapBefore,u>=i-n&&u<i){m={top:p,height:r.height};break}p+=r.height+r.gapAfter}}let a=this.getLineHeight(i,h.hasAddition?h.additionLineIndex:void 0,this.hasNoNewlineMarker(h));if(i===u){m={top:p,height:a};break}if(p+=a,r>0){let e=Ne({type:l,metrics:this.metrics});if(e!=null){if(u>i&&u<=i+r){m={top:p+e.gapBefore,height:e.height};break}p+=e.totalHeight}}}return m}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}scrollToLine(e,t,n){let{virtualizer:r}=this;this.isLineInCollapsedContext(e)?(r.cancelScroll(),n(`cancelled`)):r.type===`advanced`?r.scrollToInstanceLine(this,e,t,n):r.scrollSpanIntoView({align:t,onDone:n,resolveSpan:()=>{let t=this.getLinePosition(e);return t==null?void 0:{top:this.getVirtualizedTop()+t.top,height:t.height}}})}cancelScroll(e){this.virtualizer.cancelScroll(e)}getRenderedBounds(){let e=this.renderRange;if(!this.enabled||e==null||e.totalLines<=0)return;let t=this.getLayoutDiff();return{top:ot(this.metrics,this.options.disableFileHeader??!1)+(e.startingLine===0?this.cache.fileAnnotationHeight:e.bufferBefore),bottom:this.height-(t!=null&&t.hunks.length===0?0:me(this.metrics))-e.bufferAfter}}getNumericScrollAnchor(e){let t=this.getLayoutDiff();if(t==null)return;let{disableFileHeader:n=!1,expandUnchanged:r=!1,collapsed:i=!1,collapsedContextThreshold:a=1}=this.options;if(i)return;let o=this.getDiffStyle(),s=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(t);let c=this.getLayoutCheckpointBeforeTop(e),l=c?.top??ot(this.metrics,n)+this.cache.fileAnnotationHeight,u,d=new Ue({diff:t,diffStyle:o,startingLine:c?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,includeTrailingNewline:this.hunksRenderer.includesTrailingNewline()});for(;d.next();){let{hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i}=d,a=o===`split`?d.splitLineIndex:d.unifiedLineIndex;if(r>0){let e=je({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(l+=e.totalHeight)}if(l>=e){u=d.hasDeletion?{lineNumber:d.deletionLineNumber,side:`deletions`,top:l}:{lineNumber:d.additionLineNumber,side:`additions`,top:l};break}let c=this.getLineHeight(a,d.hasAddition?d.additionLineIndex:void 0,this.hasNoNewlineMarker(d));if(l+=c,i>0){let e=Ne({type:s,metrics:this.metrics});e!=null&&(l+=e.totalHeight)}}return u}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){let t=this.getLayoutDiff();if(this.top==null||t==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let n=e==null?this.renderRange:this.computeRenderRangeFromWindow(t,this.top,e);if(n==null)return;let{bufferBefore:r,bufferAfter:i,totalLines:a}=n,o=0;if(a===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(o=i)}return{topOffset:this.top+r+o,height:this.height-(r+i)}}cleanUp(e=!1){let t=this.cache.ghostTextRows.size>0;t&&(this.layoutDirty=!0);let n=e&&this.isAdvancedMode()&&this.fileContainer!=null&&(t||!E(this.getRenderedDiff(),this.getWorkingDiff()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetMeasurements(),this.invalidateLayout({includeEstimatedHeights:!0}),this.pendingExpandedHunks=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(e),n&&this.virtualizer.instanceChanged(this,!0)}expandHunk=(e,t,n)=>{if(this.getInputDiff()!=null){if(this.loadFilesIfNecessary(),this.isAdvancedMode()){let{expansionLineCount:r=100}=this.options,i=this.pendingExpandedHunks??=new Map(this.hunksRenderer.getExpandedHunksMap());i.set(e,z(i.get(e),t,n??r))}else this.hunksRenderer.expandHunk(e,t,n),this.resetMeasurements(),this.invalidateLayout({includeEstimatedHeights:!0}),this.computeApproximateSize();this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}};async handleFilesLoaded(e,t){if(this.getInputDiff()===e&&e.isPartial){if(this.isAdvancedMode()){let n=go(`clone`,e,t,this.options.parseDiffOptions);if(await ao(()=>this.primeHighlightCache(n)),this.getInputDiff()!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(go(`merge`,e,t,this.options.parseDiffOptions),this.setHydratedState(t),!this.installHydratedDiff(e)&&(await ao(()=>this.primeHighlightCache(e)),this.getInputDiff()!==e))return;this.resetMeasurements(),this.invalidateLayout({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.getInputDiff())return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineInCollapsedContext(e,t=`additions`,n=this.pendingExpandedHunks??this.hunksRenderer.getExpandedHunksMap()){return super.isLineInCollapsedContext(e,t,n)}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.invalidateLayout({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(e){e===`exit`?this.resetMeasurements():this.dropMeasurementsPastEnd(),this.invalidateEditSessionLayout(),this.enabled&&this.getInputDiff()!=null&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}getLineCutsForSearch(){let{hunksRenderer:e,options:t}=this;return{cutLength:e.getLineCutLength(t),expandedLines:e.lineCuts.expandedLines}}getDiffForSearch(){return this.getWorkingDiff()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.getInputDiff()==null&&this.additionFile==null&&this.deletionFile==null)return;let e=this.getWorkingDiff(),t=e==null?void 0:this.getDiffForNextRender(e);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.isSimpleMode()&&this.requestRender()||this.virtualizer.instanceChanged(this,!E(this.getRenderedDiff(),t))}get isComponentManaged(){return this.getAdvancedVirtualizer()?.isComponentManaged??super.isComponentManaged}syncGhostTextRows(){let e=this.getAdvancedVirtualizer();e==null?this.getSimpleVirtualizer()?.requestHeightReconcile(this):(e.capturePendingLayoutAnchor(),this.layoutDirty=!0,e.instanceChanged(this,!0))}computeApproximateSize(e=!1,t=this.getLayoutDiff()){if(!e&&!this.layoutDirty)return;if(this.height,this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}this.applyGhostTextRows(this.editor?.__getGhostTextRows()??bl);let{disableFileHeader:n=!1,collapsed:r=!1}=this.options;r?(this.height+=Ee(this.metrics,n),this.layoutDirty=!1):(this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal+this.ghostTextRowsHeight(),this.layoutDirty=!1)}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getLayoutAnnotations(){let{pendingRender:e}=this;return e==null?this.lineAnnotations:this.getAnnotationsForDiff(e.diff)}getActiveEstimatedHeight(e=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.getLayoutDiff()){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=oo({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Ml(e,this.options.loadDiffFiles!=null),includeTrailingNewline:this.hunksRenderer.includesTrailingNewline(),showNoNewlineMarkers:this.hunksRenderer.showsNoNewlineMarkers()});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.getLayoutDiff()){}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=lo(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!Pl(s,this.deletionFile)||!Pl(c,this.additionFile)),u=t??this.getInputDiff();t==null&&o&&(l||this.getInputDiff()==null)&&(u=Ps(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=u!=null&&!E(this.getInputDiff(),u),m=p||l;if(e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;p&&this.updateInputDiff(u,r);let{pendingRenderDiff:h,layoutDiffChanged:g,renderedDiffChanged:_,annotationsChanged:v}=this.pendingRender!=null&&this.pendingRender.workingDiff===(this.getWorkingDiff(u)??u)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(u,r);if(g&&(this.resetMeasurements(),this.invalidateLayout({includeEstimatedHeights:!0})),f)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,h));else{this.computeApproximateSize(!1,h);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!m||!f))return a!=null&&(this.deletionFile=s,this.additionFile=c),p&&this.clearReusableHeader(),this.renderPlaceholder(this.height);let y=this.virtualizer.getWindowSpecs(),b=this.top??0,x=this.computeRenderRangeFromWindow(h,b,y);return super.render({fileDiff:u,fileContainer:e,renderRange:x,lineAnnotations:r,forceRender:(d??n)||v||_||p,...a,...i})}finalizeRender(){if(!E(this.getRenderedDiff(),this.pendingRender?.diff))throw Error(`VirtualizedFileDiff.render: rendered a different diff than its prepared layout`);this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(e,t){let n=this.getWorkingDiff(e)??e,r=this.getRenderedDiff(),{pendingRender:i}=this,a=i?.diff??r,o=this.getDiffForNextRender(n);return this.pendingRender={workingDiff:n,diff:o},{pendingRenderDiff:o,annotationsChanged:this.syncLineAnnotations(t),layoutDiffChanged:!E(a,o),renderedDiffChanged:!E(r,o)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return Nl(this.options.hunkSeparators)}approximateLayoutCheckpoints(e){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=Ml(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=wl(this.cache.heightDeltas,this.ghostTextRowsByIndex(e),this.metrics.lineHeight),u=ot(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=Dl(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+Ol(i,e)*this.metrics.lineHeight+Tl(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=yl}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+Tl(l,t,t+e)+r,d=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let l=et({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?je({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?Fe({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?Ne({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:this.hunksRenderer.showsNoNewlineMarkers()?kl({diffStyle:o,hunk:n,rowCount:g}):[]}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=et({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=Fe({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),e.hunks.length>0&&(o?.collapsedLines??0)===0&&this.hunksRenderer.hasTrailingNewlineRow(e)&&(n+=1),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=(t===`split`?e.splitLineCount:e.unifiedLineCount)+ +!!this.hunksRenderer.hasTrailingNewlineRow(e);return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=Ml(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=ot(this.metrics,i),h=e.hunks.length>0?me(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],D=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),O=t+(D?.top??_),k=D?.renderedLineIndex??0,A,j,M=new Ue({diff:e,diffStyle:l,startingLine:D?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,includeTrailingNewline:this.hunksRenderer.includesTrailingNewline()});for(;M.next();){let{hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,splitLineIndex:f,unifiedLineIndex:p}=M,m=this.hasNoNewlineMarker(M),h=i===e.hunks.length-1&&a!=null&&(l===`split`?f===a.splitLineStart+a.splitLineCount-1:p===a.unifiedLineStart+a.unifiedLineCount-1),g=(o>0?je({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;O+=g;let v=k%s===0,y=Math.floor(k/s);if(v&&(E[y]=O-(t+_+g),j!=null)){if(j<=0)break;j--}let b=this.getLineHeight(l===`split`?f:p,M.hasAddition?M.additionLineIndex:void 0,m);if(O>n-b&&O<r&&(A??=y),j==null&&O>=r&&v&&(j=T),k++,O+=b,c>0||h&&d){let e=Ne({type:u,metrics:this.metrics});e!=null&&(O<r&&O+e.totalHeight>n&&(A??=y),O+=e.totalHeight)}}if(A==null){if(x)A=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}let N=Math.max(0,Math.ceil(p/s)-w),ee=Math.min(A,N),P=ee*s,F=E[ee]??0,I=P===0?0:g+F,te=ee+w,ne=te<E.length?v-E[te]:v-(O-t-_);return{startingLine:P,totalLines:C,bufferBefore:I,bufferAfter:Math.max(0,ne)}}};function Cl(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===`-1,-1`&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function wl(e,t,n){let r=e;if(t.size>0){r=new Map(e);for(let[e,i]of t)r.set(e,(r.get(e)??0)+i*n)}let i=Array.from(r).sort((e,t)=>e[0]-t[0]),a=[],o=[0],s=0;for(let[e,t]of i)a.push(e),s+=t,o.push(s);return{lineIndexes:a,prefixTotals:o}}function Tl({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=El(e,n);return(t[El(e,r)]??0)-(t[i]??0)}function El(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function Dl(e){return Math.ceil(e/yl)*yl}function Ol(e,t){let n=0;for(let r of e)r<t&&n++;return n}function kl({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function Al(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function jl(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Ml(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Nl(e){return typeof e==`function`?`custom`:e??`line-info`}function Pl(e,t){return e==null||t==null?e==null&&t==null:O(e,t)}function Fl(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}var Il=`theme.disableLineNumbers.overflow.themeType.disableFileHeader.disableVirtualizationBuffers.preferredHighlighter.deferHydrationHighlight.useCSSClasses.useTokenTransformer.tokenizeMaxLineLength.tokenizeMaxLength.unsafeCSS.diffStyle.diffIndicators.disableBackground.expandUnchanged.loadDiffFiles.parseDiffOptions.collapsedContextThreshold.lineDiffType.maxLineDiffLength.expansionLineCount.lineHoverHighlight.enableTokenInteractionsOnWhitespace.enableGutterUtility.__debugPointerEvents.enableLineSelection.controlledSelection.disableErrorHandling`.split(`.`),Ll=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`deferHydrationHighlight`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],Rl=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderFilenameSuffix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],zl=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],Bl=Symbol(`CodeView.itemOptionsState`);function Vl(e,t){Object.defineProperty(e,Bl,{configurable:!1,enumerable:!1,value:t})}function Hl(e){return e[Bl]}function Ul(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var Wl=120,Gl=1,Kl=`--diffs-overflow-override`;function ql(e,t,n){return{containerHeight:e,triggerTop:t,targetTop:n,targetBottom:e-n,threshold:e-t}}var Jl=ql(12e6,1e6,2e6),Yl=ql(2**22,5e5,1e6);function Xl(e){if(e==null)throw Error(`CodeView: createEditor is required for items with edit: true`)}var Zl=(()=>{let{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),r=e.platform===`MacIntel`&&e.maxTouchPoints>1;return(n||r)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})(),Ql=class{static __STOP=!1;static __lastScrollPosition=0;type=`advanced`;config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;focusedEditor;selectedLines=null;itemEditors=new Map;attachedEditors=new Set;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollRebaseConfig=Dn()?Yl:Jl;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;rootHasBox;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1,measurementsPending:!1};itemMetricsCache=tt;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingScrollDone;pendingLayoutAnchor;shouldFixContainerFocus=!1;focusedItemId;scrollAnimation;root;resizeObserver;search=new Wr(this);container=document.createElement(`div`);stickyContainer=document.createElement(`div`);stickyOffset=document.createElement(`div`);header={element:void 0,render:void 0,height:0};footer={element:void 0,render:void 0,height:0};elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isReadySubscription;pendingHighlighterTheme;isComponentManaged;slotSnapshotStale=!1;constructor(e={theme:rt},t,n=!1){this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isComponentManaged=n,this.stickyOffset.style.contain=`layout size`,this.stickyContainer.style.position=`sticky`,this.stickyContainer.style.width=`100%`,this.stickyContainer.style.contain=`layout style inline-size`,this.stickyContainer.style.isolation=`isolate`,this.stickyContainer.style.display=`flex`,this.stickyContainer.style.flexDirection=`column`}getLayout(){return this.options.layout??H}getItemTopOffset(){return this.getLayout().paddingTop+this.header.height}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??tt.hunkLineCount,lineHeight:e?.lineHeight??tt.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??tt.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??tt.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??C}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}validateRenderedItemHeight(e){}validateStickyContainerHeight(){}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents=`none`,this.pointerEventsDisabled=!0),Zl&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Kl,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,Wl)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(Kl,`auto`),!1)};syncLayout(){let{gap:e,paddingBottom:t,paddingTop:n}=this.getLayout();this.stickyContainer.style.gap=`${e}px`,this.container?.style.setProperty(`margin-top`,`${n}px`),this.container?.style.setProperty(`margin-bottom`,`${t}px`)}reconcileHeaderFooterHosts(){let e=this.reconcileHost(`header`),t=this.reconcileHost(`footer`);return e||t}reconcileHost(e){let{root:t,container:n}=this;if(t==null||n==null)return!1;let r=e===`header`?this.header:this.footer,i=e===`header`?this.options.renderCodeViewHeader:this.options.renderCodeViewFooter;if(i==null)return r.element==null||(this.resizeObserver?.unobserve(r.element),r.element.remove(),r.element=void 0,r.render=void 0,this.setHostHeight(r,0)),!1;if(r.element!=null&&i===r.render)return!1;let a=r.element??Qr(e,n,this.resizeObserver);r.element=a;let o=i();return o==null?!this.isComponentManaged&&a.children.length>0&&(a.textContent=``):a.replaceChildren(o),r.render=i,!0}setHostHeight(e,t){e.height!==t&&(e.height=t,this.scrollDirty=!0)}measureMountedHosts(){this.header.element!=null&&this.setHostHeight(this.header,this.header.element.getBoundingClientRect().height),this.footer.element!=null&&this.setHostHeight(this.footer,this.footer.element.getBoundingClientRect().height)}setup(e){if(this.root!=null)throw Error(`CodeView.setup: already setup`);this.workerManager?.subscribeToThemeChanges(this),this.root=e,this.root.style.overflowAnchor=`none`,this.root.hasAttribute(`tabindex`)||(this.root.tabIndex=-1),this.container??=document.createElement(`div`),this.container.style.contain=`layout style`,this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.root.addEventListener(`wheel`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`touchstart`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`pointerdown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.search.handleKeyDown,!0),this.root.addEventListener(`keydown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`focusin`,this.handleFocusIn),this.root.addEventListener(`focusout`,this.handleFocusOut),this.resizeObserver.observe(this.root,{box:`border-box`}),this.render(!0)}reset(){bn(this.computeRenderRangeAndEmit),this.clearReadySubscription(),this.workerManager?.cancelLocalThemeRender(this),this.search.closeInPlace(),this.restoreScrollInteractions(),this.cleanAllRenderedItems();let{items:e}=this,t=[...this.itemEditors.values()].map(e=>{let t=this.idToItem.get(e.state.id);return t!=null&&(e.state.removedItem=t.item),e});this.itemEditors.clear(),this.focusedEditor=void 0,this.attachedEditors.clear(),this.selectedLines=null,this.items=[],this.idToItem.clear(),this.instanceToItem.clear();let n=!1,r;for(let e of t)try{e.editor.cleanUp(`discard`)}catch(e){n||(n=!0,r=e)}for(let t of e)try{t.instance.cleanUp()}catch(e){n||(n=!0,r=e)}if(this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent=``,this.stickyOffset.style.height=``,this.container?.style.removeProperty(`height`),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.cancelScroll(),this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isComponentManaged||this.flushSlotCoordinator(),n)throw r}cleanUp(){let e=!1,t;try{this.reset()}catch(n){e=!0,t=n}if(bn(this.computeRenderRangeAndEmit),this.workerManager?.cancelLocalThemeRender(this),this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.rootHasBox=void 0,this.root?.removeEventListener(`scroll`,this.handleScroll),this.root?.removeEventListener(`wheel`,this.clearPendingScroll),this.root?.removeEventListener(`touchstart`,this.clearPendingScroll),this.root?.removeEventListener(`pointerdown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.search.handleKeyDown,!0),this.root?.removeEventListener(`keydown`,this.clearPendingScroll),this.root?.removeEventListener(`focusin`,this.handleFocusIn),this.root?.removeEventListener(`focusout`,this.handleFocusOut),this.focusedItemId=void 0,this.root?.style.removeProperty(`overflow-anchor`),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent=``,this.header.element?.remove(),this.header.element=void 0,this.header.render=void 0,this.header.height=0,this.footer.element?.remove(),this.footer.element=void 0,this.footer.render=void 0,this.footer.height=0,this.root=void 0,this.container=void 0,this.search.clearTheme(),e)throw t}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){e.type!==`position`&&this.idToItem.get(e.id)?.instance.primeHighlightCache()}getElementPoolLimit(){let e=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isComponentManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;e!=null&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return e??=document.createElement(Be),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){let{element:t}=e;t!=null&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0,bn(this.search.syncFocus)),this.focusedEditor?.id===e.item.id&&(this.focusedEditor=void 0),e.instance.cleanUp(!0),this.attachedEditors.delete(e.item.id),e.element=void 0,t!=null&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){let{activeElement:t}=document;return t===e||e.contains(t)||e.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&=(this.root?.focus({preventScroll:!0}),!1)}handleFocusIn=e=>{e.target!==this.root&&(this.focusedItemId=this.renderedItemInPath(e.composedPath())?.item.id)};handleFocusOut=e=>{if(this.shouldFixContainerFocus)return;let{relatedTarget:t}=e;t instanceof Node&&this.root?.contains(t)===!0||(this.focusedItemId=void 0)};renderedItemInPath(e){let{firstIndex:t,lastIndex:n}=this.renderState;if(!(t<0))for(let r=t;r<=n;r++){let t=this.items[r];if(t?.element!=null&&e.includes(t.element))return t}}returnParkedFocus(e){let{id:t}=e.item;if(this.focusedItemId!==t||!this.rootHasFocus()||this.search.isOpen()&&this.search.state.scope?.itemId!==t)return;let n=this.itemEditors.get(t);if(n==null||!this.attachedEditors.has(t))return;let r=n.editor.getViewState().selections?.at(-1);r!=null&&e.instance.lineElement(pn(r).line)!=null&&n.editor.focus({preventScroll:!0})}rootHasFocus(){let{root:e}=this;if(e==null)return!1;let t=e.getRootNode();return(t instanceof ShadowRoot?t.activeElement:document.activeElement)===e}cleanElement(e){let{shadowRoot:t}=e;if(t!=null)for(let e of Array.from(t.children))ru(e)||e.remove();this.isComponentManaged||e.replaceChildren()}queueElementForPool(e){let t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:e}=this;this.pendingElementPool=[];let t=this.getElementPoolLimit();for(let n of e)this.isElementPoolGenerationCurrent(n)&&this.isElementClean(n)&&this.elementPool.length<t?this.elementPool.push(n):this.isElementPoolGenerationCurrent(n)&&this.getElementPoolSize()<t&&this.pendingElementPool.push(n)}isElementClean(e){return e.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(e){this.elementPoolTracker.set(e,this.elementPoolVersion)}isElementPoolGenerationCurrent(e){return this.elementPoolTracker.get(e)===this.elementPoolVersion}resolveEffectiveScrollBehavior(e,t){return ri()?`instant`:e.behavior===`smooth-auto`?Math.abs(t-this.getScrollTop())<=this.getHeight()*10?`smooth`:`instant`:e.behavior??`instant`}scrollTo(e){this.search.keepView(),this.requestScroll(e)}requestScroll(e,t){if(this.root==null)return;let{width:n,height:r}=this.root.getBoundingClientRect();if(n===0&&r===0){console.error(`CodeView.requestScroll: the root has no layout, scroll request ignored`),t?.(`cancelled`);return}this.setRootHasBox(!0);let{pendingScrollDone:i}=this;this.pendingScrollDone=void 0,this.installScrollRequest(e,t),i?.(`cancelled`)}installScrollRequest(e,t){let n=this.normalizeScrollTarget(e),r=n==null?void 0:this.resolveScrollTargetTop(n);if(n==null||r==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0,t?.(`cancelled`);return}this.pendingScrollDone=t,this.primeScrollTarget(n);let i=this.resolveEffectiveScrollBehavior(n,r),a=ai(r)!==ai(this.getScrollTop());i===`smooth`&&a?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,a&&this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=n,this.render()}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}openSearch(e){this.search.open(e)}closeSearch(){this.search.close()}restoreFocus(e){this.root?.focus({preventScroll:!0});let t=e==null?void 0:this.idToItem.get(e);t!=null&&(this.focusedItemId=e,this.returnParkedFocus(t))}isSearchOpen(){return this.search.isOpen()}navigateSearch(e){this.search.navigate(e)}getItem(e){return this.idToItem.get(e)?.item}getEditor(e){return this.itemEditors.get(e)?.editor}updateItem(e){let t=this.idToItem.get(e.id);return t==null?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):this.syncItemRecord(t,e)?(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncItemEditors(),this.syncSelection(),this.search.rescanItem(e.id),!0):!1}updateItemId(e,t){if(e===t)return!0;let n=this.idToItem.get(e);if(n==null)return console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1;if(this.idToItem.has(t))return console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1;this.idToItem.delete(e),n.item.id=t,this.idToItem.set(t,n),this.updateItemOptionsId(n.instance.options,t),this.selectedLines?.id===e&&(this.selectedLines={...this.selectedLines,id:t},this.options.onSelectedLinesChange?.(this.selectedLines));let r=this.itemEditors.get(e);return r!=null&&(this.itemEditors.delete(e),this.itemEditors.set(t,r),this.attachedEditors.delete(e)&&this.attachedEditors.add(t)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.search.renameItem(e,t),this.render(),!0}addItem(e){this.addItems([e])}addItems(e){this.appendItemsInternal(e),this.syncItemEditors(),this.syncSelection(),this.search.addItems(e.length)}removeItem(e){let t=this.idToItem.get(e);if(t==null)return console.error(`CodeView.removeItem: unknown item id "${e}"`),!1;let n=[];for(let e of this.items)e!==t&&n.push(e.item);return this.search.removeItem(e),this.replaceItems(n),!0}setItems(e){this.search.invalidateScan(),this.replaceItems(e)}replaceItems(e){let t;this.items.length===0?this.appendItemsInternal(e):this.tryAppendItems(e)||(t=this.reconcileItems(e));try{this.syncItemEditors(t)}finally{for(let e of t?.values()??[])e.instance.cleanUp()}this.syncSelection(),this.search.markMatchesDirty()}appendItemsInternal(e,t=!0){if(e.length===0)return;let n=this.getLayout(),r=this.items.length===0?0:this.scrollHeight+n.gap,i=r;for(let t=0;t<e.length;t++){let i=e[t];if(i==null)throw Error(`CodeView.appendItemsInternal: missing input item`);if(this.idToItem.has(i.id))throw Error(`CodeView.addItem: duplicate id "${i.id}"`);let a=this.createItem(i,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=$l(a),r+=a.height+n.gap}this.scrollHeight=r-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(i)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool(),this.search.invalidateTheme(),this.render()}setOptions(e){if(e==null)return;this.capturePendingLayoutAnchor();let{options:t}=this,n=this.getLayout(),{itemMetricsCache:r}=this,i=eu(t,e);i&&this.search.invalidateTheme(),(i||t.unsafeCSS!==e.unsafeCSS)&&this.invalidateElementPool(),this.options=e;let a=this.computeMetricsCache(e.itemMetrics),o=!an(r,a),s=!an(n,this.getLayout());s&&this.syncLayout();let c=o||tu(t,e);if(c){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:o?a:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||o||nu(t,e)}}(s||c)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),on(t,e)||this.renderOptionsRevision++,this.syncItemEditors();let l=t.renderCodeViewHeader!==e.renderCodeViewHeader||t.renderCodeViewFooter!==e.renderCodeViewFooter;!this.isComponentManaged&&(this.items.length>0||l||i)&&this.render(),this.search.optionsChanged(t,e)}capturePendingLayoutAnchor(e=this.idToItem){this.root!=null&&this.items.length!==0&&this.pendingScrollTarget==null&&(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop(),e))}render(e=!1){e?(bn(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):yn(this.computeRenderRangeAndEmit)}clearReadySubscription(){this.isReadySubscription!=null&&(this.isReadySubscription(),this.isReadySubscription=void 0,this.pendingHighlighterTheme=void 0)}getTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??rt}isSharedHighlighterReady(){let{workerManager:e}=this;if(e!=null)return!e.renderWhenLocalThemeLoads(this,this.renderOnLocalTheme);let t=this.getTheme();return R({theme:t})==null?(Se(this.pendingHighlighterTheme,t)||this.clearReadySubscription(),this.isReadySubscription??=(()=>{this.pendingHighlighterTheme=t;let e=!1;return ke({themes:Ye(t),langs:[],preferredHighlighter:ii(this.workerManager,this.options)}).then(()=>{e||(this.clearReadySubscription(),this.render(!0))},t=>{e||(this.clearReadySubscription(),t instanceof He||console.error(t))}),()=>{e=!0}})(),!1):(this.clearReadySubscription(),!0)}renderOnLocalTheme=()=>{this.render()};onHighlightError(e){console.error(e)}instanceChanged(e,t){let n=this.instanceToItem.get(e);if(n==null)throw Error(`CodeView.instanceChanged: An instance has changed that is not registered`);t&&this.markItemLayoutDirty(n),this.itemEditors.has(n.item.id)||(this.slotSnapshotStale=!0),this.search.rescanItem(n.item.id),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getHeaderElement(){return this.header.element}getFooterElement(){return this.footer.element}getRenderedItems(){let{firstIndex:e,lastIndex:t}=this.renderState;if(e===-1||t===-1||t<e)return[];let n=[];for(let r=e;r<=t;r++){let e=this.items[r];e?.element!=null&&(e.type===`diff`?n.push({id:e.item.id,type:`diff`,item:e.item,version:e.version,element:e.element,instance:e.instance}):n.push({id:e.item.id,type:`file`,item:e.item,version:e.version,element:e.element,instance:e.instance}))}return n}setSlotCoordinator(e){return e!==this.slotCoordinator&&(this.slotCoordinator=e,this.slotSnapshot=void 0,!0)}getSlotSnapshot(e){return this.buildSlotSnapshot(e)}buildSlotSnapshot(e){let t=lu(this.getRenderedItems(),e),{element:n}=this.header,{element:r}=this.footer;if(t!=null||n!=null||r!=null)return{items:t,header:n,footer:r}}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){let t=this.instanceToItem.get(e);if(t==null)throw Error(`CodeView.getLocalTopForInstance: unknown virtualized instance`);return t.top}scrollToInstanceLine(e,t,n,r){let i=this.instanceToItem.get(e);if(i==null)throw Error(`CodeView.scrollToInstanceLine: unknown virtualized instance`);this.requestScroll({type:`line`,id:i.item.id,lineNumber:t,align:n},r)}getTopForItem(e){let t=this.idToItem.get(e);if(t!=null)return t.top+this.getItemTopOffset()}createItem(e,t,n){let{itemMetricsCache:r}=this;if(e.type===`diff`){let i=new Sl(this.createDiffOptions(e.id),this,r,this.workerManager);return{type:`diff`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}let i=new ro(this.createFileOptions(e.id),this,r,this.workerManager);return{type:`file`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}applySelectedLines(e,t){let{selectedLines:n}=this;e==null&&n==null||e!=null&&n?.id===e.id&&Zr(n.range,e.range)||(n!=null&&n.id!==e?.id&&this.idToItem.get(n.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=e,this.idToItem.get(e?.id??``)?.instance.setSelectedLines(e?.range??null,t))}syncSelection(){if(this.selectedLines==null)return;let e=this.idToItem.get(this.selectedLines.id);e==null?(this.selectedLines=null,this.options.onSelectedLinesChange?.(null)):e.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}isItemInEditMode(e){return e.item.edit===!0&&e.item.collapsed!==!0}attachItemEditor(e){let{id:t}=e.item,{createEditor:n}=this.options;if(e.element==null||this.attachedEditors.has(t)||!this.isItemInEditMode(e))return;let r=this.itemEditors.get(t),i;try{if(r==null&&!e.instance.isReadyToEdit()){e.instance.__prepareForEditing();return}if(r==null){Xl(n);let r=Hl(e.instance.options);if(r==null)throw Error(`CodeView.attachItemEditor: instance options are missing their state`);let a=e=>{let t=this.idToItem.get(r.id);t!=null&&(this.search.rescanItem(r.id),this.options.onItemEditChange?.(e,t.item))},o=()=>{this.focusedEditor=r,this.search.syncFocus()},s=()=>{this.focusedEditor===r&&(this.focusedEditor=void 0,yn(this.search.syncFocus))},c=()=>{this.search.editorRendered(r.id)},l=this.options.getEditStateKey?.(e.item);if(e.type===`diff`){let u=n(`file-diff`,{onChange:a,onFocus:o,onBlur:s,onRender:c,searchPanel:`host`},l);i=u,this.itemEditors.set(t,{editor:u,state:r,dispose:u.edit(e.instance)})}else{let u=n(`file`,{onChange:a,onFocus:o,onBlur:s,onRender:c,searchPanel:`host`},l);i=u,this.itemEditors.set(t,{editor:u,state:r,dispose:u.edit(e.instance)})}}else r.dispose=(e.type,r.editor.edit(e.instance));this.attachedEditors.add(t)}catch(t){throw i?.cleanUp(),this.releaseRenderedItem(e),t}}syncItemEditors(e){if(this.itemEditors.size===0)return;let t=[];for(let[n,r]of this.itemEditors){let i=this.idToItem.get(n),a=e?.get(n);if(a==null&&i!=null){let{edit:e=!1,collapsed:t=!1}=i.item;if(e){t&&this.attachedEditors.delete(n)&&r.editor.cleanUp(`recycle`);continue}}else a!=null&&(r.state.removedItem=a.item);this.itemEditors.delete(n),this.attachedEditors.delete(n),t.push(r)}if(t.length===0)return;let n=!1,r;for(let e of t){try{e.dispose()}catch(e){n||(n=!0,r=e)}let t=this.idToItem.get(e.state.id);t!=null&&this.markItemLayoutDirty(t)}if(this.render(),n)throw r}requireItemFromState(e){let t=this.idToItem.get(e.id)?.item??e.removedItem;if(t==null)throw Error(`CodeView.onItemEditComplete: unknown item "${e.id}"`);return t}completeFileItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`file`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a file item`);let r={...n,file:t.file,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}completeDiffItemEdit(e,t){let n=this.requireItemFromState(e);if(n.type!==`diff`)throw Error(`CodeView.onItemEditComplete: item "${e.id}" is not a diff item`);let r={...n,fileDiff:t.fileDiff,annotations:t.lineAnnotations,edit:!1,version:(n.version??0)+1};return(this.options.onItemEditComplete?.(t,n,r)??`reject`)===`reject`?`reject`:(this.idToItem.has(n.id)&&this.updateItem(r),`accept`)}renamePendingScrollTarget(e,t){let{pendingScrollTarget:n}=this;n!=null&&n.type!==`position`&&n.id===e&&(this.pendingScrollTarget={...n,id:t})}renamePendingLayoutAnchor(e,t){this.pendingLayoutAnchor?.id===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){let e={};for(let t of Ll)Ul(e,t,()=>this.options[t]);Ul(e,`stickyHeader`,()=>this.options.stickyHeaders),Ul(e,`collapsed`,e=>{let t=Hl(e);if(t!=null)return this.getItemOptions(t,`file`)?.item.collapsed}),Ul(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=Hl(e);if(t!=null)return e=>this.completeFileItemEdit(t,e)});for(let t of Rl)this.defineItemSharedCallback(e,`file`,t);for(let t of zl)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of Il)Ul(e,t,()=>this.options[t]);Ul(e,`stickyHeader`,()=>this.options.stickyHeaders),Ul(e,`hunkSeparators`,()=>this.options.hunkSeparators),Ul(e,`collapsed`,e=>{let t=Hl(e);if(t!=null)return this.getItemOptions(t,`diff`)?.item.collapsed}),Ul(e,`onEditComplete`,e=>{if(this.options.onItemEditComplete==null)return;let t=Hl(e);if(t!=null)return e=>this.completeDiffItemEdit(t,e)});for(let t of Rl)this.defineItemSharedCallback(e,`diff`,t);for(let t of zl)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return Vl(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return Vl(t,{id:e}),t}updateItemOptionsId(e,t){let n=Hl(e);if(n==null)throw Error(`CodeView.updateItemOptionsId: No valid state`);n.id=t}getItemOptions(e,t){let n=this.idToItem.get(e.id);if(n!=null&&n.type===t)return n}defineItemSharedCallback(e,t,n){Ul(e,n,e=>{if(this.options[n]==null)return;let r=Hl(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=((...e)=>{let i=this.getItemOptions(r,t);if(i!=null)return(0,this.options[n])?.(...e,i)}),i[n]=a),a})}defineItemSelectionCallback(e,t,n){Ul(e,n,e=>{let r=Hl(e);if(r==null)return;let i=r.callbackCache??={},a=i[n];return a??(a=e=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=e==null?null:{id:i.item.id,range:e};return this.options.controlledSelection!==!0&&(e!=null||this.selectedLines?.id===i.item.id)&&this.applySelectedLines(a,{notify:!1}),this.options.onSelectedLinesChange?.(a),(0,this.options[n])?.(e,i)},i[n]=a),a})}markLayoutDirtyFromIndex(e){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${e.item.id}"`);this.markLayoutDirtyFromIndex(e.index)}tryAppendItems(e){if(e.length<=this.items.length)return!1;for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null||n.item.id!==r.id||n.type!==r.type)return!1}for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null)throw Error(`CodeView.tryAppendItems: append candidate missing prefix item`);this.syncItemRecord(n,r)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){let{items:t,idToItem:n}=this,r=new Set(t),i=[],a=new Map,o=new Map,s=new Map,c;for(let s=0;s<e.length;s++){let l=e[s];if(l==null)throw Error(`CodeView.reconcileItems: missing input item`);if(a.has(l.id))throw Error(`CodeView.setItems: duplicate id "${l.id}"`);let u=n.get(l.id),d=u!=null&&u.type===l.type?u:this.createItem(l,s,0);d.index=s,u!=null&&u.type===l.type?(r.delete(u),this.syncItemRecord(d,l)&&(c=Math.min(c??s,s))):c=Math.min(c??s,s),t[s]!==d&&(c=Math.min(c??s,s)),i.push(d),a.set(l.id,d),o.set(d.instance,d)}if(c==null){if(r.size===0)return;c=Math.max(i.length-1,0)}this.capturePendingLayoutAnchor(a);for(let e=0;e<t.length;e++){let n=t[e];if(n==null||!r.has(n))continue;s.set(n.item.id,n),this.releaseRenderedItem(n);let a=Math.max(i.length-1,0);c=Math.min(c??a,a)}return this.items=i,this.idToItem=a,this.instanceToItem=o,this.renderState.firstIndex>=i.length?this.resetRenderState():this.renderState.lastIndex>=i.length&&(this.renderState.lastIndex=i.length-1),this.markLayoutDirtyFromIndex(c),this.scrollDirty=!0,this.render(),s.size>0?s:void 0}syncItemRecord(e,t){if(e.type!==t.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${t.id}"`);return e.version!==t.version&&(e.item=t,e.version=t.version,e.renderedOptionsRevision=-1,!0)}getMaxScrollTopForHeight(e){let{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+this.header.height+e+this.footer.height+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>this.scrollRebaseConfig.threshold}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),this.scrollRebaseConfig.containerHeight):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){let t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){let t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){let t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=ai(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=ai(this.clampPagedScrollTop(e-r)),r=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:r}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};let{scrollPageOffset:t,scrollRebaseConfig:n}=this,r=this.clampScrollPageOffset(t),i=e-r,a=this.getMaxPagedScrollTop(),o=this.getMaxScrollPageOffset(),s=i>n.threshold&&r<o,c=i<n.triggerTop&&r>0;return i<0||i>a||s||c?this.resolveScrollPageWindow(e,c?Math.min(n.targetBottom,a):n.targetTop):{pagedScrollTop:ai(this.clampPagedScrollTop(i)),scrollPageOffset:r}}needsScrollPageUpdate(e){let t=ai(this.clampScrollTop(e)),{scrollPageOffset:n}=this.resolvePagedScrollPosition(t);return n!==this.scrollPageOffset}getPagedLayoutTop(e){return this.shouldRebaseScroll()?Math.max(e-this.scrollPageOffset,0):e}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return{top:t.top,height:t.height};if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${iu(e.range)} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}let n=this.getLineScrollPosition(t,e);if(n==null)console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);else return{top:t.top+n.top,height:n.height}}normalizeScrollTarget(e){if(e.type===`position`||e.align!==`nearest`)return e;let t=this.getScrollTargetRect(e);if(t==null)return;let n=e.offset??0,r=this.getItemTopOffset()+t.top,i=r+t.height,a=this.getScrollTop(),o=a+(e.type===`line`||e.type===`range`?this.getStickyHeaderOffset():0),s=a+this.getHeight(),c={...e,align:`start`,offset:r-o};return r-n<=o&&i+n>=s?c:r-n<o?{...e,align:`start`}:i+n>s?{...e,align:`end`}:c}resolveScrollTargetTop(e){if(e.type===`position`){let t=this.clampScrollTop(e.position);return t===e.position?this.clampScrollTop(e.position-this.getStickyHeaderOffset()):t}let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${iu(e.range)} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}let n=(e.searchMatch===!0?this.search.state.currentPosition:void 0)??this.getLineScrollPosition(t,e);if(n==null)console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);else return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(e,t,n,r=0,i=0){e+=this.getItemTopOffset();let a=this.getHeight();return n===`center`&&t+r<a?e-(a-t)/2+r:n===`end`?e-(a-t)+r:e-i-r}getLineScrollPosition(e,t){return e.type===`diff`?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){let{range:n}=t,r=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.start,side:n.side}),i=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.end,side:n.endSide??n.side});if(r==null||i==null)return;let a=r.top,o=a+r.height,s=i.top,c=s+i.height,l=Math.min(a,s);return{top:l,height:Math.max(o,c)-l}}computeTargetScrollTopForFrame(e,t){if(this.pendingScrollTarget==null)return e;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null)return e;let{scrollAnimation:r}=this;return r==null?n:this.computeSpringStep(r,n,t).position}computeSpringStep(e,t,n){let r=Math.max(0,n-e.lastTimestamp),{omega:i}=this.getSmoothScrollSettings(),a=Math.exp(-i*r),o=e.position-t,s=e.velocity+i*o;return{position:t+(o+s*r)*a,velocity:(s*(1-i*r)-i*o)*a}}advanceScrollAnimation(e,t){if(this.pendingScrollTarget==null)return;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0,this.finishPendingScroll(`cancelled`);return}let r=this.scrollAnimation;if(r==null)return n;r.position+=t;let{position:i,velocity:a}=this.computeSpringStep(r,n,e);r.lastTimestamp=e,r.position=i,r.velocity=a;let{positionEpsilon:o,velocityEpsilon:s}=this.getSmoothScrollSettings();return Math.abs(n-i)<=o&&Math.abs(a)<=s?(r.position=n,r.velocity=0,this.scrollAnimation=void 0,n):r.position}computeRenderRangeAndEmit=(e=performance.now())=>{if(this.container==null||(this.workerManager?.initializeIfNeeded(),!this.isSharedHighlighterReady())||!this.hasLayout())return;let t=this.getHeight(),n=this.getScrollTop(),r=n,i=this.pendingLayoutAnchor!=null,a=this.getScrollAnchor(r);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,i=!0),i&&a!=null){let e=this.resolveAnchoredScrollTop(a);if(e!=null){let t=e-r;r=e,this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}}i&&(r=this.clampScrollTop(r),this.syncContainerHeight()),this.search.flushMatches();let o=this.computeTargetScrollTopForFrame(r,e),s=!i&&(this.renderState.scrollTop===-1||Math.abs(o-this.renderState.scrollTop)>t+this.config.overscrollSize*2);s&&(a=void 0),this.windowSpecs=$r({scrollTop:o-this.header.height,height:t,scrollHeight:this.getScrollHeight(),fitPerfectly:s,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let c=n;(this.pendingScrollTarget!=null&&o!==c||this.needsScrollPageUpdate(o))&&(this.applyScrollFix(o,c,this.windowSpecs),c=o);let{top:l,bottom:u}=this.windowSpecs,{firstIndex:d,lastIndex:f}=this.renderState;if(d>=0)for(let e=d;e<=f;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${e}`);t.top>l-t.height&&t.top<=u||this.releaseRenderedItem(t)}let p=this.reconcileHeaderFooterHosts(),m,h=new Set,g=this.findFirstVisibleIndex(l),_=this.findLastVisibleIndex(u);for(let e=g;e<=_;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: missing item`);let{instance:n}=t;t.element==null?(t.element=this.acquireElement(),su(this.stickyContainer,t.element,m),n.virtualizedSetup(),ou(t,t.element,!1)&&(t.renderedOptionsRevision=this.renderOptionsRevision,h.add(t)),m=t.element):(su(this.stickyContainer,t.element,m),ou(t,void 0,t.renderedOptionsRevision!==this.renderOptionsRevision)&&(t.renderedOptionsRevision=this.renderOptionsRevision,h.add(t)),m=t.element),t.item.edit===!0&&(this.attachItemEditor(t),this.returnParkedFocus(t))}this.renderState.firstIndex=g<=_?g:-1,this.renderState.lastIndex=_,this.search.flushPendingTheme(),this.flushSlotCoordinator(),this.flushManagers(h);let{measurementsPending:v}=this.renderState;(p||v)&&this.measureMountedHosts();let y=this.reconcileRenderedItems(v?void 0:h);this.renderState.measurementsPending=!y,this.syncContainerHeight(),this.updateStickyPositioning();let b=a==null?void 0:this.resolveAnchoredScrollTop(a);a===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);let x=b==null?0:b-r;this.search.paintHighlights();let{pendingScrollTarget:S}=this;S?.type===`line`&&S.searchMatch===!0&&this.search.measureCurrentMatch();let C=o,w=!1;if(this.pendingScrollTarget!=null){let t=this.advanceScrollAnimation(e,x);t==null?C=r:(C=t,w=!0)}else C=b??o;C!==c&&(this.applyScrollFix(C,c,this.windowSpecs),c=C),w&&y&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=ai(c),this.updateStickyPositioning(),y&&this.validateStickyContainerHeight(),this.fixContainerFocus(),this.pendingScrollTarget??this.finishPendingScroll(`settled`),(s||this.scrollAnimation!=null||this.renderState.measurementsPending)&&this.render()};flushManagers(e){for(let t of e)t.instance.flushManagers()}syncContainerHeight(){let e=this.getPagedScrollHeight();this.container!=null&&this.containerHeight!==e&&(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){let{firstIndex:t,lastIndex:n}=e==null?this.renderState:{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)};if(t===-1||n===-1||t>n)return;let r=this.items[t]?.instance.getAdvancedStickySpecs(e),i=this.items[n]?.instance.getAdvancedStickySpecs(e);if(r!=null&&i!=null)return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(i.topOffset+i.height)}}applyStickyPositioning({stickyTop:e,stickyBottom:t}){let n=this.getHeight(),{itemMetricsCache:r}=this,i=t-e;this.renderState.stickyHeight=i,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;let a=(Math.random()*r.lineHeight|0)*-1,o=-Math.max(i+a,0)+n;this.stickyContainer.style.top=`${o}px`,this.stickyContainer.style.bottom=`${o+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();let t=this.getStickyBounds(e);t==null?this.stickyOffset.style.height=`${this.getPagedLayoutTop(e.top)}px`:this.applyStickyPositioning(t)}reconcileRenderedItems(e){let{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1)return!0;let r=-1,i=!1,a=!0;for(let o=t;o<this.items.length&&!(!i&&o>n);o++){let t=this.items[o];if(t==null)throw Error(`CodeView.reconcileRenderedItems: Invalid item`);r===-1?r=t.top:t.top!==r&&(t.top=r,t.instance.syncVirtualizedTop(),i=!0),(e==null?o<=n:e.has(t))&&(t.instance.reconcileHeights()&&(i=!0,t.height=t.instance.getVirtualizedHeight()),t.instance.unmeasured?a=!1:this.validateRenderedItemHeight(t)),r+=t.instance.getVirtualizedHeight(),o<this.items.length-1&&(r+=this.getLayout().gap)}return i&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r),a}updateStickyPositioning(){let e=this.getStickyBounds();if(e==null){this.renderState.firstIndex===-1&&(this.stickyOffset.style.height=``);return}let{stickyTop:t,stickyBottom:n}=e;(n-t!==this.renderState.stickyHeight||t!==this.renderState.stickyTop||n!==this.renderState.stickyBottom)&&this.applyStickyPositioning(e)}handleScroll=()=>{this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render()};clearPendingScroll=e=>{if(e!=null){if(!ni(e)||e.type!==`wheel`&&this.search.ownsEvent(e))return;this.search.userScrolled()}this.pendingLayoutAnchor=void 0,this.cancelScroll()};cancelScroll(e){(e==null||this.pendingScrollDone===e)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0,this.finishPendingScroll(`cancelled`))}finishPendingScroll(e){let{pendingScrollDone:t}=this;this.pendingScrollDone=void 0,t?.(e)}hasLayout(){return this.rootHasBox!==!1}setRootHasBox(e){this.rootHasBox=e,e||(this.renderState.measurementsPending=!0)}handleResize=e=>{let t=!1,n=e.find(e=>e.target===this.root);if(n!=null){let{inlineSize:e,blockSize:r}=n.borderBoxSize[0];this.setRootHasBox(e>0||r>0),this.scrollDirty=!0,this.heightDirty=!0,t=!0}if(this.hasLayout()){for(let n of e)if(n.target===this.stickyContainer){let e=n.borderBoxSize[0].blockSize;if(Math.abs(e-this.renderState.stickyHeight)>=Gl){let e=this.getScrollTop(),n=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();let r=n==null?void 0:this.resolveAnchoredScrollTop(n);if(r!=null){let t=r-e;this.applyScrollFix(r,e,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}else if(n.target===this.header.element||n.target===this.footer.element){let e=n.target===this.header.element?this.header:this.footer,r=n.borderBoxSize[0].blockSize;if(r!==e.height){let n=this.getScrollTop(),i=this.getScrollAnchor(n);this.setHostHeight(e,r);let a=i==null?void 0:this.resolveAnchoredScrollTop(i);if(a!=null){let e=a-n;this.applyScrollFix(a,n,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=e)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),t=!0}}t&&this.render(!0)}};getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e,t=this.idToItem){let n,{pendingLayoutAnchor:r}=this;if(r!=null){let e=this.idToItem.get(r.id);if(e!=null&&t.get(r.id)===e)return r;e!=null&&(n=e)}if(e<=0)return;let{firstIndex:i,lastIndex:a,stickyTop:o,stickyBottom:s}=this.renderState;if(i===-1||a===-1)return;let c=this.getHeight();if(o!==-1&&s!==-1){for(let r=i;r<=a;r++){let i=this.items[r];if(i==null)continue;let a=this.getItemTopOffset()+i.top;if(a+i.height<=e)continue;if(a>=e+c)break;if(t.get(i.item.id)!==i){n??=i;continue}if(a>=e)return{type:`item`,id:i.item.id,viewportOffset:a-e};let o=this.getScrollAnchorViewportTop(a,e)-a,s=i.instance.getNumericScrollAnchor(o);if(s!=null){let t=a+s.top;return{type:`line`,id:i.item.id,lineNumber:s.lineNumber,side:s.side,viewportOffset:t-e}}}if(n!=null)for(let e=n.index+1;e<this.items.length;e++){let n=this.items[e];if(n!=null&&t.get(n.item.id)===n)return{type:`item`,id:n.item.id,viewportOffset:0}}}}resolveAnchoredScrollTop(e){let t=this.idToItem.get(e.id);if(t==null)return;let n=this.getItemTopOffset();if(e.type===`item`){let r=n+t.top;return this.clampScrollTop(r-e.viewportOffset)}let r=t.type===`diff`?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(r==null)return;let i=n+t.top+r.top;return this.clampScrollTop(i-e.viewportOffset)}scrollToAnchor(e,t){let{id:n,viewportOffset:r}=e;this.requestScroll(e.type===`line`?{type:`line`,id:n,lineNumber:e.lineNumber,side:e.side,align:`start`,offset:r-this.getStickyHeaderOffset(),behavior:t}:{type:`item`,id:n,align:`start`,offset:r,behavior:t})}isAtScrollAnchor(e){let t=this.resolveAnchoredScrollTop(e);return t!=null&&Math.abs(t-this.getScrollTop())<1}applyScrollFix(e,t,n){if(this.root==null)return;let r=ai(this.clampScrollTop(e)),i=ai(t),{scrollPageOffset:a}=this,o=ai(this.clampPagedScrollTop(i-a)),{pagedScrollTop:s,scrollPageOffset:c}=this.resolvePagedScrollPosition(r),l=s,u=a!==c;(r!==this.renderState.scrollTop||r!==i||l!==o||u)&&(this.suspendScrollInteractions(),(l!==o||u)&&(this.scrollPageOffset=c,this.syncPagedScrollScaffolding(n)),l!==o&&this.root.scrollTo({top:l,behavior:`instant`}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(e){let t=this.resolveScrollTargetTop(e);return t==null||ai(this.getScrollTop())===ai(t)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(e+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty&&(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0),this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let e=this.buildSlotSnapshot(this.slotCoordinator);(this.slotSnapshotStale||!Yr(this.slotSnapshot,e))&&(this.slotSnapshotStale=!1,this.slotSnapshot=e,this.slotCoordinator.onSnapshotChange(e))}notifyScroll(){if(this.scrollListeners.size===0)return;let e=this.getScrollTop();for(let t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,r=this.items.length;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findFirstVisibleIndex: invalid item index`);a.top+a.height>e?(r=i,n=i-1):t=i+1}return r}findLastVisibleIndex(e){let t=0,n=this.items.length-1,r=-1;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findLastVisibleIndex: invalid item index`);a.top<=e?(r=i,t=i+1):n=i-1}return r}recomputeLayout(e=0,t){if(this.items.length===0){this.scrollHeight=0;return}let n=this.getLayout(),r=0;if(e>0){let t=this.items[e-1];if(t==null)throw Error(`CodeView.recomputeLayout: invalid dirty index`);r=t.top+t.height+n.gap}for(let i=e;i<this.items.length;i++){let e=this.items[i];if(e==null)throw Error(`CodeView.recomputeLayout: invalid item index`);e.top=r,e.height=e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,r,t,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,r,t,e.item.annotations??[]),r+=e.height,i<this.items.length-1&&(r+=n.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1,this.renderState.measurementsPending=!1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function $l(e){return e.instance.cleanUp(!0),e.type===`diff`?e.instance.updateCodeViewLayout(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.updateCodeViewLayout(e.item.file,e.top,void 0,e.item.annotations??[])}function eu(e,t){return!Se(e.theme??rt,t.theme??rt)||(e.themeType??`system`)!==(t.themeType??`system`)}function tu(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function nu(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function ru(e){return e instanceof SVGElement||ei(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function iu(e){let t=au(e.start,e.side),n=au(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function au(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function ou(e,t,n=!1){return e.type===`diff`?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:e.item.annotations??[]})}function su(e,t,n){n==null?e.firstChild!==t&&e.prepend(t):n.nextSibling!==t&&n.after(t)}function cu(e){return(e.item.annotations?.length??0)>0||ln(e).lineAnnotations.length>0}function lu(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:r}){if(e.length===0)return;if(t||r)return e;if(!n)return;let i=[];for(let t of e)cu(t)&&i.push(t);return i.length>0?i:void 0}function uu(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}var du=r(),fu=typeof window>`u`?U.useEffect:U.useLayoutEffect;function pu(e){return{instance:void 0,items:void 0,controlled:e,managedOptions:void 0,disableFlushSync:!1,slotCoordinator:void 0}}function mu(e,t){let{className:n,containerRef:r,disableWorkerPool:i=!1,editorOptions:a,getEditStateKey:o,initialItems:s,items:c,onItemEditChange:l,onItemEditComplete:u,onScroll:d,onSelectedLinesChange:f,options:p,renderAnnotation:m,renderCodeViewFooter:h,renderCodeViewHeader:g,renderCustomHeader:_,renderGutterUtility:v,renderHeaderFilenameSuffix:y,renderHeaderMetadata:b,renderHeaderPrefix:x,selectedLines:S,style:C}=e,w=c!==void 0,T=Jt(),E=(0,U.useContext)(we),D=(0,U.useRef)(pu(w)),O=_!=null,k=m!=null,A=v!=null,j=O||x!=null||y!=null||b!=null,M=j||k||A,N=g!=null,ee=h!=null,P=Kt(e=>{f?.(e)}),F=S!==void 0,I=Kt((e,t,n)=>{if(T==null)throw Error(`CodeView: EditContext is not attached`);let r={...a,...t,onFocus:()=>{t.onFocus(),a?.onFocus?.()},onBlur:()=>{t.onBlur(),a?.onBlur?.()},onRender:()=>{t.onRender(),a?.onRender?.()}};return T(e,r,n)}),te=Kt((e,t)=>{l?.(e,t)}),ne=Kt((e,t,n)=>u?.(e,t,n)??`reject`),re=(0,U.useMemo)(()=>bu({options:p,hasCustomHeader:O,hasGutterRenderer:A,hasCodeViewHeader:N,hasCodeViewFooter:ee,onSelectedLinesChange:f==null?void 0:P,controlledSelection:F,getEditStateKey:o,createEditor:T==null?void 0:I,onItemEditChange:l==null?void 0:te,onItemEditComplete:u==null?void 0:ne}),[T,F,I,te,ne,P,ee,N,O,A,o,l,u,f,p]),[ie]=(0,U.useState)(()=>yu()),[,ae]=(0,U.useState)({}),oe=Kt(e=>{D.current.instance!=null&&(e==null||e!==D.current.instance.getContainerElement())&&(D.current.instance.cleanUp(),ie.publish(void 0),D.current=pu(w)),e!=null&&e!==D.current.instance?.getContainerElement()&&(D.current.instance=new Ql(re,i?void 0:E,!0),D.current.instance.setup(e)),uu(r,e)}),se=Kt(e=>{D.current.disableFlushSync?ie.publish(e):(0,du.flushSync)(()=>{ie.publish(e)})}),L=(0,U.useMemo)(()=>{if(j||k||A||N||ee)return{hasHeaderRenderers:j,hasAnnotationRenderer:k,hasGutterRenderer:A,onSnapshotChange:se}},[se,k,A,j,N,ee]);return fu(()=>d==null?void 0:D.current.instance?.subscribeToScroll(d)),fu(()=>{let{instance:e,controlled:t,items:n,managedOptions:r,slotCoordinator:i}=D.current;if(e!=null)try{D.current.disableFlushSync=!0;let a=!1;if(on(re,r)||(D.current.managedOptions=re,e.setOptions(re),a=!0),t!==w){console.error(`CodeView: cannot switch between controlled and uncontrolled modes. Remount with a new key instead.`);return}if(w)c!==n&&(_u(n,c)?D.current.items=c:gu(n,c)?(D.current.items=c,e.addItems(c.slice(n.length))):(D.current.items=c,e.setItems(c),a=!0));else if(n==null){let t=s??[];D.current.items=t,t.length>0&&(e.setItems(t),a=!0)}S!==void 0&&e.setSelectedLines(S,{notify:!1});let o=e.setSlotCoordinator(L),l=!1;L!==i&&((L==null||i==null)&&(l=!0),D.current.slotCoordinator=L),(a||o)&&e.render(!0),o&&L==null&&ie.publish(void 0),l&&ae({})}finally{D.current.disableFlushSync=!1}}),(0,U.useImperativeHandle)(t,()=>({addItems(e){let{controlled:t,instance:n}=D.current;vu(t,`addItems`),n==null?console.error(`CodeView.addItems: no valid instance to append items with`,e):n.addItems(e)},getItem(e){let{instance:t}=D.current;if(t==null)console.error(`CodeView.getItem: no valid instance exists`,e);else return t.getItem(e)},removeItem(e){let{controlled:t,instance:n}=D.current;return vu(t,`removeItem`),n==null?(console.error(`CodeView.removeItem: no valid instance to remove item from`,e),!1):n.removeItem(e)},updateItem(e){let{controlled:t,instance:n}=D.current;return vu(t,`updateItem`),n==null?(console.error(`CodeView.updateItem: no valid instance to update item with`,e),!1):n.updateItem(e)},updateItemId(e,t){let{controlled:n,instance:r}=D.current;return vu(n,`updateItemId`),r==null?(console.error(`CodeView.updateItemId: no valid instance to update item id with`,e,t),!1):r.updateItemId(e,t)},scrollTo(e){let{instance:t}=D.current;t==null?console.error(`CodeView.scrollTo: no valid instance to scroll with`,e):t.scrollTo(e)},setSelectedLines(e){let{instance:t}=D.current;t==null?console.error(`CodeView.setSelectedLines: no valid instance to update selection with`,e):(t.setSelectedLines(e,{notify:!1}),P(e))},getSelectedLines(){let{instance:e}=D.current;return e==null?(console.error(`CodeView.getSelectedLines: no valid instance exists`),null):e.getSelectedLines()},clearSelectedLines(){let{instance:e}=D.current;e==null?console.error(`CodeView.clearSelectedLines: no valid instance to update selection with`):(e.clearSelectedLines({notify:!1}),P(null))},openSearch(e){let{instance:t}=D.current;t==null?console.error(`CodeView.openSearch: no valid instance to search with`,e):t.openSearch(e)},closeSearch(){D.current.instance?.closeSearch()},isSearchOpen(){return D.current.instance?.isSearchOpen()===!0},navigateSearch(e){D.current.instance?.navigateSearch(e)},getEditor(e){let{instance:t}=D.current;if(t==null)console.error(`CodeView.getEditor: no valid instance exists`,e);else return t.getEditor(e)},getInstance(){return D.current.instance}}),[P]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{ref:oe,className:n,style:C}),(M||N||ee)&&(0,W.jsx)(xu,{managedContentStore:ie,renderCustomHeader:_,renderHeaderPrefix:x,renderHeaderFilenameSuffix:y,renderHeaderMetadata:b,renderAnnotation:m,renderGutterUtility:v,renderCodeViewHeader:g,renderCodeViewFooter:h})]})}var hu=(0,U.forwardRef)(mu);function gu(e,t){if(e==null||t.length<=e.length)return!1;if(e.length===0)return!0;for(let n=0;n<e.length;n++)if(t[n]!==e[n])return!1;return!0}function _u(e,t){if(e==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function vu(e,t){if(e)throw Error(`CodeView.${t} cannot be used when CodeView is controlled. Use initialItems for imperative item updates.`)}function yu(){let e,t=new Set;return{getSnapshot(){return e},publish(n){if(e!==n){e=n;for(let e of t)e()}},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}function bu({options:e,hasCustomHeader:t,hasGutterRenderer:n,hasCodeViewHeader:r,hasCodeViewFooter:i,onSelectedLinesChange:a,controlledSelection:o,getEditStateKey:s,createEditor:c,onItemEditChange:l,onItemEditComplete:u}){let d={...e,controlledSelection:o,onSelectedLinesChange:a,createEditor:c};return s!=null&&(d.getEditStateKey=s),l!=null&&(d.onItemEditChange=l),u!=null&&(d.onItemEditComplete=u),t&&(d.renderCustomHeader=wu),n&&(d.renderGutterUtility=wu),r&&(d.renderCodeViewHeader=wu),i&&(d.renderCodeViewFooter=wu),d}var xu=(0,U.memo)(function({managedContentStore:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o,renderCodeViewHeader:s,renderCodeViewFooter:c}){"use no memo";let l=Kt(t=>e.subscribe(t)),u=Kt(()=>e.getSnapshot()),d=(0,U.useSyncExternalStore)(l,u,u),f=(0,U.useMemo)(()=>{let e={renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o};return d?.items?.map(t=>(0,du.createPortal)(t.type===`diff`?(0,W.jsx)(Su,{version:t.version??0,item:t.item,getHoveredLine:t.instance.getHoveredLine,getAnnotationSlotName:t.instance.getAnnotationSlotName,...ln(t),...e}):(0,W.jsx)(Cu,{version:t.version??0,item:t.item,getHoveredLine:t.instance.getHoveredLine,getAnnotationSlotName:t.instance.getAnnotationSlotName,...ln(t),...e}),t.element,t.id))},[t,n,r,i,a,o,d?.items]),p=(0,U.useMemo)(()=>s!=null&&d?.header!=null?(0,du.createPortal)(s(),d.header):null,[s,d?.header]),m=(0,U.useMemo)(()=>c!=null&&d?.footer!=null?(0,du.createPortal)(c(),d.footer):null,[c,d?.footer]);return(0,W.jsxs)(W.Fragment,{children:[f,p,m]})}),Su=(0,U.memo)(function({item:e,fileDiff:t,lineAnnotations:n,getHoveredLine:r,getAnnotationSlotName:i,renderCustomHeader:a,renderHeaderPrefix:o,renderHeaderFilenameSuffix:s,renderHeaderMetadata:c,renderAnnotation:l,renderGutterUtility:u}){return tn({fileDiff:t,renderCustomHeader:a==null?void 0:()=>a(e),renderHeaderPrefix:o==null?void 0:()=>o(e),renderHeaderFilenameSuffix:s==null?void 0:()=>s(e),renderHeaderMetadata:c==null?void 0:()=>c(e),renderAnnotation:l==null?void 0:(t,n)=>l(t,n,e),lineAnnotations:n,renderGutterUtility:u==null?void 0:t=>u(t,e),getHoveredLine:r,getAnnotationSlotName:i})}),Cu=(0,U.memo)(function({item:e,file:t,lineAnnotations:n,getHoveredLine:r,getAnnotationSlotName:i,renderCustomHeader:a,renderHeaderPrefix:o,renderHeaderFilenameSuffix:s,renderHeaderMetadata:c,renderAnnotation:l,renderGutterUtility:u}){return rn({file:t,renderCustomHeader:a==null?void 0:()=>a(e),renderHeaderPrefix:o==null?void 0:()=>o(e),renderHeaderFilenameSuffix:s==null?void 0:()=>s(e),renderHeaderMetadata:c==null?void 0:()=>c(e),renderAnnotation:l==null?void 0:(t,n)=>l(t,n,e),lineAnnotations:n,renderGutterUtility:u==null?void 0:t=>u(t,e),getHoveredLine:r,getAnnotationSlotName:i})});function wu(){}var Tu=!1;function Eu(){if(Tu)return;let e=Ki.prototype,t=e.setup;typeof t==`function`&&typeof e.observe==`function`&&typeof e.applyNewHeight==`function`&&(Tu=!0,e.setup=function(...e){if(t.apply(this,e),this.observedNodes instanceof Map)for(let[e,t]of this.observedNodes){if(t.type!==`annotations`||!(e instanceof HTMLElement))continue;let n=t;for(let t of[n.column1,n.column2])t.child!==e&&e.parentElement===t.container&&(t.child=e,t.childHeight=e.getBoundingClientRect().height,this.observe(e),this.applyNewHeight(n,Math.max(n.column1.childHeight,n.column2.childHeight)))}})}var Du=new Set(Object.keys(Ut));function Ou(e){let t=I(e);return Du.has(t)?t:`text`}function ku(e,t){return t===`hidden`?[]:t===`active`?e.filter(e=>!Mt(e.status)):[...e]}function Au(e){let t=new Map;for(let n of[...e].sort(yt)){let e=Nt(n);if(e.kind!==`line`&&e.kind!==`file`)continue;let r=t.get(e.path)??[];r.push({thread:n,anchor:e}),t.set(e.path,r)}return t}function ju(e,t){let n=[e,t];for(let e of n)if(e.state===`error`)return{kind:`error`,message:e.message};if(n.some(e=>e.state===`pending`))return{kind:`loading`};if(n.some(e=>e.state===`idle`))return{kind:`not-loaded`};for(let e of n)if(e.state===`loaded`&&e.content.kind===`binary`)return{kind:`binary`};for(let e of n)if(e.state===`loaded`&&e.content.kind===`too-large`)return{kind:`too-large`,reason:e.content.reason,bytes:e.content.bytes};return null}function Mu(e){return e.state===`loaded`&&e.content.kind===`text`?e.content.text:null}function Nu(e,t){return e.originalObjectId??`${t??`base`}:${e.originalPath??e.path}`}function Pu(e,t,n){return{name:e,contents:t,cacheKey:n,lang:Ou(e)}}function Fu(e,t,n,r){let i=e.change===`added`?null:Mu(t),a=e.change===`deleted`?null:Mu(n);if(e.change!==`added`&&i===null||e.change!==`deleted`&&a===null)return null;let o=e.originalPath??e.path;return Ps(i===null?null:Pu(o,i,Nu(e,r)),a===null?null:Pu(e.path,a,e.objectId??`new:${e.path}`))}function Iu(e){let t=e.originalPath??e.path,n=e=>({name:e,contents:``,cacheKey:`placeholder:${e}`}),r=Ps(e.change===`added`?null:n(t),e.change===`deleted`?null:n(e.path));return e.change===`renamed`&&(r.prevName=t),r}function Lu(e){let t=0,n=0;for(let r of e.hunks)t+=r.additionLines,n+=r.deletionLines;return{additions:t,deletions:n}}function Ru(e,t,n,r=1){let i=t===`additions`?e.additionLines.length:e.deletionLines.length;if(n<1||n>i)return!1;let a=0;for(let i of e.hunks){let[e,o]=Vu(i,t);if(n<e)return e-1-a<=r;if(n<e+o)return!0;a=e+o-1}return i-a<=r}function zu(e){for(let t of e.hunks)for(let e of t.hunkContent)if(e.type===`change`){if(e.additions>0)return{side:`additions`,lineNumber:e.additionLineIndex+1};if(e.deletions>0)return{side:`deletions`,lineNumber:e.deletionLineIndex+1}}return null}function Bu(e,t,n){let r=(t===`additions`?e.additionLines:e.deletionLines)[n-1];return r===void 0?null:r.replace(/\r?\n$/,``)}function Vu(e,t){return t===`additions`?[e.additionStart,e.additionCount]:[e.deletionStart,e.deletionCount]}function Hu({file:e,fileDiff:t,notice:n,threads:r,collapsed:i,version:a,composers:o=[]}){let s=t??Iu(e),c=t!==null,l=new Map,u=[];for(let{thread:e,anchor:t}of r)if(t.kind===`file`)u.push(e);else if(t.kind===`line`){let n=`${t.side}:${t.lineNumber}`,r=l.get(n)??{side:t.side,lineNumber:t.lineNumber,threads:[]};r.threads.push(e),l.set(n,r)}let d=[],f=[];for(let e of l.values()){let t=e.threads.sort(yt);c&&Ru(s,e.side,e.lineNumber)?d.push({side:e.side,lineNumber:e.lineNumber,metadata:{kind:`threads`,threads:t}}):f.push({side:e.side,lineNumber:e.lineNumber,threads:t})}f.sort((e,t)=>e.lineNumber-t.lineNumber||e.side.localeCompare(t.side)),(n!==null||u.length>0||f.length>0)&&d.unshift({side:e.change===`deleted`?`deletions`:`additions`,lineNumber:0,metadata:{kind:`file`,notice:n,threads:u.sort(yt),offDiff:f}});let p=e.change===`deleted`?`deletions`:`additions`,m=o.map(e=>{let{anchor:t}=e,n=t.kind===`line`&&c&&Ru(s,t.side,t.endLine);return{side:n&&t.kind===`line`?t.side:p,lineNumber:n&&t.kind===`line`?t.endLine:0,metadata:{kind:`composer`,entry:e}}});return d.unshift(...m),{id:e.path,type:`diff`,fileDiff:s,annotations:d,collapsed:i,version:a}}var Uu=8;function Wu(e){return e.state===`absent`||e.state===`loaded`}function Gu({changeSet:e,sides:t,threads:n,filter:r,collapsed:i,priority:a,composers:o=Ku}){let s=(0,U.useRef)(new Map),c=(0,U.useRef)(new Map),l=(0,U.useRef)(1),[u,d]=(0,U.useState)(0),f=(0,U.useRef)(null);f.current!==e&&(f.current=e,s.current=new Map),(0,U.useEffect)(()=>{if(e===null)return;let n=e.baseCommit,r=new Map(e.files.map((e,t)=>[e.path,t])),i=e.files.filter(e=>{let n=t.get(e.path);if(n===void 0||!Wu(n.old)||!Wu(n.new))return!1;let r=s.current.get(e.path);return r===void 0||r.old!==n.old||r.new!==n.new}).sort((e,t)=>{let n=a.indexOf(e.path),i=a.indexOf(t.path);return n===i?(r.get(e.path)??0)-(r.get(t.path)??0):(n===-1?1e9:n)-(i===-1?1e9:i)});if(i.length===0)return;let o=!1,c=null,u=()=>{let e=performance.now()+Uu,r=!1;for(;i.length>0&&performance.now()<e;){let e=i.shift(),a=t.get(e.path);if(a===void 0)continue;let o=null,c=null;if(ju(a.old,a.new)===null)try{o=Fu(e,a.old,a.new,n)}catch(e){c=e instanceof Error?e.message:`Could not compute the diff`}s.current.set(e.path,{id:l.current++,old:a.old,new:a.new,fileDiff:o,error:c}),r=!0}r&&!o&&d(e=>e+1),i.length>0&&!o&&(c=setTimeout(u,0))};return c=setTimeout(u,0),()=>{o=!0,c!==null&&clearTimeout(c)}},[e,t,a]);let p=(0,U.useMemo)(()=>Au(n??[]),[n]),m=(0,U.useMemo)(()=>{let e=new Map;for(let t of o){let n=e.get(t.anchor.path)??[];n.push(t),e.set(t.anchor.path,n)}return e},[o]);return(0,U.useMemo)(()=>{let n=[],a=new Map,o=0;for(let l of e?.files??[]){let e=t.get(l.path)??{old:{state:`pending`},new:{state:`pending`}},u=s.current.get(l.path),d=u!==void 0&&u.old===e.old&&u.new===e.new,f=ju(e.old,e.new),h=null,g=0;d?(g=u.id,u.error===null?h=u.fileDiff:f={kind:`error`,message:u.error}):f===null&&(f={kind:`loading`}),(h!==null||f!==null&&f.kind!==`loading`&&f.kind!==`not-loaded`)&&o++;let _=p.get(l.path)??[],v=new Set(ku(_.map(e=>e.thread),r)),y=_.filter(e=>v.has(e.thread)),b=i(l),x=m.get(l.path)??Ku,S=[g,JSON.stringify(f),b,y.map(e=>qu(e.thread)).join(`,`),x.map(e=>e.key).join(`,`)].join(`|`),C=c.current.get(l.path),w;C!==void 0&&C.signature===S?w=C.item:(w=Hu({file:l,fileDiff:h,notice:f,threads:y,collapsed:b,version:(C?.item.version??0)+1,composers:x}),c.current.set(l.path,{signature:S,item:w})),n.push(w),a.set(l.path,{file:l,notice:f,stats:h===null?null:Lu(h),threadCount:_.length})}return{items:n,summaries:a,ready:o}},[e,t,p,r,i,u,m])}var Ku=[];function qu(e){let t=e.comments.map(e=>`${e.id}.${e.lastUpdatedDate??``}.${+!!e.isDeleted}.${e.content.length}`).join(`;`);return`${e.id}@${e.lastUpdatedDate??``}:${e.status??``}:${+!!e.isDeleted}:${t}`}function Ju(e){return`azdiffs:viewed:${e.organization.toLowerCase()}:${e.repositoryId.toLowerCase()}:${e.pullRequestId}`}function Yu(e){return e.objectId===void 0?`deleted:${e.originalObjectId??e.originalPath??e.path}`:e.objectId}function Xu(e,t){let n=Ju(t),r=new Set,i=o(),a=0;function o(){try{let t=e?.getItem(n)??null;if(t===null)return{};let r=JSON.parse(t);if(typeof r!=`object`||!r||Array.isArray(r))return{};let i={};for(let[e,t]of Object.entries(r))typeof t==`string`&&(i[e]=t);return i}catch{return{}}}function s(){try{Object.keys(i).length===0?e?.removeItem(n):e?.setItem(n,JSON.stringify(i))}catch{}}return{isViewed(e){return i[e.path]===Yu(e)},setViewed(e,t){let n={...i};t?n[e.path]=Yu(e):delete n[e.path],i=n,s(),a++;for(let e of r)e()},revision:()=>a,subscribe(e){return r.add(e),()=>r.delete(e)}}}function Zu({entry:e,returnFocus:t}){let n=Rt();return n===null?null:(0,W.jsx)(Qu,{entry:e,review:n,returnFocus:t})}function Qu({entry:e,review:t,returnFocus:n}){let r=xt(t.store,t=>t.busy.has(e.key)),i=xt(t.store,t=>t.errors.get(e.key)),a=xt(t.store,t=>t.focus===e.key),o=Ct(e.anchor),s=wt(),{anchor:c}=e,l=s!==null&&c.kind===`line`&&c.side===`additions`?s.newSideLines(c.path,c.startLine,c.endLine):null;return(0,W.jsx)(`div`,{"data-composer-key":e.key,children:(0,W.jsx)(Dt,{drafts:t.drafts,draftKey:e.key,label:`Comment on ${o}`,submitLabel:`Comment`,busy:r,autoFocus:a,onFocused:()=>t.store.update(()=>({focus:null})),onSubmit:n=>t.submitComposer(e,n),onCancel:()=>t.closeComposer(e.key),...n===void 0?{}:{returnFocus:n},problem:i===void 0?null:(0,W.jsx)(jt,{review:t,errorKey:e.key,error:i,organization:t.organization}),testId:`new-thread-composer`,suggestion:l===null?void 0:{original:l}})})}function $u({annotation:e,actions:t,returnFocus:n}){switch(e.kind){case`composer`:return(0,W.jsx)(`div`,{className:`azd-annotation px-3 py-2`,children:(0,W.jsx)(Zu,{entry:e.entry,...n===void 0?{}:{returnFocus:n}})});case`threads`:return(0,W.jsx)(`div`,{className:`azd-annotation space-y-2 px-3 py-2`,"data-testid":`line-threads`,children:e.threads.map(e=>(0,W.jsx)(It,{thread:e},e.id))});case`file`:return(0,W.jsxs)(`div`,{className:`azd-annotation space-y-2 px-3 py-2`,"data-testid":`file-annotation`,children:[e.notice!==null&&(0,W.jsx)(nd,{notice:e.notice,actions:t}),e.threads.length>0&&(0,W.jsx)(`section`,{"aria-label":`Comments on this file`,className:`space-y-2`,children:e.threads.map(e=>(0,W.jsx)(It,{thread:e,label:`Comment on this file`},e.id))}),e.offDiff.map(e=>(0,W.jsx)(rd,{group:e},`${e.side}:${e.lineNumber}`))]});default:return null}}function ed(e){return e>=1048576?`${(e/1048576).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}var td=h;function nd({notice:e,actions:t}){switch(e.kind){case`loading`:return(0,W.jsxs)(`p`,{className:`flex items-center gap-2 text-xs text-muted`,"data-testid":`file-loading`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`azd-pulse h-2 w-24 rounded-full bg-raised`}),`Loading file…`]});case`not-loaded`:return(0,W.jsxs)(`p`,{className:`flex items-center gap-3 text-xs text-muted`,children:[`Not loaded yet: this pull request is large, so files load as you reach them.`,(0,W.jsx)(`button`,{type:`button`,className:td,onClick:t.load,children:`Load file`})]});case`binary`:return(0,W.jsx)(`p`,{className:`text-xs text-muted`,children:`Binary file: no diff to show.`});case`too-large`:return(0,W.jsxs)(`p`,{className:`flex items-center gap-3 text-xs text-muted`,children:[e.reason===`size`?`Large file (${ed(e.bytes)}): the diff is not shown by default.`:`Large file: a line longer than 20,000 characters; the diff is not shown by default.`,(0,W.jsx)(`button`,{type:`button`,className:td,onClick:t.loadLarge,children:`Load diff`})]});case`error`:return(0,W.jsxs)(`p`,{role:`alert`,className:`flex items-center gap-3 text-xs text-danger`,children:[(0,W.jsxs)(`span`,{children:[`Could not load this file: `,e.message]}),(0,W.jsx)(`button`,{type:`button`,className:td,onClick:t.retry,children:`Retry`})]})}}function rd({group:e}){let t=`Comment on line ${e.lineNumber}${e.side===`deletions`?` (old version)`:``}`;return(0,W.jsxs)(`section`,{"aria-label":t,className:`space-y-1`,children:[(0,W.jsxs)(`p`,{className:`text-xs text-muted`,children:[t,`, outside the lines shown`]}),e.threads.map(e=>(0,W.jsx)(It,{thread:e},e.id))]})}var id=`file-tree-container`,ad=`data-file-tree-style`,od=`data-file-tree-unsafe-css`,sd=`data-file-tree-scrollbar-measure`,cd=`data-file-tree-scrollbar-gutter-measured`,ld=`--trees-scrollbar-gutter-measured`,ud=`header`,dd=`context-menu`,fd=`context-menu-trigger`,pd=typeof window>`u`?U.useEffect:U.useLayoutEffect;function md(e,t,n){let r=e==null?null:(0,W.jsx)(`div`,{slot:ud,children:e}),i=t!=null&&n!=null?(0,W.jsx)(`div`,{slot:dd,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,W.jsxs)(W.Fragment,{children:[r,i]})}function hd(e,t){return typeof window>`u`&&t!=null?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,W.jsx)(W.Fragment,{children:e})}function gd(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement||e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function _d(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function vd(e){let t=(0,U.useRef)(e.getComposition()),n=(0,U.useRef)(e);return n.current!==e&&(n.current=e,t.current=e.getComposition()),t.current}function yd({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(null),u=vd(n),d=i!=null,[f,p]=(0,U.useState)(d);f!==d&&(p(d),o!=null&&s(null));let m=(0,U.useCallback)(()=>{s(null)},[]),h=(0,U.useCallback)((e,t)=>{s({context:t,item:e})},[]),g=(0,U.useMemo)(()=>_d(u,e,d,m,h),[u,m,h,d,e]),_=(0,U.useCallback)(e=>{l(e)},[]);pd(()=>{n.setComposition(g)},[g,n]),pd(()=>{if(c!=null)return r!=null&&gd(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(u)}},[u,c,n,r]);let v=hd(md(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,W.jsx)(id,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}var bd=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
196
+ <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
197
+ <path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
198
+ </symbol>
199
+ <symbol id="file-tree-icon-dot" viewBox="0 0 6 6">
200
+ <circle cx="3" cy="3" r="3" />
201
+ </symbol>
202
+ <symbol id="file-tree-icon-file" viewBox="0 0 16 16">
203
+ <path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".5"/>
204
+ <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
205
+ </symbol>
206
+ <symbol id="file-tree-icon-lock" viewBox="0 0 16 16">
207
+ <path fill="currentcolor" d="M4 5.336V4a4 4 0 1 1 8 0v1.336c1.586.54 2 1.843 2 4.664v1c0 4.118-.883 5-5 5H7c-4.117 0-5-.883-5-5v-1c0-2.821.414-4.124 2-4.664M5.5 4v1.054Q6.166 4.998 7 5h2q.834-.002 1.5.054V4a2.5 2.5 0 0 0-5 0m-2 6v1c0 .995.055 1.692.167 2.193.107.483.246.686.35.79s.307.243.79.35c.5.112 1.198.167 2.193.167h2c.995 0 1.692-.055 2.193-.166.483-.108.686-.247.79-.35.104-.105.243-.308.35-.791.112-.5.167-1.198.167-2.193v-1c0-.995-.055-1.692-.166-2.193-.108-.483-.247-.686-.35-.79-.105-.104-.308-.243-.791-.35C10.693 6.555 9.995 6.5 9 6.5H7c-.995 0-1.692.055-2.193.167-.483.107-.686.246-.79.35s-.243.307-.35.79C3.555 8.307 3.5 9.005 3.5 10" />
208
+ </symbol>
209
+ <symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
210
+ <path d="M5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M9.5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M14 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" />
211
+ </symbol>
212
+ </svg>`,xd=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
213
+ <path fill="currentColor" d="M6.08 13.92c-.63-.57-.81-1.79-.55-2.67.45.56 1.08.73 1.73.83 1 .15 1.99.1 2.92-.37l.32-.19q.13.38.08.78a2.1 2.1 0 0 1-.9 1.5q-.3.24-.61.43c-.64.44-.81.95-.57 1.69l.02.08a1.7 1.7 0 0 1-.74-.64 2 2 0 0 1-.3-.98q0-.27-.02-.52-.07-.61-.61-.62a.7.7 0 0 0-.75.6z" class="bg" opacity=".6"/>
214
+ <path fill="currentColor" d="M2.5 11.1s1.86-.9 3.72-.9l1.4-4.39c.05-.21.2-.36.38-.36s.33.15.38.36l1.4 4.38c2.2 0 3.72.92 3.72.92l-3.16-8.69q-.13-.4-.45-.42H6.11q-.3.02-.45.42z" class="fg"/>
215
+ </symbol>`,Sd=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
216
+ <path fill="currentColor" fill-rule="evenodd" d="M9.49.5q1.92.05 2.66.54 1.27.6 1.35 1.52v.23a4 4 0 0 1-.53 1.9l-1.38 1.24q-.74.38-.72.63c.77.82 1.33 1.29.85 2.42q-.47 1.1-2.04 2.28c-.5.32-1.88 1.35-2.96 1.86-1.64.77-3.1 1.4-4.65 1.89-.51.16-1.5.16-1.5.16L.5 15A76 76 0 0 0 5.76 3.49q-.1-.08-.1-.2.1 0 .32-.35l-.03-.09q-1.17.39-2.38 1.3l-.13.03q0-.1-.21-.16-.46.31-.82.7l-.13-.19.16-.06-.03-.16-.34.29L2 4.5q.36-.48.72-.54l.04-.1V3.8q.16 0 .15-.06l.13-.06a6 6 0 0 0 1.13-.9v-.03H4.1l-.12.07q0-.1-.1-.1l-.15.07-.04-.1q.93-.52 1.63-1.05Q7.89.65 9.5.5M8.46 7.83l-.32.04c-1.31.54-2.31.82-2.91.88a71 71 0 0 0-2.2 4.54h.07q.58-.04 3.04-1.42.13 0 1.66-1.05L9.18 9.7v.03q.45-.2.81-1.3v-.2q-.5-.46-1.53-.4m.28-5.75c-.5.1-.75.19-.72.38l-1.16 2.6q-.17.1-.34.95-.3.48-.25.77v.1l.22.05A15 15 0 0 1 8.86 6c1.1-.71 2.12-1.38 2.8-2.54q.24-.33.21-.54-.02-.33-.4-.54c-.54 0-1.07-.34-1.63-.28l-.94-.03z" clip-rule="evenodd"/>
217
+ </symbol>`,Cd=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
218
+ <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
219
+ <path fill="currentColor" d="M11.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zM7 6.75C7 6.42 6.64 6 6 6s-1 .42-1 .75q-.01.25.22.41.26.21.89.35.74.14 1.28.53c.37.29.61.7.61 1.21 0 .87-.68 1.5-1.5 1.7v.55a.5.5 0 0 1-1 0v-.56c-.82-.18-1.5-.82-1.5-1.69a.5.5 0 0 1 1 0c0 .33.36.75 1 .75s1-.42 1-.75q.01-.25-.22-.41a2 2 0 0 0-.89-.35q-.74-.14-1.28-.53A1.5 1.5 0 0 1 4 6.75c0-.87.68-1.5 1.5-1.7V4.5a.5.5 0 0 1 1 0v.56c.82.18 1.5.82 1.5 1.69a.5.5 0 0 1-1 0" class="fg-stroke"/>
220
+ </symbol>`,wd=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
221
+ <path fill="currentColor" d="M8 2 4.88 7.35a7 7 0 0 1 3.7-.13l1.04.25-.99 4.16-1.05-.25a2.7 2.7 0 0 0-3.07 1.45l-.98-.47a4 4 0 0 1 1.07-1.31 3.8 3.8 0 0 1 3.23-.71l.5-2.08a6 6 0 0 0-5.07 1.12A5.9 5.9 0 0 0 1 14h14z"/>
222
+ </symbol>`,Td=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
223
+ <path fill="currentColor" fill-rule="evenodd" d="M11.72 1.5A2.5 2.5 0 0 1 14.2 4q.02 1.08.3 2.09c.22.73.56 1.24 1.08 1.45.22.08.4.27.4.5s-.18.43-.4.51q-.76.34-1.08 1.45c-.2.65-.27 1.32-.3 2a2.5 2.5 0 0 1-2.48 2.5H4.25A2.6 2.6 0 0 1 1.7 12c-.04-.85-.1-1.68-.22-2.04C1.26 9.23.92 8.7.4 8.5.18 8.42 0 8.23 0 8s.18-.42.4-.5q.77-.35 1.09-1.46c.1-.36.17-1.19.2-2.04a2.6 2.6 0 0 1 2.56-2.5z" class="bg" clip-rule="evenodd" opacity=".2"/>
224
+ <path fill="currentColor" fill-rule="evenodd" d="M8.47 4.54c1.23 0 2.04.68 2.04 1.73 0 .73-.55 1.39-1.24 1.5v.04c.94.1 1.58.77 1.58 1.7 0 1.2-.9 1.95-2.37 1.95H5.97a.3.3 0 0 1-.2-.08.3.3 0 0 1-.08-.2V4.82a.3.3 0 0 1 .08-.2.3.3 0 0 1 .2-.08zm-1.7 6.04h1.49q1.47-.01 1.49-1.15Q9.74 8.31 8.2 8.3H6.77zm0-5.16v2.06h1.21c.93 0 1.45-.38 1.45-1.06 0-.65-.44-1-1.22-1z" class="fg" clip-rule="evenodd"/>
225
+ </symbol>`,Ed=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
226
+ <path fill="currentColor" d="M8.88 6.96c0 3.82 3.72 4.7 5.7 3.74-.23.9-1.04 1.67-2.35 1.93-.02.4.42 1.28.82 1.63-.9.35-1.94-.12-2.51-.48a5 5 0 0 0-.32 1.87c-.68 0-1.57-1-1.8-1.37-.3.18-.85 1.15-.96 1.72a2.4 2.4 0 0 1-.81-.86 2.4 2.4 0 0 1-.3-1.15c-.38.27-1.48.95-1.99 1.18-.25-.58-.15-1.3 0-2.06-.21.12-1.8.27-2.43.12.32-.36.75-1.19.94-1.57A4.5 4.5 0 0 1 .44 10.6c.48-.22.97-.53 1.49-1.06C1.26 9.17.24 8.64 0 7.7a6 6 0 0 0 1.79-.32C1.28 7.08.44 6.15.6 5.01c.42.21 1.3.37 1.73.3a3.4 3.4 0 0 1-.25-2.75 5 5 0 0 0 1.48 1c-.08-.8.3-2.31.8-2.71.2.46.73 1.21 1.08 1.4.09-.61.87-2.06 1.57-2.25 0 .5.27 1.4.5 1.67.51-.54 2.25-1.44 3.64-1.13-.43.45-.75.61-.86.98 1.05 0 2.78.34 4.27 1.93-2.34-.89-5.69.56-5.69 3.5" class="bg" opacity=".5"/>
227
+ <path fill="currentColor" d="M11.21 3.59a4.1 4.1 0 0 0 2.47 2.89c.24-.22.61-.38.95-.19.76.44.2 1.26-.34 1.66l-.07.06a13 13 0 0 1-4.49 1.61l-.3-.43a10.5 10.5 0 0 0 4.13-1.31 1 1 0 0 0 .23-.25.5.5 0 0 0-.21-.69l-.15-.06a4.5 4.5 0 0 1-1.77-1.31 4.5 4.5 0 0 1-.88-1.77q.2-.12.43-.21"/>
228
+ <path fill="currentColor" d="M10.36 5.18a.4.4 0 0 0-.03.38c.09.2.3.3.46.23s.24-.3.15-.5l-.01-.02q.23.13.34.39a.83.83 0 0 1-.43 1.08.8.8 0 0 1-1.08-.43.83.83 0 0 1 .6-1.13"/>
229
+ </symbol>`,Dd=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
230
+ <path fill="currentColor" d="M8 14c3.87 0 7-2.46 7-5.49 0-1.88-1.2-3.53-3.04-4.52q-1.1-.61-1.84-1.07C9.2 2.35 8.64 2 8 2s-1.36.45-2.31 1.03A29 29 0 0 1 4.04 4C2.2 4.98 1 6.63 1 8.51 1 11.54 4.13 14 8 14M7.18 3.88q.3-.66.3-1.37c0-.08.11-.1.13-.01.38 1.57-.53 2.35-1.2 2.61-.08.03-.12-.07-.06-.12a3 3 0 0 0 .83-1.12m1.2-.05a3 3 0 0 0-.45-1.3V2.5c-.04-.07.05-.15.1-.1 1.15 1.2.77 2.3.33 2.87-.05.05-.13 0-.11-.08q.21-.67.13-1.37m1.04-.32a3 3 0 0 0-.94-1.02v-.01c-.06-.05-.01-.16.07-.12 1.51.61 1.61 1.8 1.43 2.5l-.03.03a.07.07 0 0 1-.1-.06 3 3 0 0 0-.43-1.32m-2.97.32c-.36.3-.74.43-1.2.56q-.11 0-.1-.1a3.5 3.5 0 0 0 1.76-1.57s.09-.07.1.04c0 .18-.2.76-.56 1.07m2.89 6.36q-.13.52-.55.88a1.3 1.3 0 0 1-.75.35 1.3 1.3 0 0 1-.77-.35 1.7 1.7 0 0 1-.54-.88.13.13 0 0 1 .15-.15h2.31a.14.14 0 0 1 .15.15M6.15 8.95a1.1 1.1 0 0 1-1.39-.14A1.1 1.1 0 0 1 5.12 7a1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1-.17 1.69m4.96 0a1.1 1.1 0 0 1-1.4-.14 1.1 1.1 0 0 1 .37-1.8 1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1 .24 1.2 1 1 0 0 1-.41.5"/>
231
+ </symbol>`,Od=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
232
+ <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
233
+ </symbol>`,kd=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
234
+ <path fill="currentColor" d="M3.75 10.31 6.5 8.77l.04-.14-.04-.07h-.14l-.46-.03-1.57-.04-1.38-.07-1.33-.07-.34-.07L1 7.86l.03-.21.28-.18.4.03.89.07 1.33.08.97.06 1.43.16h.22l.03-.1-.07-.05-.06-.06-1.39-.92-1.48-.98-.79-.57-.42-.28-.2-.28-.1-.6.39-.41.52.04.12.03.52.4 1.12.86L6.2 6.04l.2.17.09-.06.01-.04-.1-.15-.76-1.46-.85-1.46-.37-.6-.1-.36a1 1 0 0 1-.06-.42l.42-.59.25-.07.6.08.22.2.36.84.58 1.3.9 1.77.29.53.14.47.04.14h.1v-.07l.07-1 .14-1.22.14-1.57.04-.45.23-.53.42-.28.36.15.28.41-.04.25-.16 1.08-.36 1.7-.21 1.14h.12l.14-.15.58-.76.97-1.2.42-.5.5-.51.32-.25h.6l.44.66-.2.68-.61.79-.52.65-.74 1-.45.8.04.05h.1l1.68-.36.9-.16 1.06-.18.5.23.05.22-.2.48-1.15.28-1.34.28-2 .46-.04.01.03.04.9.09.4.03h.94l1.77.14.46.28.27.37-.04.28-.72.37-.95-.23-2.24-.53-.76-.18h-.11v.06l.64.63L12 10.86l1.48 1.35.07.34-.18.28-.2-.03-1.29-.98-.5-.42-1.12-.95h-.07v.1l.25.38 1.37 2.05.07.63-.1.2-.36.14-.38-.08-.8-1.12-.85-1.26-.66-1.15-.07.05-.4 4.23-.19.21-.42.17-.35-.28-.2-.42.2-.87.23-1.12.18-.9.17-1.1.1-.36v-.03h-.1l-.84 1.16-1.27 1.72-1 1.07-.24.1-.42-.22.04-.39.22-.32 1.4-1.8.84-1.1.57-.64-.02-.07h-.04l-3.7 2.4-.66.09-.28-.28.03-.42.14-.14 1.12-.77z"/>
235
+ </symbol>`,Ad=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
236
+ <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
237
+ </symbol>`,jd=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
238
+ <path fill="currentColor" d="M8 15c-5.76 0-7-1.24-7-7V2a1 1 0 0 1 1-1h6c5.77 0 7 1.24 7 7s-1.24 7-7 7" class="vector" opacity=".2"/>
239
+ <path fill="currentColor" d="M10.1 9.19h.73c.03.49.22.6 1 .6.76 0 .93-.12.93-.68 0-.52-.17-.67-.94-.85-1.38-.3-1.68-.56-1.68-1.47 0-1.05.3-1.29 1.67-1.29 1.29 0 1.57.2 1.6 1.13h-.74c-.01-.34-.17-.42-.85-.42-.77 0-.94.1-.94.58 0 .42.17.55.96.73 1.36.3 1.66.58 1.66 1.59 0 1.14-.31 1.39-1.73 1.39-1.39 0-1.69-.24-1.67-1.31m-3.9 0h.74c.03.49.21.6.99.6.76 0 .93-.12.93-.68 0-.52-.17-.67-.93-.85-1.39-.3-1.69-.56-1.69-1.47 0-1.05.3-1.29 1.67-1.29 1.3 0 1.58.2 1.6 1.13h-.73c-.02-.34-.18-.42-.85-.42-.78 0-.95.1-.95.58 0 .42.17.55.96.73 1.37.3 1.67.58 1.67 1.59 0 1.14-.32 1.39-1.74 1.39-1.38 0-1.68-.24-1.66-1.31m-1.22 0h.75c-.09 1.07-.37 1.31-1.56 1.31-1.37 0-1.68-.45-1.68-2.5 0-1.96.36-2.5 1.68-2.5 1.16 0 1.44.25 1.52 1.35h-.76c-.08-.52-.22-.64-.76-.64-.74 0-.9.33-.9 1.78 0 1.47.16 1.8.9 1.8.58 0 .74-.11.8-.6"/>
240
+ </symbol>`,Md=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
241
+ <path fill="currentColor" d="M14.953 9.733a12.4 12.4 0 0 1-.244 1.936c-.207.933-.532 1.58-.996 2.044s-1.11.789-2.044.996C10.73 14.918 9.533 15 8 15s-2.73-.082-3.669-.291c-.933-.207-1.58-.532-2.044-.996s-.789-1.11-.996-2.044c-.122-.547-.2-1.182-.244-1.92q.23.364.532.667c.64.639 1.482 1.031 2.533 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265a4 4 0 0 0 .541-.683"/>
242
+ <path fill="currentColor" d="M14.93 5.924c-.046.663-.118 1.24-.23 1.743-.207.932-.532 1.579-.995 2.042s-1.11.789-2.042.996c-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997s-.789-1.11-.996-2.042a12 12 0 0 1-.227-1.683l.016-.188a4 4 0 0 0 .5.62c.638.639 1.48 1.031 2.532 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265.192-.192.357-.404.506-.633z"/>
243
+ <path fill="currentColor" d="M8 1c1.533 0 2.73.082 3.669.291.933.207 1.58.533 2.044.996.403.404.904.944.91 1.695.004.764-.509 1.318-.918 1.727-.463.463-1.11.789-2.042.996-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997-.406-.406-.915-.953-.915-1.71 0-.758.509-1.305.915-1.712.464-.463 1.11-.789 2.044-.996C5.27 1.082 6.467 1 8 1"/>
244
+ </symbol>`,Nd=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
245
+ <path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".4"/>
246
+ <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
247
+ </symbol>`,Pd=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
248
+ <path fill="currentColor" d="M15.85 6.54c-.05-.04-.45-.36-1.31-.36q-.34 0-.68.06a2.7 2.7 0 0 0-1.14-1.79l-.23-.14-.15.23a3 3 0 0 0-.4 1q-.24 1.01.26 1.84c-.4.24-1.03.3-1.17.3H.5a.5.5 0 0 0-.5.52q-.01 1.46.46 2.83.55 1.5 1.6 2.18c.79.5 2.08.79 3.54.79q.96 0 1.94-.18a8 8 0 0 0 2.55-.97 7 7 0 0 0 1.73-1.5 10 10 0 0 0 1.7-3.06h.15a2.4 2.4 0 0 0 1.8-.7 2 2 0 0 0 .47-.74l.06-.2z"/>
249
+ <path fill="currentColor" d="M1.48 7.36h1.4a.14.14 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H1.48a.13.13 0 0 0-.13.14v1.32q.02.13.13.13m1.94 0h1.41a.14.14 0 0 0 .13-.13V5.91q-.01-.12-.13-.14h-1.4a.13.13 0 0 0-.13.14v1.32q0 .13.12.13m1.98 0h1.4q.13 0 .14-.13V5.91a.13.13 0 0 0-.14-.14H5.4q-.1.01-.12.14v1.32q0 .13.12.13m1.95 0h1.42q.1 0 .12-.13V5.91q0-.12-.12-.14H7.35q-.1.01-.12.14v1.32q.01.13.12.13M3.42 5.5h1.41c.07 0 .13-.08.13-.15V4.03a.13.13 0 0 0-.13-.14h-1.4q-.12 0-.13.14v1.31q0 .13.12.15m1.98 0h1.4c.08 0 .14-.08.14-.15V4.03q0-.13-.14-.14H5.4q-.1 0-.12.14v1.31q0 .13.12.15m1.95 0h1.42c.06 0 .12-.08.12-.15V4.03q-.01-.13-.12-.14H7.35q-.1 0-.12.14v1.31q.01.13.12.15m0-1.9h1.42q.1-.02.12-.14v-1.3Q8.88 2 8.77 2H7.35q-.1 0-.12.14v1.3q.01.13.12.14m1.97 3.78h1.4a.13.13 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H9.32q-.1.01-.12.14v1.32q.01.13.12.13" opacity=".5"/>
250
+ </symbol>`,Fd=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
251
+ <path fill="currentColor" d="M11.16 6.1 8.12 4.35a.3.3 0 0 0-.24 0L4.84 6.1a.3.3 0 0 0-.12.2v3.5q0 .14.12.22l3.04 1.74q.12.08.24 0l3.04-1.74a.2.2 0 0 0 .13-.22V6.3a.3.3 0 0 0-.13-.2" opacity=".5"/>
252
+ <path fill="currentColor" d="m.1 7.69 3.63-6.3A.8.8 0 0 1 4.37 1h7.26c.26 0 .5.17.64.4l3.63 6.27a.8.8 0 0 1 0 .75l-3.63 6.24a.7.7 0 0 1-.64.34H4.37a.7.7 0 0 1-.64-.34L.1 8.41a.7.7 0 0 1 0-.72m3 3.02q.01.15.14.23l4.63 2.66q.13.06.26 0l4.63-2.66a.3.3 0 0 0 .14-.23V5.4a.3.3 0 0 0-.14-.23L8.13 2.52a.3.3 0 0 0-.26 0L3.24 5.17a.3.3 0 0 0-.14.23z"/>
253
+ </symbol>`,Id=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
254
+ <path fill="currentColor" d="M12.3 13c-1.59 0-2.68-.99-2.68-2.5 0-1.43 1-2.34 2.88-2.35h2.16v-.83c0-1.08-.62-1.68-1.73-1.68-1.05 0-1.66.54-1.73 1.36H9.93c.09-1.43 1.06-2.48 3.05-2.48 1.75 0 3.02.95 3.02 2.68v5.66h-1.29v-1.02h-.04c-.41.66-1.16 1.16-2.37 1.16m.36-1.12c1.14 0 2-.72 2-1.74v-.96H12.6c-1.12 0-1.6.54-1.6 1.28 0 .97.8 1.42 1.66 1.42m-11.24.98H0L3.8 2h1.39l3.8 10.86H7.54l-1.08-3.2H2.5zm3.09-9.25h-.04l-1.6 4.95H6.1z"/>
255
+ </symbol>`,Ld=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
256
+ <path fill="currentColor" d="M14.74 7.38 8.62 1.26a.9.9 0 0 0-1.27 0L6.08 2.53l1.61 1.61a1.07 1.07 0 0 1 1.36 1.37l1.55 1.55a1.07 1.07 0 0 1 1.1 1.77 1.07 1.07 0 0 1-1.74-1.16L8.5 6.22v3.8a1.07 1.07 0 1 1-.89-.02V6.15a1.07 1.07 0 0 1-.58-1.4l-1.58-1.6-4.2 4.2a.9.9 0 0 0 0 1.27l6.12 6.12a.9.9 0 0 0 1.27 0l6.09-6.09a.9.9 0 0 0 0-1.27"/>
257
+ </symbol>`,Rd=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
258
+ <path fill="currentColor" fill-rule="evenodd" d="M4.41 4.57A3.2 3.2 0 0 1 6.87 5q.74.49 1.08 1.29.08.12-.1.16l-1.55.4c-.14.03-.15.04-.27-.1a1 1 0 0 0-.44-.34 1.6 1.6 0 0 0-1.68.14q-.95.61-.94 1.73c0 .73.52 1.33 1.25 1.43q.95.1 1.58-.6l.25-.34h-1.8c-.19 0-.24-.12-.17-.27.12-.28.34-.76.47-1a.3.3 0 0 1 .24-.14h2.98a4 4 0 0 1 .64-1.19 4 4 0 0 1 2.6-1.52 3.5 3.5 0 0 1 2.64.46q1.13.73 1.31 2.04a3.5 3.5 0 0 1-1.06 3.09q-.93.92-2.23 1.17l-.74.08a3.5 3.5 0 0 1-2.27-.8 3 3 0 0 1-.93-1.42 4 4 0 0 1-.39.61 4 4 0 0 1-2.64 1.56 3.3 3.3 0 0 1-2.5-.6 3 3 0 0 1-1.18-2.03 3.5 3.5 0 0 1 .8-2.67 4 4 0 0 1 2.6-1.58M13.1 7.5a1.53 1.53 0 0 0-1.9-1.21q-1.3.3-1.62 1.59a1.5 1.5 0 0 0 .85 1.72q.77.33 1.52-.05a2 2 0 0 0 1.18-1.74q0-.17-.03-.3" clip-rule="evenodd"/>
259
+ </symbol>`,zd=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
260
+ <path fill="currentColor" fill-rule="evenodd" d="M8 1a1.25 1.25 0 0 1 1.18 1.65l2.8 1.61q.33-.25.77-.26a1.25 1.25 0 0 1 .48 2.4v3.2a1.25 1.25 0 1 1-1.25 2.13l-2.8 1.62A1.25 1.25 0 0 1 8 15a1.25 1.25 0 0 1-1.18-1.65l-2.8-1.62q-.33.26-.77.27a1.25 1.25 0 0 1-.48-2.4V6.4a1.25 1.25 0 1 1 1.25-2.14l2.8-1.61A1.25 1.25 0 0 1 8 1M4.44 11.14l-.06.13 2.75 1.58a1.25 1.25 0 0 1 1.74 0l2.74-1.58-.05-.13zm3.89-7.68a1.3 1.3 0 0 1-.66 0L4.03 9.77q.37.3.45.78h7.04q.08-.48.45-.78zM4.38 4.73a1.24 1.24 0 0 1-1.02 1.76v3.02l.13.01 3.67-6.35-.03-.02zm4.46-1.56 3.67 6.35.13-.01V6.49a1.25 1.25 0 0 1-1.03-1.76L8.87 3.15z" clip-rule="evenodd"/>
261
+ </symbol>`,Bd=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
262
+ <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
263
+ <path fill="currentColor" d="M10.48 3.76a.5.5 0 0 1 .4.58L10.6 5.8h1.14a.5.5 0 0 1 0 1h-1.32L10 9.2h1.08a.5.5 0 0 1 0 1H9.8l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H6.4l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H4.25a.5.5 0 0 1 0-1h1.32L6 6.8H4.93a.5.5 0 0 1 0-1H6.2l.3-1.64a.5.5 0 1 1 .98.18L7.2 5.8h2.4l.3-1.64a.5.5 0 0 1 .58-.4M6.58 9.2h2.4l.44-2.4h-2.4z" class="fg"/>
264
+ </symbol>`,Vd=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
265
+ <path fill="currentColor" d="M12.5 2A2.5 2.5 0 0 1 15 4.5v4.67l-4.05-3.54-4.08 4.08-3-2L1 10.6V4.5A2.5 2.5 0 0 1 3.5 2z" opacity=".3"/>
266
+ <path fill="currentColor" d="M15 10.5v1a2.5 2.5 0 0 1-2.5 2.5h-9a2.5 2.5 0 0 1-2.46-2.04L4 9l3 2 4-4zm-7-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>
267
+ </symbol>`,Hd=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
268
+ <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
269
+ <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66M3.5 9.5h.98c0 .76.15.92.85.92.77 0 .94-.18.94-1.02V5.1h1v4.34c0 1.54-.35 1.87-1.92 1.87-1.55 0-1.89-.32-1.86-1.8"/>
270
+ </symbol>`,Ud=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
271
+ <path fill="currentColor" d="M13.25 11.5V9.75a.5.5 0 0 1 .36-.48l.55-.15a1.16 1.16 0 0 0 0-2.24l-.55-.15a.5.5 0 0 1-.36-.48V4.5a2.5 2.5 0 0 0-2.5-2.5h-.25a.5.5 0 0 0 0 1h.25a1.5 1.5 0 0 1 1.5 1.5v1.75a1.5 1.5 0 0 0 1.09 1.44l.54.15a.16.16 0 0 1 0 .32l-.54.15a1.5 1.5 0 0 0-1.09 1.44v1.75a1.5 1.5 0 0 1-1.5 1.5h-.25a.5.5 0 0 0 0 1h.25a2.5 2.5 0 0 0 2.5-2.5m-10.5 0V9.75a.5.5 0 0 0-.36-.48l-.55-.15a1.16 1.16 0 0 1 0-2.24l.55-.15a.5.5 0 0 0 .36-.48V4.5A2.5 2.5 0 0 1 5.25 2h.25a.5.5 0 0 1 0 1h-.25a1.5 1.5 0 0 0-1.5 1.5v1.75a1.5 1.5 0 0 1-1.09 1.44l-.54.15a.16.16 0 0 0 0 .32l.54.15a1.5 1.5 0 0 1 1.09 1.45v1.74a1.5 1.5 0 0 0 1.5 1.5h.25a.5.5 0 0 1 0 1h-.25a2.5 2.5 0 0 1-2.5-2.5"/>
272
+ </symbol>`,Wd=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
273
+ <path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
274
+ </symbol>`,Gd=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
275
+ <path fill="currentColor" d="M9.26-.04a3 3 0 0 1 2 .82 2.8 2.8 0 0 1 .8 2.35 2.9 2.9 0 0 1 2.41.8l.03.02a2.74 2.74 0 0 1 0 3.94l-5.8 5.69-.04.06-.02.07q0 .04.02.07.01.04.04.06l1.2 1.17a.55.55 0 0 1 0 .79.6.6 0 0 1-.81 0l-1.2-1.17a1.3 1.3 0 0 1 0-1.84L13.7 7.1a1.65 1.65 0 0 0 .37-1.82 2 2 0 0 0-.37-.54l-.03-.03a1.73 1.73 0 0 0-2.4 0L6.47 9.4l-.07.06a.58.58 0 0 1-.92-.18.6.6 0 0 1 .12-.6l4.85-4.76a1.65 1.65 0 0 0 0-2.36 1.73 1.73 0 0 0-2.4 0l-6.43 6.3a.6.6 0 0 1-.8 0 .55.55 0 0 1 0-.8L7.25.79a3 3 0 0 1 2-.82"/>
276
+ <path fill="currentColor" d="M9.26 2.19a.6.6 0 0 1 .52.34.6.6 0 0 1 0 .43l-.12.18L4.9 7.79a1.65 1.65 0 0 0 0 2.36 1.73 1.73 0 0 0 2.4 0l4.75-4.66a.58.58 0 0 1 .93.18.6.6 0 0 1-.12.61l-4.75 4.66a2.9 2.9 0 0 1-4.01 0 2.75 2.75 0 0 1-.62-3.04A3 3 0 0 1 4.1 7l4.74-4.65a.6.6 0 0 1 .4-.16"/>
277
+ </symbol>`,Kd=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
278
+ <defs>
279
+ <linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
280
+ <stop stop-color="currentColor"/>
281
+ <stop offset="1" stop-color="currentColor" stop-opacity="0"/>
282
+ </linearGradient>
283
+ </defs>
284
+ <path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
285
+ <path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
286
+ <path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
287
+ </symbol>`,qd=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
288
+ <path fill="currentColor" d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z" class="vector" opacity=".2"/>
289
+ <path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
290
+ </symbol>`,Jd=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
291
+ <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .5.5V3h3.5a.5.5 0 0 1 .38.83L10.5 7.69v1.44q.41.04.95-.16a4 4 0 0 0 .72-.35l.04-.03h.01a.5.5 0 0 1 .67.1l2 2.5a.5.5 0 0 1 0 .62c-.76.96-3.14 2.69-6.89 2.69s-6.13-1.73-6.89-2.69a.5.5 0 0 1 0-.62l2-2.5a.5.5 0 0 1 .67-.1l.05.03.16.09q.22.13.56.26.54.2.95.16V7.69L2.12 3.83A.5.5 0 0 1 2.5 3H6V1.5a.5.5 0 0 1 .5-.5zM7 3.5a.5.5 0 0 1-.5.5H3.6l2.78 3.17a.5.5 0 0 1 .12.33v2a.5.5 0 0 1-.28.45c-.7.35-1.5.15-2.02-.05a5 5 0 0 1-.58-.26l-1.46 1.84c.82.78 2.8 2.02 5.84 2.02s5.02-1.24 5.84-2.02l-1.46-1.83a5 5 0 0 1-.58.26c-.52.2-1.33.39-2.02.04a.5.5 0 0 1-.28-.45v-2a.5.5 0 0 1 .12-.33L12.4 4H9.5a.5.5 0 0 1-.5-.5V2H7z"/>
292
+ </symbol>`,Yd=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
293
+ <path fill="currentColor" d="M14.5 8a6.5 6.5 0 0 0-5.9-6.47l5.42 8.93A7 7 0 0 0 14.5 8M2.88 12A6.5 6.5 0 0 0 8 14.5c2.08 0 3.93-.98 5.12-2.5zm8.62-1h1.68L11.5 8.24zm-1-.55a4 4 0 0 1-.7.55h.7zM8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M5.5 11h.7a4 4 0 0 1-.7-.55zm-2.68 0H4.5V8.24zm3.76-6.2A4 4 0 0 1 8 4.5q.76 0 1.42.3L8 2.46zM1.5 8q0 1.31.48 2.46L7.4 1.53A6.5 6.5 0 0 0 1.5 8m14 0a7.5 7.5 0 0 1-.99 3.72l-.01.03-.02.03A7.5 7.5 0 0 1 8 15.5a7.5 7.5 0 0 1-6.5-3.75l-.01-.03A7.5 7.5 0 1 1 15.5 8"/>
294
+ </symbol>`,Xd=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
295
+ <path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
296
+ <path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
297
+ <path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
298
+ <path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
299
+ </symbol>`,Zd=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
300
+ <path fill="currentColor" d="M8.33 8.4H10c1.16 0 1.9-.73 1.9-1.86V5.08q0-.24.25-.24h.74c.75 0 1.33.32 1.66.97q.4.73.41 1.46c.09.9.09 1.78-.24 2.67-.25.73-.75 1.3-1.58 1.46h-4.8c-.08 0-.25 0-.25.08v.4s.17.09.25.09h2.82q.34-.02.33.32v1.06c0 .56-.25.97-.75 1.13-.41.16-.83.33-1.24.4a7 7 0 0 1-2.98-.07 3 3 0 0 1-1.16-.49c-.33-.32-.58-.65-.5-1.14v-2.91c0-1.13.67-1.78 1.82-1.78q.89-.1 1.66-.08m2.32 4.86a.65.65 0 0 0-.66-.65c-.34 0-.67.33-.67.65s.33.57.67.65a.65.65 0 0 0 .66-.65" class="bg" opacity=".8"/>
301
+ <path fill="currentColor" d="M7.67 7.6H6c-1.16 0-1.9.73-1.9 1.86v1.46q0 .24-.25.24h-.74c-.75 0-1.33-.32-1.66-.97a3 3 0 0 1-.41-1.46 6 6 0 0 1 .24-2.67c.25-.73.75-1.3 1.58-1.46h4.8c.08 0 .25 0 .25-.08v-.4s-.17-.09-.25-.09H4.85c-.24 0-.33-.08-.33-.32V2.65c0-.56.25-.97.75-1.13.41-.16.83-.33 1.24-.4a7 7 0 0 1 2.98.07c.41.09.83.25 1.16.49.33.32.58.65.5 1.13v2.92c0 1.14-.67 1.78-1.82 1.78-.58.08-1.16.08-1.66.08M5.35 2.73c0 .33.25.65.66.65.33 0 .66-.32.66-.65 0-.32-.33-.56-.66-.64a.65.65 0 0 0-.66.64" class="fg"/>
302
+ </symbol>`,Qd=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
303
+ <path fill="currentColor" d="M8 6.65c.73 0 1.31.6 1.31 1.35S8.73 9.35 8 9.35 6.69 8.75 6.69 8 7.27 6.65 8 6.65"/>
304
+ <path fill="currentColor" fill-rule="evenodd" d="M8 2.55c1.3-.99 2.59-1.34 3.5-.8.92.55 1.27 1.87 1.08 3.53C14.06 5.94 15 6.9 15 8s-.94 2.06-2.42 2.72c.19 1.65-.16 2.98-1.08 3.52-.91.55-2.2.2-3.5-.8-1.3 1-2.58 1.35-3.5.8-.91-.54-1.27-1.87-1.08-3.52C1.94 10.06 1 9.1 1 8s.94-2.06 2.42-2.72c-.19-1.66.17-2.98 1.08-3.52s2.2-.2 3.5.8M4.26 11.2c-.08 1.34.28 2.03.68 2.26s1.15.22 2.25-.52l.11-.09a12 12 0 0 1-1.24-1.39 11 11 0 0 1-1.8-.41zm7.47-.15q-.83.27-1.79.41-.6.8-1.24 1.4l.11.08c1.1.74 1.86.76 2.25.52.4-.23.76-.92.68-2.26zm-3.04.54a14 14 0 0 1-1.38 0q.34.38.69.7.35-.32.7-.7M8 5.29q-.76 0-1.47.1A13 13 0 0 0 5.07 8a14 14 0 0 0 1.46 2.62 13 13 0 0 0 2.94 0A13 13 0 0 0 10.93 8a14 14 0 0 0-1.46-2.62A13 13 0 0 0 8 5.3M4.64 9.18q-.15.5-.25.96.44.16.94.27a15 15 0 0 1-.7-1.23m6.73 0a15 15 0 0 1-.7 1.23q.5-.11.95-.27a10 10 0 0 0-.25-.96M3.44 6.26C2.27 6.86 1.87 7.53 1.87 8s.4 1.14 1.57 1.74l.13.07q.18-.88.55-1.81a12 12 0 0 1-.55-1.8q-.07.02-.13.06m8.99-.07A12 12 0 0 1 11.88 8q.36.94.55 1.8l.13-.06c1.17-.6 1.56-1.27 1.56-1.74s-.39-1.14-1.56-1.74zm-7.1-.6q-.5.11-.94.27.1.46.25.96a15 15 0 0 1 .69-1.23m5.34 0a15 15 0 0 1 .7 1.23q.14-.5.24-.96-.44-.15-.94-.27M7.18 3.06c-1.09-.74-1.85-.76-2.24-.52s-.76.92-.69 2.26l.01.15a11 11 0 0 1 1.8-.41q.6-.8 1.24-1.4zm3.88-.52c-.4-.24-1.15-.22-2.25.52l-.12.08q.65.6 1.25 1.4.96.15 1.8.41v-.14c.08-1.35-.28-2.04-.68-2.27M8 3.7a10 10 0 0 0-.7.7 14 14 0 0 1 1.4 0 10 10 0 0 0-.7-.7" clip-rule="evenodd"/>
305
+ </symbol>`,$d=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
306
+ <path fill="currentColor" fill-rule="evenodd" d="M11.04 2c.48 0 .92.23 1.18.6l2.54 3.65c.37.52.3 1.23-.15 1.69l-5.58 5.64a1.47 1.47 0 0 1-2.06 0L1.39 7.94a1.3 1.3 0 0 1-.15-1.7l2.54-3.63q.2-.3.5-.45.33-.16.68-.16zm.84 2.17a.5.5 0 0 0-.7-.05L8 6.84 4.83 4.12a.5.5 0 0 0-.65.76L6.65 7H3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1H9.35l2.48-2.12a.5.5 0 0 0 .05-.7" clip-rule="evenodd"/>
307
+ </symbol>`,ef=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
308
+ <path fill="currentColor" fill-rule="evenodd" d="M8 .8a.2.2 0 0 1 .18.1l.38.6.16.02.5-.53.01-.01a.2.2 0 0 1 .33.08l.25.68.16.05.59-.43h.02a.2.2 0 0 1 .3.14l.12.71.15.08.65-.3a.2.2 0 0 1 .2.02.2.2 0 0 1 .1.18l-.03.72.12.1.71-.16a.2.2 0 0 1 .25.25l-.17.7q.06.06.1.13l.73-.03A.2.2 0 0 1 14 4a.2.2 0 0 1 .02.2l-.3.66.08.14.71.12a.2.2 0 0 1 .14.32l-.43.59.05.16.68.25a.2.2 0 0 1 .07.35l-.53.49.01.16.62.38a.2.2 0 0 1 0 .36l-.62.38-.01.16.53.5a.2.2 0 0 1-.07.34l-.68.25-.05.16.43.59a.2.2 0 0 1-.14.32l-.72.12-.07.15.3.65a.2.2 0 0 1-.02.2.2.2 0 0 1-.18.1l-.72-.03-.1.13.16.7a.2.2 0 0 1-.25.25l-.7-.17-.13.1.03.73a.2.2 0 0 1-.1.18.2.2 0 0 1-.2.02l-.66-.3-.14.08-.12.71a.2.2 0 0 1-.32.14l-.59-.43-.16.05-.25.68a.2.2 0 0 1-.34.07l-.5-.53-.16.01-.38.62a.2.2 0 0 1-.36 0l-.38-.62-.16-.01-.5.53a.2.2 0 0 1-.34-.07l-.25-.68-.16-.05-.59.43a.2.2 0 0 1-.32-.14L5 13.78l-.15-.07-.65.3a.2.2 0 0 1-.2-.02.2.2 0 0 1-.1-.18l.03-.72-.13-.1-.7.16a.2.2 0 0 1-.25-.25l.17-.7-.1-.13-.73.03a.2.2 0 0 1-.2-.3l.3-.66-.08-.14-.71-.12a.2.2 0 0 1-.14-.32l.43-.59-.05-.16-.68-.25A.2.2 0 0 1 1 9.22l.53-.5-.02-.16-.6-.38A.2.2 0 0 1 .8 8a.2.2 0 0 1 .1-.18l.6-.38.02-.16-.53-.5a.2.2 0 0 1 .07-.34l.68-.25.05-.16-.43-.59a.2.2 0 0 1 .14-.32L2.2 5l.08-.15L2 4.2a.2.2 0 0 1 .2-.3l.72.03.1-.13-.16-.7a.2.2 0 0 1 .25-.25l.7.16.13-.1-.03-.72A.2.2 0 0 1 4 2a.2.2 0 0 1 .2-.02l.65.3L5 2.2l.12-.71v-.03a.2.2 0 0 1 .32-.1l.59.41.16-.04.25-.68.01-.02A.2.2 0 0 1 6.8.99l.49.53.16-.02.38-.61.02-.02A.2.2 0 0 1 8 .79M6.8 9.45h1.26l.06.01q.03.01.03.05v1.52q0 .07-.09.06h-4.5A5.4 5.4 0 0 0 8 13.42a5.4 5.4 0 0 0 4.45-2.33h-2.42c-.36 0-.68-.5-.77-.75-.08-.22-.2-.91-.25-1.12-.15-.61-.59-.71-.78-.73H6.8zM8 2.58a5.4 5.4 0 0 0-4.07 1.85h5.74l.17.02c.23.03.6.12.96.35.34.23.83.68.83 1.4 0 .66-.55 1.16-1.08 1.5.42.33.7.53.86 1.44.04.17.34.32.62.29.29-.03.62-.16.62-.75v-.24q0-.1.07-.1h.68A5.43 5.43 0 0 0 8 2.59M2.96 6.03a5.4 5.4 0 0 0-.19 3.37h1.66V6.03zM6.8 7.06h1.66c.35 0 .77-.12.77-.47 0-.42-.55-.53-.65-.53H6.8z" clip-rule="evenodd"/>
309
+ </symbol>`,tf=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
310
+ <path fill="currentColor" fill-rule="evenodd" d="M8.08 1.44c2.41-.91 4.96-.37 5.35 1.27.39 1.62-.92 3.56-2.6 4.25a5 5 0 0 1-3.26.35c-.58-.2-.92-.62-1-.85-.03-.09-.09-.24 0-.3.05-.03.08-.02.22.15s.7.6 1.75.48c2.78-.34 4.45-2.64 3.92-3.88-.37-.87-2.5-1.26-5.18.16C4.03 4.81 3.85 6.24 3.82 6.8c-.08 1.5 1.73 2.28 2.7 3.4q.04.03.07.08c.3-.12.7-.19 1.35-.2 1.58-.03 2.47 1.08 2.43 2.08-.03.78-.7 1.1-.82 1.13-.1.01-.14.02-.15-.06q-.03-.06.13-.15c.16-.09.42-.3.48-.72.05-.43-.24-1.44-1.76-1.63a3 3 0 0 0-1.33.08c.27.62.32 1.87-.29 2.83-.63 1-1.8 1.61-2.93 1.27-.37-.1-.93-.92-.45-2.05.46-1.07 2.4-2.12 2.66-2.26-.9-.83-3.08-1.95-3.4-3.65-.08-.49.13-1.65 1.46-2.98a12 12 0 0 1 4.11-2.52m-1.88 9.7c-.01.01-.9.47-1.52 1.17-.59.66-.75 1.48-.43 1.69.3.18 1-.04 1.51-.62a3 3 0 0 0 .5-.9q.2-.64.02-1.39z" clip-rule="evenodd"/>
311
+ </symbol>`,nf=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
312
+ <path fill="currentColor" d="M4 3v3.5l1.5-1L7 15 .5 6l1-1.5L0 3l2.5-2h1zm12 0-1.5 1.5 1 1.5L9 15l1.5-9.5 1.5 1V3l.5-2h1zm-8 8.5a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1"/>
313
+ <path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
314
+ </symbol>`,rf=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
315
+ <path fill="currentColor" d="m3.98 3.7 3.36-2.08a4.5 4.5 0 0 1 5.9 1.23 4 4 0 0 1 .7 3.02q-.16.75-.58 1.4c.42.77.56 1.66.4 2.52a3.7 3.7 0 0 1-1.57 2.4l-.17.1-3.36 2.09a4.5 4.5 0 0 1-5.9-1.23 4 4 0 0 1-.66-1.44 4 4 0 0 1-.04-1.58 4 4 0 0 1 .58-1.4 4 4 0 0 1-.4-2.52 3.7 3.7 0 0 1 1.57-2.4zl3.36-2.08zm7.87 0a2.7 2.7 0 0 0-1.26-.95 2.7 2.7 0 0 0-1.6-.07 3 3 0 0 0-.52.2l-.16.09-3.36 2.08a2 2 0 0 0-.69.64 2 2 0 0 0-.36.86 2.3 2.3 0 0 0 .42 1.81A2.7 2.7 0 0 0 7.18 9.4q.28-.06.53-.2l.16-.09 1.28-.79.2-.09a.8.8 0 0 1 .87.31.7.7 0 0 1 .13.55.7.7 0 0 1-.24.4l-.08.05-3.36 2.08-.2.09a1 1 0 0 1-.49-.02 1 1 0 0 1-.38-.3 1 1 0 0 1-.13-.37v-.1l.01-.13-.13-.03a4 4 0 0 1-1.1-.5l-.2-.14-.18-.12-.07.18-.08.3a2.3 2.3 0 0 0 .43 1.82q.45.64 1.19.93.73.28 1.51.14l.16-.04q.27-.07.52-.2l.16-.09 3.36-2.08q.4-.25.69-.64.27-.4.36-.86a2.3 2.3 0 0 0-.42-1.82 2.7 2.7 0 0 0-1.27-.95 2.7 2.7 0 0 0-1.6-.08q-.27.07-.52.2l-.16.1-1.28.79-.2.09a1 1 0 0 1-.49-.03 1 1 0 0 1-.38-.29.7.7 0 0 1-.13-.54.7.7 0 0 1 .24-.4l.08-.06L9.33 4.4l.2-.1a.8.8 0 0 1 .87.32 1 1 0 0 1 .13.38v.22l.11.04q.6.18 1.12.5l.2.14.17.12.06-.19.08-.3a2.3 2.3 0 0 0-.42-1.81z"/>
316
+ </symbol>`,af=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
317
+ <path fill="currentColor" d="M5 7a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z"/>
318
+ <path fill="currentColor" d="M6 1a5 5 0 0 1 4.58 3H7a3 3 0 0 0-3 3v3.58A5 5 0 0 1 6 1" opacity=".5"/>
319
+ </symbol>`,of=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
320
+ <path fill="currentColor" d="M9.43 4.8A.6.6 0 1 1 9.19 6l-.56.96a1.2 1.2 0 0 1 .32 1.58l.7.53a.89.89 0 1 1-.17.22l-.7-.52a1.2 1.2 0 0 1-1.4.25l-.56.87a.75.75 0 1 1-.57-.2 1 1 0 0 1 .32.05l.56-.87a1.2 1.2 0 0 1-.4-1.24l-1.2-.47a.56.56 0 1 1 .1-.28v.02l1.2.47a1.2 1.2 0 0 1 1.56-.55l.56-.97a.6.6 0 0 1-.15-.64.6.6 0 0 1 .63-.4"/>
321
+ <path fill="currentColor" fill-rule="evenodd" d="M9.17 1q.16.63.27 1.26a6 6 0 0 1 1.61.67q.52-.38 1.08-.71l1.65 1.64q-.32.56-.68 1.05.48.78.72 1.67.6.09 1.18.25v2.32q-.55.15-1.11.24a6 6 0 0 1-.7 1.82q.31.44.59.91l-1.65 1.65-.85-.55a6 6 0 0 1-1.9.83q-.08.47-.2.95H6.84q-.12-.46-.2-.93a6 6 0 0 1-1.96-.81q-.39.27-.8.51l-1.65-1.65q.25-.43.53-.84a6 6 0 0 1-.75-1.9L1 9.16V6.83q.54-.14 1.09-.24a6 6 0 0 1 .77-1.74q-.33-.47-.63-.98l1.65-1.65q.54.32 1.03.68a6 6 0 0 1 1.66-.66q.1-.61.26-1.24zM7.96 3.73a4 4 0 0 0-1.74.36 4.5 4.5 0 0 0-2.3 2.3 4.4 4.4 0 0 0-.1 3.29l.03.06a4.4 4.4 0 0 0 2.4 2.47 4.4 4.4 0 0 0 3.48-.02l.03-.02a4.4 4.4 0 0 0 2.3-2.42l.06-.14a4.4 4.4 0 0 0-.2-3.4 4.4 4.4 0 0 0-2.13-2.07L9.47 4a4 4 0 0 0-1.51-.27" clip-rule="evenodd"/>
322
+ </symbol>`,sf=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
323
+ <path fill="currentColor" d="M9.63 1c6.15 4.35 4.16 9.15 4.16 9.15s1.75 2.05 1.04 3.85c0 0-.72-1.26-1.93-1.26-1.17 0-1.85 1.26-4.2 1.26C3.47 14 1 9.46 1 9.46c4.71 3.22 7.93.94 7.93.94C6.8 9.12 2.29 3 2.29 3c3.93 3.47 5.63 4.39 5.63 4.39-1.01-.87-3.86-5.13-3.86-5.13C6.34 4.66 10.86 8 10.86 8c1.28-3.7-1.23-7-1.23-7"/>
324
+ </symbol>`,cf=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
325
+ <path fill="currentColor" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" opacity=".4"/>
326
+ <path fill="currentColor" d="M11.5 8a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5zM5 12h2.5v-1H5zm3.5 0H11v-1H8.5zM5 10h2.5V9H5zm3.5 0H11V9H8.5zm1-9a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
327
+ </symbol>`,lf=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
328
+ <path fill="currentColor" fill-rule="evenodd" d="M8 4Q5.2 4 4.5 6.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C8.98 7.23 9.77 8 11.5 8q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C10.52 4.77 9.73 4 8 4M4.5 8Q1.7 8 1 10.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C5.48 11.23 6.26 12 8 12q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C7.02 8.77 6.24 8 4.5 8" clip-rule="evenodd"/>
329
+ </symbol>`,uf=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
330
+ <path fill="currentColor" d="M1 0v5.05l4.35 2.53V2.53zm9.18 5.34L5.83 2.82v5.05l4.35 2.53zm.47 5.06V5.34L15 2.82v5.05zm-.48 5.6-4.35-2.53V8.42l4.35 2.53z"/>
331
+ </symbol>`,df=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
332
+ <path fill="currentColor" fill-rule="evenodd" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" clip-rule="evenodd" opacity=".4"/>
333
+ <path fill="currentColor" d="M8.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zm2-2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm-1-8a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z"/>
334
+ </symbol>`,ff=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
335
+ <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
336
+ <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66m-3 1.57V5.99H3.5v-.9h4.21v.9H6.1v5.22z"/>
337
+ </symbol>`,pf=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
338
+ <path fill="currentColor" d="M8.57 14.87c-.18.26-.55.11-.55-.22v-3.18l-.05-.27-.13-.22-.2-.15-.24-.06H4.29c-.26 0-.4-.32-.26-.55L6.08 7c.3-.46 0-1.1-.5-1.1H1.8c-.25 0-.4-.32-.25-.56l2.65-4.2A.3.3 0 0 1 4.46 1h7.9c.26 0 .4.32.26.55l-2.05 3.23c-.29.46 0 1.1.5 1.1h3.12c.26 0 .4.34.24.57z"/>
339
+ </symbol>`,mf=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
340
+ <path fill="currentColor" d="m5.11 9.68-2.4 1.84a.6.6 0 0 1-.75-.04l-.77-.7a.6.6 0 0 1 0-.87L3.28 8zm5.52-8.42a.51.51 0 0 1 .87.36V4.8L7.32 8 5.1 6.32z" opacity=".75"/>
341
+ <path fill="currentColor" d="M11.1 14.99h.03zM1.96 4.52a.6.6 0 0 1 .75-.04l8.8 6.71v3.19a.51.51 0 0 1-.88.36L1.19 6.1a.6.6 0 0 1 0-.87z" opacity=".65"/>
342
+ <path fill="currentColor" d="M11.62 14.91a.9.9 0 0 1-1-.17.51.51 0 0 0 .88-.36V1.62a.51.51 0 0 0-.87-.36.9.9 0 0 1 1-.17l2.87 1.39a.9.9 0 0 1 .5.8v9.44a.9.9 0 0 1-.5.8z"/>
343
+ </symbol>`,hf=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
344
+ <path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
345
+ <path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
346
+ </symbol>`,gf=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
347
+ <path fill="currentColor" d="M13 1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h3a2 2 0 1 0 4 0z" class="subtract" opacity=".2"/>
348
+ <path fill="currentColor" d="M4.64 11.4h.02l.8-3.4h.91l.73 3.45L7.88 8h.96l-1.25 5h-.97L5.9 9.6 5.1 13h-1L3 8h.98z"/>
349
+ <path fill="currentColor" fill-rule="evenodd" d="M13 13h-1.02l-.33-1.11H9.9L9.64 13h-.97l1.26-5h1.54zm-2.49-3.77-.42 1.84h1.32l-.49-1.84z" clip-rule="evenodd"/>
350
+ </symbol>`,_f=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
351
+ <path fill="currentColor" d="M14.1 11.79 8.26 15v-2.5l3.64-1.94zm.4-.35V4.73l-2.14 1.2v4.3zm-12.6.35L7.74 15v-2.5L4.1 10.56zm-.4-.35V4.73l2.14 1.2v4.3zm.25-7.15 6-3.29v2.42L3.9 5.47l-.03.01zm12.5 0L8.25 1v2.42l3.85 2.05.03.01z" class="bg" opacity=".4"/>
352
+ <path fill="currentColor" d="m7.74 11.93-3.59-1.92v-3.8l3.6 2.02zm.52 0 3.59-1.92v-3.8l-3.6 2.02zM4.4 5.77 8 3.85l3.6 1.93L8 7.8z" class="fg"/>
353
+ </symbol>`,vf=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
354
+ <path fill="currentColor" d="M7.5 2A1.5 1.5 0 0 1 9 3.5v3A1.5 1.5 0 0 1 7.5 8h-2v2A1.5 1.5 0 0 0 7 11.5v-1A1.5 1.5 0 0 1 8.5 9h5a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-5A1.5 1.5 0 0 1 7 13.5v-1A2.5 2.5 0 0 1 4.5 10V8h-2A1.5 1.5 0 0 1 1 6.5v-3A1.5 1.5 0 0 1 2.5 2zm1 8a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5zm-6-7a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5z"/>
355
+ </symbol>`,yf=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
356
+ <path fill="currentColor" d="m14.73 1.5-7.29 8.82h4.17l-1.73 2.04H5.76L1.27 14.5l7.3-8.91H4.39l1.73-2.05h4.12z"/>
357
+ <path fill="currentColor" d="M5.21 3.54 3.56 5.6h-.55v4.73h.83L2.1 12.36H1V3.54zm9.79 0v8.82h-4.3l1.74-2.04h.55V5.68h-.83l1.74-2.14z"/>
358
+ </symbol>`,bf=[Cd,Od,Ad,jd,Md,Nd,Id,Ld,Rd,Bd,Vd,Hd,Ud,Wd,Gd,Zd,$d,ef,sf,cf,df,ff,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
359
+ <path fill="currentColor" d="M4.585 2a2 2 0 0 1 1.028.285l1.788 1.072a1 1 0 0 0 .514.143H12A2 2 0 0 1 13.935 5H0V4a2 2 0 0 1 2-2z" class="bg" opacity=".5"/>
360
+ <path fill="currentColor" fill-rule="evenodd" d="M14 12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-1.25h1v-1H0V6h14zM9.9 8.25c-.883 0-1.9.5-1.9.5H7v1h1v1s1.017.5 1.9.5c.884 0 1.6-.672 1.6-1.5s-.716-1.5-1.6-1.5M2 9.75v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1zm-5-1v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1z" class="fg" clip-rule="evenodd"/>
361
+ </symbol>`],xf=[xd,Sd,wd,Td,Ed,Dd,kd,Pd,Fd,zd,Kd,qd,Jd,Yd,Xd,Qd,tf,nf,rf,af,of,lf,uf,pf,mf,hf,gf,_f,vf,yf];function Sf(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
362
+ `)}\n</svg>`)}var Cf=Sf(bd,bf),wf={minimal:bd,standard:Cf,complete:Sf(Cf,xf)},Tf={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},Ef={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mm:`cpp`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},Df={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},Of=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),kf=new Set([`complete`]);function Af(e){return wf[e===`none`?`minimal`:e]}function jf(e){return`file-tree-builtin-${e}`}function Mf(e){return e!==`none`&&kf.has(e)}function Nf(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=Tf[t.toLowerCase()];if(i!=null&&(r||Of.has(i)))return i;for(let e of n){if(r){let t=Df[e];if(t!=null)return t}let t=Ef[e];if(t!=null&&(r||Of.has(t)))return t}return`default`}function Pf(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function Ff(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(Pf(e)?`none`:`complete`),colored:e.colored??!0}}var If=Object.freeze({searchPlaceholder:`Search…`,contextMenuTrigger:`Options`,renameItem:e=>`Rename ${e}`,gitStatusTitles:Object.freeze({added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`}),containsGitStatusTitle:`Contains git status items`});function Lf(e){if(e==null)return If;let t=If,n=e.gitStatusTitles;return{searchPlaceholder:e.searchPlaceholder??t.searchPlaceholder,contextMenuTrigger:e.contextMenuTrigger??t.contextMenuTrigger,renameItem:e.renameItem??t.renameItem,gitStatusTitles:n==null?t.gitStatusTitles:{added:n.added??t.gitStatusTitles.added,deleted:n.deleted??t.gitStatusTitles.deleted,ignored:n.ignored??t.gitStatusTitles.ignored,modified:n.modified??t.gitStatusTitles.modified,renamed:n.renamed??t.gitStatusTitles.renamed,untracked:n.untracked??t.gitStatusTitles.untracked},containsGitStatusTitle:e.containsGitStatusTitle??t.containsGitStatusTitle}}var Rf={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function zf(e,t){if(typeof e==`number`)return{itemHeight:t??Rf.default.itemHeight,factor:e};let n=Rf[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Bf=Rf.default.itemHeight,Vf=`@layer base {
363
+ :host {
364
+ --trees-accent: var(--trees-accent-override, #009fff);
365
+ --trees-fg: var(--trees-fg-override, var(--trees-theme-sidebar-fg, light-dark(#6c6c71, #adadb1)));
366
+ --trees-fg-muted: var(--trees-fg-muted-override, var(--trees-theme-sidebar-header-fg, #84848a));
367
+ --trees-bg: var(--trees-bg-override, var(--trees-theme-sidebar-bg, light-dark(#f8f8f8, #141415)));
368
+ --trees-bg-muted: var(--trees-bg-muted-override, var(--trees-theme-list-hover-bg, light-dark(color-mix(in lab,
369
+ var(--trees-accent) var(--trees-bg-alpha-light, 8%),
370
+ var(--trees-bg)), color-mix(in lab,
371
+ var(--trees-accent) var(--trees-bg-alpha-dark, 10%),
372
+ var(--trees-bg)))));
373
+ --trees-input-bg: var(--trees-input-bg-override, light-dark(#f8f8f8, #070707));
374
+ --trees-added-light: #16a994;
375
+ --trees-added-dark: #00cab1;
376
+ --trees-ignored-light: #adadb1;
377
+ --trees-ignored-dark: #4a4a4e;
378
+ --trees-modified-light: #1ca1c7;
379
+ --trees-modified-dark: #08c0ef;
380
+ --trees-renamed-light: #d5a910;
381
+ --trees-renamed-dark: #ffd452;
382
+ --trees-untracked-light: #16a994;
383
+ --trees-untracked-dark: #00cab1;
384
+ --trees-deleted-light: #ff2e3f;
385
+ --trees-deleted-dark: #ff6762;
386
+ --trees-border-color: var(--trees-border-color-override, var(--trees-theme-sidebar-border, light-dark(#eeeeef, #070707)));
387
+ --trees-indent-guide-bg: var(--trees-indent-guide-bg-override, color-mix(in lab, var(--trees-fg-muted) 25%, transparent));
388
+ --trees-density: var(--trees-density-override, 1);
389
+ --trees-border-radius: var(--trees-border-radius-override, calc(6px * var(--trees-density)));
390
+ --trees-font-family: var(--trees-font-family-override, system-ui);
391
+ --trees-font-size: var(--trees-font-size-override, 13px);
392
+ --trees-font-weight-regular: var(--trees-font-weight-regular-override, 400);
393
+ --trees-font-weight-semibold: var(--trees-font-weight-semibold-override, 600);
394
+ --trees-focus-ring-color: var(--trees-focus-ring-color-override, var(--trees-theme-focus-ring, var(--trees-accent)));
395
+ --trees-focus-ring-width: var(--trees-focus-ring-width-override, 1px);
396
+ --trees-focus-ring-offset: var(--trees-focus-ring-offset-override, -1px);
397
+ --trees-search-fg: var(--trees-search-fg-override, var(--trees-theme-input-fg, var(--trees-fg)));
398
+ --trees-search-font-weight: var(--trees-search-font-weight-override, 600);
399
+ --trees-search-bg: var(--trees-search-bg-override, var(--trees-theme-input-bg, var(--trees-input-bg)));
400
+ --trees-scrollbar-thumb: var(--trees-scrollbar-thumb-override, var(--trees-theme-scrollbar-thumb, color-mix(in lab, var(--trees-fg) 25%, var(--trees-bg))));
401
+ --trees-selected-fg: var(--trees-selected-fg-override, var(--trees-theme-list-active-selection-fg, var(--trees-fg)));
402
+ --trees-selected-bg: var(--trees-selected-bg-override, var(--trees-theme-list-active-selection-bg, light-dark(color-mix(in lab, var(--trees-accent) 12%, var(--trees-bg)), color-mix(in lab, var(--trees-accent) 15%, var(--trees-bg)))));
403
+ --trees-selected-focused-border-color: var(--trees-selected-focused-border-color-override, var(--trees-theme-focus-ring, var(--trees-accent)));
404
+ --trees-status-added: var(--trees-status-added-override, var(--trees-theme-git-added-fg, light-dark(var(--trees-added-light), var(--trees-added-dark))));
405
+ --trees-status-ignored: var(--trees-status-ignored-override, var(--trees-theme-git-ignored-fg, light-dark(var(--trees-ignored-light), var(--trees-ignored-dark))));
406
+ --trees-status-modified: var(--trees-status-modified-override, var(--trees-theme-git-modified-fg, light-dark(var(--trees-modified-light), var(--trees-modified-dark))));
407
+ --trees-status-renamed: var(--trees-status-renamed-override, var(--trees-theme-git-renamed-fg, light-dark(var(--trees-renamed-light), var(--trees-renamed-dark))));
408
+ --trees-status-untracked: var(--trees-status-untracked-override, var(--trees-theme-git-untracked-fg, light-dark(var(--trees-untracked-light), var(--trees-untracked-dark))));
409
+ --trees-status-deleted: var(--trees-status-deleted-override, var(--trees-theme-git-deleted-fg, light-dark(var(--trees-deleted-light), var(--trees-deleted-dark))));
410
+ --trees-git-modified-color: var(--trees-git-modified-color-override, var(--trees-status-modified));
411
+ --trees-git-added-color: var(--trees-git-added-color-override, var(--trees-status-added));
412
+ --trees-git-ignored-color: var(--trees-git-ignored-color-override, var(--trees-status-ignored));
413
+ --trees-git-deleted-color: var(--trees-git-deleted-color-override, var(--trees-status-deleted));
414
+ --trees-git-renamed-color: var(--trees-git-renamed-color-override, var(--trees-status-renamed));
415
+ --trees-git-untracked-color: var(--trees-git-untracked-color-override, var(--trees-status-untracked));
416
+ --trees-icon-gray: light-dark(#84848a, #adadb1);
417
+ --trees-icon-red: light-dark(#d52c36, #ff6762);
418
+ --trees-icon-vermilion: light-dark(#ff8c5b, #d5512f);
419
+ --trees-icon-orange: light-dark(#d47628, #ffa359);
420
+ --trees-icon-yellow: light-dark(#d5a910, #ffd452);
421
+ --trees-icon-green: light-dark(#199f43, #5ecc71);
422
+ --trees-icon-teal: light-dark(#17a5af, #64d1db);
423
+ --trees-icon-cyan: light-dark(#1ca1c7, #68cdf2);
424
+ --trees-icon-blue: light-dark(#1a85d4, #69b1ff);
425
+ --trees-icon-indigo: light-dark(#693acf, #9d6afb);
426
+ --trees-icon-purple: light-dark(#a631be, #d568ea);
427
+ --trees-icon-pink: light-dark(#d32a61, #ff678d);
428
+ --trees-icon-mauve: light-dark(#594c5b, #79697b);
429
+ --trees-file-icon-color-default: var(--trees-file-icon-color, var(--trees-icon-gray));
430
+ --trees-file-icon-color-astro: var(--trees-file-icon-color, var(--trees-icon-purple));
431
+ --trees-file-icon-color-babel: var(--trees-file-icon-color, var(--trees-icon-yellow));
432
+ --trees-file-icon-color-bash: var(--trees-file-icon-color, var(--trees-icon-green));
433
+ --trees-file-icon-color-biome: var(--trees-file-icon-color, var(--trees-icon-blue));
434
+ --trees-file-icon-color-bootstrap: var(--trees-file-icon-color, var(--trees-icon-indigo));
435
+ --trees-file-icon-color-browserslist: var(--trees-file-icon-color, var(--trees-icon-yellow));
436
+ --trees-file-icon-color-bun: var(--trees-file-icon-color, var(--trees-icon-mauve));
437
+ --trees-file-icon-color-c: var(--trees-file-icon-color, var(--trees-icon-blue));
438
+ --trees-file-icon-color-cpp: var(--trees-file-icon-color, var(--trees-icon-blue));
439
+ --trees-file-icon-color-claude: var(--trees-file-icon-color, var(--trees-icon-orange));
440
+ --trees-file-icon-color-css: var(--trees-file-icon-color, var(--trees-icon-indigo));
441
+ --trees-file-icon-color-database: var(--trees-file-icon-color, var(--trees-icon-purple));
442
+ --trees-file-icon-color-docker: var(--trees-file-icon-color, var(--trees-icon-blue));
443
+ --trees-file-icon-color-eslint: var(--trees-file-icon-color, var(--trees-icon-indigo));
444
+ --trees-file-icon-color-git: var(--trees-file-icon-vermilion, var(--trees-icon-vermilion));
445
+ --trees-file-icon-color-go: var(--trees-file-icon-color, var(--trees-icon-cyan));
446
+ --trees-file-icon-color-graphql: var(--trees-file-icon-color, var(--trees-icon-pink));
447
+ --trees-file-icon-color-html: var(--trees-file-icon-color, var(--trees-icon-orange));
448
+ --trees-file-icon-color-image: var(--trees-file-icon-color, var(--trees-icon-pink));
449
+ --trees-file-icon-color-javascript: var(--trees-file-icon-color, var(--trees-icon-yellow));
450
+ --trees-file-icon-color-json: var(--trees-file-icon-color, var(--trees-icon-orange));
451
+ --trees-file-icon-color-markdown: var(--trees-file-icon-color, var(--trees-icon-green));
452
+ --trees-file-icon-color-mcp: var(--trees-file-icon-color, var(--trees-icon-teal));
453
+ --trees-file-icon-color-npm: var(--trees-file-icon-color, var(--trees-icon-red));
454
+ --trees-file-icon-color-oxc: var(--trees-file-icon-cyan, var(--trees-icon-cyan));
455
+ --trees-file-icon-color-postcss: var(--trees-file-icon-color, var(--trees-icon-red));
456
+ --trees-file-icon-color-prettier: var(--trees-file-icon-color, var(--trees-icon-teal));
457
+ --trees-file-icon-color-python: var(--trees-file-icon-color, var(--trees-icon-blue));
458
+ --trees-file-icon-color-react: var(--trees-file-icon-color, var(--trees-icon-cyan));
459
+ --trees-file-icon-color-ruby: var(--trees-file-icon-color, var(--trees-icon-red));
460
+ --trees-file-icon-color-rust: var(--trees-file-icon-color, var(--trees-icon-orange));
461
+ --trees-file-icon-color-sass: var(--trees-file-icon-color, var(--trees-icon-pink));
462
+ --trees-file-icon-color-svg: var(--trees-file-icon-color, var(--trees-icon-orange));
463
+ --trees-file-icon-color-svelte: var(--trees-file-icon-color, var(--trees-icon-red));
464
+ --trees-file-icon-color-svgo: var(--trees-file-icon-color, var(--trees-icon-green));
465
+ --trees-file-icon-color-swift: var(--trees-file-icon-color, var(--trees-icon-orange));
466
+ --trees-file-icon-color-table: var(--trees-file-icon-color, var(--trees-icon-teal));
467
+ --trees-file-icon-color-text: var(--trees-file-icon-color, var(--trees-icon-gray));
468
+ --trees-file-icon-color-tailwind: var(--trees-file-icon-color, var(--trees-icon-cyan));
469
+ --trees-file-icon-color-terraform: var(--trees-file-icon-color, var(--trees-icon-indigo));
470
+ --trees-file-icon-color-typescript: var(--trees-file-icon-color, var(--trees-icon-blue));
471
+ --trees-file-icon-color-vite: var(--trees-file-icon-color, var(--trees-icon-purple));
472
+ --trees-file-icon-color-vscode: var(--trees-file-icon-color, var(--trees-icon-blue));
473
+ --trees-file-icon-color-vue: var(--trees-file-icon-color, var(--trees-icon-green));
474
+ --trees-file-icon-color-wasm: var(--trees-file-icon-color, var(--trees-icon-indigo));
475
+ --trees-file-icon-color-webpack: var(--trees-file-icon-color, var(--trees-icon-blue));
476
+ --trees-file-icon-color-yml: var(--trees-file-icon-color, var(--trees-icon-red));
477
+ --trees-file-icon-color-zig: var(--trees-file-icon-color, var(--trees-icon-orange));
478
+ --trees-file-icon-color-zip: var(--trees-file-icon-color, var(--trees-icon-orange));
479
+ --trees-level-gap: var(--trees-level-gap-override, calc(8px * var(--trees-density)));
480
+ --trees-item-padding-x: var(--trees-item-padding-x-override, calc(8px * var(--trees-density)));
481
+ --trees-item-margin-x: var(--trees-item-margin-x-override, calc(2px * var(--trees-density)));
482
+ --trees-item-row-gap: var(--trees-item-row-gap-override, calc(6px * var(--trees-density)));
483
+ --trees-icon-width: var(--trees-icon-width-override, 16px);
484
+ --trees-icon-nudge: var(--trees-icon-nudge-override, calc(1px * var(--trees-density)));
485
+ --trees-row-height: var(--trees-item-height, 30px);
486
+ --trees-git-lane-width: var(--trees-git-lane-width-override, 12px);
487
+ --trees-action-lane-width: var(--trees-action-lane-width-override, calc(var(--trees-icon-width) + 2px));
488
+ --trees-context-menu-trigger-inline-offset: calc(var(--trees-padding-inline) + var(--trees-item-padding-x) -
489
+ var(--trees-focus-ring-width));
490
+ --trees-scrollbar-gutter: var(--trees-scrollbar-gutter-override, 6px);
491
+ --trees-padding-inline: var(--trees-padding-inline-override, 16px);
492
+ color-scheme: light dark;
493
+ font-size: var(--trees-font-size);
494
+ color: var(--trees-fg);
495
+ background-color: var(--trees-bg);
496
+ --truncate-marker-background-color: var(--trees-bg);
497
+ --truncate-marker-background-overlay-color: transparent;
498
+ font-family: var(--trees-font-family);
499
+ font-weight: var(--trees-font-weight-regular);
500
+ flex-direction: column;
501
+ display: flex;
502
+ }
503
+
504
+ :host([data-file-tree-virtualized="true"]) {
505
+ height: 100%;
506
+ overflow: hidden;
507
+ }
508
+
509
+ [data-file-tree-virtualized-wrapper="true"], [data-file-tree-virtualized-root="true"] {
510
+ flex-direction: column;
511
+ height: 100%;
512
+ display: flex;
513
+ overflow: hidden;
514
+ }
515
+
516
+ [data-file-tree-virtualized-scroll="true"], [data-file-tree-scrollbar-measure="true"] {
517
+ --trees-scrollbar-thumb-current: transparent;
518
+ scrollbar-gutter: stable;
519
+ overflow-y: auto;
520
+
521
+ &:hover {
522
+ --trees-scrollbar-thumb-current: var(--trees-scrollbar-thumb);
523
+ }
524
+
525
+ &::-webkit-scrollbar {
526
+ width: var(--trees-scrollbar-gutter);
527
+ height: var(--trees-scrollbar-gutter);
528
+ }
529
+
530
+ &::-webkit-scrollbar-track {
531
+ background: none;
532
+ }
533
+
534
+ &::-webkit-scrollbar-thumb {
535
+ background-color: var(--trees-scrollbar-thumb-current);
536
+ border-radius: calc(var(--trees-scrollbar-gutter) / 2);
537
+ background-clip: content-box;
538
+ border: 1px solid #0000;
539
+ }
540
+
541
+ &::-webkit-scrollbar-corner {
542
+ background-color: #0000;
543
+ }
544
+ }
545
+
546
+ [data-file-tree-scrollbar-measure="true"] {
547
+ visibility: hidden;
548
+ pointer-events: none;
549
+ width: 100px;
550
+ height: 100px;
551
+ position: absolute;
552
+ top: 0;
553
+ left: 0;
554
+ }
555
+
556
+ @supports ((-moz-appearance: none)) {
557
+ [data-file-tree-virtualized-scroll="true"], [data-file-tree-scrollbar-measure="true"] {
558
+ scrollbar-width: thin;
559
+ scrollbar-color: var(--trees-scrollbar-thumb-current) transparent;
560
+ }
561
+ }
562
+
563
+ [data-file-tree-virtualized-scroll="true"] {
564
+ min-height: 0;
565
+ padding-inline: max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
566
+ 0px)
567
+ /* NOTE(amadeus): We can assume that all Webkit based browser gutters
568
+ * will align to the value of '--trees-scrollbar-gutter', however if not, then
569
+ * \`--trees-scrollbar-gutter-measured\` should correct it. Mostly we are
570
+ * hoping to avoid SSR alignment jumps if possible. In non-SSR'd environments
571
+ * \`--trees-scrollbar-gutter-measured\` should always be immediately available.
572
+ */
573
+ max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x) -
574
+ var(--trees-scrollbar-gutter-measured, var(--trees-scrollbar-gutter))),
575
+ 0px);
576
+ flex: 1 1 0;
577
+ position: relative;
578
+ overflow-y: auto;
579
+ }
580
+
581
+ @supports ((-moz-appearance: none)) {
582
+ [data-file-tree-virtualized-scroll="true"] {
583
+ padding-inline: max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
584
+ 0px)
585
+ /* NOTE(amadeus): However on Firefox it can vary a little bit, but most
586
+ * likely the majority of cases will default to a 0px width scrollbar lets
587
+ * inherit that first to avoid SSR jumps. In non-SSR'd environments
588
+ * \`--trees-scrollbar-gutter-measured\` should always be immediately available.
589
+ */
590
+ max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x) -
591
+ var(--trees-scrollbar-gutter-measured, 0px)),
592
+ 0px);
593
+ }
594
+ }
595
+
596
+ [data-file-tree-sticky-overlay="true"] {
597
+ z-index: 4;
598
+ pointer-events: none;
599
+ height: 0;
600
+ position: sticky;
601
+ top: 0;
602
+ overflow: visible;
603
+ }
604
+
605
+ [data-file-tree-virtualized-root="true"][data-scroll-at-top="true"]:not([data-overlay-reveal]) [data-file-tree-sticky-overlay="true"] {
606
+ visibility: hidden;
607
+ }
608
+
609
+ [data-file-tree-sticky-overlay-content="true"] {
610
+ background-color: var(--trees-bg);
611
+ pointer-events: none;
612
+ position: relative;
613
+ }
614
+
615
+ [data-file-tree-virtualized-list="true"] {
616
+ background-color: var(--trees-bg);
617
+ overflow-anchor: none;
618
+ width: 100%;
619
+ min-height: 100%;
620
+ position: relative;
621
+
622
+ &[data-is-scrolling] {
623
+ pointer-events: none;
624
+ }
625
+ }
626
+
627
+ [data-file-tree-virtualized-sticky-offset="true"] {
628
+ contain: layout size;
629
+ }
630
+
631
+ [data-file-tree-virtualized-sticky="true"] {
632
+ isolation: isolate;
633
+ will-change: transform;
634
+ flex-direction: column;
635
+ width: 100%;
636
+ display: flex;
637
+ position: sticky;
638
+ top: 0;
639
+ }
640
+
641
+ [data-file-tree-search-container] {
642
+ padding: 0;
643
+ padding-inline: var(--trees-padding-inline);
644
+ margin-bottom: var(--trees-item-row-gap);
645
+ display: flex;
646
+ }
647
+
648
+ [data-file-tree-search-input] {
649
+ --trees-focus-ring-width: 2px;
650
+ font-family: var(--trees-font-family);
651
+ font-size: var(--trees-font-size);
652
+ height: var(--trees-row-height);
653
+ padding-inline: var(--trees-item-padding-x);
654
+ line-height: var(--trees-row-height);
655
+ color: var(--trees-search-fg);
656
+ background-color: var(--trees-search-bg);
657
+ border: 1px solid var(--trees-border-color);
658
+ border-radius: var(--trees-border-radius);
659
+ outline: none;
660
+ flex: 1;
661
+ margin-block: 1px;
662
+
663
+ &::placeholder {
664
+ color: color-mix(in lab,
665
+ var(--trees-search-fg) 65%,
666
+ var(--trees-search-bg));
667
+ }
668
+
669
+ &:focus-visible, &[data-file-tree-search-input-fake-focus="true"] {
670
+ outline: var(--trees-focus-ring-width) solid var(--trees-focus-ring-color);
671
+ outline-offset: var(--trees-focus-ring-offset);
672
+ }
673
+ }
674
+
675
+ [role="tree"] {
676
+ gap: var(--trees-gap-override, 0);
677
+ flex-direction: column;
678
+ display: flex;
679
+ position: relative;
680
+ }
681
+
682
+ [data-type="item"] {
683
+ color: inherit;
684
+ font-family: var(--trees-font-family);
685
+ font-size: var(--trees-font-size);
686
+ text-align: start;
687
+ background-color: var(--trees-bg);
688
+ padding: 0 var(--trees-item-padding-x);
689
+ margin: 0 var(--trees-item-margin-x);
690
+ cursor: pointer;
691
+ user-select: none;
692
+ -webkit-touch-callout: none;
693
+ touch-action: manipulation;
694
+ flex: 0 0 var(--trees-row-height);
695
+ height: var(--trees-row-height);
696
+ line-height: var(--trees-row-height);
697
+ align-items: center;
698
+ gap: var(--trees-item-row-gap);
699
+ border-radius: var(--trees-border-radius);
700
+ --truncate-marker-background-color: var(--trees-bg);
701
+ --truncate-marker-background-overlay-color: transparent;
702
+ --truncate-marker-block-inset: 0px;
703
+ border: none;
704
+ outline: none;
705
+ display: flex;
706
+ position: relative;
707
+
708
+ &:hover, &[data-item-context-hover="true"] {
709
+ background-color: var(--trees-bg-muted);
710
+ --truncate-marker-background-overlay-color: var(--trees-bg-muted);
711
+ }
712
+
713
+ &[data-item-focused="true"], &:focus-visible {
714
+ z-index: 2;
715
+
716
+ & [data-item-flattened-subitems] {
717
+ --truncate-marker-block-inset: var(--trees-focus-ring-width);
718
+ }
719
+
720
+ &:before {
721
+ content: "";
722
+ border-radius: var(--trees-border-radius);
723
+ outline: var(--trees-focus-ring-width) solid
724
+ var(--trees-focus-ring-color);
725
+ outline-offset: var(--trees-focus-ring-offset);
726
+ pointer-events: none;
727
+ display: block;
728
+ position: absolute;
729
+ inset: 0;
730
+ }
731
+
732
+ &[data-item-selected="true"]:before {
733
+ outline-color: var(--trees-selected-focused-border-color);
734
+ }
735
+ }
736
+
737
+ &[data-item-selected="true"] {
738
+ color: var(--trees-selected-fg);
739
+ background-color: var(--trees-selected-bg);
740
+ --truncate-marker-background-overlay-color: var(--trees-selected-bg);
741
+ z-index: 3;
742
+
743
+ & [data-item-section="icon"] {
744
+ color: var(--trees-selected-fg);
745
+ }
746
+ }
747
+
748
+ &[data-item-search-match="true"] {
749
+ font-weight: var(--trees-search-font-weight);
750
+ }
751
+ }
752
+
753
+ [data-type="item"][data-file-tree-sticky-row="true"] {
754
+ pointer-events: auto;
755
+ }
756
+
757
+ [data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"] {
758
+ pointer-events: none;
759
+ }
760
+
761
+ [data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"]:hover:not([data-item-selected="true"]), [data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"][data-item-context-hover="true"]:not([data-item-selected="true"]) {
762
+ background-color: var(--trees-bg);
763
+ --truncate-marker-background-overlay-color: transparent;
764
+ }
765
+
766
+ [data-item-selected="true"]:has( + [data-item-selected="true"]) {
767
+ border-bottom-right-radius: 0;
768
+ border-bottom-left-radius: 0;
769
+ }
770
+
771
+ [data-item-selected="true"] + [data-item-selected="true"] {
772
+ border-top-left-radius: 0;
773
+ border-top-right-radius: 0;
774
+ }
775
+
776
+ [data-item-flattened-subitems] {
777
+ align-items: center;
778
+ gap: 2px;
779
+ display: inline-flex;
780
+ }
781
+
782
+ [data-item-flattened-subitem]:hover, [data-item-flattened-subitem-drag-target="true"] {
783
+ text-decoration: underline;
784
+ }
785
+
786
+ [data-item-section="icon"] {
787
+ color: var(--trees-fg-muted);
788
+ fill: currentColor;
789
+ width: var(--trees-icon-width);
790
+ flex-shrink: 0;
791
+ justify-content: center;
792
+ align-items: center;
793
+ display: flex;
794
+ }
795
+
796
+ :where([data-item-section="icon"] > [data-icon-token]) {
797
+ color: var(--trees-fg-muted);
798
+ }
799
+
800
+ [data-file-tree-colored-icons="true"] {
801
+ & [data-icon-token="astro"] {
802
+ color: var(--trees-file-icon-color-astro);
803
+ }
804
+
805
+ & [data-icon-token="babel"] {
806
+ color: var(--trees-file-icon-color-babel);
807
+ }
808
+
809
+ & [data-icon-token="bash"] {
810
+ color: var(--trees-file-icon-color-bash);
811
+ }
812
+
813
+ & [data-icon-token="biome"] {
814
+ color: var(--trees-file-icon-color-biome);
815
+ }
816
+
817
+ & [data-icon-token="bootstrap"] {
818
+ color: var(--trees-file-icon-color-bootstrap);
819
+ }
820
+
821
+ & [data-icon-token="browserslist"] {
822
+ color: var(--trees-file-icon-color-browserslist);
823
+ }
824
+
825
+ & [data-icon-token="bun"] {
826
+ color: var(--trees-file-icon-color-bun);
827
+ }
828
+
829
+ & [data-icon-token="c"] {
830
+ color: var(--trees-file-icon-color-c);
831
+ }
832
+
833
+ & [data-icon-token="cpp"] {
834
+ color: var(--trees-file-icon-color-cpp);
835
+ }
836
+
837
+ & [data-icon-token="claude"] {
838
+ color: var(--trees-file-icon-color-claude);
839
+ }
840
+
841
+ & [data-icon-token="css"] {
842
+ color: var(--trees-file-icon-color-css);
843
+ }
844
+
845
+ & [data-icon-token="database"] {
846
+ color: var(--trees-file-icon-color-database);
847
+ }
848
+
849
+ & [data-icon-token="default"] {
850
+ color: var(--trees-file-icon-color-default);
851
+ }
852
+
853
+ & [data-icon-token="docker"] {
854
+ color: var(--trees-file-icon-color-docker);
855
+ }
856
+
857
+ & [data-icon-token="eslint"] {
858
+ color: var(--trees-file-icon-color-eslint);
859
+ }
860
+
861
+ & [data-icon-token="git"] {
862
+ color: var(--trees-file-icon-color-git);
863
+ }
864
+
865
+ & [data-icon-token="go"] {
866
+ color: var(--trees-file-icon-color-go);
867
+ }
868
+
869
+ & [data-icon-token="graphql"] {
870
+ color: var(--trees-file-icon-color-graphql);
871
+ }
872
+
873
+ & [data-icon-token="html"] {
874
+ color: var(--trees-file-icon-color-html);
875
+ }
876
+
877
+ & [data-icon-token="image"] {
878
+ color: var(--trees-file-icon-color-image);
879
+ }
880
+
881
+ & [data-icon-token="javascript"] {
882
+ color: var(--trees-file-icon-color-javascript);
883
+ }
884
+
885
+ & [data-icon-token="json"] {
886
+ color: var(--trees-file-icon-color-json);
887
+ }
888
+
889
+ & [data-icon-token="markdown"] {
890
+ color: var(--trees-file-icon-color-markdown);
891
+ }
892
+
893
+ & [data-icon-token="mcp"] {
894
+ color: var(--trees-file-icon-color-mcp);
895
+ }
896
+
897
+ & [data-icon-token="npm"] {
898
+ color: var(--trees-file-icon-color-npm);
899
+ }
900
+
901
+ & [data-icon-token="oxc"] {
902
+ color: var(--trees-file-icon-color-oxc);
903
+ }
904
+
905
+ & [data-icon-token="postcss"] {
906
+ color: var(--trees-file-icon-color-postcss);
907
+ }
908
+
909
+ & [data-icon-token="prettier"] {
910
+ color: var(--trees-file-icon-color-prettier);
911
+ }
912
+
913
+ & [data-icon-token="python"] {
914
+ color: var(--trees-file-icon-color-python);
915
+ }
916
+
917
+ & [data-icon-token="react"] {
918
+ color: var(--trees-file-icon-color-react);
919
+ }
920
+
921
+ & [data-icon-token="ruby"] {
922
+ color: var(--trees-file-icon-color-ruby);
923
+ }
924
+
925
+ & [data-icon-token="rust"] {
926
+ color: var(--trees-file-icon-color-rust);
927
+ }
928
+
929
+ & [data-icon-token="sass"] {
930
+ color: var(--trees-file-icon-color-sass);
931
+ }
932
+
933
+ & [data-icon-token="svg"] {
934
+ color: var(--trees-file-icon-color-svg);
935
+ }
936
+
937
+ & [data-icon-token="svelte"] {
938
+ color: var(--trees-file-icon-color-svelte);
939
+ }
940
+
941
+ & [data-icon-token="svgo"] {
942
+ color: var(--trees-file-icon-color-svgo);
943
+ }
944
+
945
+ & [data-icon-token="swift"] {
946
+ color: var(--trees-file-icon-color-swift);
947
+ }
948
+
949
+ & [data-icon-token="table"] {
950
+ color: var(--trees-file-icon-color-table);
951
+ }
952
+
953
+ & [data-icon-token="text"] {
954
+ color: var(--trees-file-icon-color-text);
955
+ }
956
+
957
+ & [data-icon-token="tailwind"] {
958
+ color: var(--trees-file-icon-color-tailwind);
959
+ }
960
+
961
+ & [data-icon-token="terraform"] {
962
+ color: var(--trees-file-icon-color-terraform);
963
+ }
964
+
965
+ & [data-icon-token="typescript"] {
966
+ color: var(--trees-file-icon-color-typescript);
967
+ }
968
+
969
+ & [data-icon-token="vite"] {
970
+ color: var(--trees-file-icon-color-vite);
971
+ }
972
+
973
+ & [data-icon-token="vscode"] {
974
+ color: var(--trees-file-icon-color-vscode);
975
+ }
976
+
977
+ & [data-icon-token="vue"] {
978
+ color: var(--trees-file-icon-color-vue);
979
+ }
980
+
981
+ & [data-icon-token="wasm"] {
982
+ color: var(--trees-file-icon-color-wasm);
983
+ }
984
+
985
+ & [data-icon-token="webpack"] {
986
+ color: var(--trees-file-icon-color-webpack);
987
+ }
988
+
989
+ & [data-icon-token="yml"] {
990
+ color: var(--trees-file-icon-color-yml);
991
+ }
992
+
993
+ & [data-icon-token="zig"] {
994
+ color: var(--trees-file-icon-color-zig);
995
+ }
996
+
997
+ & [data-icon-token="zip"] {
998
+ color: var(--trees-file-icon-color-zip);
999
+ }
1000
+ }
1001
+
1002
+ [data-icon-name="file-tree-icon-chevron"] {
1003
+ &[data-align-capitals="false"] {
1004
+ transform: translate(0, var(--trees-icon-nudge));
1005
+ }
1006
+
1007
+ &[data-align-capitals="true"] {
1008
+ transform: translate(0);
1009
+ }
1010
+ }
1011
+
1012
+ [data-item-section="content"] {
1013
+ text-align: start;
1014
+ text-overflow: ellipsis;
1015
+ flex: 0 auto;
1016
+ min-width: 0;
1017
+ max-width: 100%;
1018
+ overflow: hidden;
1019
+ }
1020
+
1021
+ [data-item-section="decoration"] {
1022
+ text-align: end;
1023
+ min-width: 0;
1024
+ color: var(--trees-fg-muted);
1025
+ flex: 1 1 0;
1026
+ justify-content: flex-end;
1027
+ display: flex;
1028
+ overflow: hidden;
1029
+ }
1030
+
1031
+ [data-item-section="decoration"] > span {
1032
+ text-overflow: ellipsis;
1033
+ white-space: nowrap;
1034
+ justify-content: flex-end;
1035
+ align-items: center;
1036
+ min-width: 0;
1037
+ max-width: 100%;
1038
+ display: inline-flex;
1039
+ overflow: hidden;
1040
+ }
1041
+
1042
+ [data-item-section="git"], [data-item-section="action"] {
1043
+ flex: none;
1044
+ justify-content: center;
1045
+ align-items: center;
1046
+ display: flex;
1047
+ }
1048
+
1049
+ [data-item-section="git"] {
1050
+ width: var(--trees-git-lane-width);
1051
+ }
1052
+
1053
+ [data-item-section="action"] {
1054
+ width: var(--trees-action-lane-width);
1055
+ color: var(--trees-fg-muted);
1056
+ fill: currentColor;
1057
+ pointer-events: none;
1058
+ }
1059
+
1060
+ [data-item-section="git"] > span, [data-item-section="action"] > span {
1061
+ justify-content: center;
1062
+ align-items: center;
1063
+ width: 100%;
1064
+ display: inline-flex;
1065
+ }
1066
+
1067
+ [data-item-action-affordance="decorative"] {
1068
+ opacity: .85;
1069
+ }
1070
+
1071
+ [data-item-rename-input] {
1072
+ appearance: none;
1073
+ width: 100%;
1074
+ min-width: 0;
1075
+ height: calc(var(--trees-row-height) - 4px);
1076
+ font-family: inherit;
1077
+ font-size: inherit;
1078
+ color: inherit;
1079
+ box-sizing: border-box;
1080
+ background-color: #0000;
1081
+ border: 0;
1082
+ outline: none;
1083
+ padding-inline: 6px;
1084
+ }
1085
+
1086
+ [data-item-section="content"]:has([data-item-rename-input]) ~ [data-item-section="action"], [data-item-section="content"]:has([data-item-rename-input]) ~ [data-item-section="decoration"] {
1087
+ display: none;
1088
+ }
1089
+
1090
+ [aria-expanded="false"][data-item-type="folder"] > [data-item-section="icon"] > [data-icon-name="file-tree-icon-chevron"] {
1091
+ &[data-align-capitals="true"] {
1092
+ transform: rotate(-90deg)
1093
+ translate(calc(var(--trees-icon-nudge) / 2),
1094
+ calc(var(--trees-icon-nudge) / 2));
1095
+ }
1096
+
1097
+ &[data-align-capitals="false"] {
1098
+ transform: rotate(-90deg)
1099
+ translate(calc(var(--trees-icon-nudge) / 2 * -1),
1100
+ calc(var(--trees-icon-nudge) / 2));
1101
+ }
1102
+ }
1103
+
1104
+ [data-item-section="spacing"] {
1105
+ height: var(--trees-row-height);
1106
+ padding-left: calc(calc(var(--trees-icon-width) / 2) - .5px);
1107
+ flex-direction: row;
1108
+ justify-content: center;
1109
+ align-items: center;
1110
+ display: flex;
1111
+
1112
+ &:empty {
1113
+ padding-left: 0;
1114
+ }
1115
+ }
1116
+
1117
+ [data-item-section="spacing-item"] {
1118
+ border-left: 1px solid var(--trees-indent-guide-bg);
1119
+ height: 100%;
1120
+ margin-right: calc(var(--trees-level-gap) - 1px);
1121
+ opacity: 0;
1122
+ transition: opacity .15s;
1123
+ display: inline-block;
1124
+ transform: translateX(-.25px);
1125
+
1126
+ & + & {
1127
+ margin-left: calc(var(--trees-item-row-gap) + calc(var(--trees-icon-width) / 2) - .5px);
1128
+ }
1129
+ }
1130
+
1131
+ :host(:hover) [data-item-section="spacing-item"] {
1132
+ opacity: .75;
1133
+ }
1134
+
1135
+ [data-item-contains-git-change="true"] > [data-item-section="git"] {
1136
+ color: var(--trees-git-modified-color);
1137
+ opacity: .5;
1138
+ fill: currentColor;
1139
+ }
1140
+
1141
+ [data-item-git-status] {
1142
+ & > :where([data-item-section="icon"]) > :where(:not([data-icon-name="file-tree-icon-chevron"])), & > [data-item-section="content"] {
1143
+ color: var(--trees-item-git-status-color);
1144
+ }
1145
+
1146
+ & > [data-item-section="git"] {
1147
+ color: var(--trees-item-git-status-color);
1148
+ font-weight: var(--trees-font-weight-semibold);
1149
+ }
1150
+ }
1151
+
1152
+ [data-item-git-status="added"] {
1153
+ --trees-item-git-status-color: var(--trees-git-added-color);
1154
+ }
1155
+
1156
+ [data-item-git-status="deleted"] {
1157
+ --trees-item-git-status-color: var(--trees-git-deleted-color);
1158
+ }
1159
+
1160
+ [data-item-git-status="ignored"] {
1161
+ --trees-item-git-status-color: var(--trees-git-ignored-color);
1162
+
1163
+ & > [data-item-section="icon"] {
1164
+ opacity: .5;
1165
+ }
1166
+ }
1167
+
1168
+ [data-item-section="git"] [data-icon-name="file-tree-icon-dot"] {
1169
+ transform: translateY(calc(.65ex - 50%));
1170
+ }
1171
+
1172
+ [data-item-git-status="modified"] {
1173
+ --trees-item-git-status-color: var(--trees-git-modified-color);
1174
+ }
1175
+
1176
+ [data-item-git-status="renamed"] {
1177
+ --trees-item-git-status-color: var(--trees-git-renamed-color);
1178
+ }
1179
+
1180
+ [data-item-git-status="untracked"] {
1181
+ --trees-item-git-status-color: var(--trees-git-untracked-color);
1182
+ }
1183
+
1184
+ [data-item-drag-target="true"] {
1185
+ background-color: var(--trees-selected-bg);
1186
+ }
1187
+
1188
+ [data-item-dragging="true"] {
1189
+ opacity: .5;
1190
+ }
1191
+
1192
+ [data-item-section="lock"] {
1193
+ color: var(--trees-fg-muted);
1194
+ flex: none;
1195
+ align-items: center;
1196
+ margin-left: auto;
1197
+ display: flex;
1198
+ }
1199
+
1200
+ [data-item-section="lock"] svg {
1201
+ display: block;
1202
+ }
1203
+
1204
+ [data-type="header-slot"] {
1205
+ flex: none;
1206
+ display: block;
1207
+ }
1208
+
1209
+ [data-type="context-menu-wash"] {
1210
+ z-index: 3;
1211
+ touch-action: none;
1212
+ background-color: #0000;
1213
+ position: absolute;
1214
+ inset: 0;
1215
+ }
1216
+
1217
+ [data-type="context-menu-anchor"] {
1218
+ top: 0;
1219
+ right: var(--trees-context-menu-trigger-inline-offset);
1220
+ z-index: 4;
1221
+ align-items: center;
1222
+ display: none;
1223
+ position: absolute;
1224
+
1225
+ &[data-visible="true"] {
1226
+ display: flex;
1227
+ }
1228
+ }
1229
+
1230
+ [data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="context-menu-anchor"] {
1231
+ display: none;
1232
+ }
1233
+
1234
+ [data-type="context-menu-anchor"] > slot[name="context-menu"] {
1235
+ flex: 0 0 0;
1236
+ width: 0;
1237
+ min-width: 0;
1238
+ display: block;
1239
+ overflow: visible;
1240
+ }
1241
+
1242
+ [data-type="context-menu-trigger"] {
1243
+ all: unset;
1244
+ width: var(--trees-action-lane-width);
1245
+ color: var(--trees-fg-muted);
1246
+ fill: currentColor;
1247
+ cursor: pointer;
1248
+ font-family: var(--trees-font-family);
1249
+ font-size: var(--trees-font-size);
1250
+ border-top-right-radius: var(--trees-border-radius);
1251
+ border-bottom-right-radius: var(--trees-border-radius);
1252
+ margin: var(--trees-focus-ring-width);
1253
+ height: calc(var(--trees-row-height) - var(--trees-focus-ring-width) * 2);
1254
+ border-width: 0;
1255
+ justify-content: center;
1256
+ align-items: center;
1257
+ transition: color .12s;
1258
+ display: flex;
1259
+ }
1260
+
1261
+ [data-type="context-menu-trigger"]:hover, [data-type="context-menu-trigger"][aria-expanded="true"] {
1262
+ color: var(--trees-fg);
1263
+ }
1264
+
1265
+ [data-truncate-container] {
1266
+ --truncate-internal-marker-fade-width: var(--truncate-marker-fade-width, 2px);
1267
+ --truncate-internal-marker-gap: var(--truncate-marker-gap, 0px);
1268
+ --truncate-internal-marker-opacity: var(--truncate-marker-opacity, 50%);
1269
+ --truncate-internal-middle-marker-opacity: var(--truncate-middle-marker-opacity, 80%);
1270
+ --truncate-internal-marker-background-color: var(--truncate-marker-background-color, light-dark(#fff, #000));
1271
+ --truncate-internal-marker-background-overlay-color: var(--truncate-marker-background-overlay-color, transparent);
1272
+ --truncate-internal-marker-block-inset: var(--truncate-marker-block-inset, 0px);
1273
+ --truncate-internal-marker-fade-out-duration: var(--truncate-marker-fade-out-duration, 0s);
1274
+ --truncate-internal-marker-fade-in-duration: var(--truncate-marker-fade-in-duration, .1s);
1275
+ --truncate-internal-fade-marker-color: var(--truncate-fade-marker-color, #000);
1276
+ --truncate-internal-fade-marker-width: var(--truncate-fade-marker-width, .2lh);
1277
+ --truncate-internal-single-line-height: 1lh;
1278
+ height: var(--truncate-internal-single-line-height);
1279
+ min-width: 0;
1280
+ margin-top: -1px;
1281
+ margin-bottom: -1px;
1282
+ overflow: hidden;
1283
+ }
1284
+
1285
+ [data-truncate-marker] {
1286
+ height: var(--truncate-internal-single-line-height);
1287
+ padding-block: var(--truncate-internal-marker-block-inset);
1288
+ box-sizing: border-box;
1289
+ z-index: 2;
1290
+ color: color-mix(in srgb,
1291
+ currentColor var(--truncate-internal-marker-opacity),
1292
+ transparent);
1293
+ opacity: 0;
1294
+ transition: opacity var(--truncate-internal-marker-fade-out-duration)
1295
+ ease-in-out;
1296
+ background-clip: content-box;
1297
+ align-items: center;
1298
+ display: flex;
1299
+ position: absolute;
1300
+ }
1301
+
1302
+ @container measure (height > 1lh) {
1303
+ [data-truncate-marker] {
1304
+ opacity: 1;
1305
+ transition: opacity var(--truncate-internal-marker-fade-in-duration)
1306
+ ease-in-out;
1307
+ }
1308
+ }
1309
+
1310
+ [data-truncate-grid] {
1311
+ display: grid;
1312
+ position: relative;
1313
+ }
1314
+
1315
+ [data-truncate-content="visible"] {
1316
+ white-space: nowrap;
1317
+ }
1318
+
1319
+ [data-truncate-content="overflow"] {
1320
+ opacity: 0;
1321
+ pointer-events: none;
1322
+ user-select: none;
1323
+ word-break: break-all;
1324
+ margin-top: calc(-1 * var(--truncate-internal-single-line-height));
1325
+ }
1326
+
1327
+ [data-truncate-marker-cell] {
1328
+ user-select: none;
1329
+ pointer-events: none;
1330
+ overflow: visible;
1331
+ container: measure / size;
1332
+ }
1333
+
1334
+ [data-truncate-container="truncate"] {
1335
+ & [data-truncate-grid] {
1336
+ grid-template-columns: minmax(0, max-content) 0;
1337
+ }
1338
+
1339
+ & [data-truncate-marker] {
1340
+ right: 0;
1341
+ }
1342
+
1343
+ & [data-truncate-fade] {
1344
+ margin-right: calc(-2 * var(--truncate-internal-fade-marker-width));
1345
+ }
1346
+ }
1347
+
1348
+ [data-truncate-container="fruncate"] {
1349
+ & [data-truncate-grid] {
1350
+ grid-template-columns: 0 minmax(0, max-content) auto;
1351
+ }
1352
+
1353
+ & [data-truncate-content] {
1354
+ direction: rtl;
1355
+ }
1356
+
1357
+ & [data-truncate-content] > span {
1358
+ unicode-bidi: plaintext;
1359
+ }
1360
+
1361
+ & [data-truncate-fade] {
1362
+ margin-left: calc(-2 * var(--truncate-internal-fade-marker-width));
1363
+ }
1364
+ }
1365
+
1366
+ [data-truncate-variant="default"] {
1367
+ & [data-truncate-marker] {
1368
+ background-color: var(--truncate-internal-marker-background-color);
1369
+ background-image: linear-gradient(var(--truncate-internal-marker-background-overlay-color),
1370
+ var(--truncate-internal-marker-background-overlay-color));
1371
+ }
1372
+
1373
+ & [data-truncate-marker]:after, & [data-truncate-marker]:before {
1374
+ content: "";
1375
+ width: calc(var(--truncate-internal-marker-fade-width) +
1376
+ var(--truncate-internal-marker-gap));
1377
+ height: max(0px,
1378
+ calc(var(--truncate-internal-single-line-height) -
1379
+ var(--truncate-internal-marker-block-inset) * 2));
1380
+ background-color: var(--truncate-internal-marker-background-color);
1381
+ background-image: linear-gradient(var(--truncate-internal-marker-background-overlay-color),
1382
+ var(--truncate-internal-marker-background-overlay-color));
1383
+ -webkit-mask-image: linear-gradient(var(--truncate-internal-fade-dir),
1384
+ #000 0%,
1385
+ #000 var(--truncate-internal-marker-gap),
1386
+ transparent 100%);
1387
+ mask-image: linear-gradient(var(--truncate-internal-fade-dir),
1388
+ #000 0%,
1389
+ #000 var(--truncate-internal-marker-gap),
1390
+ transparent 100%);
1391
+ position: absolute;
1392
+ inset-block-start: var(--truncate-internal-marker-block-inset);
1393
+ }
1394
+
1395
+ & [data-truncate-marker]:after {
1396
+ --truncate-internal-fade-dir: to right;
1397
+ right: calc(-1 *
1398
+ (
1399
+ var(--truncate-internal-marker-fade-width) +
1400
+ var(--truncate-internal-marker-gap)
1401
+ ));
1402
+ }
1403
+
1404
+ & [data-truncate-marker]:before {
1405
+ --truncate-internal-fade-dir: to left;
1406
+ left: calc(-1 *
1407
+ (
1408
+ var(--truncate-internal-marker-fade-width) +
1409
+ var(--truncate-internal-marker-gap)
1410
+ ));
1411
+ }
1412
+ }
1413
+
1414
+ [data-truncate-variant="fade"] {
1415
+ & [data-truncate-marker] {
1416
+ background: none;
1417
+ }
1418
+ }
1419
+
1420
+ [data-truncate-fade] {
1421
+ box-shadow: 0 0 calc(var(--truncate-internal-fade-marker-width) / 2)
1422
+ var(--truncate-internal-fade-marker-color),
1423
+ 0 0 var(--truncate-internal-fade-marker-width)
1424
+ var(--truncate-internal-fade-marker-color);
1425
+ width: calc(var(--truncate-internal-fade-marker-width) * 2);
1426
+ height: calc(var(--truncate-internal-single-line-height) -
1427
+ (var(--truncate-internal-fade-marker-width) * 2));
1428
+ margin: var(--truncate-internal-fade-marker-width) 0;
1429
+ }
1430
+
1431
+ [data-truncate-group-container="middle"] {
1432
+ & [data-truncate-container] {
1433
+ --truncate-marker-opacity: var(--truncate-internal-middle-marker-opacity);
1434
+ }
1435
+
1436
+ min-width: 0;
1437
+ display: flex;
1438
+
1439
+ & > div {
1440
+ min-width: 0;
1441
+ }
1442
+
1443
+ & > div[data-truncate-segment-priority="1"] {
1444
+ flex: 0 1 max-content;
1445
+ }
1446
+
1447
+ & > div[data-truncate-segment-priority="2"] {
1448
+ flex: 0 999999 max-content;
1449
+ }
1450
+ }
1451
+ }
1452
+
1453
+ @layer theme, unsafe;
1454
+ `,Hf=`@layer base, unsafe;`;function Uf(e){return`${Hf}
1455
+ @layer base {
1456
+ ${e}
1457
+ }`}function Wf(e){return`${Hf}
1458
+ @layer unsafe {
1459
+ ${e}
1460
+ }`}var Gf=new WeakMap;function Kf(e){let t=Gf.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(sd,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),Gf.set(e,i),i}function qf(e,t){if(!e.isConnected)return;let n=Kf(t);if(n==null)return;let r=t.querySelector(`style[${cd}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(cd,``),t.appendChild(i)),i.textContent=`:host { ${ld}: ${n}px; }`}var Jf;function Yf(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){Jf??(Jf=new CSSStyleSheet,Jf.replaceSync(Uf(Vf)));let t=!1;try{e.adoptedStyleSheets=[Jf],t=!0}catch{}if(t){e.querySelector(`style[${ad}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(ad,``),t.textContent=Uf(Vf),e.prepend(t)}}function Xf(e,t){Zf(e,t),Yf(t),qf(e,t)}function Zf(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});Xf(this,e)}}if(customElements.define(id,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(id)))e instanceof HTMLElement&&Xf(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Qf=5,$f=32,ep=128;function tp(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function np(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function rp(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function ip(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function ap(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function op(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function sp(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,dp(e,t)}function cp(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=ip(e).get(t);if(i===void 0)return;let a=i>>Qf;e.childVisibleChunkSums[a]+=r}function lp(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=fp(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=$f}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function up(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>Qf;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<Qf}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function dp(e,t){if(t.childIds.length<ep){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/$f),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>Qf]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function fp(e,t,n,r){let i=Math.min(t.childIds.length,n+$f),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var pp=7,mp=3,hp=8,gp=4;function _p(e,t,n=0){return e<<gp|n<<mp|t}function vp(e){return e.depthAndFlags>>>gp}function yp(e){return(e.depthAndFlags&hp)>>mp}function K(e){return(e.depthAndFlags&hp)!==0}function bp(e){return e.depthAndFlags&pp}function xp(e,t){return(bp(e)&t)!==0}function Sp(e,t){e.depthAndFlags|=t}function Cp(e,t){e.depthAndFlags=_p(t,bp(e),yp(e))}var wp=Symbol(`benchmarkInstrumentation`);function Tp(e,t){return t==null||Object.defineProperty(e,wp,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Ep(e){return e==null?null:e[wp]??null}function q(e,t,n){return e==null?n():e.measurePhase(t,n)}function Dp(e,t,n){Number.isFinite(n)&&e!=null&&e.setCounter(t,n)}function Op(e){return e>=48&&e<=57}function kp(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Op(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&Op(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function Ap(e){let t=e.toLowerCase();return{lowerValue:t,tokens:kp(t)}}function jp(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function Mp(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=jp(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Np(e,t,n){let r=Mp(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Pp(e,t){return Np(e,t,Ap)}function Fp(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function Ip(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=Fp(e,r);return a===Fp(t,r)?Pp(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function Lp(e,t){return Ip(e,t)}function Rp(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Ap(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=Fp(e,n);return o===Fp(t,n)?Np(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function zp(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=Ap(e.valueById[t]);return e.sortKeyById[t]=r,r}function Bp(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function Vp(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function Hp(e){let{hasTrailingSlash:t,segments:n}=Vp(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function Up(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=Vp(e);return{requiresDirectory:t,segments:n}}function Wp(){let e=new Map;return e.set(``,0),{idByValue:e,valueById:[``],sortKeyById:[Ap(``)]}}function Gp(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function Kp(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var qp=Symbol(`pathStorePreparedInputKind`);function Jp(e,t){return e[qp]=t,e}function Yp(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function Xp(e,t,n){return n==="default"?Lp(e,t):n(Yp(e),Yp(t))}function Zp(){return{depthAndFlags:_p(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function Qp(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function $p(e){return e.isDirectory?e.segments.length:e.segments.length-1}function em(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function tm(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function nm(e,t={}){return cm(e,t).map(e=>e.path)}function rm(e,t={}){let n=cm(e,t);return Jp({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function im(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return Jp({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function am(e){let t=e,n=t.preparedPaths;if(t[qp]===`prepared`&&n!=null)return n;if(!em(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function om(e){let t=e;return t[qp]===`presorted`&&t.presortedPaths!=null||tm(t.presortedPaths)?t.presortedPaths:null}function sm(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function cm(e,t={}){let n=Bp(t),r=Ep(t);Dp(r,`workload.inputFiles`,e.length);let i=q(r,`store.preparePathEntries.parse`,()=>e.map(e=>Hp(e)));return q(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>Xp(e,t,n.sort))),i}var lm=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[Zp()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=Wp();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Ep(e),this.options=Bp(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,tp())}appendPaths(e){return q(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>Hp(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,q(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return q(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null){if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:_p(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:_p(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d,m=a+1}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:_p(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=Hp(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null){if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:_p(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:_p(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=Hp(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(q(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||q(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?Rp(this.lastPreparedPath,e,this.segmentSortKeyCache):Xp(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=$p(e),i=n==null?0:$p(n),a=n==null?0:Qp(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=Gp(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:_p(vp(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),ap(i,s),s}createFileChildUnchecked(e,t){let n=Gp(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:_p(vp(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ap(r,a),a}getOrCreateDirectoryChild(e,t){let n=Gp(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!K(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:_p(vp(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ap(r,a),this.directories.set(a,tp()),a}createDirectoryChild(e,t){let n=Gp(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:_p(vp(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ap(r,a),this.directories.set(a,tp()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!K(n))throw Error(`Path is not a directory: "${t}"`);if(xp(n,1))throw Error(`Duplicate path: "${t}"`);Sp(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,np());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(K(a)){let t=np();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;K(n)&&this.directories.set(t,tp());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),ap(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!K(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return sp(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function um(e,t=`closed`,n=null){let r=fm(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function dm(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function fm(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function pm(e,t){return xp(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion!==`closed`&&vp(t)<=e.defaultExpansion}function mm(e,t,n=e.snapshot.nodes[t]){return n==null||!K(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:pm(e,n)}function hm(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!K(r))return;let i=pm(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t)}else i?(e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0):e.expandedDirectoryIds.delete(t)}function gm(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function _m(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function vm(e,t){let n=gm(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function ym(e,t){let n=gm(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function bm(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function xm(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function Sm(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function Cm(e,t){e.directoryLoadInfoById.delete(t)}function wm(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function Tm(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Em(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function Dm(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function Om(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function km(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Am(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function jm(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function Mm(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Nm(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function Pm(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function Fm(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function Im(e,t,n){return{...n,visibleCountDelta:qm(e)-t}}function Lm(e,t){let n=qm(e),r=dm();e.transactionStack.push(r);try{t()}catch(t){throw Bm(e,r,!1),t}Bm(e,r,!0,qm(e)-n)}function Rm(e,t){let n=e.instrumentation;n==null?zm(e,t):q(n,`store.events.record`,()=>zm(e,t))}function zm(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;n==null?Gm(e,t):(n.events.push(t),Wm(n,t))}function Bm(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?Um(i,t):q(n,`store.events.batch.merge`,()=>Um(i,t));return}let a=Vm(t,r),o=e.instrumentation;o==null?Gm(e,a):q(o,`store.events.batch.commit`,()=>Gm(e,a))}function Vm(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function Hm(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function Um(e,t){for(let n of t.events)e.events.push(n);Hm(e,t)}function Wm(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function Gm(e,t){let n=e.instrumentation;n==null?Km(e,t):q(n,`store.events.emit`,()=>Km(e,t))}function Km(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function qm(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function Jm(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!K(n)||xp(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!K(a)?null:i}function Ym(e,t){let n=t;for(;;){let t=Jm(e,n);if(t==null)return n;n=t}}function Xm(e,t){let n=[t],r=t;for(;;){let t=Jm(e,r);if(t==null)return n;n.push(t),r=t}}function Zm(e,t){let n=t==null?e.snapshot.rootId:oh(e,t);return n==null?[]:ch(e,n)}function Qm(e,t){let n=Hp(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Ch(e,Sh(e,r)),{createdNodeIds:a,directoryId:o}=lh(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=X(e,o);if(xp(n,1))throw Error(`Path already exists: "${t}"`);Sp(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=dh(e,o,n.basename),s.add(c);rh(e,o);let l=Ch(e,o);return Tm({affectedAncestorIds:ah(e,c),affectedNodeIds:[...s],path:t,projectionChanged:wh(i,l)})}function $m(e,t,n){let r=oh(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=X(e,r);if(xp(i,2))throw Error(`The root node cannot be removed`);if(K(i)&&Y(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Ch(e,a),s=bh(e,r);mh(e,a,r,i.nameId),xh(e,a),rh(e,a);let c=Ch(e,a);return Em({affectedAncestorIds:ah(e,a),affectedNodeIds:s,path:t,projectionChanged:wh(o,c),recursive:n.recursive===!0})}function eh(e,t,n,r){let i=oh(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=X(e,i);if(xp(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=vh(e,i,n),c=Ch(e,a.parentId),l=Ch(e,s.parentId),u=Kp(e.snapshot.segmentTable,a.nameId),d=Gp(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(K(a)&&Oh(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=rp(e.snapshot.nodes,Y(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&yh(e,p,o,yp(a))===`skip`)return null;let m=a.parentId;mh(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Dh(e,i),ph(e,s.parentId,i),xh(e,m),e.pathCacheVersion++,rh(e,m),s.parentId!==m&&rh(e,s.parentId);let h=Ch(e,m),g=Ch(e,s.parentId);return Dm({affectedAncestorIds:[...new Set([...ah(e,m),...ah(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:Th([c,l],[h,g]),to:J(e,i)})}function th(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function nh(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function J(e,t){let n=X(e,t),r=th(e,t);if(r!=null)return r;if(xp(n,2))return nh(e,t,``);let i=J(e,n.parentId),a=Kp(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return nh(e,t,K(n)?`${o}/`:o)}function rh(e,t){let n=e.instrumentation;n==null?Ah(e,t):q(n,`store.recomputeCountsUpwardFrom`,()=>Ah(e,t))}function ih(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!K(o)){kh(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){kh(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function ah(e,t){let n=[],r=t;for(;r!=null;){let t=X(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function oh(e,t){if(t.length===0)return e.snapshot.rootId;let n=Up(t);return sh(e,n.segments,n.requiresDirectory)}function sh(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=Y(e,r),a=rp(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=X(e,r);return n&&!K(i)?null:r}function Y(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function X(e,t){let n=e.snapshot.nodes[t];if(n===void 0||xp(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function ch(e,t){let n=e.snapshot.nodes[t];if(n===void 0||xp(n,4))return[];if(!K(n))return[J(e,t)];if(Y(e,t).childIds.length===0)return xp(n,1)&&!xp(n,2)?[J(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||xp(n,4)){i.pop();continue}if(!K(n)){r.push(J(e,t.nodeId)),i.pop();continue}let a=Y(e,t.nodeId);if(a.childIds.length===0){xp(n,1)&&!xp(n,2)&&r.push(J(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];o==null?i.pop():(t.childIndex++,i.push({childIndex:0,nodeId:o}))}return r}function lh(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=Gp(e.snapshot.segmentTable,i),a=Y(e,r),o=rp(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!K(X(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o}else r=uh(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function uh(e,t,n){let r=X(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:_p(vp(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,tp()),ph(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function dh(e,t,n){let r=Gp(e.snapshot.segmentTable,n),i=Y(e,t);if(rp(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${Mh(e,t,n)}"`);let a=X(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:_p(vp(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),ph(e,t,o),e.activeNodeCount++,o}function fh(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];o==null||hh(e,n,o)<0?i=a:r=a+1}return r}function ph(e,t,n){let r=Y(e,t),i=X(e,n);rp(e.snapshot.nodes,r).set(i.nameId,n),cp(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=fh(e,r,n);r.childIds.splice(a,0,n),op(r,a),dp(e.snapshot.nodes,r)}function mh(e,t,n,r){let i=Y(e,t),a=ip(i),o=a.get(n)??-1;rp(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&cp(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),op(i,o),dp(e.snapshot.nodes,i))}function hh(e,t,n){let r=e.snapshot.options.sort;return r==="default"?gh(e,t,n):r(_h(e,t),_h(e,n))}function gh(e,t,n){let r=X(e,t),i=X(e,n),a=K(r);if(a!==K(i))return a?-1:1;let o=Mp(zp(e.snapshot.segmentTable,r.nameId),zp(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=Kp(e.snapshot.segmentTable,r.nameId),c=Kp(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function _h(e,t){let n=X(e,t),r=J(e,t),i=K(n),a=i?r.slice(0,-1):r;return{basename:Kp(e.snapshot.segmentTable,n.nameId),depth:vp(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function vh(e,t,n){let r=X(e,t),i=oh(e,n);if(i!=null){let t=X(e,i);if(K(t))return{basename:Kp(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=Up(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=Up(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:sh(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function yh(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${J(e,t)}"`);let i=X(e,t);if(yp(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(K(i)&&Y(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return bh(e,t),mh(e,a,t,o),xh(e,a),rh(e,a),`handled`}function bh(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=X(e,t.nodeId);if(t.visitedChildren||!K(i)){K(i)&&e.snapshot.directories.delete(t.nodeId),Sp(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Cm(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=Y(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function xh(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!K(t)||xp(t,2)||Y(e,n).childIds.length>0)return;Sp(t,1),n=t.parentId===n?null:t.parentId}}function Sh(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=rp(e.snapshot.nodes,Y(e,n)).get(t);if(i==null||!K(X(e,i)))break;n=i}return n}function Ch(e,t){let n=Eh(e,t);if(n==null)return null;let r=Ym(e,n),i=X(e,r),a=n===r?null:Xm(e,n).map(t=>J(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:Y(e,r).childIds.length>0,path:J(e,r),terminalKind:yp(i)})}function wh(e,t){return Th([e],[t])}function Th(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function Eh(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!K(t)||xp(t,2))return null;if(!mm(e,n,t))return n;n=t.parentId}return null}function Dh(e,t){let n=X(e,t);if(Cp(n,(t===e.snapshot.rootId?-1:vp(X(e,n.parentId)))+1),!K(n))return;let r=Y(e,t);for(let t of r.childIds)Dh(e,t)}function Oh(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=X(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function kh(e,t,n=X(e,t),r=!1){let i=e.instrumentation;i==null?jh(e,t,n,r):q(i,`store.recomputeNodeCounts`,()=>jh(e,t,n,r))}function Ah(e,t){let n=t;for(;n!=null;){let t=X(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(kh(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&cp(Y(e,s),n,a,o),n=s}}function jh(e,t,n,r){if(!K(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=Y(e,t);if(r){let t=e.instrumentation;t==null?sp(e.snapshot.nodes,i):q(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>sp(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;n.subtreeNodeCount=a,n.visibleSubtreeCount=xp(n,2)?o:Jm(e,t)==null?mm(e,t,n)?1+o:1:o}function Mh(e,t,n){let r=J(e,t);return r.length===0?n:`${r}${n}`}function Nh(e){return e!=null&&!xp(e,4)}function Ph(e,t){let n=e.snapshot.nodes[t];return!Nh(n)||!K(n)||xp(n,2)?null:n}function Fh(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Nh(e.snapshot.nodes[n])&&(t+=1);return t}function Ih(e){return Math.max(0,e.valueById.length-1)}function Lh(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Fh(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:Ih(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function Rh(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function zh(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)Ph(e,n)!=null&&t.push(J(e,n));for(let t of e.expandedDirectoryIds)Ph(e,t)!=null&&n.push(J(e,t));return{collapsedPaths:t,expandedPaths:n}}function Bh(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)Ph(e,n)!=null&&_m(e,n)!==`loaded`&&t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:J(e,n)});return t}function Vh(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=oh(e,n);t!=null&&hm(e,t,!0,X(e,t))}for(let n of t.collapsedPaths){let t=oh(e,n);t!=null&&hm(e,t,!1,X(e,t))}}function Hh(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=oh(e,n.path);t!=null&&Ph(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function Uh(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function Wh(e){let t=e.snapshot.segmentTable,n=Wp();for(let r of e.snapshot.nodes)Nh(r)&&(r.nameId=xp(r,2)?0:Gp(n,Kp(t,r.nameId)));e.snapshot.segmentTable=n}function Gh(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Nh(r)||!K(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Nh(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[X(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),sp(e.snapshot.nodes,n)}}function Kh(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId&&!Nh(e.snapshot.nodes[t]);)--t;e.snapshot.nodes.length=t+1}function qh(e){let t=zh(e),n=Bh(e);q(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>Uh(e)),q(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>Wh(e)),q(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>Gh(e)),q(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>Kh(e)),q(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>Vh(e,t)),q(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>Hh(e,n)),q(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>ih(e,e.snapshot.rootId))}function Jh(e){let t=zh(e),n=Bh(e),r=q(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>Zm(e)),i=Tp({...e.snapshot.options},e.instrumentation),a=q(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new lm(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,q(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>Vh(e,t)),q(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>Hh(e,n)),q(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>ih(e,e.snapshot.rootId))}function Yh(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function Xh(e,t){let n=Lh(e);t===`stable`?q(e.instrumentation,`store.cleanup.stable`,()=>qh(e)):q(e.instrumentation,`store.cleanup.aggressive`,()=>Jh(e));let r=Lh(e);return Rh(t,t===`stable`,n,r)}var Zh=64;function Qh(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function $h(e){return X(e,e.snapshot.rootId).visibleSubtreeCount}function eg(e,t,n,r){let i=X(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function tg(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:bg(e,t.cursor),setSize:t.setSize,subtreeEndIndex:eg(e,t.cursor,t.index,n)}}function ng(e,t,n,r,i,a){let o=Y(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=lp(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return rg(e,u,l,r+c,i+1,s,o.childIds.length,a)}function rg(e,t,n,r,i,a,o,s){if(!K(X(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=mg(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=X(e,c.terminalNodeId);if(!K(l)||!mm(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return ng(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function ig(e,t){let n=$h(e);if(t<0||t>=n)return null;let r=ng(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>J(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=tg(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:bg(e,r.cursor),setSize:r.setSize,subtreeEndIndex:eg(e,r.cursor,r.index,n)}}function ag(e,t,n){let r=e.instrumentation,i=$h(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return yg(e,o+1);let t=[],n=dg(e,a);for(let r=a;r<=o&&n!=null;r++){let r=bg(e,n);t.push(r),n=gg(e,n)}return t}let s=[],c=0,l=0,u=q(r,`store.getVisibleSlice.selectFirstRow`,()=>dg(e,a));for(let t=a;t<=o&&u!=null;t++){let t=q(r,`store.getVisibleSlice.materializeRow`,()=>bg(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=q(r,`store.getVisibleSlice.advanceCursor`,()=>gg(e,u))}return Dp(r,`workload.visibleRowsRead`,s.length),Dp(r,`workload.flattenedRowsRead`,c),Dp(r,`workload.flattenedSegmentsRead`,l),s}function og(e,t=$h(e)){let n=e.instrumentation;return n==null?vg(e,t):q(n,`store.getVisibleTreeProjection`,()=>vg(e,t))}function sg(e){return _g(og(e))}function cg(e,t){let n=oh(e,t);if(n==null||n===e.snapshot.rootId||K(X(e,n))&&Ym(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=X(e,i).parentId,n=Y(e,t),s=ip(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=up(a,n,s),t!==o){let n=X(e,t),a=Jm(e,t);if(!mm(e,t,n)&&a!==i)return null;Ym(e,t)===t&&(r+=1)}i=t}return r}function lg(e,t){let n=oh(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!K(r))throw Error(`Path is not a directory: "${t}"`);return mm(e,n,r)?null:(hm(e,n,!0,r),rh(e,n),Om({affectedAncestorIds:ah(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function ug(e,t){let n=oh(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!K(r))throw Error(`Path is not a directory: "${t}"`);return mm(e,n,r)?(hm(e,n,!1,r),rh(e,n),km({affectedAncestorIds:ah(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function dg(e,t){return t<0||t>=$h(e)?null:fg(e,e.snapshot.rootId,t,-1)}function fg(e,t,n,r){let i=Y(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?lp(e.snapshot.nodes,i,n):q(a,`store.getVisibleSlice.selectChildIndex`,()=>lp(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return pg(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function pg(e,t,n,r){if(!K(X(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=mg(e,t,r);if(n===0)return i;let a=X(e,i.terminalNodeId);if(!K(a)||!mm(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return fg(e,i.terminalNodeId,n-1,i.visibleDepth)}function mg(e,t,n){return K(X(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:Ym(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:q(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>Ym(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function hg(e,t){let n=X(e,t);if(!K(n))return!0;let r=n.parentId;return r===e.snapshot.rootId||Jm(e,r)!==t}function gg(e,t){let n=X(e,t.terminalNodeId);if(K(n)){let r=Y(e,t.terminalNodeId);if(mm(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:pg(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=X(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=Y(e,n),o=ip(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return pg(e,s,0,i);hg(e,r)&&i--,r=n}}function _g(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function vg(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(Zh);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=Qh(o,y);let x,S=_;if(K(v))S=f?Ym(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:J(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}let C=o[y];r[s]=C,n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let w=c[S];w!=null&&K(w)&&mm(e,S,w)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function yg(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!K(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:J(e,f)};continue}let h=l?Ym(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=bg(e,g);let _=i[h];_!=null&&K(_)&&mm(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function bg(e,t){let n=X(e,t.terminalNodeId),r=K(n)?xg(e,t):null,i=J(e,t.terminalNodeId),a=Kp(e.snapshot.segmentTable,n.nameId),o=K(n)&&Y(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?Xm(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:Kp(e.snapshot.segmentTable,r.nameId),nodeId:n,path:J(e,n)}}):q(c,`store.getVisibleSlice.flatten.collectSegments`,()=>Xm(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:Kp(e.snapshot.segmentTable,r.nameId),nodeId:n,path:J(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:K(n)&&mm(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:K(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function xg(e,t){if(t.headNodeId===t.terminalNodeId)return _m(e,t.terminalNodeId);let n=Xm(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=_m(e,t);if(n===`loading`)return`loading`;n===`error`?i=!0:n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}var Sg=8;function Cg(e){let{nodes:t,directories:n,rootId:r,options:i}=e,a=t.length,o=new Int32Array(a),s=new Int32Array(a),c=new Int32Array(a),l=new Int32Array(a),u=new Int32Array(a),d=new Int32Array(a),f=new Int32Array(a);for(let e=0;e<a;e+=1){let n=t[e];n!=null&&(o[e]=n.parentId,s[e]=n.nameId,c[e]=n.depthAndFlags,l[e]=n.subtreeNodeCount,u[e]=n.visibleSubtreeCount)}let p=0;for(let e of n.values())p+=e.childIds.length;let m=new Int32Array(p),h=0;for(let[e,t]of n){let n=t.childIds;d[e]=h,f[e]=n.length;for(let e=0;e<n.length;e+=1)m[h]=n[e],h+=1}return{nodeCount:a,rootId:r,flattenEmptyDirectories:i.flattenEmptyDirectories===!0,parentId:o,nameId:s,depthAndFlags:c,subtreeNodeCount:l,visibleSubtreeCount:u,childStart:d,childCount:f,childIdsFlat:m}}function wg(e){let{nodeCount:t,rootId:n,flattenEmptyDirectories:r,depthAndFlags:i,subtreeNodeCount:a,visibleSubtreeCount:o,childStart:s,childCount:c,childIdsFlat:l}=e;for(let e=t-1;e>=1;--e){if((i[e]&Sg)===0)continue;let t=s[e],n=c[e],u=0,d=0;for(let e=0;e<n;e+=1){let n=l[t+e];u+=a[n],d+=o[n]}a[e]=1+u;let f;f=r&&n===1?(i[l[t]]&Sg)===0?1+d:d:1+d,o[e]=f}let u=s[n],d=c[n],f=0,p=0;for(let e=0;e<d;e+=1){let t=l[u+e];f+=a[t],p+=o[t]}a[n]=1+f,o[n]=p}function Tg(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!K(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&dp(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&K(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,dp(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Eg(e){let{directories:t,nodes:n,rootId:r}=e.snapshot,i=Cg(e.snapshot);wg(i);let a=i.subtreeNodeCount,o=i.visibleSubtreeCount;for(let e=0;e<n.length;e+=1){let t=n[e];t!=null&&(t.subtreeNodeCount=a[e],t.visibleSubtreeCount=o[e])}for(let[e,i]of t){let t=i.childIds,a=t.length,o=0,s=0;for(let e=0;e<a;e++){let r=t[e];if(r==null)continue;let i=n[r];o+=i.subtreeNodeCount,s+=i.visibleSubtreeCount}i.totalChildSubtreeNodeCount=o,i.totalChildVisibleSubtreeCount=s,(e===r||a>=128)&&dp(n,i)}}function Dg(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Og=class e{#e;constructor(e={}){let t=Ep(e),n=q(t,`store.builder.create`,()=>new lm(e));if(e.preparedInput!=null){let t=om(e.preparedInput);t==null?n.appendPreparedPaths(am(e.preparedInput),!1):n.appendPresortedPaths(t,sm(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(q(t,`store.preparePathEntries`,()=>cm(r,e)))}let r=q(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=q(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=q(t,`store.state.create`,()=>um(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:q(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Dg(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&q(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?e.useSoaCountSweep===!0?q(t,`store.state.initializeOpenVisibleCountsViaSoa`,()=>Eg(this.#e)):q(t,`store.state.initializeOpenVisibleCounts`,()=>Tg(this.#e)):q(t,`store.state.recomputeCounts`,()=>ih(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return nm(e,t)}static prepareInput(e,t={}){return rm(e,t)}static preparePresortedInput(e){return im(e)}list(e){return q(this.#e.instrumentation,`store.list`,()=>Zm(this.#e,e))}add(e){q(this.#e.instrumentation,`store.add`,()=>{let t=$h(this.#e);Rm(this.#e,Im(this.#e,t,Qm(this.#e,e)))})}remove(e,t={}){q(this.#e.instrumentation,`store.remove`,()=>{let n=$h(this.#e);Rm(this.#e,Im(this.#e,n,$m(this.#e,e,t)))})}move(e,t,n={}){q(this.#e.instrumentation,`store.move`,()=>{let r=$h(this.#e),i=eh(this.#e,e,t,n);i!=null&&Rm(this.#e,Im(this.#e,r,i))})}batch(e){Lm(this.#e,()=>{if(typeof e==`function`)e(this);else for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision})}})}getVisibleCount(){return q(this.#e.instrumentation,`store.getVisibleCount`,()=>$h(this.#e))}getVisibleSlice(e,t){return q(this.#e.instrumentation,`store.getVisibleSlice`,()=>ag(this.#e,e,t))}getVisibleRowContext(e){return q(this.#e.instrumentation,`store.getVisibleRowContext`,()=>ig(this.#e,e))}getVisibleTreeProjection(){return sg(this.#e)}getVisibleTreeProjectionData(e){return og(this.#e,e)}getVisibleIndex(e){return q(this.#e.instrumentation,`store.getVisibleIndex`,()=>cg(this.#e,e))}getPathInfo(e){return q(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=oh(this.#e,e);if(t==null)return null;let n=X(this.#e,t);return{depth:vp(n),kind:K(n)?`directory`:`file`,path:J(this.#e,t)}})}isExpanded(e){return q(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=X(this.#e,t);return mm(this.#e,t,n)})}expand(e){q(this.#e.instrumentation,`store.expand`,()=>{let t=$h(this.#e),n=lg(this.#e,e);n!=null&&Rm(this.#e,Im(this.#e,t,n))})}collapse(e){q(this.#e.instrumentation,`store.collapse`,()=>{let t=$h(this.#e),n=ug(this.#e,e);n!=null&&Rm(this.#e,Im(this.#e,t,n))})}on(e,t){return wm(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return _m(this.#e,t)}markDirectoryUnloaded(e){q(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(Y(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=$h(this.#e);ym(this.#e,t),Rm(this.#e,Im(this.#e,n,Am({affectedAncestorIds:ah(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return q(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=$h(this.#e),r=vm(this.#e,t);return Rm(this.#e,Im(this.#e,n,jm({affectedAncestorIds:ah(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return q(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||_m(this.#e,n)!==`loading`||!xm(this.#e,n,e.attemptId))return!1;let r=J(this.#e,n);this.validateChildPatch(r,t);let i=$h(this.#e),a=[];for(let e of t.operations){kg(r,e);let t=$h(this.#e);switch(e.type){case`add`:a.push(Im(this.#e,t,Qm(this.#e,e.path)));break;case`remove`:a.push(Im(this.#e,t,$m(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=eh(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(Im(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return Rm(this.#e,Im(this.#e,i,Mm({affectedAncestorIds:ah(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:J(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return q(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=$h(this.#e),r=bm(this.#e,t,e.attemptId);return Rm(this.#e,Im(this.#e,n,Nm({affectedAncestorIds:ah(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:J(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return q(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=$h(this.#e),i=Sm(this.#e,n,e.attemptId,t);return Rm(this.#e,Im(this.#e,r,Pm({affectedAncestorIds:ah(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:J(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return q(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(Yh(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=$h(this.#e),n=Xh(this.#e,e.mode??`stable`);return Rm(this.#e,Im(this.#e,t,Fm({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=Y(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Ap(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=Mp(zp(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0||!K(X(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h)a=null,i=0,n.length=0,r.length=0;else for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=X(this.#e,n);mm(this.#e,n,i)||(hm(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=X(this.#e,e);if(!mm(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=oh(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!K(X(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!K(X(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=X(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=X(this.#e,e),r=Jm(this.#e,e);if(!mm(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function kg(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`)}}var Ag=e=>e.startsWith(`f::`)?e.slice(3):e;function jg(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function Mg(e,t){return e===``?t:`${e}/${t}`}function Ng({files:e,path:t,isFolder:n,nextBasename:r}){let i=Ag(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=jg(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=Mg(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function Pg(e){return e.endsWith(`/`)}function Fg(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function Ig(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function Lg(e,t){return t.includes(e)?Ig(t):[e]}function Rg(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function zg(e,t){return{draggedPaths:e,target:t}}function Bg(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Pg(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function Vg(e,t){return t.kind===`root`||t.directoryPath==null?Fg(e):t.directoryPath}function Hg(e,t){let n=e.map(e=>{let n=Vg(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function Ug(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Wg(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!Ug(Og.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function Gg(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function Kg(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function qg(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function Jg(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return qg(e,t.path)?n?e:null:e;case`move`:return Kg(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=Jg(r,e,n),r==null)return null;return r}}}function Yg(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function Xg(e){switch(e.operation){case`add`:return{...Yg(e),operation:`add`,path:e.path};case`remove`:return{...Yg(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...Yg(e),from:e.from,operation:`move`,to:e.to}}}function Zg(e){return{...Yg(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>Xg(e)),operation:`batch`}}function Qg(e){switch(e.operation){case`add`:case`remove`:case`move`:return Xg(e);case`batch`:return Zg(e);default:return null}}function $g(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function e_(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function t_(e){return e_(e).at(-1)??null}function n_(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function r_(e){return e.endsWith(`/`)}var i_=e=>e.toLowerCase();function a_(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function o_(e){return e.endsWith(`/`)?e.slice(0,-1):e}function s_(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var c_=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},l_=Symbol(`FILE_TREE_RENAME_VIEW`),u_=512,d_=512;function f_(e){return e===`top`||e===`center`?e:`nearest`}function p_(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=e_(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function m_(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:p_(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var h_=class e{static{Object.defineProperty(e.prototype,l_,{configurable:!0,value(){return{cancel:()=>{this.#J()},commit:()=>{this.#Y()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#X(e)}}},writable:!0})}#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=new Set;#A=[];#j;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=null;#z=0;#B=null;#V=new Set;#H=0;#U;#W=0;#G=!1;#K=0;#q;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=Wg({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#j=n??`hide-non-matches`,this.#U=this.#ue(u.paths,u.preparedInput);let d=i?.map(e=>this.#Pe(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#V=new Set(d),this.#B=f,this.#H=1),this.#Me(f,!1),r!=null&&this.#Ee(r,!1),this.#q=this.#Ve()}destroy(){this.#q?.(),this.#q=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#ge()}focusFirstItem(){this.#xe().length>0&&this.#Ie(0)}focusLastItem(){this.#K<=0||(this.#Le(),this.#Ie(this.#K-1))}focusNextItem(){this.#je(1)}focusParentItem(){if(this.#c==null)return;let e=t_(this.#c);if(e==null)return;let t=this.#Q(e);t>=0&&this.#Ie(t)}focusPath(e){let t=this.#U.getPathInfo(e)?.path??null;if(t==null)return;this.#Le();let n=this.#Q(t);n>=0&&this.#Ie(n)}scrollToPath(e,t){let n=this.#U.getPathInfo(e)?.path??null;if(n==null)return;this.#Le();let r=this.#Se(n);r<0||this.#Ne(r)!=null&&(t?.focus!==!1&&this.#Ie(r,!1),this.#R={id:this.#z+=1,offset:f_(t?.offset),visibleIndex:r},this.#Oe())}focusMountedPathFromInput(e){let t=this.#U.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Q(t);n>=0&&this.#Ie(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Q(t);return n>=0?(this.#Ie(n),this.#xe()[n]??t):null}focusPreviousItem(){this.#je(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#$(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#R}clearScrollRequest(e){this.#R?.id===e&&(this.#R=null)}resolveNearestVisiblePath(e){let t=this.#xe();if(this.#K===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#U.getPathInfo(e)?.path??e,r=this.#Q(n);return r>=0?t[r]??n:this.#Z(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#V]}getSelectionVersion(){return this.#H}getVisibleCount(){return this.#K}getVisibleRows(e,t){if(t<e||this.#K===0)return[];let n=Math.max(0,e),r=Math.min(this.#K-1,t);if(r<n)return[];let i=r-n+1;if(this.#I==null&&!this.#l&&r>=this.#b.length&&i<=d_){let e=[];for(let t=n;t<=r;t+=1){let n=this.#U.getVisibleRowContext(t);if(n==null)break;e.push(this.#te(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Le(),this.#I!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Ce(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];r!=null&&r===a+1?a=r:(i>=0&&this.#U.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null?(i=-1,a=-1):(i=r,a=r))}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Ce(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#ee(o,i,a,{ancestorPaths:this.#ie(a),path:s})})}return this.#U.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#ee(e,r,r,{ancestorPaths:this.#ie(r),path:i})})}getStickyRowCandidates(e,t){if(this.#I!=null)return null;if(this.#K===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#K;r+=1){let i=e+r*t,a=Math.min(this.#K-1,Math.floor(i/t)),o=this.#ne(a,r)??(a>0?this.#ne(a-1,r):void 0);if(o==null)break;n.push({row:this.#te(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#U.getPathInfo(e);return t==null?null:this.#$(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#U.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&(this.#N!=null&&this.#N.length>0&&(this.#O.has(t)?this.#O.delete(t):this.#U.isExpanded(t)&&this.#O.add(t)),this.#He(t))}selectAllVisiblePaths(){this.#Le();let e=[...this.#xe()];this.#oe(e,this.#c??this.#B)}selectOnlyPath(e){let t=this.#Pe(e);t!=null&&this.#oe([t],t)}selectOnlyMountedPathFromInput(e){this.#oe([e],e)}selectPath(e){let t=this.#Pe(e);t==null||this.#V.has(t)||this.#oe([...this.#V,t])}deselectPath(e){let t=this.#Pe(e);t!=null&&this.#V.has(t)&&this.#oe([...this.#V].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Pe(e);t!=null&&(this.#V.has(t)?this.deselectPath(t):this.selectPath(t))}togglePathSelectionFromInput(e){let t=this.#Pe(e);t!=null&&(this.#V.has(t)?this.#oe([...this.#V].filter(e=>e!==t),t):this.#oe([...this.#V,t],t))}selectPathRange(e,t){let n=this.#Pe(e);if(n==null)return;this.#Le();let r=this.#B,i=r==null?-1:this.#we(r),a=this.#we(n);if(i===-1||a===-1){let e=t?[...this.#V,n]:[n];this.#oe(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#xe().slice(o,s+1),l=t?[...this.#V,...c]:c;this.#oe(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#K-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Le();let r=this.#xe(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#V);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#oe([...o],this.#B??i,!1),this.#Ie(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Pe(e);if(t==null||this.#N!=null&&this.#N.length>0)return!1;let n=this.getSelectedPaths(),r=Lg(t,n);return this.#r.canDrag?.(r)!==!1&&(n.includes(t)||this.#oe([t],t,!1),this.#Fe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#Oe(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=zg(t.draggedPaths,n);(Bg(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}Rg(t.target,n)||(this.#i={...t,target:n},this.#Oe())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#Oe())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#Oe(),!1;let n=zg(e.draggedPaths,t);if(Bg(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#Oe(),!1;let r=Hg(e.draggedPaths,t);if(r==null)return this.#Oe(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#U.move(e.from,e.to,{collision:e.collision})}else this.#le(r.operations),this.#U.batch(r.operations)}catch(e){return this.#Oe(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#U.add(e)}remove(e,t={}){this.#U.remove(e,t)}move(e,t,n={}){this.#U.move(e,t,n)}batch(e){this.#U.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Ee(e,!0)}openSearch(e=``){this.#Ee(e,!0)}closeSearch(){this.#Ee(null,!0)}isSearchOpen(){return this.#N!==null}getSearchValue(){return this.#N??``}getSearchMatchingPaths(){return this.#A}focusNextSearchMatch(){this.#Te(1)}focusPreviousSearchMatch(){this.#Te(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#U.getPathInfo(e);if(n==null)return!1;let r=n.path,i=r_(r),a=o_(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of e_(r))this.#U.isExpanded(e)||this.#U.expand(e);return this.#oe([r],r,!1),this.#N!=null&&(this.#Ee(null,!1),this.#y?.(this.#N)),this.#Fe(r),this.#T=r,this.#E=a_(r),this.#D=t.removeIfCanceled??!1,this.#Oe(),!0}#J(){if(this.#T==null)return;let e=this.#T,t=this.#D;this.#T=null,this.#E=``,this.#D=!1,t?this.remove(e,r_(e)?{recursive:!0}:void 0):(this.#Fe(e),this.#Oe())}#Y(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,r_(e)?{recursive:!0}:void 0);return}let t=r_(e),n=Ng({files:this.#U.list(),isFolder:t,nextBasename:this.#E,path:o_(e)});this.#T=null,this.#E=``,this.#D=!1,`error`in n?(this.#Fe(e),this.#v?.(n.error),this.#Oe()):n.sourcePath===n.destinationPath?(this.#Fe(e),this.#Oe()):(this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(s_(n.sourcePath,t),s_(n.destinationPath,t)))}#X(e){this.#T!=null&&this.#E!==e&&(this.#E=e,this.#Oe())}resetPaths(e,t={}){let n=!Array.isArray(e),r=n?void 0:e,i=n?e:t,a=this.#U.list().length,o=this.#K,s=Wg({paths:r,preparedInput:i.preparedInput},`resetPaths`,this.#e.sort),c=this.#ue(s.paths,s.preparedInput,i.initialExpandedPaths),l=this.#c,u=this.#T,d=this.getSelectedPaths(),f=this.#B;this.#q?.(),this.#U=c,this.#d.clear(),this.#ge();let p=d.map(e=>c.getPathInfo(e)?.path??null).filter(e=>e!=null),m=!$g(this.#V,p);this.#V=new Set(p),m&&(this.#H+=1),this.#B=f==null?null:c.getPathInfo(f)?.path??null,this.#T=u==null?null:c.getPathInfo(u)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#Me(l,l!=null||p.length>0||this.#B!=null),this.#q=this.#Ve(),this.#Oe(),this.#ke({canonicalChanged:!0,operation:`reset`,pathCountAfter:s.paths.length,pathCountBefore:a,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#K-o})}#Z(e){this.#Le();let t=t_(e),n=n_(e,t),r=null,i=null;for(let e of this.#xe()){if(t_(e)!==t)continue;let a=n_(e,t);if(a<n)r=e;else if(a>n){i=e;break}}return r??i}#Q(e){let t=this.#we(e);if(t!==-1)return t;let n=e_(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#we(t);if(r!==-1)return r}return this.#xe().length>0?0:-1}#$(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#U.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#se(r.path):this.#ce(r.path);return this.#d.set(r.path,i),i}#ee(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#V.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#te(e){return this.#ee(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#ne(e,t){let n=this.#U.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#re(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#re(n),n];return this.#a.set(e,r),r}#ie(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#re(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ae(e){this.#U.collapse(e)}#oe(e,t=this.#B,n=!0){let r=[...new Set(e)],i=!$g(this.#V,r),a=this.#B!==t;(i||a)&&(this.#V=new Set(r),this.#B=t,i&&(this.#H+=1),n&&this.#Oe())}#se(e){return{collapse:()=>{this.#ae(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#Ae(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#U.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#V.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#He(e)}}}#ce(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#V.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#le(e){let t=this.#U.list();this.#ue(t).batch(e)}#ue(e,t,n){return new Og({...this.#e,paths:e,preparedInput:t,...n===void 0?{}:{initialExpandedPaths:n}})}#de(){return this.#h??=this.#U.list(),this.#h}#fe(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#de()){e.add(t);for(let n of e_(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#pe(){return this.#g??=this.#de().map(i_),this.#g}#me(){return this.#f??=this.#fe().filter(e=>e.endsWith(`/`)),this.#f}#he(){return this.#p??=this.#me().map(i_),this.#p}#ge(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#_e(){return this.#me().filter(e=>this.#U.isExpanded(e))}#ve(e){let t=new Set(this.#M??[]);if(e)for(let e of this.#V)for(let n of e_(e))t.add(n);this.#ye(t)}#ye(e){this.#G=!0;try{for(let t of this.#me()){let n=e.has(t),r=this.#U.isExpanded(t);n&&!r?this.#U.expand(t):!n&&r&&this.#U.collapse(t)}}finally{this.#G=!1}}#be(){if(this.#N==null||this.#N.length===0){this.#I=null,this.#L=null,this.#F=null,this.#K=this.#W;return}let e=this.#b;if(this.#j!==`hide-non-matches`||this.#k.size===0){this.#I=null,this.#L=null,this.#F=null,this.#K=this.#W;return}let t=[],n=[],r=new Map,i=this.#P;for(let[a,o]of e.entries())i?.has(o)===!0&&(r.set(o,n.length),t.push(a),n.push(o));this.#I=t,this.#L=n,this.#F=r,this.#K=n.length}#xe(){return this.#L??this.#b}#Se(e){return this.#L==null?this.#U.getVisibleIndex(e)??-1:this.#F?.get(e)??-1}#Ce(e){return this.#I?.[e]??e}#we(e){return this.#F?.get(e)??this.#U.getVisibleIndex(e)??-1}#Te(e){let t=this.#A;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Ee(e,t){let n=e==null?null:c_(e),r=this.#N;if(r!==n){if(r==null&&n!=null&&(this.#M=this.#_e()),this.#N=n,n==null)this.#O.clear(),this.#ve(!0),this.#M=null,this.#k.clear(),this.#A=[],this.#P=null,this.#Me(this.#c,!0);else if(n.length===0)this.#O.clear(),this.#ve(!1),this.#k.clear(),this.#A=[],this.#P=null,this.#Me(this.#c,!0);else{let e=this.#De();this.#Me(e,!0)}t&&(this.#y?.(this.#N),this.#Oe())}}#De(){if(this.#N==null||this.#N.length===0)return this.#k.clear(),this.#A=[],this.#c;this.#Re();let e=this.#N,t=this.#de(),n=this.#pe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#me(),s=this.#he();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#k=i,this.#A=r;let c=this.#j===`hide-non-matches`&&r.length>0?new Set:null;this.#P=c;let l=this.#j===`expand-matches`?new Set(this.#M??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of e_(e))l.add(t),c?.add(t)}for(let e of this.#O)if(l.delete(e),c!=null){c.add(e);for(let t of e_(e))c.add(t)}return this.#ye(l),a??this.#c}#Oe(){for(let e of this.#t)e()}#ke(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#Ae(e){for(let t of e_(e))this.#U.isExpanded(t)||this.#U.expand(t);this.#U.isExpanded(e)||this.#U.expand(e)}#je(e){let t=this.#K;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#I==null&&r>=this.#b.length&&this.#Le(),this.#Ie(r))}#Me(e,t=!0){let n=this.#U.getVisibleCount();this.#W=n;let r=m_(this.#U.getVisibleTreeProjectionData(t?void 0:Math.min(n,u_)),e,t?e=>this.#U.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#be(),this.#s=e==null?this.#xe().length>0?0:-1:this.#Q(e),this.#c=this.#s<0?null:this.#Ne(this.#s)}#Ne(e){return this.#xe()[e]??(this.#I==null?this.#U.getVisibleRowContext(e)?.row.path??null:null)}#Pe(e){return this.#U.getPathInfo(e)?.path??null}#Fe(e){if(e==null)return;let t=this.#Q(e);t>=0&&this.#Ie(t,!1)}#Ie(e,t=!0){let n=this.#Ne(e);n!=null&&(this.#s!==e||this.#c!==n)&&(this.#s=e,this.#c=n,t&&this.#Oe())}#Le(){this.#l||this.#Me(this.#c,!0)}#Re(){if(this.#O.size!==0)for(let e of[...this.#O])this.resolveMountedDirectoryPathFromInput(e)!==e&&this.#O.delete(e)}#ze(e){if(this.#O.size===0)return;let t=new Set;for(let n of this.#O){let r=Jg(n,e);if(r==null)continue;let i=this.#U.getPathInfo(r)?.path??null;i!=null&&i.endsWith(`/`)&&t.add(i)}this.#O=t}#Be(e){this.#ze(e);let t=Jg(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=Jg(this.#c,e,!0),r=[...this.#V].map(t=>Jg(t,e)).filter(e=>e!=null).map(e=>this.#U.getPathInfo(e)?.path??null).filter(e=>e!=null),i=Jg(this.#B,e),a=i==null?null:this.#U.getPathInfo(i)?.path??null,o=[...new Set(r)];return $g(this.#V,o)||(this.#V=new Set(o),this.#H+=1),this.#B=a,n}#Ve(){return this.#U.on(`*`,e=>{if(this.#G)return;e.canonicalChanged&&(this.#d.clear(),this.#ge()),this.#i!=null&&Gg(e)&&(this.#i=null);let t=Gg(e)?this.#Be(e):this.#c,n;if(this.#N!=null&&this.#N.length>0){let e=this.#De();n=this.#c!=null&&this.#P?.has(this.#c)===!0?this.#c:e}else n=this.#N===``?this.#c:t;let r=this.#N!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#Me(n,r),this.#Oe();let i=Qg(e);i!=null&&this.#ke(i)})}#He(e){this.#U.isExpanded(e)?this.#ae(e):this.#Ae(e)}},g_=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function __(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1)e[t]!==`/`&&t!==e.length?r===-1&&(r=t):r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1);return n===``?null:{isDirectory:t,path:n}}function v_(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let e=t.indexOf(`/`,r);if(e===-1)break;n.push(t.slice(0,e+1)),r=e+1}return n}function y_(e,t){return t?`${e}/`:e}function b_(e,t=null){let n=g_(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set,o=new Map;for(let t of e??[]){let e=S_(t);e!=null&&T_({canonicalPath:e.canonicalPath,changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,isDirectory:e.isDirectory,status:t.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}function x_(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let i=new Map(e?.statusByPath),a=new Set(e?.directoriesWithChanges),o=new Set(e?.ignoredDirectoryPaths),s=new Map(e?.changeCountByDirectoryPath),c=!1;for(let e of n){let t=C_(e);t!=null&&(c=w_({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=S_(e);t!=null&&(c=T_({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,isDirectory:t.isDirectory,status:e.status,statusByPath:i})||c)}return c?i.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,signature:O_(i),statusByPath:i}:e}function S_(e){return C_(e.path)}function C_(e){let t=__(e);if(t!=null)return{canonicalPath:y_(t.path,t.isDirectory),isDirectory:t.isDirectory}}function w_({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:i}){let a=i.get(e);return a!=null&&(i.delete(e),a===`ignored`&&e.endsWith(`/`)&&r.delete(e),D_(t,n,e),!0)}function T_({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??E_(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function E_(e,t,n){for(let r of v_(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function D_(e,t,n){for(let r of v_(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function O_(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var k_=e=>e.trim().toLowerCase(),A_=e=>e.split(`/`).at(-1)??e,j_=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function M_(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function N_(e){let t=Ff(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(k_(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let s=A_(o),c=s.toLowerCase(),l=r.get(c);if(l!=null)return M_(l,e);for(let[t,n]of a)if(c.includes(t))return M_(n,e);let u=j_(s);for(let t of u){let n=i.get(t);if(n!=null)return M_(n,e)}let d=Nf(t.set,s,u);if(d!=null&&t.set!==`none`){if(d==="default"){let t=n?.[e];if(t!=null)return M_(t,e)}return{name:jf(d),remappedFrom:e,token:d}}}let s=n?.[e];return s==null?{name:e}:M_(s,e)}}}var Z,P_,F_,I_,L_,R_,z_,B_,V_,H_,U_={},W_=[],G_=Array.isArray,K_=W_.slice,q_=Object.assign;function J_(e){e&&e.parentNode&&e.remove()}function Y_(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?K_.call(arguments,2):n),X_(e,o,r,i,null)}function X_(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++P_,__i:-1,__u:0};return i==null&&Z.vnode!=null&&Z.vnode(a),a}function Z_(e){return e.children}function Q_(e,t){this.props=e,this.context=t,this.__g=0}function $_(e,t){if(t==null)return e.__?$_(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?$_(e):null}function e1(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return e1(e)}}function t1(e){(8&e.__g||!(e.__g|=8)||!F_.push(e)||L_++)&&I_==Z.debounceRendering||((I_=Z.debounceRendering)||queueMicrotask)(n1)}function n1(){for(var e,t,n,r,i,a,o,s,c=1;F_.length;)F_.length>c&&F_.sort(R_),e=F_.shift(),c=F_.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=q_({},r)).__v=r.__v+1,Z.vnode&&Z.vnode(n),u1(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??$_(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,f1(a,n,o),n.__e!=i&&e1(n)));L_=0}function r1(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||W_,b=t.length;for(c=i1(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?U_:y[m.__i]||U_,m.__i=f,_=u1(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&h1(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=a1(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function i1(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?X_(null,o,null,null,null):G_(o)?X_(Z_,{children:o},null,null,null):o.constructor==null&&o.__b>0?X_(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=o1(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=$_(s)),g1(s,s));return r}function a1(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=a1(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=$_(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function o1(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function s1(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function c1(e,t,n,r,i){var a;e:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||s1(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||s1(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(z_,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=B_,e.addEventListener(t,a?H_:V_,a)):e.removeEventListener(t,a?H_:V_,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break e}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function l1(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=B_++;else if(t.u<n.l)return;return n(Z.event?Z.event(t):t)}}}function u1(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=Z.__b)&&d(t);e:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new M(v,x):(t.__c=f=new Q_(v,x),f.constructor=M,f.render=_1),b&&b.sub(f),f.props=v,f.state||(f.state={}),f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=q_({},f.__s)),q_(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=Z.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=q_({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===Z_&&d.key==null&&(E=p1(d.props.children)),s=r1(e,G_(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null){if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)J_(a[j]);d1(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||d1(t);Z.__e(e,t,n)}else s=t.__e=m1(n.__e,t,n,r,i,a,o,c,l,u);return(d=Z.diffed)&&d(t),128&t.__u?void 0:s}function d1(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(d1)}function f1(e,t,n){for(var r=0;r<n.length;r++)h1(n[r],n[++r],n[++r]);Z.__c&&Z.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Z.__e(e,t.__v)}})}function p1(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:G_(e)?e.map(p1):q_({},e)}function m1(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(Z.__m&&Z.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=K_.call(e.childNodes),v=n.props||U_,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;c1(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||c1(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),r1(b==`template`?e.content:e,G_(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&$_(n,0),s,c,l),a!=null)for(u=a.length;u--;)J_(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||c1(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&c1(e,u,g,v[u],i))}return e}function h1(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){Z.__e(e,n)}}function g1(e,t,n){var r,i;if(Z.unmount&&Z.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||h1(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Z.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&g1(r[i],t,n||typeof e.type!=`function`);n||J_(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function _1(e,t,n){return this.constructor(e,n)}function v1(e,t){var n,r,i,a;t==document&&(t=document.documentElement),Z.__&&Z.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=Y_(Z_,null,[e]),i=[],a=[],u1(t,e,r||U_,U_,t.namespaceURI,r?null:t.firstChild?K_.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),f1(i,e,a)}function y1(e,t){e.__u|=32,v1(e,t)}Z={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw L_=0,e}},P_=0,Q_.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=q_({},this.state);typeof e==`function`&&(e=e(q_({},n),this.props)),e&&q_(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),t1(this))},Q_.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),t1(this))},Q_.prototype.render=Z_,F_=[],L_=0,R_=function(e,t){return e.__v.__b-t.__v.__b},z_=/(PointerCapture)$|Capture$/i,B_=0,V_=l1(!1),H_=l1(!0);var b1=0;Array.isArray;function Q(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--b1,__i:-1,__u:0,__source:i,__self:a};return Z.vnode&&Z.vnode(l),l}var x1=16,S1=16,C1={};function w1({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=C1[e]??{width:x1,height:S1},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Q(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:Q(`use`,{href:c})})}var T1=e=>e!==void 0&&/\s/.test(e),E1=(e,t)=>{let n=t=>T1(e[t-1])||T1(e[t]);if(!n(t))return t;for(let r=1;r<e.length;r++){let i=t-r;if(i>0&&!n(i))return i;let a=t+r;if(a<e.length&&!n(a))return a}return t},D1=e=>E1(e,Math.ceil(e.length/2)),O1=e=>{if(e.length<2)return[e,``];let t=D1(e);return[e.slice(0,t),e.slice(t)]},k1=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:D1(e);return[e.slice(0,r),e.slice(r)]},A1=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},j1=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},M1=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},N1=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function P1({children:e,marker:t,variant:n=`default`}){"use no memo";return Q(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Q(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Q(`span`,{"data-truncate-fade":!0}):t})})}function F1(e){"use no memo";let{mode:t,children:n}=e;return Q(`div`,{children:[Q(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Q(`span`,{children:n}):n}),Q(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Q(`span`,{children:n}):n})]})}function I1({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Q(F1,{mode:t,children:e},`content`),o=Q(P1,{marker:n,mode:t,variant:r},`marker`),s=Q(`div`,{"data-truncate-fill":!0},`fill`);return Q(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Q(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function L1({children:e,...t}){"use no memo";return Q(I1,{mode:`truncate`,...t,children:e})}function R1({children:e,...t}){"use no memo";return Q(I1,{mode:`fruncate`,...t,children:e})}function z1({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=Q(L1,{...s,children:t[0]}),l=Q(R1,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Q(`div`,{className:a,style:o});if(e.length<i)return Q(n===`end`?R1:L1,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=O1:r===`extension`?t=k1:r===`leaf-path`&&(t=A1);else if(typeof r==`number`)t=j1,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=M1:e===`first`&&(t=N1)}else typeof r==`function`&&(t=r);t??=O1;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=Q(L1,{...s,..._,children:f}),l=Q(R1,{...s,...v,children:p})}return Q(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Q(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Q(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var B1={endIndex:-1,startIndex:-1};function V1(e,t,n){return Math.min(Math.max(e,t),n)}function H1(e,t){return e<0||t<e?B1:{endIndex:t,startIndex:e}}function U1(e){return e.startIndex<0||e.endIndex<e.startIndex}function W1(e,t){return U1(e)?0:(e.endIndex-e.startIndex+1)*t}function G1(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function K1(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function q1(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);i==null?t.set(r,[n]):i.push(n)}),t}function J1(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;o<=t?(i=a,n=a+1):r=a-1}return i}function Y1(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function X1(e,t,n){if(e.length===0||t<=0)return[];let r=Y1(e),i=q1(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=J1(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function Z1(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=V1(t.scrollTop,0,o),c=t.stickyRows??X1(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=G1(s,n,t.itemHeight),m=G1(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?B1:H1(m,K1(u+d,n,t.itemHeight)),y=g+1,b=U1(v)?B1:H1(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=W1(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:U1(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var Q1={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`};function $1(e){return e.current?!0:(e.current=!0,!1)}function e0(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function t0(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return e0({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function n0(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function r0(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function i0(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function a0(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function o0(e,t){return e!=null&&e>0?e:t}function s0(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function c0(e,t,n,r,i=0){let a=e0({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function l0(e,t,n,r,i,a,o=0){let s=t0({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function u0(e,t,n,r,i,a){let o=n0({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function d0(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function f0(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function p0({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Q(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function m0(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function h0(e){let{event:t,mode:n,isDirectory:r}=e,i=t.ctrlKey||t.metaKey,a=t.shiftKey||i,o=t.shiftKey?{additive:i,kind:`range`}:i?{kind:`toggle`}:{kind:`single`};return{closeSearch:!1,revealCanonical:n===`sticky`,selection:o,toggleDirectory:!a&&r}}var g0,_0,v0,y0,b0=Object.is,x0=0,S0=[],C0=Z,w0=C0.__b,T0=C0.__r,E0=C0.diffed,D0=C0.__c,O0=C0.unmount,k0=C0.__;function A0(e,t){C0.__h&&C0.__h(_0,e,x0||t),x0=0;var n=_0.__H||(_0.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function j0(e){return x0=1,M0(U0,e)}function M0(e,t,n){var r=A0(g0++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):U0(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);b0(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=_0,!_0.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,b0(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};_0.__f=!0;var a=_0.shouldComponentUpdate,o=_0.componentWillUpdate;_0.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},_0.shouldComponentUpdate=i}return r.__N||r.__}function N0(e,t){var n=A0(g0++,3);!C0.__s&&H0(n.__H,t)&&(n.__=e,n.u=t,_0.__H.__h.push(n))}function P0(e,t){var n=A0(g0++,4);!C0.__s&&H0(n.__H,t)&&(n.__=e,n.u=t,_0.__h.push(n))}function $(e){return x0=5,F0(function(){return{current:e}},[])}function F0(e,t){var n=A0(g0++,7);return H0(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function I0(e,t){return x0=8,F0(function(){return e},t)}function L0(){for(var e;e=S0.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(B0),e.__H.__h.forEach(V0),e.__H.__h=[]}catch(t){e.__H.__h=[],C0.__e(t,e.__v)}}C0.__b=function(e){_0=null,w0&&w0(e)},C0.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),k0&&k0(e,t)},C0.__r=function(e){T0&&T0(e),g0=0;var t=(_0=e.__c).__H;t&&(v0===_0?(t.__h=[],_0.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(B0),t.__h.forEach(V0),t.__h=[],g0=0)),v0=_0},C0.diffed=function(e){E0&&E0(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(S0.push(t)!==1&&y0===C0.requestAnimationFrame||((y0=C0.requestAnimationFrame)||z0)(L0)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),v0=_0=null},C0.__c=function(e,t){t.some(function(e){try{e.__h.forEach(B0),e.__h=e.__h.filter(function(e){return!e.__||V0(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],C0.__e(n,e.__v)}}),D0&&D0(e,t)},C0.unmount=function(e){O0&&O0(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{B0(e)}catch(e){t=e}}),n.__H=void 0,t&&C0.__e(t,n.__v))};var R0=typeof requestAnimationFrame==`function`;function z0(e){var t,n=function(){clearTimeout(r),R0&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);R0&&(t=requestAnimationFrame(n))}function B0(e){var t=_0,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),_0=t}function V0(e){var t=_0;e.__c=e.__(),_0=t}function H0(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!b0(t,e[n])})}function U0(e,t){return typeof t==`function`?t(e):t}function W0(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Q(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Q(Z_,{children:[Q(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Q(L1,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function G0(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function K0(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function q0(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function J0({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=Z1(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:q0(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?q0(u,1,t,o):i&&r<=0&&c.length>0?X1(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var Y0=400,X0=40,Z0=18;function Q0(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?$0(e,t,n):a instanceof HTMLElement?a:null}function $0(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function ev(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function tv(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function nv(){return navigator.vendor!==`Apple Computer, Inc.`}function rv(e,t){let n=e-t.top;if(n<X0)return-Math.ceil((X0-Math.max(0,n))/X0*Z0);let r=t.bottom-e;return r<X0?Math.ceil((X0-Math.max(0,r))/X0*Z0):0}function iv(e,t,n){if(e!=null){let t=Q1[e];return t==null?null:{text:t,title:n.gitStatusTitles[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:n.containsGitStatusTitle}:null}function av(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function ov(e){return e!=null&&`toggle`in e}function sv(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function cv(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function lv(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function uv(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function dv(e,t){return t&&uv(e)||(e.ctrlKey||e.metaKey)&&sv(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var fv=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function pv(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function mv(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function hv(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function gv(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function _v(e,t,n){n==null?e.delete(t):e.set(t,n)}function vv(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function yv(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function bv(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function xv(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=bv(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function Sv(e,t){return{kind:e.kind,name:K0(e),path:t}}function Cv(e){return e==null?void 0:`${e}__tree`}function wv(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function Tv(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function Ev(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Q(`span`,{title:e.title,children:e.text}):Q(`span`,{title:e.title,children:e.parts.map((e,t)=>Q(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?Tv(e.icon)?t(e.icon):{name:e.icon}:Tv(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Q(`span`,{title:e.title,children:Q(w1,{...n})})}function Dv(e){e!=null&&r0(e.querySelector(`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)??e)}function Ov(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=G0(e);return Q(Z_,{children:[e.depth>0?Q(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Q(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Q(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Q(w1,{...t(`file-tree-icon-chevron`)}):Q(w1,{...t(`file-tree-icon-file`,u)})}),Q(`div`,{"data-item-section":`content`,children:e.isFlattened?W0(e,c,a):c??Q(z1,{minimumLength:5,split:`extension`,children:e.name})}),i?Q(`div`,{"data-item-section":`decoration`,children:r==null?null:Ev(r,t)}):null,s?Q(`div`,{"data-item-section":`git`,children:Ev(o,t)}):null,n?Q(`div`,{"data-item-section":`action`,children:l?Q(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Q(w1,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function kv(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,labels:S,contextMenuEnabled:C,contextMenuTriggerMode:w,contextMenuButtonTriggerEnabled:T,contextMenuButtonVisibility:E,contextMenuRightClickEnabled:D,registerRenameInput:O,registerButton:k,resolveIcon:A,renderDecorationForRow:j,openContextMenuForRow:M,onRowClick:N,onKeyDown:ee}=e,P=G0(t),{isParked:F=!1,mode:I=`flow`,style:te}=r,ne=I===`sticky`,re=_?.get(P)??null??av(t.ancestorPaths,v,y),ie=t.kind===`directory`&&(b?.has(P)??!1),ae=j(t,P),oe=iv(re,ie,S),se=C&&T,L=ae!=null||x||se,ce=se&&E===`always`,le=a.getPath()===P,ue=le?a.getValue():``,R=ne||!le?null:Q(p0,{ref:O,ariaLabel:S.renameItem(K0(t)),isFlattened:t.isFlattened,value:ue,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),de=Ov(t,A,{actionLaneEnabled:se,customDecoration:ae,decorationLaneEnabled:L,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:oe,gitLaneActive:x,renameInput:R,showDecorativeActionAffordance:ce}),fe={...m0({ariaLabel:K0(t),domId:t.isFocused?wv(h,P,F):void 0,extraStyle:te,features:{actionLaneEnabled:se,contextMenuButtonVisibility:se?E:null,contextMenuEnabled:C,contextMenuTriggerMode:C?w:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:ie,effectiveGitStatus:re,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:C||u?e=>{d()?e.preventDefault():C&&(e.preventDefault(),D&&(i.focusMountedPathFromInput(P),M(t,P,{anchorRect:hv(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:ne?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:ne?void 0:ee,ref:e=>{k(P,e)}};return!ne&&le?Q(`div`,{...fe,children:de}):Q(`button`,{...fe,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{(ne||i.isSearchOpen())&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{N(e,t,P,I)},children:de})}function Av(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(G0(e))).map((n,r)=>kv(e,n,t.start+r))}function jv({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Bf,labels:c=If,overscan:l=10,renamingEnabled:u=!1,renderRowDecoration:d,searchBlurBehavior:f=`close`,searchEnabled:p=!1,searchFakeFocus:m=!1,slotHost:h,stickyFolders:g=!1,initialViewportHeight:_=420}){"use no memo";let v=$(null),y=$(null),b=$(!1),x=$(null),S=$(null),C=$(null),w=$(null),T=$(null),E=$(new Map),D=$(new Map),O=$(()=>{}),k=$(null),A=$(0),j=$(!1),M=$(null);M.current!==t&&(j.current=!1,M.current=t);let N=$(!1),ee=$(null),P=$(null),F=$(!1),I=$(null),te=$(null),ne=$(null),re=$(null),ie=$(null),ae=$(null),oe=$(null),se=$(null),L=$(!1),ce=$(null),le=$(null),ue=$(null),R=$(null),de=F0(()=>new Map,[]),[,fe]=j0(0),pe=$(!1),[me,he]=j0(null),[ge,_e]=j0(null),[ve,ye]=j0(null),[be,xe]=j0(null),[Se,Ce]=j0(0),[z,we]=j0(null),Te=$(z);Te.current=z;let Ee=$(0),De=I0((e,t)=>{let n=Te.current;return n!=null&&n.path===e&&n.source===t?n.token:(Ee.current+=1,Ee.current)},[]),Oe=$(null),ke=$(null),Ae=$(null),je=$(null),Me=$(null),Ne=$(!1),Pe=()=>{ke.current=null,Ae.current=null,je.current=null},Fe=(e,t)=>{ke.current=e,Ae.current=null,je.current=t==null?null:{path:e,scrollTop:t}},Ie=(e,t)=>{ke.current=null,Ae.current={path:e,viewportOffset:t},je.current=null},Le=$(f===`retain`&&t.isSearchOpen()),[Re,ze]=j0(m);N0(()=>{m||ze(!1)},[m]);let Be=$(!1),Ve=I0(()=>{Be.current=!0,ze(e=>e&&!1)},[]),[He,Ue]=j0(()=>J0({controller:t,itemHeight:s,overscan:l,scrollTop:0,stickyFolders:g,viewportHeight:_})),[We,Ge]=j0(!1);N0(()=>{Ge(!0)},[]);let B=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ke=e?.contextMenu?.triggerMode??(B?`right-click`:`both`),qe=Ke===`both`||Ke===`button`,Je=e?.contextMenu?.buttonVisibility??`when-needed`,Ye=Ke===`both`||Ke===`right-click`;P0(()=>{let e=C.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Me.current=t,_e(t),xe(t==null?null:`pointer`)},n=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail;Ne.current=t?.disabled===!0};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Xe=I0((e,t)=>{_v(E.current,e,t)},[]),Ze=I0((e,t)=>{_v(D.current,e,t)},[]),Qe=I0(e=>{S.current=e},[]),$e=I0(e=>vv(e,D.current,E.current),[]),et=n!=null||r!=null||i!=null,{resolveIcon:tt}=F0(()=>N_(a),[a]),nt=t[l_](),rt=nt.getPath(),it=rt!=null,at=t.isSearchOpen(),ot=t.getSearchValue(),V=t.getFocusedPath(),H=t.getFocusedIndex(),st=t.getScrollRequest(),ct=t.isDragAndDropEnabled(),lt=t.getDragSession(),ut=F0(()=>lt==null?null:new Set(lt.draggedPaths),[lt]),dt=lt?.target??null,ft=lt?.primaryPath??null,pt=Cv(o),{overlayHeight:mt,overlayRows:ht,snapshot:gt,visibleRows:_t}=He,vt=gt.physical.viewportHeight,yt=F0(()=>({end:gt.window.endIndex,start:gt.window.startIndex}),[gt.window.endIndex,gt.window.startIndex]),bt=ht,xt=gt.sticky.rows,St=gt.physical.totalHeight,Ct=gt.sticky.height,wt=F0(()=>new Set(xt.map(e=>G0(e.row))),[xt]),Tt=H>=0&&H>=yt.start&&H<=yt.end,Et=I0((e,t)=>d?.({item:Sv(e,t),row:e})??null,[d]),Dt=I0(e=>r0(e==null?null:E.current.get(e)??null)?!0:r0(C.current),[]),Ot=I0(e=>{let n=t.focusNearestPath(e);Dt(n)},[t,Dt]),kt=$(Ot);kt.current=Ot;let At=$(!0),jt=$(()=>{}),Mt=I0((t=!0,n)=>{let r=Te.current;r!=null&&(n==null||n===r.token)&&(At.current=At.current&&t,we(null),e?.contextMenu?.onClose?.(),At.current&&Ot(r.path))},[e?.contextMenu,Ot]);jt.current=Mt;let Nt=I0(e=>{let t=e==null?null:gv(C.current,e);ye(e=>e===t?e:t)},[]),Pt=I0((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=$e(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=w.current;Fe(n,e?.scrollTop??null),N.current=!0,he(e=>e===n?e:n)}i.focus(),Nt(a),At.current=!0;let o=r?.source??`keyboard`;we({anchorRect:r?.anchorRect??null,item:Sv(e,n),path:n,source:o,token:De(n,o)})},[t,$e,De,Nt]),Ft=I0(e=>{if(u){if(t.isSearchOpen()){let e=w.current,t=a0(e,vt);I.current=H<0||e==null?null:Math.max(0,Math.min(H*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(xe(`focus`),fe(e=>e+1))}},[t,H,s,u,vt]),It=I0((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=w.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let c=a0(i,vt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:J0({controller:t,itemHeight:s,overscan:l,scrollTop:i.scrollTop,stickyFolders:g,viewportHeight:c}).snapshot.sticky.height;return N.current=!0,u0(i,a,s,c,u,d),O.current(),Oe.current=n?e:null,!0},[t,s,l,vt,g]),Lt=()=>b.current===!0||R.current!=null||L.current===!0,Rt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),zt=e=>{e!=null&&(typeof window.cancelAnimationFrame==`function`?window.cancelAnimationFrame(e):window.clearTimeout(e))},Bt=()=>{re.current!=null&&(clearTimeout(re.current),re.current=null),ne.current=null},Vt=()=>{ae.current?.remove(),ae.current=null},Ht=()=>{zt(te.current),te.current=null,ie.current=null},Ut=e=>{let t=C.current?.getRootNode();t instanceof ShadowRoot?t.append(e):document.body.append(e)},Wt=()=>{se.current?.(),se.current=null,R.current!=null&&(clearTimeout(R.current),R.current=null),L.current=!1,ce.current=null,ue.current=null,le.current!=null&&(le.current.setAttribute(`draggable`,`true`),le.current.style.removeProperty(`touch-action`),le.current=null),Vt(),Bt(),Ht(),oe.current=null},Gt=(e,n)=>{let r=C.current?.getRootNode(),i=ev(Q0(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},U=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Bt();return}let r=t.getItem(e.directoryPath),i=ov(r)?r:null;if(i==null||i.isExpanded()){Bt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;ne.current!==a&&(Bt(),ne.current=a,re.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Kt=()=>{te.current=null;let e=ie.current,n=w.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=rv(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,O.current());let s=Gt(e.clientX,e.clientY);U(s),te.current=Rt(Kt)},W=(e,t)=>{ie.current={clientX:e,clientY:t},te.current??=Rt(Kt)},qt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Wt(),Vt(),Bt(),Ht(),t.startDrag(r)===!1)e.preventDefault();else if(oe.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),nv())){let t=tv(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Ut(t),ae.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Jt=()=>{Vt(),Bt(),Ht(),oe.current=null,t.cancelDrag()},Yt=(e,n,r)=>{if(R.current!=null||L.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;ue.current={clientX:i.clientX,clientY:i.clientY},le.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!L.current;R.current!=null&&(clearTimeout(R.current),R.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),se.current===o&&(se.current=null),t&&(a.setAttribute(`draggable`,`true`),le.current===a&&(le.current=null),ue.current=null)},s=e=>{let t=e.touches[0],n=ue.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=100||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),se.current=o,R.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),le.current===a&&(le.current=null),ue.current=null;return}L.current=!0,le.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),oe.current=n;let e=a.getBoundingClientRect(),s=tv(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Ut(s),ae.current=s,ce.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=ce.current;n!=null&&ae.current!=null&&(ae.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`);let r=Gt(t.clientX,t.clientY);U(r),W(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Gt(n.clientX,n.clientY),t.completeDrag(),Wt()},u=()=>{t.cancelDrag(),Wt()};se.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},Y0)},Xt=e=>{if(z!=null){if(e.key===`Escape`){Mt(),e.preventDefault(),e.stopPropagation();return}fv.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(nt.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)nt.cancel();else if(e.key===`Enter`)nt.commit();else return;xe(`focus`),fe(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(u&&e.key===`F2`){Ft(V??void 0),e.preventDefault(),e.stopPropagation();return}if(at){if(e.key===`Escape`)F.current=!1,I.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e)}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;xe(`focus`),fe(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(p&&cv(e)){t.openSearch(e.key),fe(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=B&&uv(e),r=dv(e,B),i=r&&C.current!=null?i0(C.current):null,a=r?new Set(yv(C.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==V&&a.has(o)){let e=w.current;Fe(o,e?.scrollTop??null),t.focusPath(o)}let l=t.getFocusedPath(),d=t.getFocusedIndex(),f=t.getFocusedItem();if(f==null)return;let m=ov(f)?f:null,h=l!=null&&(wt.has(l)||c&&o===l&&a.has(l)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=w.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&l!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=vv(l,D.current,E.current);e==null||n==null?y=!1:Pt(e,l)}else if((e.ctrlKey||e.metaKey)&&sv(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;xe(`focus`);let b=t.getFocusedPath(),x=b!=null&&(wt.has(b)||a.has(b)),S=g&&b!==l,T=n&&c&&o===l&&b===l;if((h||T)&&b!=null&&(S&&x||T))Fe(b,v?.scrollTop??null),N.current=!0,he(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==l;b!=null&&(t||_&&b===l)?(Ie(b,xv(C.current,v,i,l,s,Ct,vt)),N.current=!0,he(e=>e===b?e:b)):Pe()}fe(e=>e+1),e.preventDefault(),e.stopPropagation()};P0(()=>{p&&at&&(Le.current?Le.current=!1:r0(T.current))},[at,p]),P0(()=>{let e=S.current;switch(f0({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:rt})){case`reset`:P.current=null;return;case`reveal-canonical`:rt!=null&&It(rt,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Oe.current=null,P.current=rt,r0(e),e.select());return}},[yt.end,yt.start,rt,It,wt]),P0(()=>{let e=C.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=i0(e)?.dataset.itemPath??null;he(e=>e===t?e:t)},i=()=>{n(),N.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{t=null,i0(e)==null?(N.current=!1,he(null)):r()},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),N.current=!1,he(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;he(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),P0(()=>{let e=C.current;e!=null&&(gt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[gt.physical.scrollTop]),P0(()=>{let e=null,n=w.current,r=x.current,i=C.current;if(n==null)return;k.current=a0(n,_);let a=()=>{let e=t.getVisibleCount(),r=o0(k.current,_),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ue(J0({controller:t,itemHeight:s,overscan:l,scrollTop:Math.min(n.scrollTop,i),stickyFolders:g,viewportHeight:r}))};if(!j.current){j.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=o0(k.current,_),i=t.getVisibleRows(e,e)[0]??null;c0(n,e,s,r,g&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}O.current=a;let o=t.subscribe(()=>{$1(pe)&&fe(e=>e+1),a()}),c=()=>{Ne.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),b.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,b.current=!1,Ce(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&Ne.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{a(),n.scrollTop>0&&d(),Te.current!=null&&b.current&&jt.current(),Ne.current===!0?b.current=!1:(_e(e=>e==null?e:null),c())},m=()=>{c(),f()},h=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),v=e=>{h.has(e.key)&&m()};n.addEventListener(`scroll`,p,{passive:!0}),n.addEventListener(`wheel`,m,{passive:!0}),n.addEventListener(`touchmove`,m,{passive:!0}),n.addEventListener(`keydown`,v);let y=typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0]==null?null:s0(e[0]);k.current=t??a0(n,_),a()}):null;return y?.observe(n),()=>{O.current=()=>{},o(),n.removeEventListener(`scroll`,p),n.removeEventListener(`wheel`,m),n.removeEventListener(`touchmove`,m),n.removeEventListener(`keydown`,v),e!=null&&clearTimeout(e),u!=null&&clearTimeout(u),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),b.current=!1,k.current=null,y?.disconnect()}},[t,_,s,l,g]),P0(()=>{B||z==null||Mt(!1)},[Mt,B,z]);let Zt=F0(()=>z==null?null:`${z.path}::${z.source}`,[z]);P0(()=>{if(Zt==null){h?.clearSlotContent(dd);return}let t=Te.current;if(t==null)return;let n=y.current??v.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??mv(n.getBoundingClientRect()),close:e=>{jt.current(e?.restoreFocus??!0,t.token)},restoreFocus:()=>{At.current&&kt.current(Te.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return h?.setSlotContent(dd,i),e?.contextMenu?.onOpen?.(t.item,r),Dv(i),queueMicrotask(()=>{i!=null&&i.isConnected&&document.activeElement===i&&Dv(i)}),()=>{h?.clearSlotContent(dd)}},[Zt,e?.contextMenu,h]),P0(()=>{z!=null&&t.getItem(z.path)==null&&Mt()},[Mt,z,t]),P0(()=>{if(z==null)return;let e=C.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:C.current,n=e=>{let n=e.target;n instanceof Node&&(pv(e)||v.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Mt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Mt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Mt,z]),P0(()=>{let e=w.current,n=C.current;if(e==null||n==null){ee.current=V;return}let r=V==null?null:E.current.get(V)??null,i=i0(n),a=i?.dataset.itemPath??null,o=it&&S.current===i,c=p&&T.current===i,l=F.current&&!at,u=I.current??0,d=Oe.current,f=ke.current,m=Ae.current,h=je.current,_=i!=null,v=N.current||_,y=ee.current!==V,b=f!=null&&f===V&&V!=null,x=!1,D=!1;if(st!=null&&st.id!==A.current){A.current=st.id;let n=st.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=g?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,vt-s))):Ct;x=!0,D=l0(e,n,s,vt,St,st.offset,t)}t.clearScrollRequest(st.id)}let k=!x&&l&&u0(e,H,s,vt,St,u),j=!x&&d!=null&&d===V&&u0(e,H,s,vt,St,Ct),M=!x&&m!=null&&m.path===V&&u0(e,H,s,vt,St,m.viewportOffset),P=!x&&h!=null&&h.path===V&&e.scrollTop!==h.scrollTop;P&&(e.scrollTop=h.scrollTop),(P||D||j||M||k||v&&y&&d!==V&&!b&&c0(e,H,s,vt,Ct))&&O.current(),x?ee.current=V:v?o||c&&!l?ee.current=V:r==null?(l&&H>=0&&(u0(e,H,s,vt,St,u),O.current()),ee.current=V):((y||l||d===V||f===V||m?.path===V||h?.path===V||a==null||a!==V)&&(r0(r),d===V&&(Oe.current=null),f===V&&(ke.current=null),m?.path===V&&(Ae.current=null),h?.path===V&&(je.current=null),F.current=!1,I.current=null),ee.current=V):ee.current=V},[t,H,V,Tt,s,it,at,yt,vt,p,st,g,Ct,St,_t]);let Qt=H>=0&&H>=gt.visible.startIndex&&H<=gt.visible.endIndex,$t=V!=null&&bt.some(e=>G0(e.row)===V),en=Qt||$t,tn=qe&&N.current===!0&&en?V:null,nn=be===`pointer`?ge:null,rn=z?.path??Me.current??nn??tn??ge,an=z?.source===`right-click`;P0(()=>{b.current&&z==null||Nt($e(rn))},[z,$e,yt,vt,Se,bt,rn,Nt,_t]);let on=I0(e=>{if(b.current||pv(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&xe(e=>e===`pointer`?e:`pointer`),_e(e=>e===i?e:i)},[]),sn=I0(()=>{_e(null)},[]);P0(()=>{if(!ct)return;let e=()=>{Wt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Wt(),t.cancelDrag()}},[t,ct]);let cn=e=>{if(!ct||t.getDragSession()==null||L.current)return;let n=ev(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n);let r=t.getDragSession()?.target??null;U(r),W(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},ln=e=>{if(!ct||t.getDragSession()==null||L.current)return;let n=e.relatedTarget;n instanceof Node&&C.current?.contains(n)===!0||(Bt(),Ht(),t.setDragTarget(null))},un=e=>{ct&&t.getDragSession()!=null&&!L.current&&(e.preventDefault(),Gt(e.clientX,e.clientY),t.completeDrag(),Vt(),Bt(),Ht(),oe.current=null)},dn=gt.window.height,fn=gt.window.offsetTop,pn=Math.min(0,vt-dn),mn=Math.min(0,vt-dn-Ct),hn=me===V||F.current,gn=V!=null&&hn&&!Tt&&H>=0?_t[H]??t.getVisibleRows(H,H)[0]??null:null,_n=gn==null?null:d0(H,s,yt,dn),vn=oe.current,yn=ft!=null&&vn!=null&&vn.path===ft&&vn.index>=yt.start&&vn.index<=yt.end,bn=ft!=null&&vn!=null&&vn.path===ft&&!yn&&vn.path!==gn?.path?vn:null,xn=bn==null?null:d0(bn.index,s,yt,dn),Sn=lv((H>=0?_t[H]??t.getVisibleRows(H,H)[0]??null:null)?.ancestorPaths.at(-1)??null),Cn=at&&V!=null?wv(o,V,!Tt):void 0,wn=z?.path??(at?V:me),Tn=z?.path??ge,En=$e(rn),Dn=B&&qe&&!an&&!it&&En!=null&&ve!=null&&rn!=null,On=B&&(Dn||z!=null),kn=z?.anchorRect,An=kn==null&&En!=null&&ve!=null&&(z!=null||Dn)?ve:null,jn=kn==null?An==null?void 0:{top:`${An}px`}:{left:`${kn.left}px`,position:`fixed`,right:`auto`,top:`${kn.top}px`},Mn=an?{opacity:`0`}:void 0,Nn=I0((e,n,r,i)=>{let a=h0({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:at,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c)}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=gt.visible.startIndex&&n.index<=gt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(N.current=!0,he(e=>e===c?e:c),xe(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&It(c,{targetOffset:`sticky-parents`})},[t,at,gt.visible.endIndex,gt.visible.startIndex,It]),Pn=()=>{if(b.current||!qe||rn==null||En==null)return;let e=t.getItem(rn);if(e==null)return;Nt(En),At.current=!0;let n=e.getPath();we({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:En.getAttribute(`aria-label`)??rn,path:n},path:n,source:`button`,token:De(n,`button`)})},Fn={contextHoverPath:Tn,contextMenuButtonTriggerEnabled:qe,contextMenuButtonVisibility:Je,contextMenuEnabled:B,contextMenuRightClickEnabled:Ye,contextMenuTriggerMode:Ke,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:ct,draggedPathSet:ut,dragTarget:dt,gitLaneActive:et,gitStatusByPath:n,handleRowDragEnd:Jt,handleRowDragStart:qt,handleRowTouchStart:Yt,ignoredGitDirectories:r,ignoredInheritanceCache:de,instanceId:o,itemHeight:s,labels:c,onKeyDown:Xt,onRowClick:Nn,openContextMenuForRow:Pt,registerButton:Xe,registerRenameInput:Qe,renameView:nt,renderDecorationForRow:Et,resolveIcon:tt,shouldSuppressContextMenu:Lt,visualFocusPath:wn},In={...Fn,registerButton:Ze};return Q(`div`,{ref:C,id:pt,"data-file-tree-context-menu-button-visibility":B&&qe?Je:void 0,"data-file-tree-context-menu-trigger-mode":B?Ke:void 0,"data-file-tree-has-context-menu-action-lane":B&&qe?`true`:void 0,"data-file-tree-has-git-lane":et?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:ct?ln:void 0,onDragOver:ct?cn:void 0,onDrop:ct?un:void 0,onKeyDown:Xt,onPointerLeave:B?sn:void 0,onPointerOver:B?on:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Q(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:Sn}}),Q(`slot`,{name:ud,"data-type":`header-slot`}),p?Q(`div`,{"data-file-tree-search-container":!0,"data-open":at?`true`:`false`,children:Q(`input`,{ref:T,"aria-activedescendant":Cn,"aria-controls":pt,placeholder:c.searchPlaceholder,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Re?`true`:void 0,value:ot,onBlur:()=>{(f!==`retain`||Be.current)&&t.closeSearch()},onFocus:Ve,onPointerDown:Ve,onInput:e=>{Ve();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Q(`div`,{ref:w,"data-file-tree-virtualized-scroll":`true`,children:[g&&We&&bt.length>0?Q(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Q(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${mt}px`},children:bt.map((e,t)=>kv(In,e.row,`sticky:${G0(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${bt.length-t}`}}))})}):null,Q(`div`,{ref:x,"data-file-tree-virtualized-list":`true`,style:{height:`${St}px`},children:[Q(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${fn}px`}}),Q(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${dn}px`,top:`${pn}px`,bottom:`${mn}px`},children:[Av(Fn,yt,wt),gn!=null&&_n!=null?kv(Fn,gn,`parked:${gn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:ft===gn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${_n}px`}}):null,bn!=null&&xn!=null?kv(Fn,bn,`parked-drag:${bn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${xn}px`}}):null]})]})]}),B?Q(`div`,{ref:v,"data-type":`context-menu-anchor`,"data-visible":On?`true`:`false`,style:jn,children:[Q(`button`,{ref:y,type:`button`,"data-type":fd,"aria-label":c.contextMenuTrigger,"aria-haspopup":`menu`,"aria-expanded":z==null?`false`:`true`,"data-visible":Dn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{e.preventDefault(),e.stopPropagation(),z==null?Pn():Mt()},tabIndex:-1,style:Mn,children:Q(w1,{...tt(`file-tree-icon-ellipsis`)})}),z==null?null:Q(`slot`,{name:dd})]}):null,z==null?null:Q(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Mt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Mt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var Mv={hydrateRoot:(e,t)=>{y1(Y_(jv,t),e)},renderRoot:(e,t)=>{v1(Y_(jv,t),e)},unmountRoot:e=>{v1(null,e)}};function Nv(e,t){Mv.renderRoot(e,t)}function Pv(e,t){Mv.hydrateRoot(e,t)}function Fv(e){Mv.unmountRoot(e)}var Iv=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);n===t?t!=null&&(this.#e.set(e,t),this.#r(e,t)):(n?.remove(),t==null?this.#e.delete(e):(this.#e.set(e,t),this.#r(e,t)))}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}};Array.isArray;var Lv=0;function Rv(e){return e!=null&&e.length>0?e:(Lv+=1,`pst_ft_${Lv}`)}function zv({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Bf)}function Bv(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function Vv(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function Hv(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var Uv=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new Iv;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b=null;#x;#S=!1;#C=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,labels:l,onSearchChange:u,onSelectionChange:d,overscan:f,renderRowDecoration:p,renaming:m,search:h,searchBlurBehavior:g,searchFakeFocus:_,stickyFolders:v,unsafeCSS:y,initialVisibleRowCount:b,...x}=e;this.#e=t,this.#n=Rv(a),this.#p=b_(i),this.#m=s,this.#h=Lf(l),this.#g=y,this.#r=d,this.#i=p,this.#a=m!=null&&m!==!1,this.#o=g,this.#s=h===!0,this.#c=_===!0,this.#u=zf(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:f,stickyFolders:v,initialVisibleRowCount:b},this.#t=new h_({...x,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:u,renaming:m}),this.#y=this.#t.getSelectionVersion(),this.#b=this.#r==null?null:this.subscribe(()=>{this.#O()})}unmount(){this.#x!=null&&(Fv(this.#x),delete this.#x.dataset.fileTreeVirtualizedWrapper,this.#x=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#L(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#b?.(),this.#b=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{t?e():t=!0})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=x_(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#E();n!=null&&Nv(n.wrapper,this.#T())}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#E();t!=null&&(this.#k(),Nv(t.wrapper,this.#T()))}setGitStatus(e){let t=b_(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#E();n!=null&&Nv(n.wrapper,this.#T())}setIcons(e){this.#m=e;let t=this.#E();t!=null&&(this.#D(t.host,t.wrapper),Nv(t.wrapper,this.#T()))}setLabels(e){this.#h=Lf(e);let t=this.#E();t!=null&&Nv(t.wrapper,this.#T())}hydrate({fileTreeContainer:e}){let t=this.#F(e),n=this.#P(t);this.#k(),Pv(n,this.#T())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#F(t??this.#f,e),r=this.#P(n);this.#k(),Nv(r,this.#T())}#w(){return{initialViewportHeight:zv({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#T(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,labels:this.#h,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#w()}}#E(){let e=this.#f,t=this.#x;return e==null||t==null?null:{host:e,wrapper:t}}#D(e,t){let n=e.shadowRoot;n!=null&&(this.#A(n),this.#j(n)),this.#M(t)}#O(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#y&&(this.#y=t,e(this.#t.getSelectedPaths()))}#k(){let e=this.#e?.header?.render;e==null?this.#l.setSlotHtml(ud,this.#e?.header?.html??null):this.#l.setSlotContent(ud,e())}#A(e){let t=Hv(e).find(e=>Vv(e)),n=Bv(Af(Ff(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#j(e){let t=Hv(e),n=t.find(e=>Vv(e)),r=t.filter(e=>e!==n),i=Ff(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=Bv(i);if(a==null)for(let e of r)e.remove();else if(r.length!==1||r[0].outerHTML!==a.outerHTML){for(let e of r)e.remove();e.appendChild(a)}}#M(e){let t=Ff(this.#m);t.colored&&Mf(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#N(e){let t=e.querySelector(`style[${od}]`);this.#_==null&&t instanceof HTMLStyleElement&&(this.#_=t),this.#g==null||this.#g===``?(this.#_?.remove(),this.#_=void 0,this.#v=void 0):(this.#_?.parentNode!==e||this.#v!==this.#g)&&(this.#_??=document.createElement(`style`),this.#_.setAttribute(od,``),this.#_.parentNode!==e&&e.appendChild(this.#_),this.#_.textContent=Wf(this.#g),this.#v=this.#g)}#P(e){if(this.#x!=null)return this.#x;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#x=r??document.createElement(`div`),this.#x.dataset.fileTreeId=this.#n,this.#x.dataset.fileTreeVirtualizedWrapper=`true`,this.#D(e,this.#x),this.#x.parentNode!==t&&t.appendChild(this.#x),this.#x}#F(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return Xf(n,r),this.#N(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#I(n),this.#l.setHost(n),this.#f=n,n}#I(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#S=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#C=!0)}#L(e){this.#S&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#C&&=(e.style.removeProperty(`--trees-density-override`),!1)}};function Wv(e){let[t]=(0,U.useState)(()=>new Uv(e)),n=(0,U.useRef)({timeout:null,model:t});return(0,U.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}var Gv=`var(--azd-added)`,Kv=`var(--azd-deleted)`,qv=`var(--azd-muted)`;function Jv(e,t){let n=[],r=[];return e!=null&&((e.additions>0||e.deletions===0)&&n.push({text:`+${e.additions}`,color:Gv}),e.deletions>0&&n.push({text:`${n.length>0?`\xA0`:``}−${e.deletions}`,color:Kv}),r.push(`${e.additions} ${e.additions===1?`addition`:`additions`}, ${e.deletions} ${e.deletions===1?`deletion`:`deletions`}`)),t&&(n.push({text:`${n.length>0?`\xA0`:``}✓`,color:qv}),r.unshift(`Viewed`)),n.length===0?null:{text:n.map(e=>e.text).join(``),parts:n,title:r.join(` · `)}}var Yv={added:`added`,modified:`modified`,deleted:`deleted`,renamed:`renamed`},Xv={gitStatusTitles:{added:`Added`,modified:`Modified`,deleted:`Deleted`,renamed:`Renamed`}};function Zv({files:e,viewed:t,stats:n,currentPath:r,filter:i,onSelect:a}){let o=(0,U.useMemo)(()=>e.map(e=>e.path),[e]),s=(0,U.useMemo)(()=>e.map(e=>({path:e.path,status:Yv[e.change]})),[e]),c=(0,U.useRef)(a);c.current=a;let l=(0,U.useRef)(null),u=(0,U.useRef)(new Set(o)),d=(0,U.useRef)({viewed:t,stats:n});d.current={viewed:t,stats:n};let{model:f}=Wv({paths:o,gitStatus:s,flattenEmptyDirectories:!0,initialExpansion:`open`,density:`default`,itemHeight:28,icons:{set:`complete`,colored:!0},labels:Xv,fileTreeSearchMode:`hide-non-matches`,renderRowDecoration:(0,U.useRef)(({item:e})=>e.kind===`file`?Jv(d.current.stats.get(e.path),d.current.viewed.has(e.path)):null).current,onSelectionChange:e=>{let t=e.at(-1);t!==void 0&&t!==l.current&&u.current.has(t)&&c.current(t)}}),p=(0,U.useRef)(o);return(0,U.useEffect)(()=>{u.current=new Set(o),p.current!==o&&(p.current=o,f.resetPaths(o)),f.setGitStatus(s)},[f,o,s]),(0,U.useEffect)(()=>{f.setLabels(Xv)},[f,t,n]),(0,U.useEffect)(()=>{f.setSearch(i.length===0?null:i)},[f,i]),(0,U.useEffect)(()=>{if(r!==null){for(let e of f.getSelectedPaths())e!==r&&f.getItem(e)?.deselect();l.current=r,f.getItem(r)?.select(),f.scrollToPath(r,{offset:`nearest`})}},[f,r]),(0,W.jsx)(yd,{model:f,"aria-label":`Changed files`,"data-testid":`file-tree`,className:`azd-file-tree min-h-0 flex-1`,style:Qv})}var Qv={height:`100%`,"--trees-bg-override":`var(--azd-sidebar)`,"--trees-fg-override":`var(--azd-fg)`,"--trees-fg-muted-override":`var(--azd-muted)`,"--trees-bg-muted-override":`var(--azd-hover)`,"--trees-border-color-override":`var(--azd-border)`,"--trees-selected-bg-override":`var(--azd-selected)`,"--trees-selected-fg-override":`var(--azd-fg)`,"--trees-selected-focused-border-color-override":`var(--azd-accent)`,"--trees-focus-ring-color-override":`var(--azd-accent)`,"--trees-accent-override":`var(--azd-accent)`,"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`13px`,"--trees-border-radius-override":`6px`,"--trees-padding-inline-override":`8px`,"--trees-status-added-override":`var(--azd-added)`,"--trees-status-modified-override":`var(--azd-modified)`,"--trees-status-deleted-override":`var(--azd-deleted)`,"--trees-status-renamed-override":`var(--azd-renamed)`,"--trees-git-added-color-override":`var(--azd-added)`,"--trees-git-modified-color-override":`var(--azd-modified)`,"--trees-git-deleted-color-override":`var(--azd-deleted)`,"--trees-git-renamed-color-override":`var(--azd-renamed)`};function $v(e){let t=e.iterations.at(-1),n=e.iterations.filter(e=>t!==void 0&&e.id<t.id);return(0,W.jsx)(V,{label:`View options`,testId:`view-options`,trigger:e=>(0,W.jsx)(d,{...e,ref:e.ref,label:`View options`,framed:!0,"data-testid":`view-options-button`,children:(0,W.jsx)(p,{})}),children:(0,W.jsxs)(`div`,{className:`space-y-3.5`,children:[!e.readOnly&&(0,W.jsx)(ey,{label:`Changes`,children:(0,W.jsxs)(`select`,{"aria-label":`Changes`,value:e.since??``,onChange:t=>{let n=t.currentTarget.value;e.onSinceChange(n===``?null:Number(n))},className:`h-7 w-full min-w-0 rounded-md border border-border bg-raised px-1.5 text-xs text-fg hover:border-border-strong focus:border-[var(--azd-focus)] focus:outline-none`,"data-testid":`since-select`,children:[(0,W.jsx)(`option`,{value:``,children:`All changes`}),[...n].reverse().map(e=>(0,W.jsx)(`option`,{value:e.id,children:ty(e)},e.id))]})}),(0,W.jsx)(ey,{label:`Layout`,children:(0,W.jsx)(c,{label:`Layout`,value:e.diffStyle,onChange:e.onDiffStyleChange,stretch:!0,choices:[{value:`split`,label:`Split`},{value:`unified`,label:`Unified`}]})}),(0,W.jsx)(ey,{label:`Long lines`,children:(0,W.jsx)(c,{label:`Long lines`,value:e.overflow,onChange:e.onOverflowChange,stretch:!0,choices:[{value:`scroll`,label:`Scroll`},{value:`wrap`,label:`Wrap`}]})}),!e.readOnly&&(0,W.jsx)(ey,{label:`Comments`,children:(0,W.jsx)(c,{label:`Comments`,value:e.commentFilter,onChange:e.onCommentFilterChange,stretch:!0,choices:[{value:`all`,label:`All`},{value:`active`,label:`Active`},{value:`hidden`,label:`Hidden`}]})}),(0,W.jsx)(`div`,{className:`border-t border-border pt-2.5`,children:(0,W.jsxs)(`button`,{type:`button`,onClick:e.onShowHelp,className:`flex h-7 w-full items-center gap-2 rounded-md px-1.5 text-xs text-muted hover:bg-hover hover:text-fg`,children:[(0,W.jsx)(_,{className:`size-3.5`}),`Keyboard shortcuts`,(0,W.jsx)(`kbd`,{className:`ml-auto rounded border border-border px-1 font-mono text-[11px]`,children:`?`})]})})]})})}function ey({label:e,children:t}){return(0,W.jsxs)(`div`,{className:`grid grid-cols-[5.5rem_minmax(0,1fr)] items-center gap-2`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs text-muted`,children:e}),t]})}function ty(e){let t=Vt(e.createdDate),n=e.author?.displayName;return[`Since update ${e.id}`,t,n].filter(e=>e!==void 0&&e.length>0).join(` · `)}function ny({viewed:e,total:t}){let n=2*Math.PI*6,r=t===0?0:e/t,i=t>0&&e===t;return(0,W.jsxs)(`span`,{className:`flex h-8 shrink-0 items-center gap-2 rounded-[7px] px-2 text-[13px] text-muted`,"data-testid":`viewed-count`,title:`${e} of ${t} files viewed`,children:[(0,W.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,className:`size-4 -rotate-90`,children:[(0,W.jsx)(`circle`,{cx:`8`,cy:`8`,r:6,fill:`none`,stroke:`var(--azd-border-strong)`,strokeWidth:`2`}),(0,W.jsx)(`circle`,{cx:`8`,cy:`8`,r:6,fill:`none`,stroke:i?`var(--azd-added)`:`var(--azd-fg)`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`${r*n} ${n}`,className:`transition-[stroke-dasharray] duration-300 motion-reduce:transition-none`})]}),(0,W.jsxs)(`span`,{className:`tabular-nums`,children:[(0,W.jsx)(`span`,{className:`font-medium text-fg`,children:e}),` / `,t,(0,W.jsx)(`span`,{className:`ml-1`,children:`viewed`})]})]})}Eu();function ry({since:e,onSinceChange:n,location:r,initialPanel:i=`files`}){let{pullRequest:a}=Ze();return a.supportsIterations?(0,W.jsx)(cy,{location:r,pullRequest:a,source:{kind:`pull-request`,since:e,onSinceChange:n,initialPanel:i}},`${a.repository.id}:${a.pullRequestId}`):(0,W.jsx)(t,{sidebarLabel:`Inbox`,sidebar:(0,W.jsx)(Qe,{location:r}),topBar:(0,W.jsx)(Je,{mode:`review`}),children:(0,W.jsx)(f,{title:`This pull request has no updates to compare`,children:(0,W.jsx)(`p`,{children:`Azure DevOps reports that this pull request does not support iterations, so its changed files cannot be listed. Open it in Azure DevOps instead.`})})})}function iy({path:e}){let{location:t,shortForm:n}=Ze();return(0,W.jsxs)(ze,{location:t,shortForm:n,page:{tab:`conflicts`,file:`/${e}`},className:`inline-flex h-5 shrink-0 items-center gap-1 rounded-md px-1.5 text-xs text-warning shadow-[0_0_0_1px_var(--azd-border)] hover:bg-hover`,testId:`file-conflict`,title:`Resolve the conflict in ${e}`,children:[(0,W.jsx)(o,{className:`size-3`}),`Conflict`]})}function ay(){try{return globalThis.localStorage??null}catch{return null}}function oy(e){return u(e)||m(e,`unauthorized`)}var sy=6;function cy({location:e,pullRequest:n,source:r}){let o=r.kind===`commit`,c=r.kind===`pull-request`?r.since:null,u=(0,U.useMemo)(()=>({organization:e.organization,project:e.project,repositoryId:n.repository.id,pullRequestId:e.pullRequestId}),[e.organization,e.project,e.pullRequestId,n.repository.id]),f=o?null:u,p=ve(u,n,!o),m=(0,U.useMemo)(()=>new Set((p.data??[]).filter(e=>e.resolutionStatus!==`resolved`).map(e=>e.path.replace(/^\//,``))),[p.data]),h=ee(f),_=(0,U.useMemo)(()=>{let e=h.data,t=e?.at(-1);return e===void 0||t===void 0?null:{iteration:t,since:c!==null&&c<t.id?e.find(e=>e.id===c)??null:null}},[h.data,c]),v=k(f,_),y=te(f,_),b=r.kind===`commit`?r.changeSet:v.data,x=Ft(u,b??null),C=kt(),w=(0,U.useMemo)(()=>Xu(ay(),{organization:u.organization,repositoryId:u.repositoryId,pullRequestId:u.pullRequestId}),[u]),T=(0,U.useSyncExternalStore)(w.subscribe,w.revision),E=(0,U.useMemo)(()=>b?.files??[],[b]),D=(0,U.useRef)([]),O=(0,U.useMemo)(()=>_===null?null:{iteration:_.iteration.id,since:_.since?.id??0},[_]),A=(0,U.useCallback)((e,t,n)=>{let r=D.current.find(t=>t.id===e);return r===void 0?null:Bu(r.fileDiff,t,n)},[]),j=Tt({scope:u,comparison:O,repositoryName:n.repository.name,files:E,lineText:A}),M=zt({scope:u,location:e,pullRequest:n,latest:_?.iteration??null,since:_?.since?.id??null,lineText:A,review:j}),N=xt(j.store,e=>e.composers),P=(0,U.useMemo)(()=>new Set(N.map(e=>e.anchor.path)),[N]),F=(0,U.useMemo)(()=>o?new Set:new Set(E.filter(e=>w.isViewed(e)).map(e=>e.path)),[E,w,T,o]),[I,ne]=(0,U.useState)(()=>new Map);(0,U.useEffect)(()=>{b!==void 0&&ne(new Map)},[b]);let re=(0,U.useCallback)(e=>I.get(e.path)??(!P.has(e.path)&&(F.has(e.path)||At(e.path))),[I,F,P]),[ie,ae]=(0,U.useState)(null),oe=ie??E[0]?.path??null,se=(0,U.useMemo)(()=>{let e=Math.max(0,E.findIndex(e=>e.path===oe));return E.slice(e,e+sy).map(e=>e.path)},[E,oe]),{prioritize:L}=x;(0,U.useEffect)(()=>L(se),[L,se]);let{items:ce,summaries:le,ready:ue}=Gu({changeSet:b??null,sides:x.sides,threads:y.data,filter:C.commentFilter,collapsed:re,priority:se,composers:N}),R=(0,U.useRef)(null);D.current=ce;let de=(0,U.useRef)(null),[fe,pe]=(0,U.useState)(``),[me,he]=(0,U.useState)(!1),[ge,_e]=(0,U.useState)(r.kind===`pull-request`?r.initialPanel??`files`:`files`),ye=(0,U.useRef)(null),be=(0,U.useRef)(null),xe=(0,U.useCallback)(e=>{ye.current=e,ae(e),L([e]),R.current?.scrollTo({type:`item`,id:e,align:`start`})},[L]),Se=(0,U.useRef)(null),Ce=(0,U.useCallback)((e,t)=>{Se.current===null&&(Se.current=requestAnimationFrame(()=>{Se.current=null;let n=D.current;if(ye.current!==null){let n=t.getTopForItem(ye.current),r=be.current?.clientHeight??0;if(n!==void 0&&n>=e-4&&n<e+r)return;ye.current=null}let r=0,i=n.length-1,a=0;for(;r<=i;){let o=r+i>>1,s=t.getTopForItem(n[o]?.id??``);s!==void 0&&s<=e+4?(a=o,r=o+1):i=o-1}let o=n[a]?.id;o!==void 0&&ae(e=>e===o?e:o)}))},[]);(0,U.useEffect)(()=>()=>{Se.current!==null&&cancelAnimationFrame(Se.current)},[]);let z=(0,U.useCallback)((e,t)=>{ne(n=>new Map(n).set(e,t))},[]),we=(0,U.useCallback)((e,t)=>{let n=R.current?.getInstance()?.getTopForItem(e.path),r=be.current?.scrollTop??0;if(w.setViewed(e,t),ne(t=>{let n=new Map(t);return n.delete(e.path),n}),!t)return;n!==void 0&&n<r&&requestAnimationFrame(()=>R.current?.scrollTo({type:`item`,id:e.path,align:`start`}));let i=E.findIndex(t=>t.path===e.path),a=E[i+1];a!==void 0&&(ye.current=a.path,ae(a.path))},[w,E]),Te=(0,U.useRef)(null),Ee=(0,U.useCallback)(e=>{let t=[];for(let e of D.current){let n=[...e.annotations??[]].sort((e,t)=>e.lineNumber-t.lineNumber);for(let r of n){let n=r.metadata;(n.kind===`threads`||n.kind===`file`&&(n.threads.length>0||n.offDiff.length>0))&&t.push({id:e.id,lineNumber:r.lineNumber,side:r.side})}}if(t.length===0)return;let n=Te.current;if(n===null||t[n]?.id!==oe){let r=D.current.findIndex(e=>e.id===oe),i=t.findIndex(e=>D.current.findIndex(t=>t.id===e.id)>=r);n=e===1?(i===-1?t.length:i)-1:i===-1?t.length:i}let r=Math.min(t.length-1,Math.max(0,n+e));Te.current=r;let i=t[r];i!==void 0&&(ye.current=i.id,ae(i.id),D.current.find(e=>e.id===i.id)?.collapsed===!0&&z(i.id,!1),requestAnimationFrame(()=>{i.lineNumber===0?R.current?.scrollTo({type:`item`,id:i.id,align:`start`}):R.current?.scrollTo({type:`line`,id:i.id,lineNumber:i.lineNumber,side:i.side,align:`center`})}))},[oe,z]),De=(0,U.useCallback)(e=>{let t=E.findIndex(e=>e.path===oe),n=E[Math.min(E.length-1,Math.max(0,t+e))];n!==void 0&&xe(n.path)},[E,oe,xe]),Oe=(0,U.useRef)(null),ke=(0,U.useCallback)(()=>{let e=Oe.current;Oe.current=null,e instanceof HTMLElement&&e.isConnected&&e!==document.body&&e.focus();let t=be.current;t!==null&&(e===null||document.activeElement!==e)&&(t.hasAttribute(`tabindex`)||(t.tabIndex=-1),t.focus({preventScroll:!0}))},[]),Ae=(0,U.useCallback)((e,t)=>{let n=E.find(t=>t.path===e);if(n===void 0)return;let r={kind:`file`,path:e};t!==null&&(r={kind:`line`,path:e,side:n.change===`added`?`additions`:n.change===`deleted`?`deletions`:t.side,startLine:t.startLine,endLine:t.endLine});let i=document.activeElement;Oe.current=i instanceof HTMLTextAreaElement?null:i,re(n)&&z(e,!1),ye.current=e,ae(e),j.openComposer(r),requestAnimationFrame(()=>{r.kind===`line`?R.current?.scrollTo({type:`line`,id:e,lineNumber:r.endLine,side:r.side,align:`nearest`}):R.current?.scrollTo({type:`item`,id:e,align:`start`})})},[E,re,z,j]),je=(0,U.useRef)(Ae);je.current=Ae;let Me=(0,U.useCallback)(()=>{let e=R.current?.getSelectedLines()??null;if(e!==null){Ae(e.id,St(e.range));return}let t=D.current.find(e=>e.id===oe);if(t===void 0)return;let n=zu(t.fileDiff);Ae(t.id,n===null?null:{side:n.side,startLine:n.lineNumber,endLine:n.lineNumber})},[Ae,oe]),Ne=E.find(e=>e.path===oe);S({c:()=>{o||Me()},j:()=>De(1),k:()=>De(-1),n:()=>Ee(1),p:()=>Ee(-1),v:()=>{!o&&Ne!==void 0&&we(Ne,!F.has(Ne.path))},x:()=>{Ne!==void 0&&z(Ne.path,!re(Ne))},s:()=>Lt({diffStyle:C.diffStyle===`split`?`unified`:`split`}),w:()=>Lt({overflow:C.overflow===`wrap`?`scroll`:`wrap`}),t:()=>{C.panelCollapsed&&Lt({panelCollapsed:!1}),_e(`files`),requestAnimationFrame(()=>de.current?.focus())},"?":()=>he(!0)}),(0,U.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()===`f`){if(R.current===null)return;e.preventDefault(),R.current.openSearch()}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let Pe=(0,U.useMemo)(()=>({diffStyle:C.diffStyle,overflow:C.overflow,theme:Xe,themeType:`system`,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:44},layout:{paddingTop:16,paddingBottom:64,gap:12},unsafeCSS:Ie,hunkSeparators:`line-info`,collapsedContextThreshold:1,lineDiffType:`word-alt`,searchOptions:{disableShortcuts:!0},enableGutterUtility:!o,enableLineSelection:!o,lineHoverHighlight:`number`,...o?{}:{onLineSelectionEnd:(e,t)=>{if(e===null)return;let n=St(e);n.startLine!==n.endLine&&je.current(t.item.id,n)}}}),[C.diffStyle,C.overflow,o]),Fe=(0,U.useMemo)(()=>{let e=0,t=0;for(let n of le.values())e+=n.stats?.additions??0,t+=n.stats?.deletions??0;return{additions:e,deletions:t,ready:ue,files:E.length}},[le,ue,E.length]),Le=_?.iteration.id,Re=_!==null&&_.since===null;(0,U.useEffect)(()=>{!o&&Re&&Le!==void 0&&(Fe.files===0||Fe.ready<Fe.files||Et(Bt({...u,iteration:Le}),{additions:Fe.additions,deletions:Fe.deletions}))},[o,Re,Le,u,Fe]);let ze=(0,U.useMemo)(()=>{let e=new Map;for(let[t,n]of le)e.set(t,n.stats);return e},[le]),Be=(0,U.useCallback)(t=>r.kind===`commit`?`https://dev.azure.com/${[e.organization,e.project,`_git`,e.repository,`commit`,r.commitId].map(encodeURIComponent).join(`/`)}?path=${encodeURIComponent(`/${t}`)}`:g(`${s(e)}?_a=files&path=${encodeURIComponent(`/${t}`)}`),[e,r]),Ve=y.error!==null&&oy(y.error)?y.error:null,He=x.sessionError??Ve,Ue=()=>{x.retryFailed(),y.refetch()},We=(e,t)=>(0,W.jsx)(ly,{onActivate:()=>{let n=R.current?.getSelectedLines()??null;if(n!==null&&n.id===t.id){Ae(t.id,St(n.range));return}let r=e();r!==void 0&&`side`in r&&Ae(t.id,{side:r.side===`deletions`?`deletions`:`additions`,startLine:r.lineNumber,endLine:r.lineNumber})}}),Ge=r.kind===`commit`?r.error:h.error??v.error,B;B=Ge==null?!o&&h.data!==void 0&&h.data.length===0?(0,W.jsx)(dy,{title:`No updates yet`,text:`This pull request has no pushes to compare.`}):b===void 0?(0,W.jsx)(py,{}):E.length===0?(0,W.jsx)(dy,{title:o?`No file changes in this commit`:`No file changes in this comparison`,text:o?`This commit changes no files that can be shown (only folders or submodules).`:_?.since===null?`The source branch has no changes against the target.`:`Nothing changed between these updates. Choose All changes to see the whole pull request.`}):(0,W.jsx)(hu,{ref:R,containerRef:be,items:ce,options:Pe,onScroll:Ce,className:`azd-code-view azd-scrollbar min-h-0 flex-1 overflow-auto px-5 focus:outline-none`,style:{height:`100%`},renderCustomHeader:e=>{let t=le.get(e.id);return t===void 0?null:(0,W.jsx)(Pt,{summary:t,generated:At(e.id),collapsed:e.collapsed===!0,onToggleCollapsed:()=>z(e.id,e.collapsed!==!0),webUrl:Be(e.id),conflict:m.has(e.id)?(0,W.jsx)(iy,{path:e.id}):void 0,...o?{}:{viewed:F.has(e.id),onViewedChange:e=>we(t.file,e),onCommentOnFile:()=>Ae(e.id,null)}})},renderAnnotation:(e,t,n)=>(0,W.jsx)($u,{annotation:e.metadata,actions:{retry:()=>x.retry(n.id),loadLarge:()=>x.loadLarge(n.id),load:()=>L([n.id])},returnFocus:ke}),...o?{}:{renderGutterUtility:We}}):(0,W.jsx)(`div`,{className:`p-6`,children:(0,W.jsx)(Ht,{variant:`inline`,error:Ge,organization:e.organization,onRetry:()=>{r.kind===`commit`?r.retry():(h.refetch(),v.refetch())}})});let Ke=C.panelCollapsed?void 0:(0,W.jsx)(Wt,{filesCount:b===void 0?null:E.length,filter:fe,onFilterChange:pe,filterRef:de,panel:ge,onPanelChange:_e,currentCommit:r.kind===`commit`?r.commitId:null,totals:b===void 0||E.length===0?null:Fe,tree:b===void 0?(0,W.jsx)(fy,{}):(0,W.jsx)(Zv,{files:E,viewed:F,stats:ze,currentPath:oe,filter:fe,onSelect:xe})}),qe=Fe.ready<Fe.files,Ye=(0,W.jsxs)(t,{sidebarLabel:`Review`,sidebarId:`azd-file-panel`,sidebarWidth:C.panelWidth,sidebar:Ke,afterSidebar:C.panelCollapsed?null:(0,W.jsx)(uy,{width:C.panelWidth}),topBar:(0,W.jsx)(Je,{mode:`review`,lead:(0,W.jsx)(d,{label:C.panelCollapsed?`Show the sidebar`:`Hide the sidebar`,"aria-expanded":!C.panelCollapsed,"aria-controls":`azd-file-panel`,onClick:()=>Lt({panelCollapsed:!C.panelCollapsed}),className:`-ml-1.5`,children:(0,W.jsx)(a,{})}),title:b!==void 0&&E.length>0?(0,W.jsxs)(`span`,{className:`shrink-0`,title:qe?`${Fe.ready} of ${Fe.files} files counted`:void 0,children:[(0,W.jsx)(l,{additions:Fe.additions,deletions:Fe.deletions}),qe&&(0,W.jsx)(`span`,{className:`sr-only`,children:` (partial)`})]}):null,tools:(0,W.jsxs)(W.Fragment,{children:[!o&&b!==void 0&&(0,W.jsx)(ny,{viewed:F.size,total:E.length}),(0,W.jsx)(d,{label:`Search in the diff`,title:`Search in the diff (⌘F / Ctrl+F)`,framed:!0,onClick:()=>R.current?.openSearch(),disabled:b===void 0||E.length===0,children:(0,W.jsx)(i,{})}),(0,W.jsx)($v,{readOnly:o,diffStyle:C.diffStyle,onDiffStyleChange:e=>Lt({diffStyle:e}),overflow:C.overflow,onOverflowChange:e=>Lt({overflow:e}),iterations:h.data??[],since:_?.since?.id??null,onSinceChange:r.kind===`pull-request`?r.onSinceChange:()=>{},commentFilter:C.commentFilter,onCommentFilterChange:e=>Lt({commentFilter:e}),onShowHelp:()=>he(!0)})]})}),children:[(0,W.jsxs)(`section`,{"aria-label":`Diff`,className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:[r.kind===`commit`&&r.banner,He!==null&&(0,W.jsx)(`div`,{className:`absolute inset-x-0 top-0 z-30 p-3 shadow-[var(--azd-shadow)]`,"data-testid":`session-overlay`,children:(0,W.jsx)(Ht,{variant:`inline`,error:He,organization:e.organization,onRetry:Ue})}),(0,W.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:B})]}),(0,W.jsx)(Gt,{open:me,onClose:()=>he(!1)})]});return o?Ye:(0,W.jsx)(bt,{controller:j,children:(0,W.jsx)(Ot,{value:M,children:Ye})})}function ly({onActivate:e}){return(0,W.jsx)(`button`,{type:`button`,"aria-label":`Comment on this line`,title:`Comment on this line (drag across line numbers to cover several)`,"data-testid":`gutter-comment`,onClick:e,className:`azd-gutter-comment relative z-10 flex size-[18px] items-center justify-center rounded bg-accent text-accent-fg shadow-sm`,children:(0,W.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,className:`size-3`,fill:`none`,stroke:`currentColor`,children:(0,W.jsx)(`path`,{d:`M8 3.5v9M3.5 8h9`,strokeWidth:`1.8`,strokeLinecap:`round`})})})}function uy({width:e}){return(0,W.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize file tree`,"aria-valuenow":e,"aria-valuemin":180,"aria-valuemax":640,tabIndex:0,onPointerDown:t=>{t.preventDefault();let n=t.clientX,r=e,i=t.currentTarget;i.setPointerCapture(t.pointerId);let a=e=>Lt({panelWidth:r+e.clientX-n}),o=()=>{i.removeEventListener(`pointermove`,a),i.removeEventListener(`pointerup`,o)};i.addEventListener(`pointermove`,a),i.addEventListener(`pointerup`,o)},onKeyDown:t=>{let n=t.shiftKey?64:16;if(t.key===`ArrowLeft`)Lt({panelWidth:e-n});else if(t.key===`ArrowRight`)Lt({panelWidth:e+n});else return;t.preventDefault()},className:`-ml-px w-1 shrink-0 cursor-col-resize bg-transparent hover:bg-accent focus-visible:bg-accent`})}function dy({title:e,text:t}){return(0,W.jsxs)(`div`,{className:`mx-auto max-w-md px-6 py-20 text-center`,children:[(0,W.jsx)(`h2`,{className:`mb-1.5 text-[15px] font-semibold text-fg-strong`,children:e}),(0,W.jsx)(`p`,{className:`text-[13px] text-muted`,children:t})]})}function fy(){return(0,W.jsx)(`div`,{className:`space-y-2 p-3`,role:`status`,"aria-busy":`true`,"aria-label":`Loading files`,children:[72,56,64,48,80,60].map((e,t)=>(0,W.jsx)(`div`,{className:`azd-pulse h-3 rounded-full bg-raised`,style:{width:`${e}%`,marginLeft:t%3==0?0:12}},t))})}function py(){return(0,W.jsxs)(`div`,{className:`space-y-3 px-5 py-4`,"aria-busy":`true`,"data-testid":`files-loading`,children:[(0,W.jsx)(`p`,{className:`sr-only`,children:`Loading the changed files…`}),[0,1,2].map(e=>(0,W.jsxs)(`div`,{className:`overflow-hidden rounded-[10px] border border-border`,children:[(0,W.jsx)(`div`,{className:`azd-pulse h-11 bg-header`}),(0,W.jsxs)(`div`,{className:`space-y-1.5 p-3`,children:[(0,W.jsx)(`div`,{className:`azd-pulse h-2.5 w-3/4 rounded-full bg-raised`}),(0,W.jsx)(`div`,{className:`azd-pulse h-2.5 w-1/2 rounded-full bg-raised`}),(0,W.jsx)(`div`,{className:`azd-pulse h-2.5 w-2/3 rounded-full bg-raised`})]})]},e))]})}export{cy as n,ry as t};