markstream-vue2 0.0.50 → 0.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -1
- package/dist/chunks/andromeeda-0e066d27.js +4 -0
- package/dist/chunks/andromeeda-beebe2f9.cjs +1 -0
- package/dist/chunks/aurora-x-7d279c8e.cjs +1 -0
- package/dist/chunks/aurora-x-e4f2fe1b.js +4 -0
- package/dist/chunks/ayu-dark-349c357c.js +4 -0
- package/dist/chunks/ayu-dark-5e86208e.cjs +1 -0
- package/dist/chunks/ayu-light-18928686.cjs +1 -0
- package/dist/chunks/ayu-light-bfc150f8.js +4 -0
- package/dist/chunks/ayu-mirage-3383fcd0.js +4 -0
- package/dist/chunks/ayu-mirage-3af5c477.cjs +1 -0
- package/dist/chunks/catppuccin-frappe-32dd8ebe.js +4 -0
- package/dist/chunks/catppuccin-frappe-5990e1cc.cjs +1 -0
- package/dist/chunks/catppuccin-latte-7dd9ec26.cjs +1 -0
- package/dist/chunks/catppuccin-latte-842c8be1.js +4 -0
- package/dist/chunks/catppuccin-macchiato-0c355ced.js +4 -0
- package/dist/chunks/catppuccin-macchiato-12297a0c.cjs +1 -0
- package/dist/chunks/catppuccin-mocha-164bffb5.cjs +1 -0
- package/dist/chunks/catppuccin-mocha-840be6a5.js +4 -0
- package/dist/chunks/dark-plus-37515867.cjs +1 -0
- package/dist/chunks/dark-plus-51ee0d5e.js +4 -0
- package/dist/chunks/dracula-6e5c19a8.js +4 -0
- package/dist/chunks/dracula-ad0b94e0.cjs +1 -0
- package/dist/chunks/dracula-soft-223c44b5.cjs +1 -0
- package/dist/chunks/dracula-soft-744d21b1.js +4 -0
- package/dist/chunks/everforest-dark-3a566062.js +4 -0
- package/dist/chunks/everforest-dark-630f597e.cjs +1 -0
- package/dist/chunks/everforest-light-92583419.js +4 -0
- package/dist/chunks/everforest-light-ba8af69c.cjs +1 -0
- package/dist/chunks/github-dark-44cb1819.cjs +1 -0
- package/dist/chunks/github-dark-cb4e8bb4.js +4 -0
- package/dist/chunks/github-dark-default-d50179ae.js +4 -0
- package/dist/chunks/github-dark-default-f99477eb.cjs +1 -0
- package/dist/chunks/github-dark-dimmed-96ccf893.cjs +1 -0
- package/dist/chunks/github-dark-dimmed-ebbb9420.js +4 -0
- package/dist/chunks/github-dark-high-contrast-5cc08661.js +4 -0
- package/dist/chunks/github-dark-high-contrast-adcd4e61.cjs +1 -0
- package/dist/chunks/github-light-42f759a4.cjs +1 -0
- package/dist/chunks/github-light-555bd325.js +4 -0
- package/dist/chunks/github-light-default-50fa37cd.cjs +1 -0
- package/dist/chunks/github-light-default-9c006cf6.js +4 -0
- package/dist/chunks/github-light-high-contrast-15a9bb5a.cjs +1 -0
- package/dist/chunks/github-light-high-contrast-ffa0564e.js +4 -0
- package/dist/chunks/gruvbox-dark-hard-4412389e.js +4 -0
- package/dist/chunks/gruvbox-dark-hard-cc007dcd.cjs +1 -0
- package/dist/chunks/gruvbox-dark-medium-415e09f2.cjs +1 -0
- package/dist/chunks/gruvbox-dark-medium-fa0eeef7.js +4 -0
- package/dist/chunks/gruvbox-dark-soft-3125d894.cjs +1 -0
- package/dist/chunks/gruvbox-dark-soft-a4600b2a.js +4 -0
- package/dist/chunks/gruvbox-light-hard-4c8c0395.cjs +1 -0
- package/dist/chunks/gruvbox-light-hard-8e736562.js +4 -0
- package/dist/chunks/gruvbox-light-medium-0c0cbf5d.js +4 -0
- package/dist/chunks/gruvbox-light-medium-abf52b0c.cjs +1 -0
- package/dist/chunks/gruvbox-light-soft-0e7ed903.cjs +1 -0
- package/dist/chunks/gruvbox-light-soft-a35d50d0.js +4 -0
- package/dist/chunks/horizon-31da8ee5.js +4 -0
- package/dist/chunks/horizon-bright-bb8b03f8.js +4 -0
- package/dist/chunks/horizon-bright-d2ea0b12.cjs +1 -0
- package/dist/chunks/horizon-f8b833c3.cjs +1 -0
- package/dist/chunks/houston-20eb8cbf.cjs +1 -0
- package/dist/chunks/houston-d3d3c60d.js +4 -0
- package/dist/chunks/index-42602bc0.js +18739 -0
- package/dist/chunks/index-b485917b.cjs +1 -0
- package/dist/chunks/index-c958c796.cjs +1 -0
- package/dist/chunks/index-fce73667.js +1702 -0
- package/dist/chunks/kanagawa-dragon-0246ed94.cjs +1 -0
- package/dist/chunks/kanagawa-dragon-324edcdc.js +4 -0
- package/dist/chunks/kanagawa-lotus-61838bd3.cjs +1 -0
- package/dist/chunks/kanagawa-lotus-a847832a.js +4 -0
- package/dist/chunks/kanagawa-wave-2b426416.cjs +1 -0
- package/dist/chunks/kanagawa-wave-7b8409ec.js +4 -0
- package/dist/chunks/laserwave-538ee8e3.js +4 -0
- package/dist/chunks/laserwave-d5e6cfa6.cjs +1 -0
- package/dist/chunks/light-plus-471df294.cjs +1 -0
- package/dist/chunks/light-plus-a0703fa7.js +4 -0
- package/dist/chunks/material-theme-686d9ffc.js +4 -0
- package/dist/chunks/material-theme-9d859633.cjs +1 -0
- package/dist/chunks/material-theme-darker-cac9360e.js +4 -0
- package/dist/chunks/material-theme-darker-fe8dd38a.cjs +1 -0
- package/dist/chunks/material-theme-lighter-03523bbb.js +4 -0
- package/dist/chunks/material-theme-lighter-879be29a.cjs +1 -0
- package/dist/chunks/material-theme-ocean-37052f40.js +4 -0
- package/dist/chunks/material-theme-ocean-c1caeaa4.cjs +1 -0
- package/dist/chunks/material-theme-palenight-70bbf617.js +4 -0
- package/dist/chunks/material-theme-palenight-ef8b2399.cjs +1 -0
- package/dist/chunks/min-dark-0baaa2b0.cjs +1 -0
- package/dist/chunks/min-dark-16b503e6.js +4 -0
- package/dist/chunks/min-light-0c4ea4ec.js +4 -0
- package/dist/chunks/min-light-f65395e0.cjs +1 -0
- package/dist/chunks/monokai-32171550.js +4 -0
- package/dist/chunks/monokai-b9c22257.cjs +1 -0
- package/dist/chunks/night-owl-5eeb6e45.cjs +1 -0
- package/dist/chunks/night-owl-cb71e64c.js +4 -0
- package/dist/chunks/night-owl-light-3b4be46f.js +4 -0
- package/dist/chunks/night-owl-light-f04fad9f.cjs +1 -0
- package/dist/chunks/nord-0b42b6b4.cjs +1 -0
- package/dist/chunks/nord-b2f653cd.js +4 -0
- package/dist/chunks/one-dark-pro-611d46bc.js +4 -0
- package/dist/chunks/one-dark-pro-6ac63500.cjs +1 -0
- package/dist/chunks/one-light-2f27f0f0.cjs +1 -0
- package/dist/chunks/one-light-f2b411cc.js +4 -0
- package/dist/chunks/pierre-dark-9c2ca7e3.cjs +1 -0
- package/dist/chunks/pierre-dark-f4c18c96.js +4 -0
- package/dist/chunks/pierre-dark-protanopia-deuteranopia-31face57.js +4 -0
- package/dist/chunks/pierre-dark-protanopia-deuteranopia-67028f58.cjs +1 -0
- package/dist/chunks/pierre-dark-soft-3103370a.js +4 -0
- package/dist/chunks/pierre-dark-soft-59e1d5bc.cjs +1 -0
- package/dist/chunks/pierre-dark-tritanopia-b2966d75.js +4 -0
- package/dist/chunks/pierre-dark-tritanopia-d87f3323.cjs +1 -0
- package/dist/chunks/pierre-dark-vibrant-4de6032d.js +4 -0
- package/dist/chunks/pierre-dark-vibrant-f4553619.cjs +1 -0
- package/dist/chunks/pierre-light-45d08543.js +4 -0
- package/dist/chunks/pierre-light-ae152c30.cjs +1 -0
- package/dist/chunks/pierre-light-protanopia-deuteranopia-78f5453c.cjs +1 -0
- package/dist/chunks/pierre-light-protanopia-deuteranopia-816a3304.js +4 -0
- package/dist/chunks/pierre-light-soft-2a7b83ed.cjs +1 -0
- package/dist/chunks/pierre-light-soft-9c96aa07.js +4 -0
- package/dist/chunks/pierre-light-tritanopia-22534644.cjs +1 -0
- package/dist/chunks/pierre-light-tritanopia-b49f3566.js +4 -0
- package/dist/chunks/pierre-light-vibrant-178f2e13.cjs +1 -0
- package/dist/chunks/pierre-light-vibrant-1d779afc.js +4 -0
- package/dist/chunks/plastic-050a5288.js +4 -0
- package/dist/chunks/plastic-ab5115cb.cjs +1 -0
- package/dist/chunks/poimandres-9b9bffc0.cjs +1 -0
- package/dist/chunks/poimandres-e7807ea4.js +4 -0
- package/dist/chunks/red-58c74b50.cjs +1 -0
- package/dist/chunks/red-8b5bb9fd.js +4 -0
- package/dist/chunks/rose-pine-dawn-c54a297c.js +4 -0
- package/dist/chunks/rose-pine-dawn-dcd06a2d.cjs +1 -0
- package/dist/chunks/rose-pine-e3dfc7b6.js +4 -0
- package/dist/chunks/rose-pine-e443c3f3.cjs +1 -0
- package/dist/chunks/rose-pine-moon-c4ae0bee.cjs +1 -0
- package/dist/chunks/rose-pine-moon-ff747b44.js +4 -0
- package/dist/chunks/slack-dark-119fdcba.cjs +1 -0
- package/dist/chunks/slack-dark-cba39ccf.js +4 -0
- package/dist/chunks/slack-ochin-4a97383e.js +4 -0
- package/dist/chunks/slack-ochin-e53abb89.cjs +1 -0
- package/dist/chunks/snazzy-light-863adb77.js +4 -0
- package/dist/chunks/snazzy-light-aacd1ca8.cjs +1 -0
- package/dist/chunks/solarized-dark-18286b81.js +4 -0
- package/dist/chunks/solarized-dark-6c53ecf9.cjs +1 -0
- package/dist/chunks/solarized-light-abef5a54.cjs +1 -0
- package/dist/chunks/solarized-light-e7adfa5b.js +4 -0
- package/dist/chunks/synthwave-84-26ebbfca.js +4 -0
- package/dist/chunks/synthwave-84-ddb2c535.cjs +1 -0
- package/dist/chunks/tokyo-night-25368f86.js +4 -0
- package/dist/chunks/tokyo-night-6e0b49fd.cjs +1 -0
- package/dist/chunks/vesper-0ba44279.js +4 -0
- package/dist/chunks/vesper-a2e0b586.cjs +1 -0
- package/dist/chunks/vitesse-black-2be67ba4.cjs +1 -0
- package/dist/chunks/vitesse-black-33005deb.js +4 -0
- package/dist/chunks/vitesse-dark-82a14fc3.cjs +1 -0
- package/dist/chunks/vitesse-dark-9bb81e7a.js +4 -0
- package/dist/chunks/vitesse-light-2f9f7ba9.js +4 -0
- package/dist/chunks/vitesse-light-ee2c704b.cjs +1 -0
- package/dist/chunks/wasm-4cd10f60.cjs +1 -0
- package/dist/chunks/wasm-cb55701e.js +30 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +5993 -5718
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/tailwind.ts +1 -1
- package/dist/types/components/CodeBlockNode/CodeBlockNode.vue.d.ts +27 -0
- package/dist/types/components/NodeRenderer/CodeBlockNodeLoading.vue.d.ts +94 -0
- package/dist/types/components/NodeRenderer/asyncComponent.d.ts +1 -0
- package/dist/types/types/component-props.d.ts +3 -0
- package/package.json +8 -4
- package/dist/chunks/index-754b8598.js +0 -8
- package/dist/chunks/index-a4867ea2.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e,t,n,i,o,r,l=Object.defineProperty,s=Object.defineProperties,a=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,h=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable,f=Reflect.get,p=Math.pow,g=(e,t,n)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,m=(e,t)=>{for(var n in t||(t={}))u.call(t,n)&&g(e,n,t[n]);if(d)for(var n of d(t))c.call(t,n)&&g(e,n,t[n]);return e},v=(e,t)=>s(e,a(t)),b=(e,t)=>{var n={};for(var i in e)u.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&d)for(var i of d(e))t.indexOf(i)<0&&c.call(e,i)&&(n[i]=e[i]);return n},S=(e,t,n)=>(g(e,"symbol"!=typeof t?t+"":t,n),n),y=(e,t,n)=>new Promise((i,o)=>{var r=e=>{try{s(n.next(e))}catch(t){o(t)}},l=e=>{try{s(n.throw(e))}catch(t){o(t)}},s=e=>e.done?i(e.value):Promise.resolve(e.value).then(r,l);s((n=n.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("shiki"),C="diffs-container",k=(()=>{try{return"development"===process.env.NODE_ENV}catch(e){return!1}})(),L=/(?=^From [a-f0-9]+ .+$)/m,w=/(?=^diff --git)/gm,T=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,E=new RegExp("(?<=\\n)"),I=/^(---|\+\+\+)\s+([^\t\r\n]+)/,A=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,R=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,M=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,H="header-prefix",P="header-metadata",D="header-custom",O={dark:"pierre-dark",light:"pierre-light"},N="data-theme-css",F="data-unsafe-css",z="data-core-css",U="data-diffs-scrollbar-measure",B="--diffs-scrollbar-gutter-measured",j=1e5,$={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},V=v(m({},$),{hunkLineCount:1}),_={paddingTop:8,paddingBottom:8,gap:8},q={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},W=Object.freeze({fromStart:0,fromEnd:0}),G={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},K={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},X=new Set;let Y=null;function J(e){X.add(e),null!=Y||(Y=requestAnimationFrame(Q))}function Z(e){X.delete(e),0===X.size&&null!=Y&&(cancelAnimationFrame(Y),Y=null)}function Q(e){const t=new Set(X);X.clear();for(const i of t)try{i(e)}catch(n){console.error(n)}Y=X.size>0?requestAnimationFrame(Q):null}function ee(e,t,n){if(e===t||null==e||null==t)return e===t;const i=new Set(n),o=Object.keys(e),r=new Set(Object.keys(t));for(const l of o)if(r.delete(l),!(i.has(l)||l in t&&e[l]===t[l]))return!1;for(const l of Array.from(r))if(!i.has(l))return!1;return!0}function te(e,t){return null==e||null==t||"string"==typeof e||"string"==typeof t?e===t:e.dark===t.dark&&e.light===t.light}function ne(e,t){var n,i;const o=null!=(n=null==e?void 0:e.theme)?n:O,r=null!=(i=null==t?void 0:t.theme)?i:O,l=ie(e),s=ie(t);return te(o,r)&&ee(e,t,["theme","parseDiffOptions"])&&ee(l,s)}function ie(e){if(null!=e&&"parseDiffOptions"in e)return e.parseDiffOptions}function oe(e,t){return(null==e?void 0:e.start)===(null==t?void 0:t.start)&&(null==e?void 0:e.end)===(null==t?void 0:t.end)&&(null==e?void 0:e.side)===(null==t?void 0:t.side)&&(null==e?void 0:e.endSide)===(null==t?void 0:t.endSide)}function re({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:i=!1,fitPerfectlyOverscroll:o=0,overscrollSize:r}){const l=n+2*r,s=i?n+2*o:l;if(l>=(t=Math.max(t,s))||i){const n=Math.max(e-o,0),i=Math.min(e+s,t);return{top:n,bottom:Math.max(i,n)}}let a=e+n/2-l/2,d=a+l;return a<0&&(a=0),d>t&&(d=t),a=Math.floor(Math.max(a,0)),{top:a,bottom:Math.ceil(Math.max(Math.min(d,t),a))}}function le(){return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function se(e){return{type:"text",value:e}}function ae({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function de({name:e,width:t=16,height:n=16,properties:i}){return ae({tagName:"svg",properties:m({width:t,height:n,viewBox:"0 0 16 16"},i),children:[ae({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function he(e){let t=e.children[0];for(;null!=t;){if("element"===t.type&&"code"===t.tagName)return t;t="children"in t?t.children[0]:null}}function ue(e){return ae({tagName:"div",properties:{"data-gutter":""},children:e})}function ce(e,t,n,i={}){return ae({tagName:"div",properties:m({"data-line-type":e,"data-column-number":t,"data-line-index":n},i),children:null!=t?[ae({tagName:"span",properties:{"data-line-number-content":""},children:[se(`${t}`)]})]:void 0})}function fe(e,t,n){return ae({tagName:"div",properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":"annotation"===t?void 0:e,style:"annotation"===t?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function pe(){return ae({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[de({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}const ge=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class me{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function ve(e,t){const n={},i={};for(const o of e)Object.assign(n,o.property),Object.assign(i,o.normal);return new me(n,i,t)}function be(e){return e.toLowerCase()}me.prototype.normal={},me.prototype.property={},me.prototype.space=void 0;class Se{constructor(e,t){this.attribute=t,this.property=e}}Se.prototype.attribute="",Se.prototype.booleanish=!1,Se.prototype.boolean=!1,Se.prototype.commaOrSpaceSeparated=!1,Se.prototype.commaSeparated=!1,Se.prototype.defined=!1,Se.prototype.mustUseProperty=!1,Se.prototype.number=!1,Se.prototype.overloadedBoolean=!1,Se.prototype.property="",Se.prototype.spaceSeparated=!1,Se.prototype.space=void 0;let ye=0;const xe=Ie(),Ce=Ie(),ke=Ie(),Le=Ie(),we=Ie(),Te=Ie(),Ee=Ie();function Ie(){return p(2,++ye)}const Ae=Object.freeze(Object.defineProperty({__proto__:null,boolean:xe,booleanish:Ce,commaOrSpaceSeparated:Ee,commaSeparated:Te,number:Le,overloadedBoolean:ke,spaceSeparated:we},Symbol.toStringTag,{value:"Module"})),Re=Object.keys(Ae);class Me extends Se{constructor(e,t,n,i){let o=-1;if(super(e,t),He(this,"space",i),"number"==typeof n)for(;++o<Re.length;){const e=Re[o];He(this,Re[o],(n&Ae[e])===Ae[e])}}}function He(e,t,n){n&&(e[t]=n)}function Pe(e){const t={},n={};for(const[i,o]of Object.entries(e.properties)){const r=new Me(i,e.transform(e.attributes||{},i),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(r.mustUseProperty=!0),t[i]=r,n[be(i)]=i,n[be(r.attribute)]=i}return new me(t,n,e.space)}Me.prototype.defined=!0;const De=Pe({properties:{ariaActiveDescendant:null,ariaAtomic:Ce,ariaAutoComplete:null,ariaBusy:Ce,ariaChecked:Ce,ariaColCount:Le,ariaColIndex:Le,ariaColSpan:Le,ariaControls:we,ariaCurrent:null,ariaDescribedBy:we,ariaDetails:null,ariaDisabled:Ce,ariaDropEffect:we,ariaErrorMessage:null,ariaExpanded:Ce,ariaFlowTo:we,ariaGrabbed:Ce,ariaHasPopup:null,ariaHidden:Ce,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:we,ariaLevel:Le,ariaLive:null,ariaModal:Ce,ariaMultiLine:Ce,ariaMultiSelectable:Ce,ariaOrientation:null,ariaOwns:we,ariaPlaceholder:null,ariaPosInSet:Le,ariaPressed:Ce,ariaReadOnly:Ce,ariaRelevant:null,ariaRequired:Ce,ariaRoleDescription:we,ariaRowCount:Le,ariaRowIndex:Le,ariaRowSpan:Le,ariaSelected:Ce,ariaSetSize:Le,ariaSort:null,ariaValueMax:Le,ariaValueMin:Le,ariaValueNow:Le,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function Oe(e,t){return t in e?e[t]:t}function Ne(e,t){return Oe(e,t.toLowerCase())}const Fe=Pe({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Te,acceptCharset:we,accessKey:we,action:null,allow:null,allowFullScreen:xe,allowPaymentRequest:xe,allowUserMedia:xe,alt:null,as:null,async:xe,autoCapitalize:null,autoComplete:we,autoFocus:xe,autoPlay:xe,blocking:we,capture:null,charSet:null,checked:xe,cite:null,className:we,cols:Le,colSpan:null,content:null,contentEditable:Ce,controls:xe,controlsList:we,coords:Le|Te,crossOrigin:null,data:null,dateTime:null,decoding:null,default:xe,defer:xe,dir:null,dirName:null,disabled:xe,download:ke,draggable:Ce,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:xe,formTarget:null,headers:we,height:Le,hidden:ke,high:Le,href:null,hrefLang:null,htmlFor:we,httpEquiv:we,id:null,imageSizes:null,imageSrcSet:null,inert:xe,inputMode:null,integrity:null,is:null,isMap:xe,itemId:null,itemProp:we,itemRef:we,itemScope:xe,itemType:we,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:xe,low:Le,manifest:null,max:null,maxLength:Le,media:null,method:null,min:null,minLength:Le,multiple:xe,muted:xe,name:null,nonce:null,noModule:xe,noValidate:xe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:xe,optimum:Le,pattern:null,ping:we,placeholder:null,playsInline:xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:xe,referrerPolicy:null,rel:we,required:xe,reversed:xe,rows:Le,rowSpan:Le,sandbox:we,scope:null,scoped:xe,seamless:xe,selected:xe,shadowRootClonable:xe,shadowRootDelegatesFocus:xe,shadowRootMode:null,shape:null,size:Le,sizes:null,slot:null,span:Le,spellCheck:Ce,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Le,step:null,style:null,tabIndex:Le,target:null,title:null,translate:null,type:null,typeMustMatch:xe,useMap:null,value:Ce,width:Le,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:we,axis:null,background:null,bgColor:null,border:Le,borderColor:null,bottomMargin:Le,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:xe,declare:xe,event:null,face:null,frame:null,frameBorder:null,hSpace:Le,leftMargin:Le,link:null,longDesc:null,lowSrc:null,marginHeight:Le,marginWidth:Le,noResize:xe,noHref:xe,noShade:xe,noWrap:xe,object:null,profile:null,prompt:null,rev:null,rightMargin:Le,rules:null,scheme:null,scrolling:Ce,standby:null,summary:null,text:null,topMargin:Le,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Le,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:xe,disableRemotePlayback:xe,prefix:null,property:null,results:Le,security:null,unselectable:null},space:"html",transform:Ne}),ze=Pe({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ee,accentHeight:Le,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Le,amplitude:Le,arabicForm:null,ascent:Le,attributeName:null,attributeType:null,azimuth:Le,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Le,by:null,calcMode:null,capHeight:Le,className:we,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Le,diffuseConstant:Le,direction:null,display:null,dur:null,divisor:Le,dominantBaseline:null,download:xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:Le,enableBackground:null,end:null,event:null,exponent:Le,externalResourcesRequired:null,fill:null,fillOpacity:Le,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Te,g2:Te,glyphName:Te,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Le,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Le,horizOriginX:Le,horizOriginY:Le,id:null,ideographic:Le,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Le,k:Le,k1:Le,k2:Le,k3:Le,k4:Le,kernelMatrix:Ee,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Le,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Le,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Le,overlineThickness:Le,paintOrder:null,panose1:null,path:null,pathLength:Le,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:we,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Le,pointsAtY:Le,pointsAtZ:Le,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ee,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ee,rev:Ee,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ee,requiredFeatures:Ee,requiredFonts:Ee,requiredFormats:Ee,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Le,specularExponent:Le,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Le,strikethroughThickness:Le,string:null,stroke:null,strokeDashArray:Ee,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Le,strokeOpacity:Le,strokeWidth:null,style:null,surfaceScale:Le,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ee,tabIndex:Le,tableValues:null,target:null,targetX:Le,targetY:Le,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ee,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Le,underlineThickness:Le,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Le,values:null,vAlphabetic:Le,vMathematical:Le,vectorEffect:null,vHanging:Le,vIdeographic:Le,version:null,vertAdvY:Le,vertOriginX:Le,vertOriginY:Le,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Le,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Oe}),Ue=Pe({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),Be=Pe({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ne}),je=Pe({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),$e=/[A-Z]/g,Ve=/-[a-z]/g,_e=/^data[-\w.:]+$/i;function qe(e){return"-"+e.toLowerCase()}function We(e){return e.charAt(1).toUpperCase()}const Ge=ve([De,Fe,Ue,Be,je],"html"),Ke=ve([De,ze,Ue,Be,je],"svg"),Xe={}.hasOwnProperty,Ye=/["&'<>`]/g,Je=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ze=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Qe=/[|\\{}()[\]^$+*?.]/g,et=new WeakMap;const tt=/[\dA-Fa-f]/,nt=/\d/,it=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],ot={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},rt=["cent","copy","divide","gt","lt","not","para","times"],lt={}.hasOwnProperty,st={};let at;for(at in ot)lt.call(ot,at)&&(st[ot[at]]=at);const dt=/[^\dA-Za-z]/;function ht(e,t,n){let i,o=function(e,t,n){const i="&#x"+e.toString(16).toUpperCase();return n&&t&&!tt.test(String.fromCharCode(t))?i:i+";"}(e,t,n.omitOptionalSemicolons);if((n.useNamedReferences||n.useShortestReferences)&&(i=function(e,t,n,i){const o=String.fromCharCode(e);if(lt.call(st,o)){const e=st[o],r="&"+e;return n&&it.includes(e)&&!rt.includes(e)&&(!i||t&&61!==t&&dt.test(String.fromCharCode(t)))?r:r+";"}return""}(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){const i=function(e,t,n){const i="&#"+String(e);return n&&t&&!nt.test(String.fromCharCode(t))?i:i+";"}(e,t,n.omitOptionalSemicolons);i.length<o.length&&(o=i)}return i&&(!n.useShortestReferences||i.length<o.length)?i:o}function ut(e,t){return function(e,t){return e=e.replace(t.subset?function(e){let t=et.get(e);return t||(t=function(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(Qe,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}(e),et.set(e,t)),t}(t.subset):Ye,n),t.subset||t.escapeOnly?e:e.replace(Je,function(e,n,i){return t.format(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536,i.charCodeAt(n+2),t)}).replace(Ze,n);function n(e,n,i){return t.format(e.charCodeAt(0),i.charCodeAt(n+1),t)}}(e,Object.assign({format:ht},t))}const ct=/^>|^->|<!--|-->|--!>|<!-$/g,ft=[">"],pt=["<",">"];function gt(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let i=0,o=n.indexOf(t);for(;-1!==o;)i++,o=n.indexOf(t,o+t.length);return i}function mt(e,t){const n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}function vt(e){return e.join(" ").trim()}const bt=/[ \t\n\f\r]/g;function St(e){return"object"==typeof e?"text"===e.type&&yt(e.value):yt(e)}function yt(e){return""===e.replace(bt,"")}const xt=Lt(1),Ct=Lt(-1),kt=[];function Lt(e){return function(t,n,i){const o=t?t.children:kt;let r=(n||0)+e,l=o[r];if(!i)for(;l&&St(l);)r+=e,l=o[r];return l}}const wt={}.hasOwnProperty;function Tt(e){return function(t,n,i){return wt.call(e,t.tagName)&&e[t.tagName](t,n,i)}}const Et=Tt({body:function(e,t,n){const i=xt(n,t);return!i||"comment"!==i.type},caption:It,colgroup:It,dd:function(e,t,n){const i=xt(n,t);return!i||"element"===i.type&&("dt"===i.tagName||"dd"===i.tagName)},dt:function(e,t,n){const i=xt(n,t);return Boolean(i&&"element"===i.type&&("dt"===i.tagName||"dd"===i.tagName))},head:It,html:function(e,t,n){const i=xt(n,t);return!i||"comment"!==i.type},li:function(e,t,n){const i=xt(n,t);return!i||"element"===i.type&&"li"===i.tagName},optgroup:function(e,t,n){const i=xt(n,t);return!i||"element"===i.type&&"optgroup"===i.tagName},option:function(e,t,n){const i=xt(n,t);return!i||"element"===i.type&&("option"===i.tagName||"optgroup"===i.tagName)},p:function(e,t,n){const i=xt(n,t);return i?"element"===i.type&&("address"===i.tagName||"article"===i.tagName||"aside"===i.tagName||"blockquote"===i.tagName||"details"===i.tagName||"div"===i.tagName||"dl"===i.tagName||"fieldset"===i.tagName||"figcaption"===i.tagName||"figure"===i.tagName||"footer"===i.tagName||"form"===i.tagName||"h1"===i.tagName||"h2"===i.tagName||"h3"===i.tagName||"h4"===i.tagName||"h5"===i.tagName||"h6"===i.tagName||"header"===i.tagName||"hgroup"===i.tagName||"hr"===i.tagName||"main"===i.tagName||"menu"===i.tagName||"nav"===i.tagName||"ol"===i.tagName||"p"===i.tagName||"pre"===i.tagName||"section"===i.tagName||"table"===i.tagName||"ul"===i.tagName):!n||!("element"===n.type&&("a"===n.tagName||"audio"===n.tagName||"del"===n.tagName||"ins"===n.tagName||"map"===n.tagName||"noscript"===n.tagName||"video"===n.tagName))},rp:At,rt:At,tbody:function(e,t,n){const i=xt(n,t);return!i||"element"===i.type&&("tbody"===i.tagName||"tfoot"===i.tagName)},td:Rt,tfoot:function(e,t,n){return!xt(n,t)},th:Rt,thead:function(e,t,n){const i=xt(n,t);return Boolean(i&&"element"===i.type&&("tbody"===i.tagName||"tfoot"===i.tagName))},tr:function(e,t,n){const i=xt(n,t);return!i||"element"===i.type&&"tr"===i.tagName}});function It(e,t,n){const i=xt(n,t,!0);return!i||"comment"!==i.type&&!("text"===i.type&&St(i.value.charAt(0)))}function At(e,t,n){const i=xt(n,t);return!i||"element"===i.type&&("rp"===i.tagName||"rt"===i.tagName)}function Rt(e,t,n){const i=xt(n,t);return!i||"element"===i.type&&("td"===i.tagName||"th"===i.tagName)}const Mt=Tt({body:function(e){const t=xt(e,-1,!0);return!(t&&("comment"===t.type||"text"===t.type&&St(t.value.charAt(0))||"element"===t.type&&("meta"===t.tagName||"link"===t.tagName||"script"===t.tagName||"style"===t.tagName||"template"===t.tagName)))},colgroup:function(e,t,n){const i=Ct(n,t),o=xt(e,-1,!0);return!(n&&i&&"element"===i.type&&"colgroup"===i.tagName&&Et(i,n.children.indexOf(i),n))&&Boolean(o&&"element"===o.type&&"col"===o.tagName)},head:function(e){const t=new Set;for(const i of e.children)if("element"===i.type&&("base"===i.tagName||"title"===i.tagName)){if(t.has(i.tagName))return!1;t.add(i.tagName)}const n=e.children[0];return!n||"element"===n.type},html:function(e){const t=xt(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,n){const i=Ct(n,t),o=xt(e,-1);return(!n||!i||"element"!==i.type||"thead"!==i.tagName&&"tbody"!==i.tagName||!Et(i,n.children.indexOf(i),n))&&Boolean(o&&"element"===o.type&&"tr"===o.tagName)}}),Ht={name:[["\t\n\f\r &/=>".split(""),"\t\n\f\r \"&'/=>`".split("")],["\0\t\n\f\r \"&'/<=>".split(""),"\0\t\n\f\r \"&'/<=>`".split("")]],unquoted:[["\t\n\f\r &>".split(""),"\0\t\n\f\r \"&'<=>`".split("")],["\0\t\n\f\r \"&'<=>`".split(""),"\0\t\n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Pt(e,t,n){const i=function(e,t){const n=be(t);let i=t,o=Se;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&_e.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(Ve,We);i="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!Ve.test(e)){let n=e.replace($e,qe);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}o=Me}return new o(i,t)}(e.schema,t),o=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,r=e.settings.allowDangerousCharacters?0:1;let l,s=e.quote;if(!i.overloadedBoolean||n!==i.attribute&&""!==n?!i.boolean&&!i.overloadedBoolean||"string"==typeof n&&n!==i.attribute&&""!==n||(n=Boolean(n)):n=!0,null==n||!1===n||"number"==typeof n&&Number.isNaN(n))return"";const a=ut(i.attribute,Object.assign({},e.settings.characterReferences,{subset:Ht.name[o][r]}));return!0===n?a:(n=Array.isArray(n)?(i.commaSeparated?mt:vt)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n?a:(e.settings.preferUnquoted&&(l=ut(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Ht.unquoted[o][r]}))),l!==n&&(e.settings.quoteSmart&>(n,s)>gt(n,e.alternative)&&(s=e.alternative),l=s+ut(n,Object.assign({},e.settings.characterReferences,{subset:("'"===s?Ht.single:Ht.double)[o][r],attribute:!0}))+s),a+(l?"="+l:l)))}const Dt=["<","&"];function Ot(e,t,n,i){return!n||"element"!==n.type||"script"!==n.tagName&&"style"!==n.tagName?ut(e.value,Object.assign({},i.settings.characterReferences,{subset:Dt})):e.value}const Nt=function(e,t){const n=t||{};function i(t,...n){let o=i.invalid;const r=i.handlers;if(t&&Xe.call(t,e)){const n=String(t[e]);o=Xe.call(r,n)?r[n]:i.unknown}if(o)return o.call(this,t,...n)}return i.handlers=n.handlers||{},i.invalid=n.invalid,i.unknown=n.unknown,i}("type",{invalid:function(e){throw new Error("Expected node, not `"+e+"`")},unknown:function(e){throw new Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,n,i){return i.settings.bogusComments?"<?"+ut(e.value,Object.assign({},i.settings.characterReferences,{subset:ft}))+">":"\x3c!--"+e.value.replace(ct,function(e){return ut(e,Object.assign({},i.settings.characterReferences,{subset:pt}))})+"--\x3e"},doctype:function(e,t,n,i){return"<!"+(i.settings.upperDoctype?"DOCTYPE":"doctype")+(i.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,n,i){const o=i.schema,r="svg"!==o.space&&i.settings.omitOptionalTags;let l="svg"===o.space?i.settings.closeEmptyElements:i.settings.voids.includes(e.tagName.toLowerCase());const s=[];let a;"html"===o.space&&"svg"===e.tagName&&(i.schema=Ke);const d=function(e,t){const n=[];let i,o=-1;if(t)for(i in t)if(null!==t[i]&&void 0!==t[i]){const o=Pt(e,i,t[i]);o&&n.push(o)}for(;++o<n.length;){const t=e.settings.tightAttributes?n[o].charAt(n[o].length-1):void 0;o!==n.length-1&&'"'!==t&&"'"!==t&&(n[o]+=" ")}return n.join("")}(i,e.properties),h=i.all("html"===o.space&&"template"===e.tagName?e.content:e);return i.schema=o,h&&(l=!1),!d&&r&&Mt(e,t,n)||(s.push("<",e.tagName,d?" "+d:""),l&&("svg"===o.space||i.settings.closeSelfClosing)&&(a=d.charAt(d.length-1),(!i.settings.tightSelfClosing||"/"===a||a&&'"'!==a&&"'"!==a)&&s.push(" "),s.push("/")),s.push(">")),s.push(h),l||r&&Et(e,t,n)||s.push("</"+e.tagName+">"),s.join("")},raw:function(e,t,n,i){return i.settings.allowDangerousHtml?e.value:Ot(e,0,n,i)},root:function(e,t,n,i){return i.all(e)},text:Ot}}),Ft={},zt={},Ut=[];function Bt(e,t){const n=t||Ft,i=n.quote||'"',o='"'===i?"'":'"';if('"'!==i&&"'"!==i)throw new Error("Invalid quote `"+i+"`, expected `'` or `\"`");return{one:jt,all:$t,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||ge,characterReferences:n.characterReferences||zt,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:"svg"===n.space?Ke:Ge,quote:i,alternative:o}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function jt(e,t,n){return Nt(e,t,n,this)}function $t(e){const t=[],n=e&&e.children||Ut;let i=-1;for(;++i<n.length;)t[i]=this.one(n[i],i,e);return t.join("")}var Vt=class{constructor(e,t){S(this,"mode"),S(this,"options"),S(this,"hoveredLine"),S(this,"hoveredToken"),S(this,"pre"),S(this,"gutterUtilityLine"),S(this,"gutterUtilityContainer"),S(this,"gutterUtilityButton"),S(this,"gutterUtilitySlot"),S(this,"interactiveLinesAttr",!1),S(this,"interactiveLineNumbersAttr",!1),S(this,"hasPointerListeners",!1),S(this,"hasDocumentPointerListeners",!1),S(this,"selectedRange",null),S(this,"proposedSelectedRange"),S(this,"renderedSelectionRange"),S(this,"selectionAnchor"),S(this,"queuedSelectionRender"),S(this,"pointerSession",{mode:"idle"}),S(this,"getHoveredLine",()=>{var e;const t=null!=(e=this.gutterUtilityLine)?e:this.hoveredLine;if(null!=t){if("diff"===this.mode&&"diff-line"===t.type)return{lineNumber:t.lineNumber,side:t.annotationSide};if("file"===this.mode&&"line"===t.type)return{lineNumber:t.lineNumber}}}),S(this,"handlePointerClick",e=>{const{onHunkExpand:t,onLineClick:n,onLineNumberClick:i,onTokenClick:o,onMergeConflictActionClick:r}=this.options;null==t&&null==n&&null==i&&null==r&&null==o||null!=this.options.onGutterUtilityClick&&tn(e.composedPath())||(nn(this.options.__debugPointerEvents,"click"),this.handlePointerEvent({eventType:"click",event:e}))}),S(this,"handlePointerMove",e=>{if("mouse"!==e.pointerType)return;const{lineHoverHighlight:t="disabled",onLineEnter:n,onLineLeave:i,onTokenEnter:o,onTokenLeave:r,enableGutterUtility:l=!1}=this.options;("disabled"!==t||l||null!=n||null!=i||null!=o||null!=r)&&(nn(this.options.__debugPointerEvents,"move"),this.handlePointerEvent({eventType:"move",event:e}))}),S(this,"handlePointerLeave",e=>{var t,n,i,o;const{__debugPointerEvents:r}=this.options;nn(r,"move"),null!=this.hoveredLine||null!=this.hoveredToken?(null!=this.hoveredToken&&(null==(n=(t=this.options).onTokenLeave)||n.call(t,this.hoveredToken,e),this.clearHoveredToken()),null!=this.hoveredLine&&(null==(o=(i=this.options).onLineLeave)||o.call(i,v(m({},this.hoveredLine),{event:e})),this.clearHoveredLine()),this.placeUtility()):nn(r,"move")}),S(this,"handlePointerDown",e=>{if("mouse"===e.pointerType&&0!==e.button||null==this.pre||"idle"!==this.pointerSession.mode)return;const t=e.composedPath();tn(t)&&null!=this.options.onGutterUtilityClick?this.startGutterSelectionFromPointerDown(e):("mouse"!==e.pointerType&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))}),S(this,"handleDocumentPointerMove",e=>{const{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionPoint(e,{source:"coordinates-first"});if(null==n)return;return this.pointerSession.current=n,void(!0===t&&this.updateSelection(n.lineNumber,n.side))}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(null==t||null==this.selectionAnchor)return;return void this.updateSelection(t.lineNumber,t.eventSide)}case"pendingSingleLineUnselect":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(null==t||null==this.selectionAnchor)return;if(i={lineNumber:t.lineNumber,side:t.eventSide},(n=this.pointerSession.pending).lineNumber===i.lineNumber&&n.side===i.side)return;return this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),void(this.pointerSession={mode:"selecting",pointerId:e.pointerId})}}var n,i}),S(this,"handleDocumentPointerUp",e=>{const{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const i=this.resolveSelectionPoint(e,{source:"coordinates-first"});return null!=i&&(this.pointerSession.current=i,t&&this.updateSelection(i.lineNumber,i.side)),null==n||n(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()),this.clearPointerSession(),void this.detachDocumentPointerListeners()}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;return e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),void this.clearProposedSelection();case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()}}),S(this,"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()}}),S(this,"renderSelection",()=>{if(null!=this.queuedSelectionRender&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),null==this.pre||this.renderedSelectionRange===this.selectedRange)return;const e=this.pre.querySelectorAll("[data-selected-line]");for(const s of e)s.removeAttribute("data-selected-line");if(this.renderedSelectionRange=this.selectedRange,null==this.selectedRange)return;const{children:t}=this.pre;if(0===t.length)return;if(t.length>2)throw console.error(t),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const n="split"===this.pre.getAttribute("data-diff-type"),i=this.getIndexesFromSelection(this.selectedRange,n);if(null==i)throw console.error({rowRange:i,selectedRange:this.selectedRange}),new Error("InteractionManager.renderSelection: No valid rowRange");const o=i.start===i.end,r=Math.min(i.start,i.end),l=Math.max(i.start,i.end);for(const s of t){const[e,t]=s.children,i=t.children.length;if(i!==e.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");for(let s=0;s<i;s++){const i=t.children[s],a=e.children[s];if(!(i instanceof HTMLElement&&a instanceof HTMLElement))continue;const d=this.parseLineIndex(i,n);if((null!=d?d:0)>l)break;if(null==d||d<r)continue;let h=o?"single":d===r?"first":d===l?"last":"";i.setAttribute("data-selected-line",h),a.setAttribute("data-selected-line",h),a.nextSibling instanceof HTMLElement&&i.nextSibling instanceof HTMLElement&&(i.nextSibling.hasAttribute("data-line-annotation")||i.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(o?(h="last",i.setAttribute("data-selected-line","first")):d===r?h="":d===l&&i.setAttribute("data-selected-line",""),i.nextSibling.setAttribute("data-selected-line",h),a.nextSibling.setAttribute("data-selected-line",h))}}}),this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){var e,t,n,i,o,r,l;null==(e=this.pre)||e.removeEventListener("click",this.handlePointerClick),null==(t=this.pre)||t.removeEventListener("pointerdown",this.handlePointerDown),null==(n=this.pre)||n.removeEventListener("pointermove",this.handlePointerMove),null==(i=this.pre)||i.removeEventListener("pointerleave",this.handlePointerLeave),null==(o=this.pre)||o.removeAttribute("data-interactive-lines"),null==(r=this.pre)||r.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,null==(l=this.gutterUtilityContainer)||l.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(),null!=this.queuedSelectionRender&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}setup(e){this.setSelectionDirty();const{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):null!=this.gutterUtilityContainer&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,"gutterSelecting"===this.pointerSession.mode&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectionRange=void 0}isSelectionDirty(){return null===this.renderedSelectionRange}setSelection(e,t){var n;const i=!(e===this.selectedRange||oe(null!=e?e:void 0,null!=(n=this.selectedRange)?n:void 0));(this.isSelectionDirty()||i)&&(this.proposedSelectedRange=void 0,this.selectedRange=e,this.renderSelection(),this.placeUtility(),i&&!1!==(null==t?void 0:t.notify)&&this.notifySelectionCommitted())}getSelection(){return this.selectedRange}handlePointerEvent({eventType:e,event:t}){var n,i;const{__debugPointerEvents:o}=this.options,r=t.composedPath();nn(o,e);const l=this.resolvePointerTarget(r);nn(o,e);const{onLineClick:s,onLineNumberClick:a,onLineEnter:d,onLineLeave:h,onTokenClick:u,onTokenEnter:c,onTokenLeave:f,onHunkExpand:p,onMergeConflictActionClick:g}=this.options;switch(e){case"move":{const e=Kt(l)&&(null==(n=this.hoveredLine)?void 0:n.lineElement)===l.lineElement;Gt(l)&&(null==(i=this.hoveredToken)?void 0:i.tokenElement)===l.tokenElement||(null!=this.hoveredToken&&(null==f||f(this.hoveredToken,t),this.clearHoveredToken()),Gt(l)&&(this.setHoveredToken(this.toTokenEventBaseProps(l)),null==c||c(this.hoveredToken,t))),e||(null!=this.hoveredLine&&(null==h||h(v(m({},this.hoveredLine),{event:t})),this.clearHoveredLine()),Kt(l)?(this.setHoveredLine(this.toEventBaseProps(l)),this.placeUtility(),null==d||d(v(m({},this.hoveredLine),{event:t}))):this.placeUtility());break}case"click":{if(null==l)break;if(function(e){return"kind"in e&&"merge-conflict-action"===e.kind}(l)&&null!=g){g(l);break}if(function(e){return"type"in e&&"line-info"===e.type}(l)&&null!=p){p(l.hunkIndex,l.all||t.shiftKey?"both":l.direction,l.all||t.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!Kt(l))break;Gt(l)&&null!=u&&u(this.toTokenEventBaseProps(l),t);const e=this.toEventBaseProps(l);null!=a&&l.numberColumn?a(v(m({},e),{event:t})):null!=s&&s(v(m({},e),{event:t}));break}}}syncPointerListeners(e){const{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:i,onLineNumberClick:o,onLineEnter:r,onLineLeave:l,onTokenClick:s,onTokenEnter:a,onTokenLeave:d,onHunkExpand:h,onMergeConflictActionClick:u,enableGutterUtility:c=!1,enableLineSelection:f=!1,onGutterUtilityClick:p}=this.options,g=null!=p,m="disabled"!==n||null!=i||null!=o||null!=r||null!=l||null!=s||null!=a||null!=d||null!=h||null!=u||c||f||g;m&&!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,nn(t,"click",(()=>{const e=[];"both"!==t&&"click"!==t||(null!=i&&e.push("onLineClick"),null!=o&&e.push("onLineNumberClick"),null!=h&&e.push("expandable hunk separators"),null!=u&&e.push("merge conflict actions"))})()),nn(t,"move"),nn(t,"move")):!m&&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);const v="selecting"===this.pointerSession.mode||"pendingSingleLineUnselect"===this.pointerSession.mode,b="gutterSelecting"===this.pointerSession.mode;(!f&&v||!g&&b)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(null==this.pre)return;const{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,i=null!=e,o=null!=t||n;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),o&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!o&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1)}startLineSelectionFromPointerDown(e){var t,n,i;const{enableLineSelection:o=!1}=this.options;if(!o)return;const r=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(null==r)return;const{pre:l}=this;if(null==l)return;const{lineNumber:s,eventSide:a,lineIndex:d}=r;if(e.shiftKey&&null!=this.selectedRange){const n=this.getIndexesFromSelection(this.selectedRange,"split"===l.getAttribute("data-diff-type"));if(null==n)return;const i=n.start<=n.end?d>=n.start:d<=n.end;return this.selectionAnchor={lineNumber:i?this.selectedRange.start:this.selectedRange.end,side:i?this.selectedRange.side:null!=(t=this.selectedRange.endSide)?t:this.selectedRange.side},this.updateSelection(s,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},void this.attachDocumentPointerListeners()}if((null==(n=this.selectedRange)?void 0:n.start)===s&&(null==(i=this.selectedRange)?void 0:i.end)===s){const t={lineNumber:s,side:a};return this.selectionAnchor=t,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:t,pending:t},void this.attachDocumentPointerListeners()}!0===this.options.controlledSelection?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:s,side:a},this.updateSelection(s,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){var t,n;const{enableLineSelection:i=!1,onGutterUtilityClick:o}=this.options;if(null==o)return;const r=this.currentSelectionEnds(),l=null!=(t=null==r?void 0:r.bottom)?t:this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),s=null!=(n=null==r?void 0:r.top)?n:l;null!=l&&null!=s&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:s,current:l},i&&(this.selectionAnchor={lineNumber:s.lineNumber,side:s.side},this.updateSelection(l.lineNumber,l.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange())),this.attachDocumentPointerListeners())}clearHoveredLine(){null!=this.hoveredLine&&(this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0)}setHoveredLine(e){const{lineHoverHighlight:t="disabled"}=this.options;null!=this.hoveredLine&&this.clearHoveredLine(),this.hoveredLine=e,"disabled"!==t&&("both"!==t&&"line"!==t||this.hoveredLine.lineElement.setAttribute("data-hovered",""),"both"!==t&&"number"!==t||this.hoveredLine.numberElement.setAttribute("data-hovered",""))}clearHoveredToken(){null!=this.hoveredToken&&(this.hoveredToken=void 0)}setHoveredToken(e){null!=this.hoveredToken&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){var t;if(null==this.gutterUtilityContainer&&(this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","")),e)null!=this.gutterUtilityButton&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),null==this.gutterUtilitySlot&&(this.gutterUtilitySlot=document.createElement("slot"),this.gutterUtilitySlot.name="gutter-utility-slot"),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(null==(t=this.gutterUtilitySlot)||t.remove(),this.gutterUtilitySlot=void 0,null==this.gutterUtilityButton){const e=document.createElement("div");e.innerHTML=Bt(pe());const t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw new 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;const t=this.resolvePointerTarget(e);Wt(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){this.placeUtilityFromSelection()||(null==this.hoveredLine?this.hideUtility():this.showUtilityOnLine(this.hoveredLine))}placeUtilityFromSelection(){const e=this.currentSelectionEnds();if(null==e)return!1;const t=this.targetForSelectionPoint(e.bottom);return null==t?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){null!=this.gutterUtilityContainer&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){var e;null==(e=this.gutterUtilityContainer)||e.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){const e=this.getCurrentSelectionRange();return null==e?void 0:this.selectionEnds(e)}selectionEnds(e){var t;const n={lineNumber:e.start,side:e.side},i={lineNumber:e.end,side:null!=(t=e.endSide)?t:e.side},o=this.selectionPointRowIndex(n),r=this.selectionPointRowIndex(i);if(null!=o&&null!=r)return o>r?{top:i,bottom:n}:{top:n,bottom:i}}selectionPointRowIndex(e){const t=this.getLineIndex(e.lineNumber,e.side);if(null!=t)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(null==this.pre)return;const t=this.getLineIndex(e.lineNumber,e.side);if(null==t)return;const n="diff"===this.mode?`${t[0]},${t[1]}`:`${t[0]}`,i=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(const o of i){if(!(o instanceof HTMLElement))continue;const t=this.resolvePointerTarget(Jt(o));if(Wt(t)&&("diff"!==this.mode||null==e.side||t.side===e.side))return t}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){"pendingSingleLineUnselect"===this.pointerSession.mode&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,t){const n=this.resolvePointerTarget(e);if(Wt(n)&&(!t||n.numberColumn)&&null!=n.splitLineIndex)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:"diff"===this.mode?n.side:void 0}}resolveSelectionInfo(e,t){const n=this.resolveSelectionPath(e,t);return null!=n?this.selectionInfoFromPath(n,t.requireNumberColumn):void 0}selectionPointFromPath(e){const t=this.resolvePointerTarget(e);if(Wt(t))return{lineNumber:t.lineNumber,side:"diff"===this.mode?t.side:void 0}}resolveSelectionPoint(e,t){const n=this.resolveSelectionPath(e,t);return null!=n?this.selectionPointFromPath(n):void 0}resolveSelectionPath(e,t){const n=!1!==t.excludeUtility;switch(t.source){case"event-path":return this.pathFromEventPath(e.composedPath(),n);case"coordinates-first":{const t=this.pathFromCoordinates(e,n);return void 0!==t?null!=t?t:void 0:this.pathFromEventPath(e.composedPath(),n)}}}pathFromCoordinates(e,t){var n;const i=this.hitTest(e);if(void 0!==i)return null===i?null:null!=(n=this.pathFromElement(i,t))?n:null}pathFromEventPath(e,t){if(!t||!tn(e))for(const n of e)if(n instanceof Element)return this.pathFromElement(n,t)}pathFromElement(e,t){const n=Jt(e);if(t&&tn(n))return;const i=function(e){const t=e.closest("[data-line], [data-column-number]");if(t instanceof HTMLElement)return t;const n=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(n instanceof HTMLElement))return;const i=n.previousElementSibling;return i instanceof HTMLElement&&(i.hasAttribute("data-line")||i.hasAttribute("data-column-number"))?i:void 0}(e);return null!=i?Jt(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){const t=function(e){if(null==e)return;const t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(null==t)return;const n=Number.parseInt(t[2],10);return!Number.isFinite(n)||n<=0?void 0:{lineNumber:n,side:t[1]}}(function(e){var t,n;const i=e.closest('[slot^="annotation-"]');if(i instanceof HTMLElement)return null!=(t=i.getAttribute("slot"))?t:void 0;if(e instanceof HTMLElement){const t=null!=(n=e.getAttribute("name"))?n:void 0;return null!=t&&t.startsWith("annotation-")?t:void 0}}(e));if(null==t)return;const n=this.targetForSelectionPoint(t);return null!=n?Jt(n.lineElement):void 0}hitTest(e){var t;if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const n=null==(t=this.pre)?void 0:t.getRootNode(),i=Zt(n)?n:Zt(document)?document:void 0;return null!=i?i.elementFromPoint(e.clientX,e.clientY):void 0}getLineIndex(e,t){const{getLineIndex:n}=this.options;return null!=n?n(e,t):[e-1,e-1]}getCurrentSelectionRange(){return void 0!==this.proposedSelectedRange?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){var i,o,r,l;const s=this.getCurrentSelectionRange();let a;if(null==e)a=null;else{const n=null!=(o=null==(i=this.selectionAnchor)?void 0:i.side)?o:t,s=null!=(l=null==(r=this.selectionAnchor)?void 0:r.lineNumber)?l:e;a=this.buildSelectionRange(s,e,n,t)}oe(null!=s?s:void 0,null!=a?a:void 0)||(!0===this.options.controlledSelection?this.proposedSelectedRange=a:(this.selectedRange=a,null!=this.queuedSelectionRender||(this.queuedSelectionRender=requestAnimationFrame(this.renderSelection))),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){var n;if(null==this.pre)return;const i=this.getLineIndex(e.start,e.side),o=this.getLineIndex(e.end,null!=(n=e.endSide)?n:e.side);return null!=i&&null!=o?{start:t?i[1]:i[0],end:t?o[1]:o[0]}:void 0}notifySelectionCommitted(){var e,t,n;null==(n=(t=this.options).onLineSelected)||n.call(t,null!=(e=this.getCurrentSelectionRange())?e:null)}notifySelectionChangeDelta(){var e,t,n;null==(n=(t=this.options).onLineSelectionChange)||n.call(t,null!=(e=this.getCurrentSelectionRange())?e:null)}notifySelectionStart(e){var t,n;null==(n=(t=this.options).onLineSelectionStart)||n.call(t,e)}notifySelectionEnd(e){var t,n;null==(n=(t=this.options).onLineSelectionEnd)||n.call(t,e)}toEventBaseProps(e){return"file"===this.mode?{type:"line",lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:"diff-line",annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:o,tokenText:r}){return"file"===this.mode?{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:o,tokenText:r}:{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:n,side:i,tokenElement:o,tokenText:r}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,i){return m(m({start:e,end:t},null!=n?{side:n}:{}),n!==i&&null!=i?{endSide:i}:{})}resolvePointerTarget(e){var t,n,i,o,r,l,s,a;let d,h,u,c,f,p,g,v,b,S,y=!1;for(const m of e){if(!(m instanceof HTMLElement))continue;if(null==S&&m.hasAttribute("data-merge-conflict-action")){const e=null!=(t=m.getAttribute("data-merge-conflict-action"))?t:void 0,i=null!=(n=m.getAttribute("data-merge-conflict-conflict-index"))?n:void 0,o=null!=i?Number.parseInt(i,10):NaN;Xt(e)&&Number.isFinite(o)&&(S={kind:"merge-conflict-action",resolution:e,conflictIndex:o})}if(null==p&&m.hasAttribute("data-char")){p=m;const e=m.getAttribute("data-char");if(null!=e){const t=Number.parseInt(e,10);if(!Number.isNaN(t)){const e=null!=(i=m.textContent)?i:"",n=t+e.length;""===e.trim()&&!0!==this.options.enableTokenInteractionsOnWhitespace||(g={tokenElement:p,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}const e=null==f&&null!=(o=m.getAttribute("data-column-number"))?o:void 0;if(null!=e){f=m,b=Number.parseInt(e,10),y=!0,d=en(m),c=null!=(r=m.getAttribute("data-line-index"))?r:void 0;continue}const x=null==u&&null!=(l=m.getAttribute("data-line"))?l:void 0;if(null!=x){u=m,b=Number.parseInt(x,10),d=en(m),c=null!=(s=m.getAttribute("data-line-index"))?s:void 0;continue}if(null==v&&(m.hasAttribute("data-expand-button")||m.hasAttribute("data-unmodified-lines"))){v={hunkIndex:void 0,direction:(()=>m.hasAttribute("data-expand-up")?"up":m.hasAttribute("data-expand-down")?"down":"both")(),all:m.hasAttribute("data-expand-all-button")};continue}const C=null!=v&&null!=(a=m.getAttribute("data-expand-index"))?a:void 0;if(null!=v&&null!=C){const e=Number.parseInt(C,10);Number.isNaN(e)||(v.hunkIndex=e);continue}if(null==h&&m.hasAttribute("data-code")){h=m;break}}if(null!=S)return S;if(null!=(null==v?void 0:v.hunkIndex))return{type:"line-info",hunkIndex:v.hunkIndex,direction:v.direction,all:v.all};if(null!=u||(u=null!=c?Yt(h,`[data-line][data-line-index="${c}"]`):void 0),null!=f||(f=null!=c?Yt(h,`[data-column-number][data-line-index="${c}"]`):void 0),null==h||null==u||null==f||null==d||null==b||Number.isNaN(b))return;const x=this.parseLineIndex(u,this.isSplitDiff());return null!=g?"file"===this.mode?m({kind:"token",lineType:d,lineElement:u,lineNumber:b,numberColumn:y,numberElement:f,side:void 0,splitLineIndex:x},g):m({kind:"token",lineType:d,lineElement:u,lineNumber:b,numberColumn:y,numberElement:f,side:Qt(d,h),splitLineIndex:x},g):"file"===this.mode?{kind:"line",lineType:d,lineElement:u,lineNumber:b,numberColumn:y,numberElement:f,side:void 0,splitLineIndex:x}:{kind:"line",lineType:d,lineElement:u,lineNumber:b,numberColumn:y,numberElement:f,side:Qt(d,h),splitLineIndex:x}}isSplitDiff(){var e;return"split"===(null==(e=this.pre)?void 0:e.getAttribute("data-diff-type"))}parseLineIndex(e,t){var n;const i=(null!=(n=e.getAttribute("data-line-index"))?n:"").split(",").map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));return t&&2===i.length?i[1]:t?void 0:i[0]}};function _t({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:i,onLineClick:o,onLineEnter:r,onLineLeave:l,onLineNumberClick:s,onTokenClick:a,onTokenEnter:d,onTokenLeave:h,renderGutterUtility:u,__debugPointerEvents:c,enableLineSelection:f,controlledSelection:p,onLineSelected:g,onLineSelectionStart:m,onLineSelectionChange:v,onLineSelectionEnd:b},S,y,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:qt({enableGutterUtility:t,renderGutterUtility:u,onGutterUtilityClick:i}),usesCustomGutterUtility:null!=u,lineHoverHighlight:n,onGutterUtilityClick:i,onHunkExpand:S,onMergeConflictActionClick:x,onLineClick:o,onLineEnter:r,onLineLeave:l,onLineNumberClick:s,onTokenClick:a,onTokenEnter:d,onTokenLeave:h,__debugPointerEvents:c,enableLineSelection:f,controlledSelection:p,onLineSelected:g,onLineSelectionStart:m,onLineSelectionChange:v,onLineSelectionEnd:b,getLineIndex:y}}function qt({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(null!=n&&null!=t)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return null!=e&&e}function Wt(e){return null!=e&&"kind"in e&&"line"===e.kind}function Gt(e){return null!=e&&"kind"in e&&"token"===e.kind}function Kt(e){return Wt(e)||Gt(e)}function Xt(e){return"current"===e||"incoming"===e||"both"===e}function Yt(e,t){const n=null==e?void 0:e.querySelector(t);return n instanceof HTMLElement?n:void 0}function Jt(e){const t=[];let n=e;for(;null!=n;)t.push(n),n=n.parentNode;return t}function Zt(e){return null!=e&&"function"==typeof e.elementFromPoint}function Qt(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function en(e){const t=e.getAttribute("data-line-type");if(null!=t)switch(t){case"change-deletion":case"change-addition":case"context":case"context-expanded":return t;default:return}}function tn(e){for(const t of e)if(t instanceof HTMLElement&&(t.hasAttribute("data-utility-button")||t.hasAttribute("data-gutter-utility-slot")||"gutter-utility-slot"===t.getAttribute("slot")||"gutter-utility-slot"===t.getAttribute("name")))return!0;return!1}function nn(e="none",t,...n){switch(e){case"none":return;case"both":break;case"click":if("click"!==t)return;break;case"move":if("move"!==t)return}}var on=(e=class{constructor(){S(this,"observedNodes",new Map),S(this,"applyColumnUpdates",e=>{for(const[t,n]of e){const e=null!=n.codeInlineSize?rn(n.codeInlineSize):t.codeWidth,i=null!=n.numberInlineSize?ln(n.numberInlineSize):t.numberWidth,o=e!==t.codeWidth,r=i!==t.numberWidth;if((o||r)&&(t.codeWidth=e,t.numberWidth=i,o&&t.codeElement.style.setProperty("--diffs-column-width","number"==typeof e?`${e}px`:"auto"),r&&t.codeElement.style.setProperty("--diffs-column-number-width",0===i?"auto":`${i}px`),o||r&&"auto"!==e)){const n="number"==typeof e?Math.max(e-i,0):0;t.codeElement.style.setProperty("--diffs-column-content-width",n>0?`${n}px`:"auto")}}})}static getResizeObserver(){var t;const n=null!=(t=e.resizeObserver)?t:new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=n,n}static handleSharedResizeEntries(t){const n=new Map;for(const i of t){const t=e.managersByElement.get(i.target);if(null==t)continue;const o=n.get(t);null==o?n.set(t,[i]):o.push(i)}for(const[e,i]of n)e.handleResizeEntries(i)}setup(e,t){var n;const i=new Set;let o=0;const r=new Map(this.observedNodes);this.observedNodes.clear();for(const l of e.children){if(2===o)break;const e=(()=>{if(l instanceof HTMLElement&&"CODE"===l.tagName)return l})();if(null==e)continue;o++;let t=r.get(e);if(null!=t&&"code"!==t.type)throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let n=e.firstElementChild;n instanceof HTMLElement||(n=null),null!=t?(this.observedNodes.set(e,t),r.delete(e),t.numberElement!==n?(null!=t.numberElement&&(this.unobserve(t.numberElement),r.delete(t.numberElement)),null!=n&&(this.observe(n),r.delete(n),this.observedNodes.set(n,t)),t.numberElement=n,t.numberWidth=0):null!=t.numberElement?(r.delete(t.numberElement),this.observedNodes.set(t.numberElement,t)):t.numberWidth=0):(t={type:"code",codeElement:e,numberElement:n,codeWidth:"auto",numberWidth:0},this.observedNodes.set(e,t),this.observe(e),null!=n&&(this.observedNodes.set(n,t),this.observe(n)))}if(o>1&&!t){const t=e.querySelectorAll('[data-line-annotation*=","]'),o=new Map;for(const e of t){if(!(e instanceof HTMLElement))continue;const t=null!=(n=e.getAttribute("data-line-annotation"))?n:"";if(!/^-?\d+,-?\d+$/.test(t)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:t,element:e});continue}let i=o.get(t);null==i&&(i=[],o.set(t,i)),i.push(e)}for(const[e,n]of o){if(2!==n.length){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",e,n);continue}const[t,o]=n,l=t.firstElementChild,s=o.firstElementChild;if(!(t instanceof HTMLElement&&o instanceof HTMLElement&&l instanceof HTMLElement&&s instanceof HTMLElement))continue;let a=r.get(l);if(null!=a){this.observedNodes.set(l,a),this.observedNodes.set(s,a),r.delete(l),r.delete(s);continue}const d=l.getBoundingClientRect().height,h=s.getBoundingClientRect().height;a={type:"annotations",column1:{container:t,child:l,childHeight:d},column2:{container:o,child:s,childHeight:h},currentHeight:"auto"},i.add({child1:l,child2:s,item:a,newHeight:Math.max(d,h)})}for(const e of i)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);i.clear()}for(const[l,s]of r)this.unobserve(l),"code"===s.type?sn(s):an(s);r.clear()}cleanUp(){for(const e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){const{managersByElement:n}=e,i=n.get(t);if(i!==this){if(null!=i&&i!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){const{managersByElement:n,resizeObserver:i}=e,o=n.get(t);if(null!=o){if(o!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");n.delete(t),null==i||i.unobserve(t),null!=i&&0===n.size&&(i.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){var t;const n=new Map,i=new Set;for(const o of e){const{target:e,borderBoxSize:r,contentBoxSize:l}=o;if(!(e instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",o);continue}const s=this.observedNodes.get(e);if(null!=s){if("annotations"===s.type){const t=(()=>e===s.column1.child?s.column1:e===s.column2.child?s.column2:void 0)();if(null==t){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:s,target:e});continue}t.childHeight=r[0].blockSize,i.add(s)}else if("code"===s.type){const i=null!=(t=n.get(s))?t:{},o=l[0].inlineSize;e===s.codeElement?i.codeInlineSize=o:e===s.numberElement&&(i.numberInlineSize=o),n.set(s,i)}}else console.error("ResizeManager.handleResizeEntries: Not a valid observed node",o)}this.applyAnnotationUpdates(i),i.clear(),this.applyColumnUpdates(n),n.clear()}applyAnnotationUpdates(e){for(const t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}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`))}},S(e,"resizeObserver"),S(e,"managersByElement",new Map),e);function rn(e){const t=Math.max(Math.floor(e),0);return 0===t?"auto":t}function ln(e){return Math.max(Math.ceil(e),0)}function sn(e){e.codeElement.isConnected&&(e.codeElement.style.removeProperty("--diffs-column-content-width"),e.codeElement.style.removeProperty("--diffs-column-number-width"),e.codeElement.style.removeProperty("--diffs-column-width"))}function an(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty("--diffs-annotation-min-height"),e.column2.container.isConnected&&e.column2.container.style.removeProperty("--diffs-annotation-min-height")}const dn=new Map,hn=new Map,un=new Map,cn=new Set;function fn(e){for(const t of Array.isArray(e)?e:[e])if("text"!==t&&"ansi"!==t&&!cn.has(t))return!1;return!0}function pn(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(cn.has(n.name))continue;let e=dn.get(n.name);null==e&&(e=n,dn.set(n.name,e)),cn.add(e.name),t.loadLanguageSync(e.data)}}function gn(){dn.clear(),cn.clear()}function mn(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function vn(e){return y(this,null,function*(){if(mn())throw new Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);const t=hn.get(e);if(null!=t)return t;try{let t=un.get(e);if(null==t&&Object.prototype.hasOwnProperty.call(x.bundledLanguages,e)&&(t=x.bundledLanguages[e]),null==t)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const n=t().then(({default:t})=>{const n={name:e,data:t};return dn.has(e)||dn.set(e,n),n});return hn.set(e,n),yield n}finally{hn.delete(e)}})}function bn(e){var t;return null!=(t=dn.get(e))?t:vn(e)}const Sn=new Set;function yn(e){const t=[],n=new Set;for(const c of function(e){return xn(e)||function(e){return"string"==typeof e.name&&"function"==typeof e.load}(e)}(i=e.themes)?[i]:i){const e=xn(c)?c.getThemes():[c];for(const i of e){if(n.has(i.name))throw new Error(`Theme collection already contains theme "${i.name}"`);n.add(i.name),t.push(i)}}var i;const o=Object.freeze([...t]),r=Object.freeze(o.filter(e=>"light"===e.colorScheme)),l=Object.freeze(o.filter(e=>"dark"===e.colorScheme)),s=new Map(o.map(e=>[e.name,e])),a=Object.freeze(o.map(e=>e.name)),d=Object.freeze(r.map(e=>e.name)),h=Object.freeze(l.map(e=>e.name));function u(e){if(null==e)return o;const{colorScheme:t,collection:n}=e;return null==n?"light"===t?r:"dark"===t?l:o:o.filter(e=>e.collection===n&&(null==t||e.colorScheme===t))}return{getTheme:e=>s.get(e),getThemes:e=>u(e),getThemeNames:e=>null==(null==e?void 0:e.collection)?"light"===(null==e?void 0:e.colorScheme)?d:"dark"===(null==e?void 0:e.colorScheme)?h:a:u(e).map(e=>e.name),hasTheme:e=>s.has(e),orderBy:e=>yn({themes:o.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{const i=e(t.descriptor,n.descriptor);return 0!==i?i:t.index-n.index}).map(e=>e.descriptor)}),pick(e){const t=[],n=new Set;for(const i of e){if(n.has(i))throw new Error(`Theme collection pick already includes theme "${i}"`);n.add(i);const e=s.get(i);if(null==e)throw new Error(`Theme collection does not contain theme "${i}"`);t.push(e)}return yn({themes:t})},registerInto(e){for(const t of o)e.registerThemeIfAbsent(t.name,t.load)}}}function xn(e){return"function"==typeof e.getThemes}function Cn(e){return null!==e&&"object"==typeof e&&"default"in e?e.default:e}var kn=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name="DuplicateThemeError"}},Ln=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name="UnregisteredThemeError"}},wn=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name="UnresolvedThemeError"}};const Tn=function(){const e=new Map,t=new Map,n=new Map;let i=0;function o(o){const r=t.get(o);if(void 0!==r)return Promise.resolve(r);const l=n.get(o);if(void 0!==l)return l;const s=e.get(o);if(void 0===s)return Promise.reject(new Ln(o));const a=i,d=s().then(e=>{const r=Cn(e);return a===i&&t.set(o,r),n.get(o)===d&&n.delete(o),r}).catch(e=>{throw n.get(o)===d&&n.delete(o),e});return n.set(o,d),d}function r(e,n){t.set(e,n)}return{clearResolvedThemes:function(){i++,t.clear(),n.clear()},getResolvedOrResolveTheme:function(e){const n=t.get(e);return void 0!==n?n:o(e)},getResolvedTheme:function(e){return t.get(e)},getResolvedThemes:function(e){const n=[];for(const i of e){const e=t.get(i);if(void 0===e)throw new wn(i);n.push(e)}return n},hasRegisteredTheme:function(t){return e.has(t)},hasResolvedTheme:function(e){return t.has(e)},hasResolvedThemes:function(e){for(const n of e)if(!t.has(n))return!1;return!0},registerTheme:function(t,n){if(e.has(t))throw new kn(t);e.set(t,n)},registerThemeIfAbsent:function(t,n){return!e.has(t)&&(e.set(t,n),!0)},resolveTheme:o,resolveThemes:function(e){return Promise.all(e.map(e=>o(e)))},seedResolvedTheme:r,seedResolvedThemes:function(e){for(const[t,n]of e)r(t,n)}}}();function En(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if("string"==typeof n){if(e=Tn.getResolvedTheme(n),null==e)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,null==Tn.getResolvedTheme(n)&&Tn.seedResolvedTheme(n,e);Sn.has(n)||(Sn.add(n),t.loadThemeSync(e))}}function In(){Tn.clearResolvedThemes(),Sn.clear()}var An=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(const i of n)t=new e(t,i);return t}static from(...t){let n=null;for(let i=0;i<t.length;i++)n=new e(n,t[i]);return n}push(t){return new e(this,t)}getSegments(){let e=this;const t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e||null!==this.parent&&this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}},Rn=class e{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(t){e.getLanguageId(t),e.getTokenType(t),e.getFontStyle(t),e.getForeground(t),e.getBackground(t)}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return!!(1024&e)}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(16744448&e)>>>15}static getBackground(e){return(4278190080&e)>>>24}static set(t,n,i,o,r,l,s){let a=e.getLanguageId(t),d=e.getTokenType(t),h=e.containsBalancedBrackets(t)?1:0,u=e.getFontStyle(t),c=e.getForeground(t),f=e.getBackground(t);return 0!==n&&(a=n),8!==i&&(d=i),null!==o&&(h=o?1:0),-1!==r&&(u=r),0!==l&&(c=l),0!==s&&(f=s),(a|d<<8|h<<10|u<<11|c<<15|f<<24)>>>0}};"undefined"!=typeof process&&process.env.VSCODE_TEXTMATE_DEBUG;var Mn=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){var i;let o=t,r=null!=(i=null==t?void 0:t.scopePath)?i:null;for(const l of n)r=An.push(r,l.scopeNames),o=new e(o,r,l.encodedTokenAttributes);return o}static createRoot(t,n){return new e(null,new An(null,t),n)}static createRootAndLookUpScopeName(t,n,i){const o=i.getMetadataForScope(t),r=new An(null,t),l=i.themeProvider.themeMatch(r),s=e.mergeAttributes(n,o,l);return new e(null,r,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}}static mergeAttributes(e,t,n){let i=-1,o=0,r=0;return null!==n&&(i=n.fontStyle,o=n.foregroundId,r=n.backgroundId),Rn.set(e,t.languageId,t.tokenType,null,i,o,r)}pushAttributed(t,n){if(null===t)return this;if(-1===t.indexOf(" "))return e._pushAttributed(this,t,n);const i=t.split(/ /g);let o=this;for(const r of i)o=e._pushAttributed(o,r,n);return o}static _pushAttributed(t,n,i){const o=i.getMetadataForScope(n),r=t.scopePath.push(n),l=i.themeProvider.themeMatch(r),s=e.mergeAttributes(t.tokenAttributes,o,l);return new e(t,r,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){var t,n;const i=[];let o=this;for(;o&&o!==e;)i.push({encodedTokenAttributes:o.tokenAttributes,scopeNames:o.scopePath.getExtensionIfDefined(null!=(n=null==(t=o.parent)?void 0:t.scopePath)?n:null)}),o=o.parent;return o===e?i.reverse():void 0}};(t=class{constructor(e,t,n,i,o,r,l,s){S(this,"_stackElementBrand"),S(this,"_enterPos"),S(this,"_anchorPos"),S(this,"depth"),this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=o,this.endRule=r,this.nameScopesList=l,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=i}equals(e){return null!==e&&t._equals(this,e)}static _equals(e,t){return e===t||!!this._structuralEquals(e,t)&&Mn.equals(e.contentNameScopesList,t.contentNameScopesList)}static _structuralEquals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){t._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,i,o,r,l,s){return new t(this,e,n,i,o,r,l,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){var n,i;return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${null==(n=this.nameScopesList)?void 0:n.toString()}, ${null==(i=this.contentNameScopesList)?void 0:i.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new t(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){var e,t,n,i,o,r;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:null!=(i=null==(n=this.nameScopesList)?void 0:n.getExtensionIfDefined(null!=(t=null==(e=this.parent)?void 0:e.nameScopesList)?t:null))?i:[],contentNameScopesList:null!=(r=null==(o=this.contentNameScopesList)?void 0:o.getExtensionIfDefined(this.nameScopesList))?r:[]}}static pushFrame(e,n){var i,o,r;const l=Mn.fromExtension(null!=(i=null==e?void 0:e.nameScopesList)?i:null,n.nameScopesList);return new t(e,n.ruleId,null!=(o=n.enterPos)?o:-1,null!=(r=n.anchorPos)?r:-1,n.beginRuleCapturedEOL,n.endRule,l,Mn.fromExtension(l,n.contentNameScopesList))}},S(t,"NULL",new t(null,0,0,0,!1,null,null,null)),t).NULL;const Hn="__shiki_resolved";function Pn({name:e,load:t,colorScheme:n,collection:i,displayName:o}){return{name:e,colorScheme:n,collection:i,displayName:o,load:Dn(t)}}function Dn(e){return()=>y(this,null,function*(){return function(e){var t,n,i,o,r;if(null==e?void 0:e[Hn])return e;const l=m({},e);l.tokenColors&&!l.settings&&(l.settings=l.tokenColors,delete l.tokenColors),l.type||(l.type="dark"),l.colorReplacements=m({},l.colorReplacements),l.settings||(l.settings=[]);let{bg:s,fg:a}=l;if(!s||!a){const e=l.settings?l.settings.find(e=>!e.name&&!e.scope):void 0;(null==(t=null==e?void 0:e.settings)?void 0:t.foreground)&&(a=e.settings.foreground),(null==(n=null==e?void 0:e.settings)?void 0:n.background)&&(s=e.settings.background),!a&&(null==(i=null==l?void 0:l.colors)?void 0:i["editor.foreground"])&&(a=l.colors["editor.foreground"]),!s&&(null==(o=null==l?void 0:l.colors)?void 0:o["editor.background"])&&(s=l.colors["editor.background"]),a||(a="light"===l.type?"#333333":"#bbbbbb"),s||(s="light"===l.type?"#fffffe":"#1e1e1e"),l.fg=a,l.bg=s}l.settings[0]&&l.settings[0].settings&&!l.settings[0].scope||l.settings.unshift({settings:{foreground:l.fg,background:l.bg}});let d=0;const h=new Map;function u(e){var t;if(h.has(e))return h.get(e);d+=1;const n=`#${d.toString(16).padStart(8,"0").toLowerCase()}`;return(null==(t=l.colorReplacements)?void 0:t[`#${n}`])?u(e):(h.set(e,n),n)}l.settings=l.settings.map(e=>{var t,n;const i=(null==(t=e.settings)?void 0:t.foreground)&&!e.settings.foreground.startsWith("#"),o=(null==(n=e.settings)?void 0:n.background)&&!e.settings.background.startsWith("#");if(!i&&!o)return e;const r=v(m({},e),{settings:m({},e.settings)});if(i){const t=u(e.settings.foreground);l.colorReplacements[t]=e.settings.foreground,r.settings.foreground=t}if(o){const t=u(e.settings.background);l.colorReplacements[t]=e.settings.background,r.settings.background=t}return r});for(const c of Object.keys(l.colors||{}))if(("editor.foreground"===c||"editor.background"===c||c.startsWith("terminal.ansi"))&&!(null==(r=l.colors[c])?void 0:r.startsWith("#"))){const e=u(l.colors[c]);l.colorReplacements[e]=l.colors[c],l.colors[c]=e}return Object.defineProperty(l,Hn,{enumerable:!1,writable:!1,value:!0}),l}(Cn(yield e()))})}const On=["pierre-light","pierre-light-soft","pierre-light-vibrant","pierre-light-protanopia-deuteranopia","pierre-light-tritanopia"],Nn=[...On,"pierre-dark","pierre-dark-soft","pierre-dark-vibrant","pierre-dark-protanopia-deuteranopia","pierre-dark-tritanopia"],Fn=new Set(On);function zn(e){return Fn.has(e)?"light":"dark"}const Un={"pierre-dark":"Pierre Dark","pierre-dark-soft":"Pierre Dark Soft","pierre-dark-vibrant":"Pierre Dark Vibrant","pierre-dark-protanopia-deuteranopia":"Pierre Dark Protanopia & Deuteranopia","pierre-dark-tritanopia":"Pierre Dark Tritanopia","pierre-light":"Pierre Light","pierre-light-soft":"Pierre Light Soft","pierre-light-vibrant":"Pierre Light Vibrant","pierre-light-protanopia-deuteranopia":"Pierre Light Protanopia & Deuteranopia","pierre-light-tritanopia":"Pierre Light Tritanopia"},Bn={"pierre-dark":()=>Promise.resolve().then(()=>require("./pierre-dark-9c2ca7e3.cjs")),"pierre-dark-soft":()=>Promise.resolve().then(()=>require("./pierre-dark-soft-59e1d5bc.cjs")),"pierre-dark-vibrant":()=>Promise.resolve().then(()=>require("./pierre-dark-vibrant-f4553619.cjs")),"pierre-dark-protanopia-deuteranopia":()=>Promise.resolve().then(()=>require("./pierre-dark-protanopia-deuteranopia-67028f58.cjs")),"pierre-dark-tritanopia":()=>Promise.resolve().then(()=>require("./pierre-dark-tritanopia-d87f3323.cjs")),"pierre-light":()=>Promise.resolve().then(()=>require("./pierre-light-ae152c30.cjs")),"pierre-light-soft":()=>Promise.resolve().then(()=>require("./pierre-light-soft-2a7b83ed.cjs")),"pierre-light-vibrant":()=>Promise.resolve().then(()=>require("./pierre-light-vibrant-178f2e13.cjs")),"pierre-light-protanopia-deuteranopia":()=>Promise.resolve().then(()=>require("./pierre-light-protanopia-deuteranopia-78f5453c.cjs")),"pierre-light-tritanopia":()=>Promise.resolve().then(()=>require("./pierre-light-tritanopia-22534644.cjs"))},jn=yn({themes:Nn.map(e=>function(e){return Pn({name:e,collection:"pierre",colorScheme:zn(e),displayName:Un[e],load:Bn[e]})}(e))}),$n=["ayu-light","catppuccin-latte","everforest-light","github-light","github-light-default","github-light-high-contrast","gruvbox-light-hard","gruvbox-light-medium","gruvbox-light-soft","horizon-bright","kanagawa-lotus","light-plus","material-theme-lighter","min-light","night-owl-light","one-light","rose-pine-dawn","slack-ochin","snazzy-light","solarized-light","vitesse-light"],Vn=new Set($n);function _n(e){return Vn.has(e)?"light":"dark"}const qn={andromeeda:()=>Promise.resolve().then(()=>require("./andromeeda-beebe2f9.cjs")),"aurora-x":()=>Promise.resolve().then(()=>require("./aurora-x-7d279c8e.cjs")),"ayu-dark":()=>Promise.resolve().then(()=>require("./ayu-dark-5e86208e.cjs")),"ayu-light":()=>Promise.resolve().then(()=>require("./ayu-light-18928686.cjs")),"ayu-mirage":()=>Promise.resolve().then(()=>require("./ayu-mirage-3af5c477.cjs")),"catppuccin-frappe":()=>Promise.resolve().then(()=>require("./catppuccin-frappe-5990e1cc.cjs")),"catppuccin-latte":()=>Promise.resolve().then(()=>require("./catppuccin-latte-7dd9ec26.cjs")),"catppuccin-macchiato":()=>Promise.resolve().then(()=>require("./catppuccin-macchiato-12297a0c.cjs")),"catppuccin-mocha":()=>Promise.resolve().then(()=>require("./catppuccin-mocha-164bffb5.cjs")),"dark-plus":()=>Promise.resolve().then(()=>require("./dark-plus-37515867.cjs")),dracula:()=>Promise.resolve().then(()=>require("./dracula-ad0b94e0.cjs")),"dracula-soft":()=>Promise.resolve().then(()=>require("./dracula-soft-223c44b5.cjs")),"everforest-dark":()=>Promise.resolve().then(()=>require("./everforest-dark-630f597e.cjs")),"everforest-light":()=>Promise.resolve().then(()=>require("./everforest-light-ba8af69c.cjs")),"github-dark":()=>Promise.resolve().then(()=>require("./github-dark-44cb1819.cjs")),"github-dark-default":()=>Promise.resolve().then(()=>require("./github-dark-default-f99477eb.cjs")),"github-dark-dimmed":()=>Promise.resolve().then(()=>require("./github-dark-dimmed-96ccf893.cjs")),"github-dark-high-contrast":()=>Promise.resolve().then(()=>require("./github-dark-high-contrast-adcd4e61.cjs")),"github-light":()=>Promise.resolve().then(()=>require("./github-light-42f759a4.cjs")),"github-light-default":()=>Promise.resolve().then(()=>require("./github-light-default-50fa37cd.cjs")),"github-light-high-contrast":()=>Promise.resolve().then(()=>require("./github-light-high-contrast-15a9bb5a.cjs")),"gruvbox-dark-hard":()=>Promise.resolve().then(()=>require("./gruvbox-dark-hard-cc007dcd.cjs")),"gruvbox-dark-medium":()=>Promise.resolve().then(()=>require("./gruvbox-dark-medium-415e09f2.cjs")),"gruvbox-dark-soft":()=>Promise.resolve().then(()=>require("./gruvbox-dark-soft-3125d894.cjs")),"gruvbox-light-hard":()=>Promise.resolve().then(()=>require("./gruvbox-light-hard-4c8c0395.cjs")),"gruvbox-light-medium":()=>Promise.resolve().then(()=>require("./gruvbox-light-medium-abf52b0c.cjs")),"gruvbox-light-soft":()=>Promise.resolve().then(()=>require("./gruvbox-light-soft-0e7ed903.cjs")),horizon:()=>Promise.resolve().then(()=>require("./horizon-f8b833c3.cjs")),"horizon-bright":()=>Promise.resolve().then(()=>require("./horizon-bright-d2ea0b12.cjs")),houston:()=>Promise.resolve().then(()=>require("./houston-20eb8cbf.cjs")),"kanagawa-dragon":()=>Promise.resolve().then(()=>require("./kanagawa-dragon-0246ed94.cjs")),"kanagawa-lotus":()=>Promise.resolve().then(()=>require("./kanagawa-lotus-61838bd3.cjs")),"kanagawa-wave":()=>Promise.resolve().then(()=>require("./kanagawa-wave-2b426416.cjs")),laserwave:()=>Promise.resolve().then(()=>require("./laserwave-d5e6cfa6.cjs")),"light-plus":()=>Promise.resolve().then(()=>require("./light-plus-471df294.cjs")),"material-theme":()=>Promise.resolve().then(()=>require("./material-theme-9d859633.cjs")),"material-theme-darker":()=>Promise.resolve().then(()=>require("./material-theme-darker-fe8dd38a.cjs")),"material-theme-lighter":()=>Promise.resolve().then(()=>require("./material-theme-lighter-879be29a.cjs")),"material-theme-ocean":()=>Promise.resolve().then(()=>require("./material-theme-ocean-c1caeaa4.cjs")),"material-theme-palenight":()=>Promise.resolve().then(()=>require("./material-theme-palenight-ef8b2399.cjs")),"min-dark":()=>Promise.resolve().then(()=>require("./min-dark-0baaa2b0.cjs")),"min-light":()=>Promise.resolve().then(()=>require("./min-light-f65395e0.cjs")),monokai:()=>Promise.resolve().then(()=>require("./monokai-b9c22257.cjs")),"night-owl":()=>Promise.resolve().then(()=>require("./night-owl-5eeb6e45.cjs")),"night-owl-light":()=>Promise.resolve().then(()=>require("./night-owl-light-f04fad9f.cjs")),nord:()=>Promise.resolve().then(()=>require("./nord-0b42b6b4.cjs")),"one-dark-pro":()=>Promise.resolve().then(()=>require("./one-dark-pro-6ac63500.cjs")),"one-light":()=>Promise.resolve().then(()=>require("./one-light-2f27f0f0.cjs")),plastic:()=>Promise.resolve().then(()=>require("./plastic-ab5115cb.cjs")),poimandres:()=>Promise.resolve().then(()=>require("./poimandres-9b9bffc0.cjs")),red:()=>Promise.resolve().then(()=>require("./red-58c74b50.cjs")),"rose-pine":()=>Promise.resolve().then(()=>require("./rose-pine-e443c3f3.cjs")),"rose-pine-dawn":()=>Promise.resolve().then(()=>require("./rose-pine-dawn-dcd06a2d.cjs")),"rose-pine-moon":()=>Promise.resolve().then(()=>require("./rose-pine-moon-c4ae0bee.cjs")),"slack-dark":()=>Promise.resolve().then(()=>require("./slack-dark-119fdcba.cjs")),"slack-ochin":()=>Promise.resolve().then(()=>require("./slack-ochin-e53abb89.cjs")),"snazzy-light":()=>Promise.resolve().then(()=>require("./snazzy-light-aacd1ca8.cjs")),"solarized-dark":()=>Promise.resolve().then(()=>require("./solarized-dark-6c53ecf9.cjs")),"solarized-light":()=>Promise.resolve().then(()=>require("./solarized-light-abef5a54.cjs")),"synthwave-84":()=>Promise.resolve().then(()=>require("./synthwave-84-ddb2c535.cjs")),"tokyo-night":()=>Promise.resolve().then(()=>require("./tokyo-night-6e0b49fd.cjs")),vesper:()=>Promise.resolve().then(()=>require("./vesper-a2e0b586.cjs")),"vitesse-black":()=>Promise.resolve().then(()=>require("./vitesse-black-2be67ba4.cjs")),"vitesse-dark":()=>Promise.resolve().then(()=>require("./vitesse-dark-82a14fc3.cjs")),"vitesse-light":()=>Promise.resolve().then(()=>require("./vitesse-light-ee2c704b.cjs"))};function Wn(e){return Pn({name:e,collection:"shiki",colorScheme:_n(e),load:qn[e]})}const Gn=yn({themes:Object.freeze([...$n.map(e=>Wn(e)),...["andromeeda","aurora-x","ayu-dark","ayu-mirage","catppuccin-frappe","catppuccin-macchiato","catppuccin-mocha","dark-plus","dracula","dracula-soft","everforest-dark","github-dark","github-dark-default","github-dark-dimmed","github-dark-high-contrast","gruvbox-dark-hard","gruvbox-dark-medium","gruvbox-dark-soft","horizon","houston","kanagawa-dragon","kanagawa-wave","laserwave","material-theme","material-theme-darker","material-theme-ocean","material-theme-palenight","min-dark","monokai","night-owl","nord","one-dark-pro","plastic","poimandres","red","rose-pine","rose-pine-moon","slack-dark","solarized-dark","synthwave-84","tokyo-night","vesper","vitesse-black","vitesse-dark"].map(e=>Wn(e))])});function Kn(e){if(mn())throw new Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(Tn.hasRegisteredTheme(e))return;const t=Gn.getTheme(e);if(null==t)throw new Error(`No valid theme loader registered for "${e}"`);Tn.registerThemeIfAbsent(t.name,t.load)}function Xn(e,t){if(t.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}function Yn(e){return y(this,null,function*(){Kn(e);const t=yield Tn.resolveTheme(e);return Xn(e,t),t})}function Jn(e){var t;return null!=(t=Tn.getResolvedTheme(e))?t:Yn(e)}let Zn;function Qn(e){return y(this,arguments,function*({themes:e,langs:t,preferredHighlighter:n="shiki-js"}){null!=Zn||(Zn=x.createHighlighter({themes:[],langs:["text"],engine:"shiki-wasm"===n?x.createOnigurumaEngine(Promise.resolve().then(()=>require("./wasm-4cd10f60.cjs"))):x.createJavaScriptRegexEngine()}));const i=ti(Zn)?yield Zn:Zn;Zn=i;const o=[];for(const l of t){if("text"===l||"ansi"===l)continue;const e=bn(l);"then"in e?o.push(e):pn(e,i)}const r=[];for(const l of e){const e=Jn(l);"then"in e?r.push(e):En(e,Zn)}return(o.length>0||r.length>0)&&(yield Promise.all([Promise.all(o).then(e=>{pn(e,i)}),Promise.all(r).then(e=>{En(e,i)})])),i})}function ei(){if(null!=Zn&&!("then"in Zn))return Zn}function ti(e=Zn){return null!=e&&"then"in e}yn({themes:[jn,Gn]});for(const qs of jn.getThemes())Tn.registerThemeIfAbsent(qs.name,qs.load);function ni(e=O){const t=[];return"string"==typeof e?t.push(e):(t.push(e.dark),t.push(e.light)),t}function ii(e){for(const t of ni(e))if(!Sn.has(t))return!1;return!0}function oi(e){return Tn.hasResolvedThemes(e)}function ri(e,t){return te(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function li(e,t){return(null==e?void 0:e.cacheKey)===(null==t?void 0:t.cacheKey)&&(null==e?void 0:e.contents)===(null==t?void 0:t.contents)&&(null==e?void 0:e.name)===(null==t?void 0:t.name)&&(null==e?void 0:e.lang)===(null==t?void 0:t.lang)}function si(e,t){return null==e||null==t?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function ai(e){var t;return ae({tagName:"div",children:[ae({tagName:"div",children:null==(t=e.annotations)?void 0:t.map(e=>ae({tagName:"slot",properties:{name:e}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function di(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 hi({fileOrDiff:e,mode:t,stickyHeader:n}){var i;const o="type"in e?e:void 0,r={"data-diffs-header":t,"data-change-type":null==o?void 0:o.type,"data-sticky":n?"":void 0};return ae({tagName:"div",children:["custom"===t?ae({tagName:"slot",properties:{name:D}}):ui({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:null!=(i=null==o?void 0:o.type)?i:"file"}),..."custom"===t?[]:[ci(o)]],properties:r})}function ui({name:e,prevName:t,iconType:n}){const i=[ae({tagName:"slot",properties:{name:H}}),de({name:di(n),properties:{"data-change-icon":n}})];return null!=t&&(i.push(ae({tagName:"div",children:[ae({tagName:"bdi",children:[se(t)]})],properties:{"data-prev-name":""}})),i.push(de({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(ae({tagName:"div",children:[ae({tagName:"bdi",children:[se(e)]})],properties:{"data-title":""}})),ae({tagName:"div",children:i,properties:{"data-header-content":""}})}function ci(e){const t=[];if(null!=e){let n=0,i=0;for(const t of e.hunks)n+=t.additionLines,i+=t.deletionLines;(i>0||0===n)&&t.push(ae({tagName:"span",children:[se(`-${i}`)],properties:{"data-deletions-count":""}})),(n>0||0===i)&&t.push(ae({tagName:"span",children:[se(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push(ae({tagName:"slot",properties:{name:P}})),ae({tagName:"div",children:t,properties:{"data-metadata":""}})}function fi(e){return ae({tagName:"pre",properties:pi(e)})}function pi({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:i,split:o,totalLines:r,type:l,customProperties:s}){return v(m({},s),{"data-diff":"diff"===l?"":void 0,"data-file":"file"===l?"":void 0,"data-diff-type":"diff"===l?o?"split":"single":void 0,"data-overflow":i,"data-disable-line-numbers":n?"":void 0,"data-background":t?void 0:"","data-indicators":"bars"===e||"classic"===e?e:void 0,style:`--diffs-min-number-column-width-default:${`${r}`.length}ch;`})}const gi=new Map;let mi=0;const vi={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function bi(e){var t,n,i,o,r,l,s;if(gi.has(e))return null!=(t=gi.get(e))?t:"text";if(null!=vi[e])return vi[e];const a=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(null!=a){if(gi.has(a[1]))return null!=(n=gi.get(a[1]))?n:"text";if(null!=vi[a[1]])return null!=(i=vi[a[1]])?i:"text"}const d=null!=(r=null==(o=e.match(/\.([^.]+)$/))?void 0:o[1])?r:"";return gi.has(d)?null!=(l=gi.get(d))?l:"text":null!=(s=vi[d])?s:"text"}function Si(e,t){const n=gi.get(e);return n!==t&&(null!=n&&console.warn(`setCustomExtension: overriding custom mapping for "${e}" from "${n}" to "${t}"`),gi.set(e,t),mi++,!0)}function yi(e,{theme:t,preferredHighlighter:n="shiki-js"}){return{langs:[null!=e?e:"text"],themes:ni(t),preferredHighlighter:n}}function xi(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function Ci(e){return e.replace(/\n$|\r\n$/,"")}function ki(e,t,n){const i="function"==typeof n.lineInfo?n.lineInfo(t):n.lineInfo[t-1];if(null==i){const i=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(i,{node:e,line:t,state:n}),new Error(i)}return e.tagName="div",e.properties["data-line"]=i.lineNumber,e.properties["data-alt-line"]=i.altLineNumber,e.properties["data-line-type"]=i.type,e.properties["data-line-index"]=i.lineIndex,0===e.children.length&&e.children.push(se("\n")),e}const Li=Symbol("no-token"),wi=Symbol("multiple-tokens");function Ti(e){const t=function(e){const t=e.properties["data-char"];if("number"==typeof t)return t}(e);if(null!=t)return t;let n=Li;const i=[];let o,r=[];const l=()=>{if(0===r.length||null==o)return r=[],void(o=void 0);if(1===r.length){const t=r[0];if("element"===(null==t?void 0:t.type)){e=o,t.properties["data-char"]=e;for(const e of t.children)Ei(e)}else Ei(t);return i.push(t),r=[],void(o=void 0)}var e;for(const t of r)Ei(t);i.push(ae({tagName:"span",properties:{"data-char":o},children:r})),r=[],o=void 0},s=e=>{e!==Li&&(e!==wi?n!==Li?n!==e&&(n=wi):n=e:n=wi)};for(const a of e.children){const e="element"===a.type?Ti(a):Li;s(e),"number"==typeof e?(null!=o&&o!==e&&l(),null!=o||(o=e),r.push(a)):(l(),i.push(a))}return l(),e.children=i,n}function Ei(e){if("element"===e.type){e.properties["data-char"]=void 0;for(const t of e.children)Ei(t)}}function Ii(e=!1,t=!1){const n={lineInfo:[]},i=[m({line:e=>(delete e.properties.class,e),pre(t){const i=he(t),o=[];if(null!=i){let t=1;for(const r of i.children)"element"===r.type&&(e&&Ti(r),o.push(ki(r,t,n)),t++);i.children=o}return t}},e?{tokens(e){for(const t of e){let e=0;for(const n of t){const t=n;null!=t.__lineChar||(t.__lineChar=e),e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces="never"},span(e,t,n,i,o){if(null!=(null==o?void 0:o.offset)&&null!=o.content){const t=o.__lineChar;return null!=t&&(e.properties["data-char"]=t),e}return e}}:null)];return t&&i.push(Ri,Ai),{state:n,transformers:i,toClass:Ai}}const Ai=function(e={}){const{classPrefix:t="__shiki_",classSuffix:n="",classReplacer:i=e=>e}=e,o=new Map;function r(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}function l(e){let l=t+function(e,t=0){let n=3735928559^t,i=1103547991^t;for(let o,r=0;r<e.length;r++)o=e.charCodeAt(r),n=Math.imul(n^o,2654435761),i=Math.imul(i^o,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&i)+(n>>>0)).toString(36).slice(0,6)}("string"==typeof e?e:r(e))+n;return l=i(l),o.has(l)||o.set(l,"string"==typeof e?e:m({},e)),l}return{name:"@shikijs/transformers:style-to-class",pre(e){if(!e.properties.style)return;const t=l(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(const t of e)for(const e of t){if(!e.htmlStyle)continue;const t=l(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||(e.htmlAttrs={}),e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry:()=>o,getCSS(){let e="";for(const[t,n]of o.entries())e+=`.${t}{${"string"==typeof n?n:r(n)}}`;return e},clearRegistry(){o.clear()}}}({classPrefix:"hl-"}),Ri={name:"token-style-normalizer",tokens(e){for(const t of e)for(const e of t){if(null!=e.htmlStyle)continue;const t={};null!=e.color&&(t.color=e.color),null!=e.bgColor&&(t["background-color"]=e.bgColor),null!=e.fontStyle&&0!==e.fontStyle&&(1&e.fontStyle&&(t["font-style"]="italic"),2&e.fontStyle&&(t["font-weight"]="bold"),4&e.fontStyle&&(t["text-decoration"]="underline")),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function Mi(e){return`--${"token"===e?"diffs-token":"diffs"}-`}const Hi=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Pi=/^0(?:\.0+)?%?$/;function Di(e){if(null==e)return null;const t=function(e){const t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(null==t)return null;const n=t[1];let i,o=1;return 3===n.length?i=n.split("").map(e=>e+e).join(""):6===n.length?i=n:(i=n.slice(0,6),o=parseInt(n.slice(6,8),16)/255),[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),o]}(e);if(null==t)return null;const n=t[0]/255,i=t[1]/255,o=t[2]/255,r=e=>e<=.03928?e/12.92:p((e+.055)/1.055,2.4);return.2126*r(n)+.7152*r(i)+.0722*r(o)}function Oi(e){if(null==e)return!1;const t=e.trim().toLowerCase();if("transparent"===t)return!0;if(Hi.test(t))return!0;const n=function(e){var t;const n=e.indexOf("(");if(n<=0||!e.endsWith(")"))return;const i=e.slice(0,n).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(i))return;const o=e.slice(n+1,-1).trim();if(0===o.length)return;const r=o.lastIndexOf("/");if(-1!==r)return o.slice(r+1).trim();if(/^(?:rgba|hsla)$/i.test(i)){const e=o.split(",");if(4===e.length)return null==(t=e[3])?void 0:t.trim()}}(t);return null!=n&&Pi.test(n)}const Ni=new WeakMap;function Fi(e){var t,n,i,o,r,l,s,a,d;const h=Ni.get(e);if(null!=h)return h;const u=null!=(t=e.colors)?t:{},c=m({},u),f=null!=(n=u["editor.background"])?n:e.bg,p=null!=(i=u["editor.foreground"])?i:e.fg,g=null!=(o=u["sideBar.background"])?o:f,b=null!=(r=u["sideBar.foreground"])?r:p;zi(c,"editor.background",f),zi(c,"editor.foreground",p),zi(c,"sideBar.background",g),zi(c,"sideBar.foreground",b),zi(c,"input.background",null!=(l=u["input.background"])?l:g),zi(c,"sideBarSectionHeader.foreground",null!=(s=u["sideBarSectionHeader.foreground"])?s:b),zi(c,"list.activeSelectionForeground",null!=(a=u["list.activeSelectionForeground"])?a:b),zi(c,"gitDecoration.addedResourceForeground",Ui(u["gitDecoration.addedResourceForeground"],u["terminal.ansiGreen"],u["editorGutter.addedBackground"])),zi(c,"gitDecoration.modifiedResourceForeground",Ui(u["gitDecoration.modifiedResourceForeground"],u["terminal.ansiBlue"],u["editorGutter.modifiedBackground"])),zi(c,"gitDecoration.deletedResourceForeground",Ui(u["gitDecoration.deletedResourceForeground"],u["terminal.ansiRed"],u["editorGutter.deletedBackground"]));const S=null!=(d=Oi(u["list.focusOutline"])?void 0:u["list.focusOutline"])?d:Oi(u.focusBorder)?void 0:u.focusBorder;null!=S?c["list.focusOutline"]=S:delete c["list.focusOutline"];const y=u["list.hoverBackground"];var x;null!=y&&(null!=(x=g)&&y.toLowerCase()===x.toLowerCase()||function(e,t,n){if(null==t||null==n)return!1;const i=Di(e),o=Di(t),r=Di(n);return null!=i&&null!=o&&null!=r&&Math.abs(i-r)<Math.abs(i-o)}(y,g,b))&&delete c["list.hoverBackground"];const C=Object.freeze(v(m({},e),{colors:Object.freeze(c)}));return Ni.set(e,C),C}function zi(e,t,n){null!=n&&""!==n&&(e[t]=n)}function Ui(...e){for(const t of e)if(null!=t&&""!==t)return t}function Bi({theme:e=O,highlighter:t,prefix:n}){let i="";if("string"==typeof e){const o=t.getTheme(e),r=Fi(o);i+=`color:${r.fg};`,i+=`background-color:${r.bg};`,i+=`${Mi("global")}fg:${r.fg};`,i+=`${Mi("global")}bg:${r.bg};`,i+=ji(o,n)}else{let n=t.getTheme(e.dark),o=Fi(n);i+=`${Mi("global")}dark:${o.fg};`,i+=`${Mi("global")}dark-bg:${o.bg};`,i+=ji(n,"dark"),n=t.getTheme(e.light),o=Fi(n),i+=`${Mi("global")}light:${o.fg};`,i+=`${Mi("global")}light-bg:${o.bg};`,i+=ji(n,"light")}return i}function ji(e,t){var n,i,o,r,l,s,a,d,h;t=null!=t?`${t}-`:"";let u="";const c=null!=(o=null==(n=e.colors)?void 0:n["gitDecoration.addedResourceForeground"])?o:null==(i=e.colors)?void 0:i["terminal.ansiGreen"];null!=c&&(u+=`${Mi("global")}${t}addition-color:${c};`);const f=null!=(s=null==(r=e.colors)?void 0:r["gitDecoration.deletedResourceForeground"])?s:null==(l=e.colors)?void 0:l["terminal.ansiRed"];null!=f&&(u+=`${Mi("global")}${t}deletion-color:${f};`);const p=null!=(h=null==(a=e.colors)?void 0:a["gitDecoration.modifiedResourceForeground"])?h:null==(d=e.colors)?void 0:d["terminal.ansiBlue"];return null!=p&&(u+=`${Mi("global")}${t}modified-color:${p};`),u}function $i(e){let t=e.children[0];for(;null!=t;){if("element"===t.type&&"code"===t.tagName)return t.children;t="children"in t?t.children[0]:null}throw console.error(e),new Error("getLineNodes: Unable to find children")}function Vi({lines:e,startingLine:t=0,totalLines:n=1/0,callback:i}){const o=Math.min(t+n,e.length),r=(()=>{const t=e.at(-1);return""===t||"\n"===t||"\r\n"===t||"\r"===t?Math.max(0,e.length-2):e.length-1})();for(let l=t;l<o;l++){const t=l===r;if(!0===i({lineIndex:l,lineNumber:l+1,content:e[l],isLastLine:t})||t)break}}function _i(e){return""!==e?e.split(E):[]}const qi={forcePlainText:!1};function Wi(e,t,{theme:n=O,tokenizeMaxLineLength:i,useTokenTransformer:o},{forcePlainText:r,startingLine:l,totalLines:s,lines:a}=qi){var d;r?(null!=l||(l=0),null!=s||(s=1/0)):(l=0,s=1/0);const h=l>0||s<1/0,{state:u,transformers:c}=Ii(o),f=r?"text":null!=(d=e.lang)?d:bi(e.name),p="string"==typeof n?t.getTheme(n).type:void 0,g=Bi({theme:n,highlighter:t});u.lineInfo=e=>({type:"context",lineIndex:e-1+l,lineNumber:e+l});const m="string"==typeof n?{lang:f,theme:n,transformers:c,defaultColor:!1,cssVariablePrefix:Mi("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:c,defaultColor:!1,cssVariablePrefix:Mi("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0},v=$i(t.codeToHast(h?function(e,t,n){let i="";return Vi({lines:e,startingLine:t,totalLines:n,callback({content:e}){i+=e}}),i}(null!=a?a:_i(e.contents),l,s):Ci(e.contents),m)),b=h?new Array(l):v;return h&&b.push(...v),{code:b,themeStyles:g,baseThemeType:p}}const Gi="-1,-1";function Ki(e){var t;return null!=(t=null==e?void 0:e.some(e=>0===e.lineNumber))&&t}function Xi(e){const t=e[0];return null!=t&&t.length>0?t:void 0}function Yi(e){return 0===e.startingLine&&e.totalLines>0}function Ji(e,t){return ae({tagName:"div",children:e,properties:{"data-content":"",style:`grid-row: span ${t}`}})}function Zi(e){var t;return"text"===(null!=(t=e.lang)?t:bi(e.name))}function Qi(e){return!0===e.useTokenTransformer||null!=e.onTokenClick||null!=e.onTokenEnter||null!=e.onTokenLeave}let eo=-1;var to=class{constructor(e={theme:O},t,n){var i;S(this,"options"),S(this,"onRenderUpdate"),S(this,"workerManager"),S(this,"__id","file-renderer:"+ ++eo),S(this,"highlighter"),S(this,"renderCache"),S(this,"computedLang","text"),S(this,"lineAnnotations",{}),S(this,"lineCache"),this.options=e,this.onRenderUpdate=t,this.workerManager=n,!0!==(null==n?void 0:n.isWorkingPool())&&(this.highlighter=ii(null!=(i=e.theme)?i:O)?ei():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options=m(m({},this.options),e)}setLineAnnotations(e){var t;this.lineAnnotations={};for(const n of e){const e=null!=(t=this.lineAnnotations[n.lineNumber])?t:[];this.lineAnnotations[n.lineNumber]=e,e.push(n)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){var e;this.clearRenderCache(),this.highlighter=void 0,null==(e=this.workerManager)||e.cleanUpTasks(this),this.lineCache=void 0}clearRenderCache(){this.renderCache=void 0}hydrate(e){var t,n,i;const{options:o}=this.getRenderOptions(e),r=no(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());let l=null==(t=this.workerManager)?void 0:t.getFileResultCache(e);null==l||ri(o,l.options)||(l=void 0),null!=this.renderCache||(this.renderCache={file:e,options:o,highlighted:!r&&!Zi(e),result:r||null==l?void 0:l.result,renderRange:void 0}),!0===(null==(n=this.workerManager)?void 0:n.isWorkingPool())?null!=this.renderCache.result||r||this.workerManager.highlightFileAST(this,e):null==this.highlighter&&(this.computedLang=null!=(i=e.lang)?i:bi(e.name),this.initializeHighlighter())}getRenderOptions(e){const t=(()=>{var e;if(!0===(null==(e=this.workerManager)?void 0:e.isWorkingPool()))return this.workerManager.getFileRenderOptions();const{theme:t=O,tokenizeMaxLineLength:n=1e3}=this.options;return{theme:t,useTokenTransformer:Qi(this.options),tokenizeMaxLineLength:n}})(),{renderCache:n}=this;return null==(null==n?void 0:n.result)?{options:t,forceHighlight:!0}:li(e,n.file)&&ri(t,n.options)?{options:t,forceHighlight:!1}:{options:t,forceHighlight:!0}}getOrCreateLineCache(e){if(null==e.cacheKey)return this.lineCache=void 0,_i(e.contents);let{lineCache:t}=this;return null!=t&&t.cacheKey===e.cacheKey||(t={cacheKey:e.cacheKey,lines:_i(e.contents)}),this.lineCache=t,t.lines}renderFile(e=(e=>null==(e=this.renderCache)?void 0:e.file)(),t=G){var n,i;if(null==e)return;let{options:o,forceHighlight:r}=this.getRenderOptions(e);const l=this.getMatchingWorkerResultCache(e,o);null==l||this.hasHighlightedRenderCache(e,o)||(this.renderCache=m({file:e,highlighted:!0,renderRange:void 0},l),r=!1),null!=this.renderCache||(this.renderCache={file:e,highlighted:!1,options:o,result:void 0,renderRange:void 0});const s=this.getOrCreateLineCache(e),a=e.contents.length>0,d=!a||Zi(e)||no(s.length,this.getTokenizeMaxLength()),h=!li(e,this.renderCache.file),u=!si(this.renderCache.renderRange,t);if(!0===(null==(n=this.workerManager)?void 0:n.isWorkingPool()))(d||null==this.renderCache.result||!this.renderCache.highlighted&&(h||u))&&(this.renderCache.file=e,this.renderCache.options=o,this.renderCache.highlighted=!1,(null==this.renderCache.result||h||u||r)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,s)),this.renderCache.renderRange=t),d||!a||this.renderCache.highlighted&&!r||this.workerManager.highlightFileAST(this,e);else{this.computedLang=null!=(i=e.lang)?i:bi(e.name);const t=null!=this.highlighter&&ii(o.theme),n=null!=this.highlighter&&fn(this.computedLang),l=!d&&n;if(null!=this.highlighter&&t&&(r||d||!this.renderCache.highlighted&&l||null==this.renderCache.result)){const{result:t,options:i}=this.renderFileWithHighlighter(e,this.highlighter,d||!n);this.renderCache={file:e,options:i,highlighted:l,result:t,renderRange:void 0}}t&&(d||n)||this.asyncHighlight(e).then(({result:t,options:n})=>{null!=this.renderCache&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n,!d)})}return null!=this.renderCache.result?this.processFileResult(this.renderCache.file,t,this.renderCache.result):void 0}asyncRender(e){return y(this,arguments,function*(e,t=G){const{result:n}=yield this.asyncHighlight(e);return this.processFileResult(e,t,n)})}asyncHighlight(e){return y(this,null,function*(){var t;const n=no(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=n?"text":null!=(t=e.lang)?t:bi(e.name);const i=null!=this.highlighter&&oi(ni(this.options.theme)),o=n||null!=this.highlighter&&fn(this.computedLang);return null!=this.highlighter&&i&&o||(this.highlighter=yield this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,n)})}renderFileWithHighlighter(e,t,n=!1){const{options:i}=this.getRenderOptions(e);return{result:Wi(e,t,i,{forcePlainText:n}),options:i}}processFileResult(e,t,{code:n,themeStyles:i,baseThemeType:o}){var r;const{disableFileHeader:l=!1}=this.options,s=[],a=ue(),d=this.getOrCreateLineCache(e);let h=0;const u=Yi(t)?Xi(this.lineAnnotations):void 0;return null!=u&&(a.children.push(fe("context","annotation",1)),s.push(ai({type:"annotation",hunkIndex:-1,lineIndex:-1,annotations:u.map(e=>xi(e))})),h++),Vi({lines:d,startingLine:t.startingLine,totalLines:t.totalLines,callback:({lineIndex:t,lineNumber:i})=>{const o=n[t];if(null==o){const n="FileRenderer.processFileResult: Line doesnt exist";throw console.error(n,{name:e.name,lineIndex:t,lineNumber:i,lines:d}),new Error(n)}if(null!=o){a.children.push(ce("context",i,`${t}`)),s.push(o),h++;const e=this.lineAnnotations[i];null!=e&&(a.children.push(fe("context","annotation",1)),s.push(ai({type:"annotation",hunkIndex:0,lineIndex:i,annotations:e.map(e=>xi(e))})),h++)}}}),a.properties.style=`grid-row: span ${h}`,{gutterAST:null!=(r=a.children)?r:[],contentAST:s,preAST:this.createPreElement(d.length),headerAST:l?void 0:this.renderHeader(e),totalLines:d.length,rowCount:h,themeStyles:i,baseThemeType:o,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderHeader(e){const{headerRenderMode:t="default",stickyHeader:n=!1}=this.options;return hi({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return Bt(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(ae({tagName:"code",children:this.renderCodeAST(e),properties:{"data-code":""}})),v(m({},e.preAST),{children:t})}renderCodeAST(e){const t=ue();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,Ji(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return Bt(t?ae({tagName:"code",children:e,properties:{"data-code":""}}):e)}initializeHighlighter(){return y(this,null,function*(){return this.highlighter=yield Qn(yi(this.computedLang,this.options)),this.highlighter})}onHighlightSuccess(e,t,n,i=!0){var o;if(null==this.renderCache)return;const r=!li(e,this.renderCache.file)||!this.renderCache.highlighted||!ri(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:i,result:t,renderRange:void 0},r&&(null==(o=this.onRenderUpdate)||o.call(this))}getMatchingWorkerResultCache(e,t){var n;const i=null==(n=this.workerManager)?void 0:n.getFileResultCache(e);if(null!=i&&ri(t,i.options))return i}hasHighlightedRenderCache(e,t){const{renderCache:n}=this;return null!=(null==n?void 0:n.result)&&n.highlighted&&li(e,n.file)&&ri(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){var e;return null!=(e=this.options.tokenizeMaxLength)?e:1e5}createPreElement(e){const{disableLineNumbers:t=!1,overflow:n="scroll"}=this.options;return fi({type:"file",diffIndicators:"none",disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function no(e,t){return e>t}const io='<svg data-icon-sprite aria-hidden="true" width="0" height="0">\n <symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">\n <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"/>\n </symbol>\n <symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">\n <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"/>\n </symbol>\n <symbol id="diffs-icon-chevron" viewBox="0 0 16 16">\n <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"/>\n </symbol>\n <symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">\n <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"/>\n </symbol>\n <symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">\n <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"/>\n </symbol>\n <symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">\n <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"/>\n </symbol>\n <symbol id="diffs-icon-expand" viewBox="0 0 16 16">\n <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"/>\n </symbol>\n <symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">\n <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"/>\n </symbol>\n <symbol id="diffs-icon-file-code" viewBox="0 0 16 16">\n <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"/>\n </symbol>\n <symbol id="diffs-icon-plus" viewBox="0 0 16 16">\n <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"/>\n </symbol>\n <symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">\n <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"/>\n </symbol>\n <symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">\n <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"/>\n </symbol>\n <symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">\n <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"/>\n </symbol>\n <symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">\n <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"/>\n </symbol>\n <symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">\n <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"/>\n </symbol>\n <symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">\n <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"/>\n </symbol>\n <symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">\n <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"/>\n </symbol>\n</svg>';function oo(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function ro(e,t){return null==e||null==t?e===t:function(e=lo,t=lo){if(e===t)return!0;const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(const o of n)if(e[o]!==t[o])return!1;return!0}(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}const lo={};function so(e){const t=document.createElement("div");return t.dataset.annotationSlot="",t.slot=e,t.style.whiteSpace="normal",t}function ao(){const e=document.createElement("div");return e.slot="gutter-utility-slot",e.style.position="absolute",e.style.top="0",e.style.bottom="0",e.style.textAlign="center",e.style.whiteSpace="normal",e.style.touchAction="none",e}function ho(){const e=document.createElement("style");return e.setAttribute(F,""),e}var uo='@layer base {\n :host {\n --diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",\n "Courier New", monospace;\n --diffs-header-font-fallback: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",\n "Noto Sans", "Liberation Sans", Arial, sans-serif;\n --diffs-mixer: light-dark(#000, #fff);\n --diffs-gap-fallback: 8px;\n --diffs-scrollbar-gutter-fallback: 6px;\n --diffs-scrollbar-gutter: var(--diffs-scrollbar-gutter-override, var(--diffs-scrollbar-gutter-measured, var(--diffs-scrollbar-gutter-fallback)));\n --diffs-added-light: #0dbe4e;\n --diffs-added-dark: #5ecc71;\n --diffs-modified-light: #009fff;\n --diffs-modified-dark: #69b1ff;\n --diffs-deleted-light: #ff2e3f;\n --diffs-deleted-dark: #ff6762;\n color-scheme: light dark;\n font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));\n font-size: var(--diffs-font-size, 13px);\n line-height: var(--diffs-line-height, 20px);\n font-feature-settings: var(--diffs-font-features);\n --diffs-bg: light-dark(var(--diffs-light-bg, #fff), var(--diffs-dark-bg, #000));\n --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))));\n --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))));\n --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))));\n --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))));\n --diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff));\n --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))));\n --diffs-fg-conflict-marker: var(--diffs-fg-conflict-marker-override, var(--diffs-fg-number));\n --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)))));\n --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)))));\n --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)))));\n --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))));\n --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)));\n --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))));\n --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)));\n --diffs-selection-base: var(--diffs-modified-base);\n --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)));\n background-color: var(--diffs-bg);\n color: var(--diffs-fg);\n display: block;\n }\n\n pre, code, [data-error-wrapper] {\n isolation: isolate;\n font-family: var(--diffs-font-family, var(--diffs-font-fallback));\n outline: none;\n margin: 0;\n padding: 0;\n display: block;\n }\n\n pre, code {\n background-color: var(--diffs-bg);\n }\n\n code {\n contain: content;\n }\n\n *, :before, :after {\n box-sizing: border-box;\n }\n\n [data-icon-sprite] {\n display: none;\n }\n\n [data-diffs-header], [data-separator] {\n font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));\n }\n\n [data-diffs-header][data-sticky] {\n z-index: 1;\n background-color: var(--diffs-bg);\n position: sticky;\n top: 0;\n }\n\n [data-file-info] {\n color: var(--fg);\n background-color: color-mix(in lab, var(--bg) 98%, var(--fg));\n border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));\n padding: 10px;\n font-weight: 700;\n }\n\n [data-diff], [data-file] {\n --diffs-grid-number-column-width: minmax(min-content, max-content);\n --diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;\n\n &[data-dehydrated] {\n --diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);\n }\n\n &:hover [data-code]::-webkit-scrollbar-thumb {\n background-color: var(--diffs-bg-context);\n }\n }\n\n @supports (-webkit-touch-callout: none) {\n :host {\n --diffs-scrollbar-gutter-fallback: 0px;\n }\n }\n\n [data-line] span {\n color: light-dark(var(--diffs-token-light, var(--diffs-light)), var(--diffs-token-dark, var(--diffs-dark)));\n background-color: light-dark(var(--diffs-token-light-bg, inherit), var(--diffs-token-dark-bg, inherit));\n font-weight: light-dark(var(--diffs-token-light-font-weight, inherit), var(--diffs-token-dark-font-weight, inherit));\n font-style: light-dark(var(--diffs-token-light-font-style, inherit), var(--diffs-token-dark-font-style, inherit));\n text-decoration: light-dark(var(--diffs-token-light-text-decoration, inherit), var(--diffs-token-dark-text-decoration, inherit));\n }\n\n [data-line], [data-gutter-buffer], [data-column-number], [data-line-annotation], [data-no-newline], [data-merge-conflict], [data-merge-conflict-actions] {\n --diffs-computed-decoration-bg: var(--diffs-bg);\n --diffs-computed-diff-line-bg: var(--diffs-bg);\n --diffs-computed-selected-line-bg: var(--diffs-bg);\n color: var(--diffs-fg);\n background-color: var(--diffs-line-bg, var(--diffs-bg));\n\n @media (pointer: fine) {\n &:where([data-hovered]) {\n --diffs-computed-hovered-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-selected-line-bg) 97%,\n var(--diffs-bg-hover-override, var(--diffs-mixer))), color-mix(in lab,\n var(--diffs-computed-selected-line-bg) 91%,\n var(--diffs-bg-hover-override, var(--diffs-mixer))));\n --diffs-line-bg: var(--diffs-computed-hovered-line-bg, inherit);\n }\n }\n }\n\n [data-line], [data-no-newline] {\n &[data-decoration-bg] {\n --mix-deco-light: 92%;\n --mix-deco-dark: 85%;\n\n &[data-decoration-bg-depth="2"] {\n --mix-deco-light: 88%;\n --mix-deco-dark: 80%;\n }\n\n &[data-decoration-bg-depth="3"] {\n --mix-deco-light: 85%;\n --mix-deco-dark: 78%;\n }\n\n @media (pointer: fine) {\n &[data-hovered]:not([data-selected-line]) {\n --mix-deco-light: 85%;\n --mix-deco-dark: 85%;\n }\n\n &[data-hovered]:not([data-selected-line])[data-decoration-bg-depth="2"] {\n --mix-deco-light: 83%;\n --mix-deco-dark: 83%;\n }\n\n &[data-hovered]:not([data-selected-line])[data-decoration-bg-depth="3"] {\n --mix-deco-light: 81%;\n --mix-deco-dark: 81%;\n }\n }\n\n --diffs-computed-decoration-bg: light-dark(color-mix(in lab,\n var(--diffs-bg) var(--mix-deco-light),\n var(--diffs-decoration-bg)), color-mix(in lab,\n var(--diffs-bg) var(--mix-deco-dark),\n var(--diffs-decoration-bg)));\n --diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);\n --diffs-computed-selected-line-bg: var(--diffs-computed-decoration-bg);\n --diffs-line-bg: var(--diffs-computed-decoration-bg);\n }\n }\n\n [data-line-annotation], [data-gutter-buffer="annotation"] {\n --diffs-annotation-bg: var(--diffs-bg-context);\n --diffs-computed-decoration-bg: var(--diffs-annotation-bg);\n --diffs-computed-diff-line-bg: var(--diffs-annotation-bg);\n --diffs-computed-selected-line-bg: var(--diffs-annotation-bg);\n --diffs-line-bg: var(--diffs-annotation-bg);\n }\n\n [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"] {\n --diffs-computed-decoration-bg: var(--diffs-bg-context);\n --diffs-computed-diff-line-bg: var(--diffs-bg-context);\n --diffs-computed-selected-line-bg: var(--diffs-bg-context);\n --diffs-line-bg: var(--diffs-bg-context);\n }\n\n [data-gutter-buffer="merge-conflict-marker-start"], [data-merge-conflict="marker-start"] {\n --diffs-computed-decoration-bg: light-dark(color-mix(in lab,\n var(--diffs-bg) 78%,\n var(--conflict-bg-current-header-override, var(--diffs-addition-base))), color-mix(in lab,\n var(--diffs-bg) 68%,\n var(--conflict-bg-current-header-override, var(--diffs-addition-base))));\n --diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);\n --diffs-computed-selected-line-bg: var(--diffs-computed-decoration-bg);\n --diffs-line-bg: var(--diffs-computed-decoration-bg);\n }\n\n [data-gutter-buffer="merge-conflict-marker-end"], [data-merge-conflict="marker-end"] {\n --diffs-computed-decoration-bg: light-dark(color-mix(in lab,\n var(--diffs-bg) 78%,\n var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))), color-mix(in lab,\n var(--diffs-bg) 68%,\n var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))));\n --diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);\n --diffs-computed-selected-line-bg: var(--diffs-computed-decoration-bg);\n --diffs-line-bg: var(--diffs-computed-decoration-bg);\n }\n\n [data-has-merge-conflict] [data-line-annotation], [data-has-merge-conflict] [data-gutter-buffer="annotation"] {\n --diffs-computed-decoration-bg: var(--diffs-bg);\n --diffs-computed-diff-line-bg: var(--diffs-bg);\n --diffs-computed-selected-line-bg: var(--diffs-bg);\n --diffs-line-bg: var(--diffs-bg);\n }\n\n :where([data-background]) {\n & [data-gutter-buffer], & [data-column-number] {\n --mix-light: 91%;\n --mix-dark: 85%;\n }\n\n & [data-line], & [data-no-newline] {\n --mix-light: 88%;\n --mix-dark: 80%;\n }\n\n & [data-gutter-buffer], & [data-column-number], & [data-line], & [data-no-newline] {\n --diffs-diff-line-mix-target: var(--diffs-bg);\n\n &[data-line-type="change-deletion"] {\n --diffs-diff-line-mix-target: var(--diffs-bg-deletion-override, var(--diffs-deletion-base));\n\n @media (pointer: fine) {\n &[data-hovered] {\n --mix-light: 80%;\n --mix-dark: 75%;\n }\n }\n\n &:where([data-gutter-buffer], [data-column-number]) {\n color: var(--diffs-fg-number-deletion-override, var(--diffs-deletion-base));\n --diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base));\n }\n\n --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-light),\n var(--diffs-diff-line-mix-target)), color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-dark),\n var(--diffs-diff-line-mix-target)));\n --diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);\n --diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);\n }\n\n &[data-line-type="change-addition"] {\n --diffs-diff-line-mix-target: var(--diffs-bg-addition-override, var(--diffs-addition-base));\n\n @media (pointer: fine) {\n &[data-hovered] {\n --mix-light: 80%;\n --mix-dark: 70%;\n }\n }\n\n &:where([data-gutter-buffer], [data-column-number]) {\n color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));\n --diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base));\n }\n\n --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-light),\n var(--diffs-diff-line-mix-target)), color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-dark),\n var(--diffs-diff-line-mix-target)));\n --diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);\n --diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);\n }\n\n &[data-merge-conflict="current"] {\n --diffs-diff-line-mix-target: var(--conflict-bg-current-override, var(--diffs-addition-base));\n\n &:where([data-gutter-buffer], [data-column-number]) {\n color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));\n --diffs-diff-line-mix-target: var(--conflict-bg-current-number-override, var(--diffs-addition-base));\n }\n\n @media (pointer: fine) {\n &[data-hovered] {\n --mix-light: 80%;\n --mix-dark: 70%;\n }\n }\n\n --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-light),\n var(--diffs-diff-line-mix-target)), color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-dark),\n var(--diffs-diff-line-mix-target)));\n --diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);\n --diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);\n }\n\n &[data-merge-conflict="incoming"] {\n --diffs-diff-line-mix-target: var(--conflict-bg-incoming-override, var(--diffs-modified-base));\n\n &:where([data-gutter-buffer], [data-column-number]) {\n color: var(--diffs-modified-base);\n --diffs-diff-line-mix-target: var(--conflict-bg-incoming-number-override, var(--diffs-modified-base));\n }\n\n @media (pointer: fine) {\n &[data-hovered] {\n --mix-light: 80%;\n --mix-dark: 70%;\n }\n }\n\n --diffs-computed-diff-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-light),\n var(--diffs-diff-line-mix-target)), color-mix(in lab,\n var(--diffs-computed-decoration-bg) var(--mix-dark),\n var(--diffs-diff-line-mix-target)));\n --diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);\n --diffs-line-bg: var(--diffs-computed-diff-line-bg, inherit);\n }\n }\n }\n\n [data-gutter-buffer], [data-column-number], [data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline] {\n --diffs-selection-mix-target: var(--diffs-bg-selection-override, var(--diffs-selection-base));\n\n &:where([data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline])[data-selected-line] {\n --mix-selection-light: 82%;\n --mix-selection-dark: 75%;\n\n @media (pointer: fine) {\n &[data-hovered]:not([data-merge-conflict], [data-line-type="change-addition"], [data-line-type="change-deletion"]) {\n --mix-selection-light: 75%;\n --mix-selection-dark: 70%;\n }\n }\n }\n\n &:where([data-gutter-buffer], [data-column-number])[data-selected-line] {\n --mix-selection-light: 75%;\n --mix-selection-dark: 60%;\n --diffs-selection-mix-target: var(--diffs-bg-selection-number-override, var(--diffs-selection-base));\n\n @media (pointer: fine) {\n &[data-hovered]:not([data-merge-conflict], [data-line-type="change-addition"], [data-line-type="change-deletion"]) {\n --mix-selection-light: 70%;\n --mix-selection-dark: 55%;\n }\n }\n }\n\n &[data-selected-line] {\n --diffs-computed-selected-line-bg: light-dark(color-mix(in lab,\n var(--diffs-computed-diff-line-bg) var(--mix-selection-light),\n var(--diffs-selection-mix-target)), color-mix(in lab,\n var(--diffs-computed-diff-line-bg) var(--mix-selection-dark),\n var(--diffs-selection-mix-target)));\n --diffs-line-bg: var(--diffs-computed-selected-line-bg, inherit);\n }\n }\n\n [data-gutter-buffer], [data-column-number] {\n &[data-selected-line] {\n color: var(--diffs-selection-number-fg);\n }\n }\n\n [data-no-newline] {\n user-select: none;\n\n & span {\n opacity: .6;\n }\n }\n\n [data-diff-type="split"][data-overflow="scroll"] {\n grid-template-columns: 1fr 1fr;\n display: grid;\n\n & [data-additions] {\n border-left: 1px solid var(--diffs-bg);\n }\n\n & [data-deletions] {\n border-right: 1px solid var(--diffs-bg);\n }\n }\n\n [data-code] {\n grid-auto-flow: dense;\n grid-template-columns: var(--diffs-code-grid);\n overflow: var(--diffs-overflow-override, scroll) clip;\n overscroll-behavior-x: none;\n tab-size: var(--diffs-tab-size, 2);\n padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));\n padding-bottom: max(0px,\n calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) -\n var(--diffs-scrollbar-gutter)));\n scrollbar-gutter: stable;\n align-self: flex-start;\n display: grid;\n }\n\n [data-diffs-scrollbar-measure] {\n opacity: 0;\n pointer-events: none;\n scrollbar-gutter: auto;\n grid-template-columns: none;\n width: 100px;\n height: 100px;\n padding: 0;\n position: absolute;\n top: -200px;\n left: -200px;\n }\n\n [data-container-size] {\n container-type: inline-size;\n }\n\n [data-code]::-webkit-scrollbar {\n width: 0;\n height: var(--diffs-scrollbar-gutter);\n }\n\n [data-code]::-webkit-scrollbar-track {\n background: none;\n }\n\n [data-code]::-webkit-scrollbar-thumb {\n background-color: #0000;\n background-clip: content-box;\n border: 1px solid #0000;\n border-radius: 3px;\n }\n\n [data-code]::-webkit-scrollbar-corner {\n background-color: #0000;\n }\n\n @supports ((-moz-appearance: none)) {\n [data-code] {\n scrollbar-width: thin;\n scrollbar-color: var(--diffs-bg-context) transparent;\n padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));\n }\n }\n\n [data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] {\n & [data-code], &[data-overflow="wrap"] {\n padding-top: 0;\n }\n }\n\n [data-gutter] {\n grid-template-rows: subgrid;\n grid-template-columns: subgrid;\n z-index: 3;\n background-color: var(--diffs-bg);\n grid-column: 1;\n display: grid;\n position: relative;\n\n & [data-gutter-buffer], & [data-column-number] {\n border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));\n }\n }\n\n [data-content] {\n grid-template-rows: subgrid;\n grid-template-columns: subgrid;\n background-color: var(--diffs-bg);\n grid-column: 2;\n min-width: 0;\n display: grid;\n }\n\n [data-diff-type="split"][data-overflow="wrap"] {\n grid-auto-flow: dense;\n grid-template-columns: repeat(2, var(--diffs-code-grid));\n padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));\n display: grid;\n\n & [data-deletions] {\n display: contents;\n\n & [data-gutter] {\n grid-column: 1;\n }\n\n & [data-content] {\n border-right: 1px solid var(--diffs-bg);\n grid-column: 2;\n }\n }\n\n & [data-additions] {\n display: contents;\n\n & [data-gutter] {\n border-left: 1px solid var(--diffs-bg);\n grid-column: 3;\n }\n\n & [data-content] {\n grid-column: 4;\n }\n }\n }\n\n [data-overflow="scroll"] [data-gutter] {\n position: sticky;\n left: 0;\n }\n\n [data-interactive-lines] [data-line] {\n cursor: pointer;\n }\n\n [data-interactive-line-numbers] [data-column-number] {\n cursor: pointer;\n touch-action: none;\n }\n\n [data-content-buffer], [data-gutter-buffer] {\n user-select: none;\n min-height: 1lh;\n position: relative;\n }\n\n [data-gutter-buffer] {\n padding-left: 2ch;\n padding-right: 1ch;\n\n &:before {\n content: "";\n min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));\n display: block;\n }\n }\n\n [data-gutter-buffer="annotation"] {\n --diffs-annotation-bg: var(--diffs-bg-context-gutter);\n min-height: 0;\n }\n\n [data-gutter-buffer="buffer"] {\n --diffs-line-bg: var(--diffs-bg-context-gutter);\n }\n\n [data-content-buffer] {\n background-position: 5px 0;\n background-size: 8px 8px;\n background-origin: border-box;\n background-image: repeating-linear-gradient(-45deg,\n transparent,\n transparent calc(3px * 1.414),\n var(--diffs-bg-buffer) calc(3px * 1.414),\n var(--diffs-bg-buffer) calc(4px * 1.414));\n grid-column: 1;\n }\n\n [data-separator] {\n box-sizing: content-box;\n background-color: var(--diffs-bg);\n }\n\n [data-separator="simple"] {\n min-height: 4px;\n }\n\n [data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"], [data-separator="simple"] {\n background-color: var(--diffs-bg-separator);\n }\n\n [data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"] {\n height: 32px;\n position: relative;\n }\n\n [data-separator-wrapper] {\n user-select: none;\n fill: currentColor;\n background-color: var(--diffs-bg);\n align-items: center;\n height: 100%;\n display: flex;\n position: absolute;\n inset-inline: 0;\n }\n\n [data-content] [data-separator-wrapper] {\n display: none;\n }\n\n [data-separator="metadata"] [data-separator-wrapper] {\n background-color: var(--diffs-bg-separator);\n height: 100%;\n color: var(--diffs-fg-number);\n white-space: nowrap;\n text-overflow: ellipsis;\n min-width: min-content;\n padding-inline: 1ch;\n inset-inline: 100% auto;\n overflow: hidden;\n }\n\n [data-separator="line-info"] {\n margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));\n\n & [data-separator-wrapper] {\n min-width: 16px;\n }\n }\n\n [data-separator="line-info-basic"], [data-separator="metadata"] {\n margin-block: 0;\n }\n\n [data-separator="line-info"][data-separator-first] {\n margin-top: 0;\n }\n\n [data-separator="line-info"][data-separator-last] {\n margin-bottom: 0;\n }\n\n [data-expand-index] [data-separator-wrapper] {\n grid-template-columns: 32px auto;\n display: grid;\n }\n\n [data-expand-index] [data-separator-wrapper][data-separator-multi-button] {\n grid-template-columns: 32px 32px auto;\n }\n\n [data-expand-button], [data-separator-content] {\n background-color: var(--diffs-bg-separator);\n flex: none;\n align-items: center;\n display: flex;\n }\n\n [data-expand-index] [data-separator-content]:hover {\n cursor: pointer;\n text-decoration: underline;\n }\n\n [data-expand-button] {\n cursor: pointer;\n min-width: 32px;\n color: var(--diffs-fg-number);\n border-right: 2px solid var(--diffs-bg);\n flex-shrink: 0;\n justify-content: center;\n align-self: stretch;\n\n &:hover {\n color: var(--diffs-fg);\n }\n\n &[data-expand-all-button] {\n display: none;\n }\n }\n\n [data-expand-down] [data-icon] {\n transform: scaleY(-1);\n }\n\n [data-separator-content] {\n height: 100%;\n color: var(--diffs-fg-number);\n flex: auto;\n justify-content: flex-start;\n padding: 0 1ch;\n overflow: hidden;\n }\n\n [data-separator="line-info"], [data-separator="line-info-basic"] {\n & [data-separator-content] {\n user-select: none;\n height: 100%;\n overflow: clip;\n }\n }\n\n [data-unmodified-lines] {\n text-overflow: ellipsis;\n white-space: nowrap;\n flex: 0 auto;\n min-width: 0;\n display: block;\n overflow: hidden;\n }\n\n @supports (width: 1cqi) {\n [data-unified] {\n & [data-separator="line-info"] [data-separator-wrapper] {\n padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n width: 100cqi;\n\n & [data-separator-content] {\n border-radius: 6px;\n }\n }\n\n & [data-separator="line-info"][data-expand-index] [data-separator-wrapper] [data-separator-content] {\n border-top-left-radius: unset;\n border-bottom-left-radius: unset;\n }\n }\n\n [data-gutter] {\n & [data-separator="line-info"] [data-separator-wrapper] {\n padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n }\n\n & [data-separator="line-info"] [data-separator-content] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n & [data-separator="line-info"][data-expand-index] [data-separator-content] {\n border-top-left-radius: unset;\n border-bottom-left-radius: unset;\n }\n }\n\n [data-additions] {\n & [data-content] [data-separator="line-info"] {\n background-color: var(--diffs-bg);\n\n & [data-separator-wrapper] {\n display: none;\n }\n }\n\n & [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {\n background-color: var(--diffs-bg-separator);\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n height: 100%;\n display: block;\n\n & [data-separator-content], & [data-expand-button] {\n display: none;\n }\n }\n }\n\n [data-overflow="scroll"] [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {\n width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));\n }\n\n [data-overflow="wrap"] [data-additions] [data-content] [data-separator="line-info"] [data-separator-wrapper] {\n background-color: var(--diffs-bg-separator);\n height: 100%;\n margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n border-top-right-radius: 6px;\n border-bottom-right-radius: 6px;\n display: block;\n\n & [data-separator-content], & [data-expand-button] {\n display: none;\n }\n }\n\n [data-separator="line-info"] [data-separator-wrapper] {\n & [data-expand-both], & [data-expand-down], & [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n }\n\n @media (pointer: fine) {\n [data-separator="line-info"] [data-separator-wrapper] {\n &[data-separator-multi-button] {\n & [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: unset;\n }\n\n & [data-expand-down] {\n border-bottom-left-radius: 6px;\n border-top-left-radius: unset;\n }\n }\n }\n }\n }\n\n @media (pointer: coarse) {\n [data-separator="line-info-basic"] [data-separator-wrapper][data-separator-multi-button] {\n grid-template-columns: 34px 34px auto;\n\n & [data-separator-content] {\n grid-column: unset;\n grid-row: unset;\n }\n }\n\n @supports (width: 1cqi) {\n [data-separator="line-info"] [data-separator-wrapper] {\n & [data-expand-both], & [data-expand-down], & [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n &[data-separator-multi-button] {\n & [data-expand-up] {\n border-top-left-radius: 6px;\n border-bottom-left-radius: 6px;\n }\n\n & [data-expand-down] {\n border-bottom-left-radius: unset;\n border-top-left-radius: unset;\n }\n }\n }\n }\n }\n\n @media (pointer: fine) {\n [data-separator-wrapper][data-separator-multi-button] {\n grid-template-rows: 50% 50%;\n display: grid;\n\n & [data-separator-content] {\n grid-area: 1 / 2 / -1;\n min-width: min-content;\n }\n\n & [data-expand-button] {\n grid-column: 1;\n }\n }\n\n [data-separator="line-info"] [data-separator-wrapper], [data-separator="line-info"] [data-separator-wrapper][data-separator-multi-button] {\n grid-template-columns: 34px auto;\n }\n\n [data-separator="line-info-basic"][data-expand-index] [data-separator-wrapper] {\n grid-template-columns: 100% auto;\n }\n\n [data-separator="line-info"], [data-separator="line-info-basic"] {\n & [data-separator-multi-button] {\n & [data-expand-up] {\n border-bottom: 1px solid var(--diffs-bg);\n border-right: 2px solid var(--diffs-bg);\n }\n\n & [data-expand-down] {\n border-top: 1px solid var(--diffs-bg);\n border-right: 2px solid var(--diffs-bg);\n }\n }\n }\n }\n\n [data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator="line-info-basic"] [data-separator-wrapper], [data-content] [data-separator-wrapper] {\n display: none;\n }\n\n [data-line-annotation] {\n min-height: var(--diffs-annotation-min-height, 0);\n z-index: 2;\n }\n\n [data-merge-conflict-actions] {\n z-index: 2;\n }\n\n [data-separator="custom"] {\n grid-template-columns: subgrid;\n display: grid;\n }\n\n [data-line], [data-column-number], [data-no-newline] {\n padding-inline: 1ch;\n position: relative;\n }\n\n [data-indicators="classic"] [data-line] {\n padding-inline-start: 2ch;\n }\n\n [data-indicators="classic"] {\n & [data-line-type="change-addition"], & [data-line-type="change-deletion"] {\n &[data-no-newline], &[data-line] {\n &:before {\n user-select: none;\n width: 1ch;\n height: 1lh;\n display: inline-block;\n position: absolute;\n top: 0;\n left: 0;\n }\n }\n }\n\n & [data-line-type="change-addition"] {\n &[data-line], &[data-no-newline] {\n &:before {\n content: "+";\n color: var(--diffs-addition-base);\n }\n }\n }\n\n & [data-line-type="change-deletion"] {\n &[data-line], &[data-no-newline] {\n &:before {\n content: "-";\n color: var(--diffs-deletion-base);\n }\n }\n }\n }\n\n [data-indicators="bars"] {\n & [data-line-type="change-deletion"], & [data-line-type="change-addition"] {\n &[data-column-number] {\n &:before {\n content: "";\n user-select: none;\n contain: strict;\n width: 4px;\n height: 100%;\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n }\n }\n }\n\n & [data-line-type="change-deletion"] {\n &[data-column-number] {\n &:before {\n background-image: linear-gradient(0deg,\n var(--diffs-bg-deletion) 50%,\n var(--diffs-deletion-base) 50%);\n background-repeat: repeat;\n background-size: 2px 2px;\n background-size: calc(1lh / round(1lh / 2px))\n calc(1lh / round(1lh / 2px));\n }\n }\n }\n\n & [data-line-type="change-addition"] {\n &[data-column-number] {\n &:before {\n background-color: var(--diffs-addition-base);\n }\n }\n }\n }\n\n [data-overflow="wrap"] {\n & [data-line], & [data-annotation-content] {\n white-space: pre-wrap;\n word-break: break-word;\n }\n }\n\n [data-overflow="scroll"] [data-line] {\n white-space: pre;\n min-height: 1lh;\n }\n\n [data-column-number] {\n box-sizing: content-box;\n text-align: right;\n user-select: none;\n color: var(--diffs-fg-number);\n padding-left: 2ch;\n }\n\n [data-line-number-content] {\n min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));\n z-index: 1;\n display: inline-block;\n position: relative;\n }\n\n [data-disable-line-numbers] {\n & [data-gutter-buffer], & [data-column-number] {\n min-width: 4px;\n padding: 0;\n\n &:before {\n min-width: 0;\n }\n }\n\n & [data-line-number-content] {\n display: none;\n }\n\n & [data-gutter-utility-slot] {\n right: unset;\n justify-content: flex-start;\n left: 0;\n }\n\n &[data-indicators="bars"] [data-gutter-utility-slot] {\n left: 6px;\n }\n }\n\n [data-file][data-disable-line-numbers] {\n & [data-gutter-buffer], & [data-column-number] {\n border-right: 0;\n min-width: 0;\n }\n }\n\n [data-diff-span] {\n box-decoration-break: clone;\n border-radius: 3px;\n }\n\n [data-line-type="change-addition"] [data-diff-span] {\n background-color: var(--diffs-bg-addition-emphasis);\n }\n\n [data-line-type="change-deletion"] [data-diff-span] {\n background-color: var(--diffs-bg-deletion-emphasis);\n }\n\n [data-merge-conflict="marker-start"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"], [data-merge-conflict="marker-end"] {\n color: var(--diffs-fg);\n padding-left: 1ch;\n }\n\n [data-merge-conflict="marker-start"], [data-merge-conflict="marker-end"] {\n align-items: center;\n display: flex;\n\n &:after {\n color: var(--diffs-fg-conflict-marker);\n font-size: .75rem;\n font-style: normal;\n line-height: 1.25rem;\n font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));\n padding-left: 1ch;\n }\n }\n\n [data-merge-conflict="marker-start"]:after {\n content: "(Current Change)";\n }\n\n [data-merge-conflict="marker-end"]:after {\n content: "(Incoming Change)";\n }\n\n [data-merge-conflict-actions-content] {\n min-height: 1.75rem;\n font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));\n color: var(--diffs-fg);\n align-items: center;\n gap: .25rem;\n padding-inline: .5rem;\n font-size: .75rem;\n line-height: 1.2;\n display: flex;\n }\n\n [data-merge-conflict-action] {\n appearance: none;\n color: var(--diffs-fg-number);\n font: inherit;\n cursor: pointer;\n background: none;\n border: 0;\n padding: 0;\n font-style: normal;\n }\n\n [data-merge-conflict-action]:hover {\n color: var(--diffs-fg);\n }\n\n [data-merge-conflict-action="current"]:hover {\n color: var(--diffs-addition-base);\n }\n\n [data-merge-conflict-action="incoming"]:hover {\n color: var(--diffs-modified-base);\n }\n\n [data-merge-conflict-action-separator] {\n color: var(--diffs-fg-number);\n opacity: .6;\n user-select: none;\n }\n\n [data-diffs-header="default"] {\n background-color: var(--diffs-bg);\n justify-content: space-between;\n align-items: center;\n gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n min-height: calc(1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3));\n z-index: 2;\n flex-direction: row;\n padding-inline: 16px;\n display: flex;\n position: relative;\n top: 0;\n }\n\n [data-header-content] {\n align-items: center;\n gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));\n white-space: nowrap;\n flex-direction: row;\n min-width: 0;\n display: flex;\n }\n\n [data-header-content] [data-prev-name], [data-header-content] [data-title] {\n text-overflow: ellipsis;\n white-space: nowrap;\n direction: rtl;\n min-width: 0;\n overflow: hidden;\n }\n\n [data-prev-name] {\n opacity: .7;\n }\n\n [data-rename-icon] {\n fill: currentColor;\n flex-grow: 0;\n flex-shrink: 0;\n }\n\n [data-diffs-header="default"] [data-metadata] {\n white-space: nowrap;\n align-items: center;\n gap: 1ch;\n display: flex;\n }\n\n [data-diffs-header="default"] [data-additions-count] {\n font-family: var(--diffs-font-family, var(--diffs-font-fallback));\n color: var(--diffs-addition-base);\n }\n\n [data-diffs-header="default"] [data-deletions-count] {\n font-family: var(--diffs-font-family, var(--diffs-font-fallback));\n color: var(--diffs-deletion-base);\n }\n\n [data-change-icon] {\n fill: currentColor;\n flex-shrink: 0;\n }\n\n [data-change-icon="change"], [data-change-icon="rename-pure"], [data-change-icon="rename-changed"] {\n color: var(--diffs-modified-base);\n }\n\n [data-change-icon="new"] {\n color: var(--diffs-addition-base);\n }\n\n [data-change-icon="deleted"] {\n color: var(--diffs-deletion-base);\n }\n\n [data-change-icon="file"] {\n opacity: .6;\n }\n\n [data-annotation-content] {\n z-index: 2;\n isolation: isolate;\n align-self: flex-start;\n min-width: 0;\n display: flow-root;\n position: relative;\n }\n\n [data-overflow="scroll"] [data-annotation-content], [data-overflow="scroll"] [data-merge-conflict-actions-content] {\n width: var(--diffs-column-content-width, auto);\n left: var(--diffs-column-number-width, 0);\n position: sticky;\n }\n\n [data-annotation-slot] {\n text-wrap-mode: wrap;\n word-break: normal;\n white-space-collapse: collapse;\n }\n\n [data-gutter-utility-slot] {\n touch-action: none;\n justify-content: flex-end;\n display: flex;\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n }\n\n [data-utility-button] {\n appearance: none;\n cursor: pointer;\n width: 1lh;\n height: 1lh;\n font-size: var(--diffs-font-size, 13px);\n line-height: var(--diffs-line-height, 20px);\n background-color: var(--diffs-modified-base);\n color: var(--diffs-bg);\n fill: currentColor;\n z-index: 4;\n touch-action: none;\n border: none;\n border-radius: 4px;\n justify-content: center;\n align-items: center;\n margin-right: calc(-1lh + 1ch);\n padding: 0;\n display: flex;\n position: relative;\n\n &:before {\n content: "";\n display: block;\n position: absolute;\n inset: 0 0 0 -4px;\n }\n }\n\n [data-decoration-bar-stack] {\n pointer-events: none;\n isolation: isolate;\n z-index: 1;\n background-color: var(--diffs-decoration-bar-color, transparent);\n box-sizing: content-box;\n border-left: 2px solid var(--diffs-bg);\n border-right: 2px solid var(--diffs-bg);\n width: 6px;\n position: absolute;\n top: 0;\n bottom: 0;\n right: -2px;\n\n [data-decoration-bar-depth="1"] & {\n background-color: color-mix(in lab,\n var(--diffs-bg) 20%,\n var(--diffs-decoration-bar-color, transparent));\n }\n\n [data-decoration-bar-depth="2"] & {\n background-color: color-mix(in lab,\n var(--diffs-bg) 45%,\n var(--diffs-decoration-bar-color, transparent));\n }\n\n [data-decoration-bar-depth="3"] & {\n background-color: color-mix(in lab,\n var(--diffs-bg) 65%,\n var(--diffs-decoration-bar-color, transparent));\n }\n\n [data-decoration-bar-start] & {\n border-top-left-radius: 5px;\n border-top-right-radius: 5px;\n }\n\n [data-decoration-bar-end] & {\n z-index: 3;\n border-bottom-right-radius: 5px;\n border-bottom-left-radius: 5px;\n }\n }\n\n [data-placeholder] {\n contain: strict;\n }\n\n [data-error-wrapper] {\n padding: var(--diffs-gap-block, var(--diffs-gap-fallback))\n var(--diffs-gap-inline, var(--diffs-gap-fallback));\n scrollbar-width: none;\n max-height: 400px;\n overflow: auto;\n\n & [data-error-message] {\n color: var(--diffs-deletion-base);\n font-size: 18px;\n font-weight: bold;\n }\n\n & [data-error-stack] {\n color: var(--diffs-fg-number);\n }\n }\n}\n\n@layer theme, rendered, unsafe;\n';let co;function fo(e){if(null!=co)return co;const t=e.host;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&!t.isConnected)return;const n=document.createElement("div");n.setAttribute("data-code",""),n.setAttribute(U,"true");const i=document.createElement("div");return i.style.position="relative",i.style.width="200%",i.style.height="200%",n.appendChild(i),e.appendChild(n),co=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),co}function po(e){return`${B}: ${null==e?"var(--diffs-scrollbar-gutter-fallback)":`${e}px`};`}const go="@layer base, theme, rendered, unsafe;",mo=new RegExp(`${vo=B,vo.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*:\\s*[^;]+;`);var vo;function bo(e){return`${go}\n${uo}\n@layer theme {\n ${e}\n}`}function So(e){return`${go}\n@layer unsafe {\n ${e}\n}`}function yo(e,t="system",n){return`${go}\n@layer rendered {\n :host {${"system"===t?"":`\n color-scheme: ${t};`}\n ${po(n)}\n ${e}\n }\n}`}function xo(e,t){const n=po(t);return e.replace(mo,n)}function Co({code:e,pre:t,columnType:n,rowSpan:i,containerSize:o=!1}={}){return null==e&&((e=document.createElement("code")).setAttribute("data-code",""),null!=n&&e.setAttribute(`data-${n}`,""),null==t||t.appendChild(e)),null!=i?e.style.setProperty("grid-row",`span ${i}`):e.style.removeProperty("grid-row"),o?e.setAttribute("data-container-size",""):e.removeAttribute("data-container-size"),e}function ko(e,t){var n;if(null==t)return;const i=null!=(n=e.shadowRoot)?n:e.attachShadow({mode:"open"});""===i.innerHTML&&(i.innerHTML=t)}function Lo(e,{type:t,diffIndicators:n,disableBackground:i,disableLineNumbers:o,overflow:r,split:l,totalLines:s,customProperties:a}){if(null!=a)for(const d in a){const t=a[d];null!=t&&e.setAttribute(d,`${t}`)}switch("diff"===t?(e.setAttribute("data-diff",""),e.removeAttribute("data-file")):(e.setAttribute("data-file",""),e.removeAttribute("data-diff")),n){case"bars":case"classic":e.setAttribute("data-indicators",n);break;case"none":e.removeAttribute("data-indicators")}return o?e.setAttribute("data-disable-line-numbers",""):e.removeAttribute("data-disable-line-numbers"),i?e.removeAttribute("data-background"):e.setAttribute("data-background",""),"diff"===t?e.setAttribute("data-diff-type",l?"split":"single"):e.removeAttribute("data-diff-type"),e.setAttribute("data-overflow",r),e.style.setProperty("--diffs-min-number-column-width-default",`${`${s}`.length}ch`),e}function wo(e){var t;if("undefined"!=typeof HTMLStyleElement&&e instanceof HTMLStyleElement)return!0;const n=null!=(t=e.tagName)?t:e.nodeName;return"string"==typeof n&&"style"===n.toLowerCase()}function To(e){return{theme:null==e?void 0:e.theme,disableLineNumbers:null==e?void 0:e.disableLineNumbers,overflow:null==e?void 0:e.overflow,themeType:null==e?void 0:e.themeType,collapsed:null==e?void 0:e.collapsed,disableFileHeader:null==e?void 0:e.disableFileHeader,disableVirtualizationBuffers:null==e?void 0:e.disableVirtualizationBuffers,stickyHeader:null==e?void 0:e.stickyHeader,preferredHighlighter:null==e?void 0:e.preferredHighlighter,useCSSClasses:null==e?void 0:e.useCSSClasses,useTokenTransformer:null==e?void 0:e.useTokenTransformer,tokenizeMaxLineLength:null==e?void 0:e.tokenizeMaxLineLength,tokenizeMaxLength:null==e?void 0:e.tokenizeMaxLength,unsafeCSS:null==e?void 0:e.unsafeCSS,headerRenderMode:null!=(null==e?void 0:e.renderCustomHeader)?"custom":"default"}}function Eo({shadowRoot:e,currentNode:t,themeCSS:n}){if(""!==n.trim())return null!=t||(t=function(){const e=document.createElement("style");return e.setAttribute(N,""),e}()),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t;null==t||t.remove()}if("undefined"!=typeof HTMLElement&&null==customElements.get("diffs-container")){let e;class t extends HTMLElement{constructor(){if(super(),null!=this.shadowRoot)return;const t=this.attachShadow({mode:"open"});null==e&&(e=new CSSStyleSheet,e.replaceSync(uo)),t.adoptedStyleSheets=[e]}connectedCallback(){var e;fo(null!=(e=this.shadowRoot)?e:this.attachShadow({mode:"open"}))}}customElements.define(C,t)}const Io=[];let Ao=-1;var Ro=(n=class{constructor(e={theme:O},t,n=!1){var i;S(this,"options"),S(this,"workerManager"),S(this,"isContainerManaged"),S(this,"__id","file:"+ ++Ao),S(this,"type","file"),S(this,"fileContainer"),S(this,"spriteSVG"),S(this,"pre"),S(this,"code"),S(this,"bufferBefore"),S(this,"bufferAfter"),S(this,"themeCSSStyle"),S(this,"appliedThemeCSS"),S(this,"hasAdoptedThemeCSS",!1),S(this,"unsafeCSSStyle"),S(this,"appliedUnsafeCSS"),S(this,"gutterUtilityContent"),S(this,"errorWrapper"),S(this,"placeHolder"),S(this,"lastRenderedHeaderHTML"),S(this,"cachedHeaderHTML"),S(this,"appliedPreAttributes"),S(this,"lastRowCount"),S(this,"mounted",!1),S(this,"headerElement"),S(this,"headerCustom"),S(this,"headerPrefix"),S(this,"headerMetadata"),S(this,"fileRenderer"),S(this,"resizeManager"),S(this,"interactionManager"),S(this,"annotationCache",new Map),S(this,"lineAnnotations",[]),S(this,"managersDirty",!1),S(this,"file"),S(this,"renderRange"),S(this,"enabled",!0),S(this,"handleHighlightRender",()=>{this.rerender()}),S(this,"getHoveredLine",()=>this.interactionManager.getHoveredLine()),this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new to(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new on,this.interactionManager=new Vt("file",_t(e)),null==(i=this.workerManager)||i.subscribeToThemeChanges(this)}rerender(){this.enabled&&null!=this.file&&this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){null!=e&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(_t(this.options))}mergeOptions(e){this.options=m(m({},this.options),e)}setThemeType(e){var t;(null!=(t=this.options.themeType)?t:"system")!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){var t;if("string"==typeof this.options.theme||null==this.fileContainer||null==this.appliedThemeCSS)return!1;const n=null!=(t=this.appliedThemeCSS.baseThemeType)?t:e;return this.appliedThemeCSS.themeType!==n&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){var e;return null!=this.appliedThemeCSS&&!te(this.appliedThemeCSS.theme,null!=(e=this.options.theme)?e:O)}setLineAnnotations(e){this.lineAnnotations=e}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}flushManagers(){if(!this.managersDirty||null==this.pre)return void(this.managersDirty=!1);const{overflow:e="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,"wrap"===e),this.managersDirty=!1}cleanUp(e=!1){var t,n;this.emitPostRender(!0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,null==(t=this.workerManager)||t.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||null==(n=this.fileContainer)||n.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.annotationCache.clear(),this.pre=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder=void 0,this.unsafeCSSStyle=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0),this.enabled=!1}virtualizedSetup(){var e;this.enabled=!0,null==(e=this.workerManager)||e.subscribeToThemeChanges(this)}hydrate(e){const{fileContainer:t,prerenderedHTML:n,preventEmit:i=!1,file:o,lineAnnotations:r}=e;this.hydrateElements(t,n),function(e,t,n=!1){return!n&&null==e&&null!=t}(this.pre,o,this.options.collapsed)||function(e,t,n=!1){return null==e&&null!=t&&!n}(this.headerElement,o,this.options.disableFileHeader)?this.render(v(m({},e),{preventEmit:!0})):this.hydrationSetup({file:o,lineAnnotations:r}),i||this.emitPostRender()}hydrateElements(e,t){var n,i;this.fileContainer!==e&&this.emitPostRender(!0),ko(e,t);for(const o of Array.from(null!=(i=null==(n=e.shadowRoot)?void 0:n.children)?i:[]))o instanceof SVGElement?this.spriteSVG=o:o instanceof HTMLElement&&(o instanceof HTMLPreElement?(this.pre=o,this.appliedPreAttributes=void 0):o instanceof HTMLStyleElement&&o.hasAttribute("data-theme-css")?this.themeCSSStyle=o:o instanceof HTMLStyleElement&&o.hasAttribute("data-unsafe-css")?(this.unsafeCSSStyle=o,this.appliedUnsafeCSS=o.textContent):"diffsHeader"in o.dataset&&(this.headerElement=o,this.lastRenderedHeaderHTML=void 0));null!=this.pre&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute("data-dehydrated")),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=null!=t?t:this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(To(this.options)),this.syncInteractionOptions(),null!=this.pre&&(this.fileRenderer.hydrate(e),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.file){return null!=e?this.fileRenderer.getOrCreateLineCache(e):Io}render({file:e,fileContainer:t,forceRender:n=!1,preventEmit:i=!1,containerWrapper:o,deferManagers:r=!1,lineAnnotations:l,renderRange:s}){var a;const{collapsed:d=!1,themeType:h="system"}=this.options;if(!this.enabled)throw new Error("File.render: attempting to call render after cleaned up");const u=d?void 0:s,c=this.renderRange,f=this.hasThemeChanged(),p=null!=l&&(l.length>0||this.lineAnnotations.length>0)&&l!==this.lineAnnotations,g=!li(this.file,e);if(!d&&!n&&si(u,this.renderRange)&&!g&&!p&&!f)return this.applyCachedThemeState(h);this.renderRange=u,g&&(this.cachedHeaderHTML=void 0),this.file=e,this.fileRenderer.setOptions(To(this.options)),this.syncInteractionOptions(),null!=l&&this.setLineAnnotations(l),this.fileRenderer.setLineAnnotations(this.lineAnnotations);const{disableErrorHandling:m=!1,disableFileHeader:v=!1}=this.options;if(v&&(null!=this.headerElement&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,o),this.applyCachedThemeState(h),d){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{const n=this.fileRenderer.renderFile(e,K);null!=n&&this.applyThemeState(t,n.themeStyles,h,n.baseThemeType),null!=(null==n?void 0:n.headerAST)&&this.applyHeaderToDOM(n.headerAST,t),this.injectUnsafeCSS()}catch(b){if(m)throw b;console.error(b),b instanceof Error&&this.applyErrorToDOM(b,t)}return i||this.emitPostRender(),!0}try{const i=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,g||f)||!this.applyPartialRender(c,u)){const n=this.fileRenderer.renderFile(e,u);if(null==n)return!1===(null==(a=this.workerManager)?void 0:a.isInitialized())&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,h,n.baseThemeType),null!=n.headerAST&&this.applyHeaderToDOM(n.headerAST,t),this.applyFullRender(n,i)}this.applyBuffers(i,u),this.injectUnsafeCSS(),this.managersDirty=!0,r||this.flushManagers(),this.renderAnnotations(),this.renderGutterUtility()}catch(b){if(m)throw b;console.error(b),b instanceof Error&&this.applyErrorToDOM(b,t)}return i||this.emitPostRender(),!0}emitPostRender(e=!1){const{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted)return;if(this.mounted=!1,null==t)return;return void(null==n||n(t,this,"unmount"))}if(null==t)return;const i=this.mounted?"update":"mount";this.mounted=!0,null==n||n(t,this,i)}removeRenderedCode(){var e,t,n,i;this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),null==(e=this.bufferBefore)||e.remove(),this.bufferBefore=void 0,null==(t=this.bufferAfter)||t.remove(),this.bufferAfter=void 0,null==(n=this.code)||n.remove(),this.code=void 0,null==(i=this.pre)||i.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){var e;for(const{element:t}of this.annotationCache.values())t.remove();this.annotationCache.clear(),null==(e=this.gutterUtilityContent)||e.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){var t;if(null==this.fileContainer)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),null==this.placeHolder){const e=null!=(t=this.fileContainer.shadowRoot)?t:this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty("height",`${e}px`),!0}primeHighlightCache(){var e;const{file:t,workerManager:n}=this;null==t||null==t.cacheKey||null==n||Zi(t)||this.fileRenderer.getOrCreateLineCache(t).length>(null!=(e=this.options.tokenizeMaxLength)?e:1e5)||n.primeFileHighlightCache(t)}cleanChildNodes(){var e,t,n,i,o,r,l,s,a,d,h,u,c;this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),null==(e=this.bufferAfter)||e.remove(),null==(t=this.bufferBefore)||t.remove(),null==(n=this.code)||n.remove(),null==(i=this.errorWrapper)||i.remove(),null==(o=this.headerElement)||o.remove(),null==(r=this.gutterUtilityContent)||r.remove(),null==(l=this.headerPrefix)||l.remove(),null==(s=this.headerMetadata)||s.remove(),null==(a=this.headerCustom)||a.remove(),null==(d=this.pre)||d.remove(),null==(h=this.spriteSVG)||h.remove(),null==(u=this.themeCSSStyle)||u.remove(),null==(c=this.unsafeCSSStyle)||c.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.gutterUtilityContent=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||null==this.fileContainer){for(const{element:e}of this.annotationCache.values())e.remove();return void this.annotationCache.clear()}const e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(null!=t&&this.lineAnnotations.length>0)for(const[n,i]of this.lineAnnotations.entries()){const o=`${n}-${xi(i)}`;let r=this.annotationCache.get(o);if(null==r||!oo(i,r.annotation)){null==r||r.element.remove();const e=t(i);if(null==e)continue;r={element:so(xi(i)),annotation:i},r.element.appendChild(e),this.fileContainer.appendChild(r.element),this.annotationCache.set(o,r)}e.delete(o)}for(const[n,{element:i}]of e.entries())this.annotationCache.delete(n),i.remove()}renderGutterUtility(){var e,t;const{renderGutterUtility:n}=this.options;if(null==this.fileContainer||null==n)return null==(e=this.gutterUtilityContent)||e.remove(),void(this.gutterUtilityContent=void 0);const i=n(this.interactionManager.getHoveredLine);if(null!=i&&null!=this.gutterUtilityContent)return;if(null==i)return null==(t=this.gutterUtilityContent)||t.remove(),void(this.gutterUtilityContent=void 0);const o=ao();o.appendChild(i),this.fileContainer.appendChild(o),this.gutterUtilityContent=o}injectUnsafeCSS(){var e,t;const{unsafeCSS:n}=this.options,i=null==(e=this.fileContainer)?void 0:e.shadowRoot;if(null!=i)return null==n||""===n?(null!=this.unsafeCSSStyle&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),void(this.appliedUnsafeCSS=void 0)):void((null==(t=this.unsafeCSSStyle)?void 0:t.parentNode)===i&&this.appliedUnsafeCSS===n||(null!=this.unsafeCSSStyle||(this.unsafeCSSStyle=ho()),this.unsafeCSSStyle.parentNode!==i&&i.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=So(n),this.appliedUnsafeCSS=n))}applyThemeState(e,t,n,i){var o,r,l,s,a;const d=null!=(o=e.shadowRoot)?o:e.attachShadow({mode:"open"}),h=null!=i?i:n,u=null!=(r=this.options.theme)?r:O,c="string"==typeof u?u:m({},u),f=fo(d);if((null==(l=this.themeCSSStyle)?void 0:l.parentNode)!==d||(null==(s=this.appliedThemeCSS)?void 0:s.themeStyles)!==t||this.appliedThemeCSS.themeType!==h||this.appliedThemeCSS.scrollbarGutter!==f){if(this.hasAdoptedThemeCSS&&(null==(a=this.themeCSSStyle)?void 0:a.parentNode)===d)return this.hasAdoptedThemeCSS=!1,void(this.appliedThemeCSS={theme:c,themeStyles:t,themeType:h,baseThemeType:i,scrollbarGutter:f});this.themeCSSStyle=Eo({shadowRoot:d,currentNode:this.themeCSSStyle,themeCSS:yo(t,h,f)}),this.appliedThemeCSS=null!=this.themeCSSStyle?{theme:c,themeStyles:t,themeType:h,baseThemeType:i,scrollbarGutter:f}:void 0}else this.appliedThemeCSS.theme=c}hydrateMeasuredScrollbar(){var e,t;const n=null==(e=this.fileContainer)?void 0:e.shadowRoot;null!=n&&null!=this.themeCSSStyle&&(this.themeCSSStyle.textContent=xo(null!=(t=this.themeCSSStyle.textContent)?t:"",fo(n)))}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e),this.code=Co({code:this.code}),this.code.innerHTML=this.fileRenderer.renderPartialHTML(this.fileRenderer.renderCodeAST(e)),t.replaceChildren(this.code),this.lastRowCount=e.rowCount}applyPartialRender(e,t){if(null==e||null==t)return!1;const{file:n,code:i}=this,o=null!=i?this.getColumns(i):void 0;if(null==n||null==i||null==o)return!1;const r=e.startingLine,l=t.startingLine,s=e.totalLines===1/0?Number.POSITIVE_INFINITY:r+e.totalLines,a=t.totalLines===1/0?Number.POSITIVE_INFINITY:l+t.totalLines,d=Math.max(r,l),h=Math.min(s,a);if(h<=d)return!1;if(!this.trimDOMToOverlap(o.gutter,d,h)||!this.trimDOMToOverlap(o.content,d,h))return!1;let{length:u}=o.content.children;const c=(e,t)=>{if(!(t<=0))return this.fileRenderer.renderFile(n,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},f=l<d?c(l,d-l):void 0;if(void 0===f&&l<d)return!1;const p=a===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:Math.max(0,a-h),g=a>h?c(h,p):void 0;return!(void 0===g&&a>h||(this.cleanupErrorWrapper(),null!=f&&(o.gutter.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(f.gutterAST)),o.content.insertAdjacentHTML("afterbegin",this.fileRenderer.renderPartialHTML(f.contentAST)),u+=f.rowCount),null!=g&&(o.gutter.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(g.gutterAST)),o.content.insertAdjacentHTML("beforeend",this.fileRenderer.renderPartialHTML(g.contentAST)),u+=g.rowCount),this.lastRowCount!==u&&(o.gutter.style.setProperty("grid-row",`span ${u}`),o.content.style.setProperty("grid-row",`span ${u}`),this.lastRowCount=u),0))}getColumns(e){const t=e.children[0],n=e.children[1];if(t instanceof HTMLElement&&n instanceof HTMLElement&&null!=t.dataset.gutter&&null!=n.dataset.content)return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){var i,o,r,l;const s=this.getDOMBoundaryIndices(e,[t,n]),a=null!=(i=s.get(t))?i:e.children.length,d=null!=(o=s.get(n))?o:e.children.length;if(a>d)return!1;for(let h=e.children.length-1;h>=d;h-=1)null==(r=e.children[h])||r.remove();for(let h=a-1;h>=0;h-=1)null==(l=e.children[h])||l.remove();return!0}getDOMBoundaryIndices(e,t){const n=[...new Set(t)].sort((e,t)=>e-t),i=new Map;if(0===n.length)return i;let o=0,r=n[o];const{children:l}=e;0===r&&(i.set(0,0),o+=1,r=n[o]);for(let s=0;s<l.length;s+=1){const e=l[s];if(!(e instanceof HTMLElement))continue;const t=this.getLineIndexFromDOMNode(e);if(null!=t){for(;null!=r&&t>=r;)i.set(r,s),o+=1,r=n[o];if(o>=n.length)break}}for(const s of n)i.has(s)||i.set(s,l.length);return i}getLineIndexFromDOMNode(e){const t=e.dataset.lineIndex;if(null==t)return;const n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(null==t||this.shouldDisableVirtualizationBuffers())return null!=this.bufferBefore&&(this.bufferBefore.remove(),this.bufferBefore=void 0),void(null!=this.bufferAfter&&(this.bufferAfter.remove(),this.bufferAfter=void 0));t.bufferBefore>0?(null==this.bufferBefore&&(this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",e.before(this.bufferBefore)),this.bufferBefore.style.setProperty("height",`${t.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")):null!=this.bufferBefore&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(null==this.bufferAfter&&(this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",e.after(this.bufferAfter)),this.bufferAfter.style.setProperty("height",`${t.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")):null!=this.bufferAfter&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){var e;return null!=(e=this.options.disableVirtualizationBuffers)&&e}applyHeaderToDOM(e,t){var n,i,o,r,l,s,a,d,h,u;const{file:c}=this;if(null==c)return;this.cleanupErrorWrapper(),null==(n=this.placeHolder)||n.remove(),this.placeHolder=void 0;const f=null!=(i=this.cachedHeaderHTML)?i:Bt(e);if(this.cachedHeaderHTML=f,f!==this.lastRenderedHeaderHTML){const e=document.createElement("div");e.innerHTML=f;const n=e.firstElementChild;if(!(n instanceof HTMLElement))return;null!=this.headerElement?null==(o=t.shadowRoot)||o.replaceChild(n,this.headerElement):null==(r=t.shadowRoot)||r.prepend(n),this.headerElement=n,this.lastRenderedHeaderHTML=f}if(this.isContainerManaged)return;const{renderHeaderPrefix:p,renderCustomHeader:g,renderHeaderMetadata:m}=this.options;if(null!=g){const e=null!=(l=g(c))?l:void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,D,e),null==(s=this.headerPrefix)||s.remove(),null==(a=this.headerMetadata)||a.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0}else{const e=null!=(d=null==p?void 0:p(c))?d:void 0,n=null!=(h=null==m?void 0:m(c))?h:void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,H,e),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,P,n),null==(u=this.headerCustom)||u.remove(),this.headerCustom=void 0}}clearHeaderSlots(){var e,t,n;null==(e=this.headerPrefix)||e.remove(),null==(t=this.headerMetadata)||t.remove(),null==(n=this.headerCustom)||n.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,i){if(null==i)return void(null==t||t.remove());const o=null!=t?t:this.createHeaderSlotElement(n);return null==t&&e.appendChild(o),this.replaceHeaderSlotContent(o,i),o}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){const t=document.createElement("div");return t.slot=e,t}getOrCreateFileContainerNode(e,t){var n;const{fileContainer:i}=this,o=null!=(n=null!=e?e:i)?n:document.createElement("diffs-container"),r=i!==o;return r&&this.emitPostRender(!0),this.fileContainer=o,null!=i&&r&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),null!=t&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),r&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){var t;const{shadowRoot:n}=e;if(null!=n)for(const i of n.children)i instanceof SVGElement?null!=this.spriteSVG||(this.spriteSVG=i):wo(i)&&i.hasAttribute("data-theme-css")?(null!=this.themeCSSStyle||(this.themeCSSStyle=i),this.hasAdoptedThemeCSS=!0):wo(i)&&i.hasAttribute("data-unsafe-css")&&(null!=this.unsafeCSSStyle||(this.unsafeCSSStyle=i),null!=this.appliedUnsafeCSS||(this.appliedUnsafeCSS=null!=(t=this.options.unsafeCSS)?t:void 0))}ensureSpriteSVG(e){var t;const n=null!=(t=e.shadowRoot)?t:e.attachShadow({mode:"open"});if(null==this.spriteSVG){const e=document.createElement("div");e.innerHTML=io;const t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}null!=this.spriteSVG&&this.spriteSVG.parentNode!==n&&n.appendChild(this.spriteSVG)}getOrCreatePreNode(e){var t,n,i;const o=null!=(t=e.shadowRoot)?t:e.attachShadow({mode:"open"});return null==this.pre?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.code=void 0,o.appendChild(this.pre)):this.pre.parentNode!==o&&(null==(n=e.shadowRoot)||n.appendChild(this.pre),this.appliedPreAttributes=void 0),null==(i=this.placeHolder)||i.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(const t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute("data-code"))return void(this.code=t)}applyPreNodeAttributes(e,{totalLines:t}){const{overflow:n="scroll",disableLineNumbers:i=!1}=this.options,o={type:"file",split:!1,overflow:n,disableLineNumbers:i,diffIndicators:"none",disableBackground:!0,totalLines:t};ro(o,this.appliedPreAttributes)||(Lo(e,o),this.appliedPreAttributes=o)}applyErrorToDOM(e,t){var n,i,o;this.cleanupErrorWrapper(),null==(n=this.pre)||n.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;const r=null!=(i=t.shadowRoot)?i:t.attachShadow({mode:"open"});null!=this.errorWrapper||(this.errorWrapper=document.createElement("div")),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",r.appendChild(this.errorWrapper);const l=document.createElement("div");l.dataset.errorMessage="",l.innerText=e.message,this.errorWrapper.appendChild(l);const s=document.createElement("pre");s.dataset.errorStack="",s.innerText=null!=(o=e.stack)?o:"No Error Stack",this.errorWrapper.appendChild(s)}cleanupErrorWrapper(){var e;null==(e=this.errorWrapper)||e.remove(),this.errorWrapper=void 0}},S(n,"LoadedCustomComponent",!0),n);function Mo(e){return m(m({},$),e)}function Ho(e,t){const n=function(e,t){var n;return null!=(n=e.paddingTop)?n:t?e.spacing:0}(e,t);return t?n:e.diffHeaderHeight+n}function Po(e){var t;return null!=(t=e.paddingBottom)?t:e.spacing}let Do=-1;var Oo=class extends Ro{constructor(e,t,n=$,i,o=!1){super(e,i,o),S(this,"virtualizer"),S(this,"metrics"),S(this,"__id","virtualized-file:"+ ++Do),S(this,"top"),S(this,"height",0),S(this,"cache",{heights:new Map,checkpoints:[],fileAnnotationHeight:0}),S(this,"isVisible",!1),S(this,"isSetup",!1),S(this,"layoutDirty",!0),S(this,"forceRenderOverride"),S(this,"currentCollapsed"),S(this,"onRender",e=>null!=this.fileContainer&&null!=this.file&&(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}))),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){!t&&ee(this.metrics,e)||(this.metrics=e,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}syncLineAnnotations(e){return null!=e&&e!==this.lineAnnotations&&(0!==e.length||0!==this.lineAnnotations.length)&&(super.setLineAnnotations(e),!0)}hasLineAnnotations(){return this.lineAnnotations.some(e=>e.lineNumber>0)}getLineHeight(e,t=!1){const n=this.cache.heights.get(e);if(null!=n)return n;const i=t?2:1;return this.metrics.lineHeight*i}setOptions(e){if(this.isAdvancedMode())throw new Error("VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(null==e)return;const{options:t}=this,n=!ne(t,e),i=function(e,t){var n,i,o,r,l,s,a,d;return(null!=(n=e.overflow)?n:"scroll")!==(null!=(i=t.overflow)?i:"scroll")||(null!=(o=e.collapsed)&&o)!==(null!=(r=t.collapsed)&&r)||(null!=(l=e.disableLineNumbers)&&l)!==(null!=(s=t.disableLineNumbers)&&s)||(null!=(a=e.disableFileHeader)&&a)!==(null!=(d=t.disableFileHeader)&&d)||e.unsafeCSS!==t.unsafeCSS}(t,e);super.setOptions(e),i&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,i)}setThemeType(e){if(this.isAdvancedMode())throw new Error("VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.");super.setThemeType(e)}resetLayoutCache(e=!1){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),null!=this.renderRange&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){var e;let t=!1;if(null==this.fileContainer||null==this.file)return 0!==this.height&&(t=!0),this.height=0,t;const{overflow:n="scroll"}=this.options;if(this.top=this.getVirtualizedTop(),"scroll"===n&&0===this.lineAnnotations.length&&!this.isResizeDebuggingEnabled())return t;if(null==this.code)return t;const i=this.code.children[1];if(!(i instanceof HTMLElement))return t;const o=Ki(this.lineAnnotations);if(null!=this.renderRange&&o&&Yi(this.renderRange)){const n=null!=(e=function(e){let t;for(const n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===Gi&&(t=Math.max(null!=t?t:0,n.getBoundingClientRect().height));return t}(i))?e:0;n!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=n,t=!0)}else o||0===this.cache.fileAnnotationHeight||(this.cache.fileAnnotationHeight=0,t=!0);for(const r of i.children){if(!(r instanceof HTMLElement))continue;const e=r.dataset.lineIndex;if(null==e)continue;const n=Number(e);let i=r.getBoundingClientRect().height,o=!1;r.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in r.nextElementSibling.dataset||"noNewline"in r.nextElementSibling.dataset)&&("noNewline"in r.nextElementSibling.dataset&&(o=!0),i+=r.nextElementSibling.getBoundingClientRect().height),i!==this.getLineHeight(n,o)&&(t=!0,i===this.metrics.lineHeight*(o?2:1)?this.cache.heights.delete(n):this.cache.heights.set(n,i))}return(t||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),t}prepareCodeViewItem(e,t,n,i){const o=this.syncLineAnnotations(i);let r=!0===(null==n?void 0:n.resetFileLayoutCache)||o;null!=(null==n?void 0:n.metrics)&&(this.metrics=n.metrics,r=!0);const{collapsed:l=!1}=this.options;return this.currentCollapsed!==l&&(this.currentCollapsed=l,r=!0),r&&this.resetLayoutCache(),this.file!==e&&(this.layoutDirty=!0),this.file=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e){var t,n;if(null==this.file||e<1)return;const{disableFileHeader:i=!1,collapsed:o=!1}=this.options,r=No(this.getOrCreateLineCache(this.file));let l=Ho(this.metrics,i);if(o||r<0)return{top:l,height:0};const s=Math.min(Math.max(e-1,0),r),{overflow:a="scroll"}=this.options,{lineHeight:d}=this.metrics;if(l+=this.cache.fileAnnotationHeight,"scroll"===a&&!this.hasLineAnnotations())return{top:l+s*d,height:d};const h=this.getLayoutCheckpointBeforeLineIndex(s);l=null!=(t=null==h?void 0:h.top)?t:l;for(let u=null!=(n=null==h?void 0:h.lineIndex)?n:0;u<s;u++)l+=this.getLineHeight(u,!1);return{top:l,height:this.getLineHeight(s,!1)}}getNumericScrollAnchor(e){if(null==this.file||null==this.renderRange)return;const{disableFileHeader:t=!1,collapsed:n=!1,overflow:i="scroll"}=this.options;if(n||this.renderRange.totalLines<=0)return;const o=No(this.getOrCreateLineCache(this.file));if(o<0)return;const r=Ho(this.metrics,t),l=Math.min(this.renderRange.startingLine,o),s=Math.min(l+this.renderRange.totalLines-1,o);if(s<l)return;const{fileAnnotationHeight:a}=this.cache;if("scroll"===i&&!this.hasLineAnnotations()){const{lineHeight:t}=this.metrics,n=r+(0===l?a:this.renderRange.bufferBefore),i=l+Math.max(Math.ceil((e-n)/t),0);if(i>s)return;return{lineNumber:i+1,top:r+a+i*t}}let d=r+(0===l?a:this.renderRange.bufferBefore);for(let h=l;h<=s;h++){if(d>=e)return{lineNumber:h+1,top:d};d+=this.getLineHeight(h)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(null==this.top||null==this.file)return;if(!0===this.options.collapsed)return{topOffset:this.top,height:this.height};const t=null!=e?this.computeRenderRangeFromWindow(this.file,this.top,e):this.renderRange;if(null==t)return;const{bufferBefore:n,bufferAfter:i,totalLines:o}=t;let r=0;if(0===o){const t=null!=e?e:this.virtualizer.getWindowSpecs();this.top<t.top&&(r=i)}return{topOffset:this.top+n+r,height:this.height-(n+i)}}cleanUp(e=!1){var t;null!=this.fileContainer&&this.isSimpleMode()&&(null==(t=this.getSimpleVirtualizer())||t.disconnect(this.fileContainer)),e||this.resetLayoutCache(),this.isSetup=!1,super.cleanUp(e)}computeApproximateSize(e=!1){const t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;const n=0===this.height;if(this.height=0,this.cache.checkpoints=[],null==this.file)return void(this.layoutDirty=!1);const{disableFileHeader:i=!1,collapsed:o=!1,overflow:r="scroll"}=this.options,{lineHeight:l}=this.metrics,s=this.getOrCreateLineCache(this.file),a=Ho(this.metrics,i),d=Po(this.metrics);if(this.height+=a,o)this.layoutDirty=!1;else{if(this.height+=this.cache.fileAnnotationHeight,"scroll"!==r||this.hasLineAnnotations()?Vi({lines:s,callback:({lineIndex:e})=>{this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1)}}):this.height+=this.getOrCreateLineCache(this.file).length*l,s.length>0&&(this.height+=d),null!=this.fileContainer&&t&&!n){const e=this.fileContainer.getBoundingClientRect();e.height!==this.height&&(this.file.name,e.height,this.height)}this.layoutDirty=!1}}setVisibility(e){this.isAdvancedMode()||null==this.fileContainer||(e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){this.enabled&&null!=this.file&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}render(e){var t,n,i=e,{fileContainer:o,file:r,forceRender:l=!1,lineAnnotations:s}=i,a=b(i,["fileContainer","file","forceRender","lineAnnotations"]);const{forceRenderOverride:d,isSetup:h}=this;this.forceRenderOverride=void 0;const u=this.syncLineAnnotations(s);if(u&&this.resetLayoutCache(),null!=this.file||(this.file=r),o=this.getOrCreateFileContainerNode(o),null==this.file)return console.error("VirtualizedFile.render: attempting to virtually render when we dont have file"),!1;if(h)null!=this.top||(this.top=this.getVirtualizedTop());else{this.computeApproximateSize();const e=this.getSimpleVirtualizer();if(null!=this.top||(this.top=this.getVirtualizedTop()),this.isAdvancedMode())this.isVisible=!0;else{if(null==e)throw new Error("VirtualizedFile.render: simple virtualizer is not available");e.connect(o,this),this.isVisible=e.isInstanceVisible(null!=(t=this.top)?t:0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode())return this.renderPlaceholder(this.height);const c=this.virtualizer.getWindowSpecs(),f=null!=(n=this.top)?n:0,p=this.computeRenderRangeFromWindow(this.file,f,c);return super.render(m({file:this.file,fileContainer:o,renderRange:p,lineAnnotations:s,forceRender:(null!=d?d:l)||u},a))}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}isSimpleMode(){return"simple"===this.virtualizer.type}isAdvancedMode(){return"advanced"===this.virtualizer.type}addLayoutCheckpoint(e,t){e%5e3==0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||0===this.cache.checkpoints.length)return;let t,n=0,i=this.cache.checkpoints.length-1;for(;n<=i;){const o=n+i>>1,r=this.cache.checkpoints[o];if(null==r)throw new Error("VirtualizedFile: invalid checkpoint index");r.lineIndex<=e?(t=r,n=o+1):i=o-1}return t}getLayoutCheckpointBeforeTop(e,t){let n=0,i=this.cache.checkpoints.length-1,o=-1;for(;n<=i;){const t=n+i>>1,r=this.cache.checkpoints[t];if(null==r)throw new Error("VirtualizedFile: invalid checkpoint index");r.top<=e?(o=t,n=t+1):i=t-1}if(null==t)return o>=0?this.cache.checkpoints[o]:void 0;for(let r=o;r>=0;r--){const e=this.cache.checkpoints[r];if(null==e)throw new Error("VirtualizedFile: invalid checkpoint index");if(e.lineIndex%t===0)return e}}getVirtualizedTop(){return"advanced"===this.virtualizer.type?this.virtualizer.getLocalTopForInstance(this):null!=this.fileContainer?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}getSimpleVirtualizer(){return"simple"===this.virtualizer.type?this.virtualizer:void 0}isResizeDebuggingEnabled(){var e,t;return null!=(t=null==(e=this.getSimpleVirtualizer())?void 0:e.config.resizeDebugging)&&t}computeRenderRangeFromWindow(e,t,{top:n,bottom:i}){var o,r,l,s;const{disableFileHeader:a=!1,overflow:d="scroll"}=this.options,{hunkLineCount:h,lineHeight:u}=this.metrics,c=this.getOrCreateLineCache(e),f=c.length,p=this.height,g=Ho(this.metrics,a),m=f>0?Po(this.metrics):0,{fileAnnotationHeight:v}=this.cache,b=g+v,S=Math.max(0,p-g-v-m),y=Ki(this.lineAnnotations),x=t+g,C=v>0&&y&&x<i&&x+v>n;if(t<n-p||t>i)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:p-g-m};if(f<=h)return{startingLine:0,totalLines:h,bufferBefore:0,bufferAfter:0};const k=Math.ceil(Math.max(i-n,0)/u),L=Math.ceil(k/h)*h+2*h,w=L/h,T=(n+i)/2;if("scroll"===d&&!this.hasLineAnnotations()){const e=t+b;if(!(C||e<i&&e+S>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:p-g-m};const o=Math.floor(C&&T<t+b?0:(T-(t+b))/u),r=Math.floor(o/h)-Math.floor(w/2),l=Math.ceil(f/h),s=Math.max(0,Math.min(r,l))*h,a=r<0?L+r*h:L,d=0===s?0:v+s*u,c=Math.min(a,f-s);return{startingLine:s,totalLines:a,bufferBefore:d,bufferAfter:Math.max(0,(f-s-c)*u)}}const E=w,I=[],A=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-L*u*2),h);let R,M,H,P=t+(null!=(o=null==A?void 0:A.top)?o:b),D=null!=(r=null==A?void 0:A.lineIndex)?r:0;if(Vi({lines:c,startingLine:null!=(l=null==A?void 0:A.lineIndex)?l:0,callback:({lineIndex:e})=>{const o=D%h===0,r=Math.floor(D/h);if(o&&(I[r]=P-(t+b),null!=H)){if(H<=0)return!0;H--}const l=this.getLineHeight(e,!1);return P>n-l&&P<i&&(null!=R||(R=r)),P+l>T&&(null!=M||(M=r)),null==H&&P>=i&&o&&(H=E),D++,P+=l,!1}}),null==R){if(!C)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:p-g-m};R=0,M=0}null!=M||(M=R);const O=Math.round(M-w/2),N=Math.max(0,Math.ceil(f/h)-w),F=Math.max(0,Math.min(O,N)),z=F*h,U=O<0?L+O*h:L,B=null!=(s=I[F])?s:0,j=0===z?0:v+B,$=F+U/h,V=$<I.length?S-I[$]:S-(P-t-b);return{startingLine:z,totalLines:U,bufferBefore:j,bufferAfter:Math.max(0,V)}}};function No(e){const t=e.at(-1);return null==t||""===t||"\n"===t||"\r\n"===t||"\r"===t?e.length-2:e.length-1}function Fo(e,t){return e===t||null!=(null==e?void 0:e.cacheKey)&&e.cacheKey===(null==t?void 0:t.cacheKey)}const zo=new TextEncoder,Uo=new TextDecoder("utf-8",{ignoreBOM:!0}),Bo=/[\uD800-\uDFFF]/,jo=1024;let $o=new Uint8Array(jo);function Vo(){$o.length!==jo&&($o=new Uint8Array(jo))}function _o(e){if(0===e.length)return e;if(Bo.test(e))return JSON.parse(JSON.stringify(e));const t=3*e.length;$o.length<t&&($o=new Uint8Array(t));const{written:n}=zo.encodeInto(e,$o);return Uo.decode($o.subarray(0,n))}function qo(e,t,n){try{return function(e,t,n=!1){const i=function(e){return e.startsWith("diff --git")||e.includes("\ndiff --git")}(e),o=i?rr(e,"diff --git"):function(e){if(0===e.length)return[""];const t=[];let n=0,i=0,o=0,r=0,l=!1;for(;i<e.length;){const s=er(e,i);if(o<=0&&r<=0){if(Zo(e,i)){i>n&&t.push(e.slice(n,i)),n=i,l=!0,i=er(e,s);continue}if(l&&e.startsWith("@@ -",i)){const t=ir(e.slice(i,s));null!=t&&(o=t.deletionCount,r=t.additionCount)}i=s;continue}const a=e[i];"\\"!==a?(" "===a?(o=Math.max(o-1,0),r=Math.max(r-1,0)):"-"===a?o=Math.max(o-1,0):"+"===a&&(r=Math.max(r-1,0)),i=s):i=s}return t.push(e.slice(n)),t}(e);let r;const l=[];for(const s of o){if(i&&!w.test(s)){if(null==r)r=_o(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}if(!i&&!Jo(s)){if(null==r)r=_o(s);else{if(n)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",s)}continue}const e=Go(s,{cacheKey:null!=t?`${t}-${l.length}`:void 0,isGitDiff:i,throwOnError:n});null!=e&&l.push(e)}return{patchMetadata:r,files:l}}(e,t,n)}finally{Vo()}}function Wo(e,t){try{return Go(e,t)}finally{Vo()}}function Go(e,{cacheKey:t,isGitDiff:n=w.test(e),oldFile:i,newFile:o,throwOnError:r=!1}={}){var l,s,a;let d=0;const h=rr(e,"@@ ");let u;const c=null==i||null==o;let f=0,p=0;for(const g of h){const e=Yo(g),h=e[0];if(null==h){if(r)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",g);continue}const m=ir(h);let v,b,S=0,y=0;if(null==m||null==u){if(null!=u){if(r)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",g);continue}u={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:c,additionLines:c||null==i||null==o?[]:Xo(o.contents),deletionLines:c||null==i||null==o?[]:Xo(i.contents),cacheKey:sr(t)},1===u.additionLines.length&&""===(null==o?void 0:o.contents)&&(u.additionLines.length=0),1===u.deletionLines.length&&""===(null==i?void 0:i.contents)&&(u.deletionLines.length=0);for(const t of e){if(t.startsWith("diff --git")){const e=t.trim().match(R),n=null!=(l=null==e?void 0:e[1])?l:null==e?void 0:e[2],i=null!=(s=null==e?void 0:e[3])?s:null==e?void 0:e[4];if(null==n||null==i){if(r)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",t);continue}u.name=_o(i.trim()),n!==i&&(u.prevName=_o(n.trim()));continue}const e=t.startsWith("---")||t.startsWith("+++")?t.match(n?A:I):null;if(null!=e){const[,t,n]=e;if("---"===t&&"/dev/null"!==n){const e=_o(n.trim());u.prevName=e,u.name=e}else"+++"===t&&"/dev/null"!==n&&(u.name=_o(n.trim()))}else if(n){if(t.startsWith("new mode ")&&(u.mode=_o(t.slice(8).trim())),t.startsWith("old mode ")&&(u.prevMode=_o(t.slice(8).trim())),t.startsWith("new file mode")&&(u.type="new",u.mode=_o(t.slice(13).trim())),t.startsWith("deleted file mode")&&(u.type="deleted",u.mode=_o(t.slice(17).trim())),t.startsWith("similarity index")&&(t.startsWith("similarity index 100%")?u.type="rename-pure":u.type="rename-changed"),t.startsWith("index ")){const[,e,n,i]=null!=(a=t.trim().match(M))?a:[];null!=e&&(u.prevObjectId=_o(e)),null!=n&&(u.newObjectId=_o(n)),null!=i&&(u.mode=_o(i))}t.startsWith("rename from ")&&(u.prevName=_o(t.slice(12).trim())),t.startsWith("rename to ")&&(u.name=_o(t.slice(10).trim()))}}continue}for(;e.length>0&&("\n"===e[e.length-1]||"\r"===e[e.length-1]||"\r\n"===e[e.length-1]||""===e[e.length-1]);)e.pop();const{additionStart:x,deletionStart:C}=m;f=c?f:C-1,p=c?p:x-1;const k={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:m.additionCount,additionStart:x,additionLines:S,deletionCount:m.deletionCount,deletionStart:C,deletionLines:y,deletionLineIndex:f,additionLineIndex:p,hunkContent:[],hunkContext:sr(m.hunkContext),hunkSpecs:_o(h),noEOFCRAdditions:!1,noEOFCRDeletions:!1};let L=0,w=0;for(let t=1;t<e.length;t++){const n=e[t];if(L>=k.additionCount&&w>=k.deletionCount&&!n.startsWith("\\")){if(r&&tr(n)&&!nr(n))throw Error("parsePatchContent: hunk has more lines than expected");break}const i=n[0];if("+"!==i&&"-"!==i&&" "!==i&&"\\"!==i){if(r)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${i}", full line: "${n}"`),console.error("processFile: invalid rawLine:",n);continue}const o=ar(i);if("addition"===o){if(r&&L>=k.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");const e=dr(n);null!=v&&"change"===v.type||(v=hr("change",f,p),k.hunkContent.push(v)),p++,L++,c&&u.additionLines.push(e),v.additions++,S++,b="addition"}else if("deletion"===o){if(r&&w>=k.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");const e=dr(n);null!=v&&"change"===v.type||(v=hr("change",f,p),k.hunkContent.push(v)),f++,w++,c&&u.deletionLines.push(e),v.deletions++,y++,b="deletion"}else if("context"===o){if(r&&(w>=k.deletionCount||L>=k.additionCount))throw Error("parsePatchContent: hunk has too many context lines");const e=dr(n);null!=v&&"context"===v.type||(v=hr("context",f,p),k.hunkContent.push(v)),p++,f++,L++,w++,c&&(u.deletionLines.push(e),u.additionLines.push(e)),v.lines++,b="context"}else if("metadata"===o&&null!=v){if("context"===v.type?(k.noEOFCRAdditions=!0,k.noEOFCRDeletions=!0):"deletion"===b?k.noEOFCRDeletions=!0:"addition"===b&&(k.noEOFCRAdditions=!0),c&&("addition"===b||"context"===b)){const e=u.additionLines.length-1;e>=0&&(u.additionLines[e]=Ci(u.additionLines[e]))}if(c&&("deletion"===b||"context"===b)){const e=u.deletionLines.length-1;e>=0&&(u.deletionLines[e]=Ci(u.deletionLines[e]))}}}if(r&&(L!==k.additionCount||w!==k.deletionCount))throw Error("parsePatchContent: hunk line count mismatch");k.additionLines=S,k.deletionLines=y,k.collapsedBefore=Math.max(k.additionStart-1-d,0),u.hunks.push(k),d=k.additionStart+k.additionCount-1;for(const t of k.hunkContent)"context"===t.type?(k.splitLineCount+=t.lines,k.unifiedLineCount+=t.lines):(k.splitLineCount+=Math.max(t.additions,t.deletions),k.unifiedLineCount+=t.deletions+t.additions);k.splitLineStart=u.splitLineCount+k.collapsedBefore,k.unifiedLineStart=u.unifiedLineCount+k.collapsedBefore,u.splitLineCount+=k.collapsedBefore+k.splitLineCount,u.unifiedLineCount+=k.collapsedBefore+k.unifiedLineCount}if(null!=u){if(r&&c&&!n&&0===u.hunks.length)throw Error("parsePatchContent: unified file has no hunks");if(u.hunks.length>0&&!c&&u.additionLines.length>0&&u.deletionLines.length>0){const e=u.hunks[u.hunks.length-1],t=e.additionStart+e.additionCount-1,n=u.additionLines.length,i=Math.max(n-t,0);u.splitLineCount+=i,u.unifiedLineCount+=i}return n||(null!=u.prevName&&u.name!==u.prevName?u.hunks.length>0?u.type="rename-changed":u.type="rename-pure":null!=i&&""!==i.contents||null==o||""===o.contents?null==i||""===i.contents||null!=o&&""!==o.contents||(u.type="deleted"):u.type="new"),"rename-pure"!==u.type&&"rename-changed"!==u.type&&(u.prevName=void 0),u}}function Ko(e,t,n=!1){const i=[],o=function(e){return e.startsWith("From ")||e.includes("\nFrom ")}(e)?e.split(L):[e];for(const l of o)try{i.push(qo(l,null!=t?`${t}-${i.length}`:void 0,n))}catch(r){if(n)throw r;console.error(r)}return i}function Xo(e){const t=Yo(e);for(let n=0;n<t.length;n++)t[n]=_o(t[n]);return t}function Yo(e){if(0===e.length)return[""];const t=[];let n=0;for(;;){const i=e.indexOf("\n",n);if(-1===i)break;t.push(e.slice(n,i+1)),n=i+1}return n<e.length&&t.push(e.slice(n)),t}function Jo(e){return Zo(e,0)}function Zo(e,t){const n=er(e,t);return Qo(e,t,"---")&&Qo(e,n,"+++")}function Qo(e,t,n){if(!e.startsWith(n,t))return!1;const i=e[t+n.length];if(" "!==i&&"\t"!==i)return!1;for(let o=t+n.length+1;o<e.length;o++){const t=e[o];if("\n"===t||"\r"===t)break;if(" "!==t&&"\t"!==t)return!0}return!1}function er(e,t){const n=e.indexOf("\n",t);return-1===n?e.length:n+1}function tr(e){const t=e[0];return"+"===t||"-"===t||" "===t}function nr(e){if(!e.startsWith("--"))return!1;for(let t=2;t<e.length;t++){const n=e[t];if(" "!==n&&"\t"!==n&&"\n"!==n&&"\r"!==n)return!1}return!0}function ir(e){if(!e.startsWith("@@ -"))return;let t=4;const n=or(e,t);if(null==n)return;const i=n.value;t=n.endIndex;let o=1;if(","===e[t]){const n=or(e,t+1);if(null==n)return;o=n.value,t=n.endIndex}if(" "!==e[t]||"+"!==e[t+1])return;t+=2;const r=or(e,t);if(null==r)return;const l=r.value;t=r.endIndex;let s,a=1;if(","===e[t]){const n=or(e,t+1);if(null==n)return;a=n.value,t=n.endIndex}if(" "!==e[t]||"@"!==e[t+1]||"@"!==e[t+2])return;const d=t+3;return" "===e[d]&&(s=function(e){return e.endsWith("\r\n")?e.slice(0,-2):e.endsWith("\n")?e.slice(0,-1):e}(e.slice(d+1))),{additionCount:a,additionStart:l,deletionCount:o,deletionStart:i,hunkContext:s}}function or(e,t){let n=t,i=0;for(;n<e.length;n++){const t=e.charCodeAt(n)-48;if(t<0||t>9)break;i=10*i+t}if(n!==t)return{value:i,endIndex:n}}function rr(e,t){if(0===e.length)return[""];const n=`\n${t}`,i=e.startsWith(t)?0:lr(e,n,0);if(-1===i)return[e];const o=[];i>0&&o.push(e.slice(0,i));let r=i;for(;;){const t=lr(e,n,r+1);if(-1===t)break;o.push(e.slice(r,t)),r=t}return o.push(e.slice(r)),o}function lr(e,t,n){const i=e.indexOf(t,n);return-1===i?-1:i+1}function sr(e){return null==e?e:_o(e)}function ar(e){return" "===e?"context":"\\"===e?"metadata":"+"===e?"addition":"deletion"}function dr(e){const t=e.slice(1);return _o(""===t?"\n":t)}function hr(e,t,n){return"change"===e?{type:"change",additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:n,deletionLineIndex:t}}class ur{diff(e,t,n={}){let i;"function"==typeof n?(i=n,n={}):"callback"in n&&(i=n.callback);const o=this.castInput(e,n),r=this.castInput(t,n),l=this.removeEmpty(this.tokenize(o,n)),s=this.removeEmpty(this.tokenize(r,n));return this.diffWithOptionsObj(l,s,n,i)}diffWithOptionsObj(e,t,n,i){var o;const r=e=>(e=this.postProcess(e,n),i?void setTimeout(function(){i(e)},0):e),l=t.length,s=e.length;let a=1,d=l+s;null!=n.maxEditLength&&(d=Math.min(d,n.maxEditLength));const h=null!==(o=n.timeout)&&void 0!==o?o:1/0,u=Date.now()+h,c=[{oldPos:-1,lastComponent:void 0}];let f=this.extractCommon(c[0],t,e,0,n);if(c[0].oldPos+1>=s&&f+1>=l)return r(this.buildValues(c[0].lastComponent,t,e));let p=-1/0,g=1/0;const m=()=>{for(let i=Math.max(p,-a);i<=Math.min(g,a);i+=2){let o;const a=c[i-1],d=c[i+1];a&&(c[i-1]=void 0);let h=!1;if(d){const e=d.oldPos-i;h=d&&0<=e&&e<l}const u=a&&a.oldPos+1<s;if(h||u){if(o=!u||h&&a.oldPos<d.oldPos?this.addToPath(d,!0,!1,0,n):this.addToPath(a,!1,!0,1,n),f=this.extractCommon(o,t,e,i,n),o.oldPos+1>=s&&f+1>=l)return r(this.buildValues(o.lastComponent,t,e))||!0;c[i]=o,o.oldPos+1>=s&&(g=Math.min(g,i-1)),f+1>=l&&(p=Math.max(p,i+1))}else c[i]=void 0}a++};if(i)!function e(){setTimeout(function(){if(a>d||Date.now()>u)return i(void 0);m()||e()},0)}();else for(;a<=d&&Date.now()<=u;){const e=m();if(e)return e}}addToPath(e,t,n,i,o){const r=e.lastComponent;return r&&!o.oneChangePerToken&&r.added===t&&r.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:r.count+1,added:t,removed:n,previousComponent:r.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:t,removed:n,previousComponent:r}}}extractCommon(e,t,n,i,o){const r=t.length,l=n.length;let s=e.oldPos,a=s-i,d=0;for(;a+1<r&&s+1<l&&this.equals(n[s+1],t[a+1],o);)a++,s++,d++,o.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return d&&!o.oneChangePerToken&&(e.lastComponent={count:d,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,a}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){const t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){const i=[];let o;for(;e;)i.push(e),o=e.previousComponent,delete e.previousComponent,e=o;i.reverse();const r=i.length;let l=0,s=0,a=0;for(;l<r;l++){const e=i[l];if(e.removed)e.value=this.join(n.slice(a,a+e.count)),a+=e.count;else{if(!e.added&&this.useLongestToken){let i=t.slice(s,s+e.count);i=i.map(function(e,t){const i=n[a+t];return i.length>e.length?i:e}),e.value=this.join(i)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(a+=e.count)}}return i}}const cr=new class extends ur{},fr="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",pr=new class extends ur{tokenize(e){const t=new RegExp(`(\\r?\\n)|[${fr}]+|[^\\S\\n\\r]+|[^${fr}]`,"ug");return e.match(t)||[]}},gr=new class extends ur{constructor(){super(...arguments),this.tokenize=vr}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes("\n")||(e=e.trim()),n.newlineIsToken&&t.includes("\n")||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith("\n")&&(e=e.slice(0,-1)),t.endsWith("\n")&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function mr(e,t,n){return gr.diff(e,t,n)}function vr(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,"\n"));const n=[],i=e.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let o=0;o<i.length;o++){const e=i[o];o%2&&!t.newlineIsToken?n[n.length-1]+=e:n.push(e)}return n}function br(e){if(!function(e){for(let t=0;t<e.length;t++)if(e[t]<" "||e[t]>"~"||'"'===e[t]||"\\"===e[t])return!0;return!1}(e))return e;let t='"';const n=(new TextEncoder).encode(e);let i=0;for(;i<n.length;){const e=n[i];t+=7===e?"\\a":8===e?"\\b":9===e?"\\t":10===e?"\\n":11===e?"\\v":12===e?"\\f":13===e?"\\r":34===e?'\\"':92===e?"\\\\":e>=32&&e<=126?String.fromCharCode(e):"\\"+e.toString(8).padStart(3,"0"),i++}return t+='"',t}const Sr={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function yr(e,t,n,i,o,r,l){let s;s=l?"function"==typeof l?{callback:l}:l:{},void 0===s.context&&(s.context=4);const a=s.context;if(s.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(!s.callback)return d(mr(n,i,s));{const{callback:e}=s;mr(n,i,Object.assign(Object.assign({},s),{callback:t=>{const n=d(t);e(n)}}))}function d(n){if(!n)return;function i(e){return e.map(function(e){return" "+e})}n.push({value:"",lines:[]});const l=[];let s=0,d=0,h=[],u=1,c=1;for(let e=0;e<n.length;e++){const t=n[e],o=t.lines||Cr(t.value);if(t.lines=o,t.added||t.removed){if(!s){const t=n[e-1];s=u,d=c,t&&(h=a>0?i(t.lines.slice(-a)):[],s-=h.length,d-=h.length)}for(const e of o)h.push((t.added?"+":"-")+e);t.added?c+=o.length:u+=o.length}else{if(s)if(o.length<=2*a&&e<n.length-2)for(const e of i(o))h.push(e);else{const e=Math.min(o.length,a);for(const n of i(o.slice(0,e)))h.push(n);const t={oldStart:s,oldLines:u-s+e,newStart:d,newLines:c-d+e,lines:h};l.push(t),s=0,d=0,h=[]}u+=o.length,c+=o.length}}for(const e of l)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith("\n")?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,"\"),t++);return{oldFileName:e,newFileName:t,oldHeader:o,newHeader:r,hunks:l}}}function xr(e,t){var n,i,o,r,l,s;if(t||(t=Sr),Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return e.map(e=>xr(e,t)).join("\n")}const a=[];if(e.isGit){if(t=Sr,!e.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!e.newFileName)throw new Error("newFileName must be specified for Git patches");let d=e.oldFileName,h=e.newFileName;e.isCreate&&"/dev/null"===d?d=h.replace(/^b\//,"a/"):e.isDelete&&"/dev/null"===h&&(h=d.replace(/^a\//,"b/")),a.push("diff --git "+br(d)+" "+br(h)),e.isDelete&&a.push("deleted file mode "+(null!==(n=e.oldMode)&&void 0!==n?n:"100644")),e.isCreate&&a.push("new file mode "+(null!==(i=e.newMode)&&void 0!==i?i:"100644")),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(a.push("old mode "+e.oldMode),a.push("new mode "+e.newMode)),e.isRename&&(a.push("rename from "+br((null!==(o=e.oldFileName)&&void 0!==o?o:"").replace(/^a\//,""))),a.push("rename to "+br((null!==(r=e.newFileName)&&void 0!==r?r:"").replace(/^b\//,"")))),e.isCopy&&(a.push("copy from "+br((null!==(l=e.oldFileName)&&void 0!==l?l:"").replace(/^a\//,""))),a.push("copy to "+br((null!==(s=e.newFileName)&&void 0!==s?s:"").replace(/^b\//,""))))}else t.includeIndex&&e.oldFileName==e.newFileName&&void 0!==e.oldFileName&&a.push("Index: "+e.oldFileName),t.includeUnderline&&a.push("===================================================================");const d=e.hunks.length>0;!t.includeFileHeaders||void 0===e.oldFileName||void 0===e.newFileName||e.isGit&&!d||(a.push("--- "+br(e.oldFileName)+(e.oldHeader?"\t"+e.oldHeader:"")),a.push("+++ "+br(e.newFileName)+(e.newHeader?"\t"+e.newHeader:"")));for(let h=0;h<e.hunks.length;h++){const t=e.hunks[h],n=0===t.oldLines?t.oldStart-1:t.oldStart,i=0===t.newLines?t.newStart-1:t.newStart;a.push("@@ -"+n+","+t.oldLines+" +"+i+","+t.newLines+" @@");for(const e of t.lines)a.push(e)}return a.join("\n")+"\n"}function Cr(e){const t=e.endsWith("\n"),n=e.split("\n").map(e=>e+"\n");return t?n.pop():n.push(n.pop().slice(0,-1)),n}function kr(e,t,n,i=!1){const o=Wo(function(e,t,n,i,o,r,l){if("function"==typeof l&&(l={callback:l}),!(null==l?void 0:l.callback)){const s=yr(e,t,n,i,o,r,l);if(!s)return;return xr(s,null==l?void 0:l.headerOptions)}{const{callback:s}=l;yr(e,t,n,i,o,r,Object.assign(Object.assign({},l),{callback:e=>{s(e?xr(e,l.headerOptions):void 0)}}))}}(e.name,t.name,e.contents,t.contents,e.header,t.header,n),{cacheKey:(()=>{if(null!=e.cacheKey&&null!=t.cacheKey)return`${e.cacheKey}:${t.cacheKey}`})(),oldFile:e,newFile:t,throwOnError:i});if(null==o)throw new Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");return null!=t.lang&&(o.lang=t.lang),o}var Lr=class{constructor(){S(this,"isDeletionsScrolling",!1),S(this,"isAdditionsScrolling",!1),S(this,"timeoutId",-1),S(this,"codeDeletions"),S(this,"codeAdditions"),S(this,"enabled",!1),S(this,"handleDeletionsScroll",()=>{var e,t;this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),null==(t=this.codeAdditions)||t.scrollTo({left:null==(e=this.codeDeletions)?void 0:e.scrollLeft}))}),S(this,"handleAdditionsScroll",()=>{var e,t;this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),null==(t=this.codeDeletions)||t.scrollTo({left:null==(e=this.codeAdditions)?void 0:e.scrollLeft}))})}cleanUp(){var e,t;this.enabled&&(null==(e=this.codeDeletions)||e.removeEventListener("scroll",this.handleDeletionsScroll),null==(t=this.codeAdditions)||t.removeEventListener("scroll",this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,this.enabled=!1)}setup(e,t,n){var i,o,r;if(null==t||null==n)for(const l of null!=(i=e.children)?i:[])l instanceof HTMLElement&&("deletions"in l.dataset?t=l:"additions"in l.dataset&&(n=l));null!=n&&null!=t?(this.codeDeletions!==t&&(null==(o=this.codeDeletions)||o.removeEventListener("scroll",this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener("scroll",this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(null==(r=this.codeAdditions)||r.removeEventListener("scroll",this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener("scroll",this.handleAdditionsScroll,{passive:!0})),this.enabled=!0):this.cleanUp()}};function wr(e,t){return te(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Tr(e){return ae({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function Er(e){return ae({tagName:"div",children:[ae({tagName:"span",children:[se("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":e,"data-column-content":""}})}function Ir(e){return ae({tagName:"div",children:[de({name:"both"===e?"diffs-icon-expand-all":"diffs-icon-expand",properties:{"data-icon":""}})],properties:{role:"button","data-expand-button":"","data-expand-both":"both"===e?"":void 0,"data-expand-up":"up"===e?"":void 0,"data-expand-down":"down"===e?"":void 0}})}function Ar({type:e,content:t,expandIndex:n,chunked:i=!1,slotName:o,isFirstHunk:r,isLastHunk:l}){let s=0;const a=[];if("metadata"===e&&null!=t&&a.push(ae({tagName:"div",children:[se(t)],properties:{"data-separator-wrapper":""}})),("line-info"===e||"line-info-basic"===e)&&null!=t){const e=[];null!=n&&(i?(r||(e.push(Ir("up")),s++),l||(e.push(Ir("down")),s++)):(e.push(Ir(r||l?r?"down":"up":"both")),s++)),e.push(ae({tagName:"div",children:[ae({tagName:"span",children:[se(t)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),i&&null!=n&&e.push(ae({tagName:"div",children:[se("Expand all")],properties:{role:"button","data-expand-button":"","data-expand-all-button":""}})),a.push(ae({tagName:"div",children:e,properties:{"data-separator-wrapper":"","data-separator-multi-button":s>1?"":void 0}}))}return"custom"===e&&null!=o&&a.push(ae({tagName:"slot",properties:{name:o}})),ae({tagName:"div",children:a,properties:{"data-separator":0===a.length?"simple":e,"data-expand-index":n,"data-separator-first":r?"":void 0,"data-separator-last":l?"":void 0}})}function Rr(e,t){return`hunk-separator-${e}-${t}`}function Mr(e){const t=e.at(-1);return null==t?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function Hr(e){return 0===e.startingLine&&e.totalLines===1/0&&0===e.bufferBefore&&0===e.bufferAfter}function Pr({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function Dr({item:e,arr:t,enableJoin:n,isNeutral:i=!1,isLastItem:o=!1}){const r=t[t.length-1];if(null==r||o||!n)return void t.push([i?0:1,e.value]);const l=0===r[0];i===l||i&&1===e.value.length&&!l?r[1]+=e.value:t.push([i?0:1,e.value])}function Or({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:o}){var r,l;const s=Math.max(t,0);if(0===s||e)return{fromStart:0,fromEnd:0,rangeSize:s,collapsedLines:s,renderAll:!1};if(!0===n||s<=o)return{fromStart:s,fromEnd:0,rangeSize:s,collapsedLines:0,renderAll:!0};const a=null==n?void 0:n.get(i),d=Math.min(Math.max(null!=(r=null==a?void 0:a.fromStart)?r:0,0),s),h=Math.min(Math.max(null!=(l=null==a?void 0:a.fromEnd)?l:0,0),s),u=d+h,c=u>=s;return{fromStart:c?s:d,fromEnd:c?0:h,rangeSize:s,collapsedLines:Math.max(s-u,0),renderAll:c}}function Nr({fileDiff:e,errorPrefix:t}){const n=e.hunks[e.hunks.length-1];if(null==n||e.isPartial||0===e.additionLines.length||0===e.deletionLines.length)return 0;const i=e.additionLines.length-(n.additionLineIndex+n.additionCount),o=e.deletionLines.length-(n.deletionLineIndex+n.deletionCount);if(i<=0&&o<=0)return 0;if(i!==o)throw new Error(`${t}: trailing context mismatch (additions=${i}, deletions=${o}) for ${e.name}`);return Math.min(i,o)}function Fr({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:i,errorPrefix:o}){var r;if(t!==e.hunks.length-1)return;const l=Nr({fileDiff:e,errorPrefix:o});if(l<=0)return;if(!0===n||l<=i)return{fromStart:l,fromEnd:0,rangeSize:l,collapsedLines:0,renderAll:!0};const s=null==n?void 0:n.get(e.hunks.length),a=Math.min(Math.max(null!=(r=null==s?void 0:s.fromStart)?r:0,0),l);return{fromStart:a,fromEnd:0,rangeSize:l,collapsedLines:l-a,renderAll:a>=l}}function zr({type:e,metrics:t}){var n;return null!=(n=t.hunkSeparatorHeight)?n:function(e){switch(e){case"simple":return 4;case"metadata":case"line-info":case"line-info-basic":case"custom":return 32}}(e)}function Ur({type:e,metrics:t}){return"simple"===e||"metadata"===e||"line-info-basic"===e?0:t.spacing}function Br({type:e,metrics:t,hunkIndex:n,hunkSpecs:i}){if(!function({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case"simple":return t>0;case"metadata":return null!=n;case"line-info":case"line-info-basic":case"custom":return!0}}({type:e,hunkIndex:n,hunkSpecs:i}))return;const o=zr({type:e,metrics:t}),r=Ur({type:e,metrics:t}),l=n>0?r:0;return{height:o,gapBefore:l,gapAfter:r,totalHeight:l+o+r}}function jr({type:e,metrics:t}){if(!function(e){return"simple"!==e&&"metadata"!==e}(e))return;const n=zr({type:e,metrics:t}),i=Ur({type:e,metrics:t});return{height:n,gapBefore:i,gapAfter:0,totalHeight:i+n}}function $r({diff:e,diffStyle:t,startingLine:n=0,totalLines:i=1/0,expandedHunks:o,collapsedContextThreshold:r=1,callback:l}){var s,a;const d=function({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:o}){if(n<=0||"both"===t)return{hunkIndex:0,splitCount:0,unifiedCount:0};const r=function({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let i=0,o=0;const r=e.hunks.length-1,l=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){const a=e.hunks[s];if(null==a)throw new Error("iterateOverDiff: invalid hunk summary index");const d=Or({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),h=d.fromStart+d.fromEnd;i+=h+a.splitLineCount,o+=h+a.unifiedLineCount;const u=s===r?Fr({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:"iterateOverDiff"}):void 0;if(null!=u){const e=u.fromStart+u.fromEnd;i+=e,o+=e}l.push({splitCount:i,unifiedCount:o})}return l}({diff:e,expandedHunks:i,collapsedContextThreshold:o});let l=0,s=e.hunks.length-1,a=e.hunks.length;for(;l<=s;){const e=l+s>>1,i=r[e+1];if(null==i)throw new Error("iterateOverDiff: invalid hunk prefix index");("unified"===t?i.unifiedCount:i.splitCount)>n?(a=e,s=e-1):l=e+1}if(a>=e.hunks.length){const t=r[e.hunks.length];if(null==t)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}const d=r[a];if(null==d)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:a,splitCount:d.splitCount,unifiedCount:d.unifiedCount}}({diff:e,diffStyle:t,startingLine:n,expandedHunks:o,collapsedContextThreshold:r}),h={viewportStart:n,viewportEnd:n+i,isWindowedHighlight:n>0||i<1/0,splitCount:d.splitCount,unifiedCount:d.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!h.isWindowedHighlight)return!1;const e=h.unifiedCount>=n+i,o=h.splitCount>=n+i;return"unified"===t?e:("split"===t||e)&&o},shouldSkip(e,i){if(!h.isWindowedHighlight)return!1;const o=h.unifiedCount+e<n,r=h.splitCount+i<n;return"unified"===t?o:("split"===t||o)&&r},incrementCounts(e,n){"unified"!==t&&"both"!==t||(h.unifiedCount+=e),"split"!==t&&"both"!==t||(h.splitCount+=n)},isInWindow(e,n){if(!h.isWindowedHighlight)return!0;const i=h.isInUnifiedWindow(e),o=h.isInSplitWindow(n);return"unified"===t?i:"split"===t?o:i||o},isInUnifiedWindow:e=>!h.isWindowedHighlight||h.unifiedCount>=n-e&&h.unifiedCount<n+i,isInSplitWindow:e=>!h.isWindowedHighlight||h.splitCount>=n-e&&h.splitCount<n+i,emit(e,n=!1){var i;return n||("unified"===t?h.incrementCounts(1,0):"split"===t?h.incrementCounts(0,1):h.incrementCounts(1,1)),null!=(i=l(e))&&i}};e:for(let u=d.hunkIndex;u<e.hunks.length;u++){let n=function(e,n){return null==c||c.collapsedLines<=0||c.fromStart+c.fromEnd>0?0:"unified"===t?e===l.unifiedLineStart+l.unifiedLineCount-1?c.collapsedLines:0:n===l.splitLineStart+l.splitLineCount-1?c.collapsedLines:0},i=function(){return p?0:(p=!0,d.collapsedLines)};const l=e.hunks[u];if(null==l)throw new Error("iterateOverDiff: invalid hunk index");if(h.shouldBreak())break;const d=Or({isPartial:e.isPartial,rangeSize:l.collapsedBefore,expandedHunks:o,hunkIndex:u,collapsedContextThreshold:r}),c=u===h.finalHunkIndex?Fr({fileDiff:e,hunkIndex:u,expandedHunks:o,collapsedContextThreshold:r,errorPrefix:"iterateOverDiff"}):void 0,f=d.fromStart+d.fromEnd;let p=0===d.collapsedLines;if(h.shouldSkip(f,f))h.incrementCounts(f,f),i();else{let e=l.unifiedLineStart-d.rangeSize,n=l.splitLineStart-d.rangeSize,o=l.deletionLineIndex-d.rangeSize,r=l.additionLineIndex-d.rangeSize,s=l.deletionStart-d.rangeSize,a=l.additionStart-d.rangeSize;if(Vr(h,d.fromStart,t,t=>h.emit({hunkIndex:u,hunk:l,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:s+t,lineIndex:o+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:n+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:n+t,lineIndex:r+t,lineNumber:a+t,noEOFCR:!1}})))break e;if(e=l.unifiedLineStart-d.fromEnd,n=l.splitLineStart-d.fromEnd,o=l.deletionLineIndex-d.fromEnd,r=l.additionLineIndex-d.fromEnd,s=l.deletionStart-d.fromEnd,a=l.additionStart-d.fromEnd,Vr(h,d.fromEnd,t,t=>h.emit({hunkIndex:u,hunk:l,collapsedBefore:i(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:s+t,lineIndex:o+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:n+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:n+t,lineIndex:r+t,lineNumber:a+t,noEOFCR:!1}}),()=>{i()}))break e}let g=l.unifiedLineStart,m=l.splitLineStart,v=l.deletionLineIndex,b=l.additionLineIndex,S=l.deletionStart,y=l.additionStart;const x=l.hunkContent.at(-1);for(const e of l.hunkContent){if(h.shouldBreak())break e;const o=e===x;if("context"===e.type){if(h.shouldSkip(e.lines,e.lines))h.incrementCounts(e.lines,e.lines),i();else if(Vr(h,e.lines,t,t=>{const r=o&&t===e.lines-1,s=g+t,a=m+t;return h.emit({hunkIndex:u,hunk:l,collapsedBefore:i(),collapsedAfter:n(s,a),type:"context",deletionLine:{lineNumber:S+t,lineIndex:v+t,noEOFCR:r&&l.noEOFCRDeletions,unifiedLineIndex:s,splitLineIndex:a},additionLine:{unifiedLineIndex:s,splitLineIndex:a,lineIndex:b+t,lineNumber:y+t,noEOFCR:r&&l.noEOFCRAdditions}})},()=>{i()}))break e;g+=e.lines,m+=e.lines,v+=e.lines,b+=e.lines,S+=e.lines,y+=e.lines}else{const r=Math.max(e.deletions,e.additions),d=e.deletions+e.additions;if(!h.shouldSkip(d,r)){const c=_r(h,e,t);(null!=(a=null==(s=c[0])?void 0:s[0])?a:0)>0&&i();for(const[s,a]of c)for(let c=s;c<a;c++){const s=n(g+c,"unified"===t?m+(c<e.deletions?c:c-e.deletions):m+c);if(h.emit(qr({hunkIndex:u,hunk:l,collapsedBefore:i(),collapsedAfter:s,diffStyle:t,index:c,unifiedLineIndex:g,splitLineIndex:m,additionLineIndex:b,deletionLineIndex:v,additionLineNumber:y,deletionLineNumber:S,content:e,isLastContent:o,unifiedCount:d,splitCount:r}),!0))break e}}i(),h.incrementCounts(d,r),g+=d,m+=r,v+=e.deletions,b+=e.additions,S+=e.deletions,y+=e.additions}}if(null!=c){const{collapsedLines:n,fromStart:i,fromEnd:o}=c,r=i+o;if(Vr(h,r,t,t=>{const i=t===r-1;return h.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:i?n:0,type:"context-expanded",deletionLine:{lineNumber:S+t,lineIndex:v+t,noEOFCR:!1,unifiedLineIndex:g+t,splitLineIndex:m+t},additionLine:{unifiedLineIndex:g+t,splitLineIndex:m+t,lineIndex:b+t,lineNumber:y+t,noEOFCR:!1}})},void 0,()=>h.shouldBreak()))break e}}}function Vr(e,t,n,i,o,r){const[l,s]=function(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];const i=[];function o(n){const o=Math.max(0,e.viewportStart-n),r=Math.min(t,e.viewportEnd-n);r>o&&i.push([o,r])}if("split"!==n&&o(e.unifiedCount),"unified"!==n&&o(e.splitCount),0===i.length)return[0,0];let r=i[0][0],l=i[0][1];for(let s=1;s<i.length;s++){const e=i[s];r=Math.min(r,e[0]),l=Math.max(l,e[1])}return[r,l]}(e,t,n);l>0&&(e.incrementCounts(l,l),null==o||o());let a=l;for(;a<t;){if(!0===(null==r?void 0:r()))return!0;if(a>=s){e.incrementCounts(t-a,t-a);break}if(e.isInWindow(0,0)){if(!0===i(a))return!0}else e.incrementCounts(1,1);a++}return!1}function _r(e,t,n){if(!e.isWindowedHighlight)return[[0,"unified"===n?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];const i="unified"!==n,o="unified"===n?"unified":"split",r=[];function l(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;const i=Math.max(0,e.viewportStart-t),o=Math.min(n,e.viewportEnd-t);return o>i?[i,o]:void 0}function s(e,n){if(null==e)return;const[i,l]=function(e,n){return"split"===o?e:"additions"===n?[e[0]+t.deletions,e[1]+t.deletions]:e}(e,n);l>i&&r.push([i,l])}if("split"!==n&&(s(l(e.unifiedCount,t.deletions),"deletions"),s(l(e.unifiedCount+t.deletions,t.additions),"additions")),i&&(s(l(e.splitCount,t.deletions),"deletions"),s(l(e.splitCount,t.additions),"additions")),0===r.length)return r;r.sort((e,t)=>e[0]-t[0]);const a=[r[0]];for(const[d,h]of r.slice(1)){const e=a[a.length-1];d<=e[1]?e[1]=Math.max(e[1],h):a.push([d,h])}return a}function qr({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,diffStyle:o,index:r,unifiedLineIndex:l,splitLineIndex:s,additionLineIndex:a,deletionLineIndex:d,additionLineNumber:h,deletionLineNumber:u,content:c,isLastContent:f,unifiedCount:p,splitCount:g}){const m=r<c.deletions?l+r:void 0,v="unified"===o?r>=c.deletions?l+r:void 0:r<c.additions?l+c.deletions+r:void 0,b="unified"===o?s+(r<c.deletions?r:r-c.deletions):s+r,S=r<c.deletions?d+r:void 0,y=r<c.deletions?u+r:void 0,x="unified"===o?r>=c.deletions?a+(r-c.deletions):void 0:r<c.additions?a+r:void 0,C="unified"===o?r>=c.deletions?h+(r-c.deletions):void 0:r<c.additions?h+r:void 0,k="unified"===o?f&&r===c.deletions-1&&t.noEOFCRDeletions:f&&r===g-1&&t.noEOFCRDeletions,L="unified"===o?f&&r===p-1&&t.noEOFCRAdditions:f&&r===g-1&&t.noEOFCRAdditions,w=null!=S&&null!=y&&null!=m?{lineNumber:y,lineIndex:S,noEOFCR:k,unifiedLineIndex:m,splitLineIndex:b}:void 0,T=null!=x&&null!=C&&null!=v?{unifiedLineIndex:v,splitLineIndex:b,lineIndex:x,lineNumber:C,noEOFCR:L}:void 0;if(null==w&&null!=T)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:void 0,additionLine:T};if(null!=w&&null==T)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:w,additionLine:void 0};if(null==w||null==T)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:i,deletionLine:w,additionLine:T}}const Wr={forcePlainText:!1};function Gr(e,t,n,{forcePlainText:i,startingLine:o,totalLines:r,expandedHunks:l,collapsedContextThreshold:s=1}=Wr){var a;i?(null!=o||(o=0),null!=r||(r=1/0)):(o=0,r=1/0);const d=o>0||r<1/0,h="string"==typeof n.theme?t.getTheme(n.theme).type:void 0,u=Bi({theme:n.theme,highlighter:t}),c=i&&!d&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?"none":n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,g=!i&&!e.isPartial,m=i?l:void 0,v=new Map;function b(e,t,n,i){if(d){let e=n.at(-1);null!=e&&e.targetIndex+e.count===t||(e={targetIndex:t,originalOffset:i.length,count:0},n.push(e)),e.count++}i.push(e)}$r({diff:e,diffStyle:"both",startingLine:o,totalLines:r,expandedHunks:!d||m,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:i,type:o})=>{var r,l;const s=function(e){var t;const n=g?0:e,i=null!=(t=v.get(n))?t:{deletionContent:{push(e){this.value+=e,this.length++},value:"",length:0},additionContent:{push(e){this.value+=e,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]};return v.set(n,i),i}(t),a=null!=n?n.splitLineIndex:i.splitLineIndex;"change"===o&&null!=n&&null!=i&&function({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:i,deletionDecorations:o,additionDecorations:r,lineDiffType:l,maxLineDiffLength:s}){if(null==e||null==t||"none"===l)return;if(e=Ci(e),t=Ci(t),e.length>s||t.length>s)return;const a="char"===l?(f=e,p=t,cr.diff(f,p,void 0)):function(e,t){return pr.diff(e,t,void 0)}(e,t),d=[],h=[],u="word-alt"===l,c=a.at(-1);var f,p;for(const m of a){const e=m===c;m.added||m.removed?m.removed?Dr({item:m,arr:d,enableJoin:u,isLastItem:e}):Dr({item:m,arr:h,enableJoin:u,isLastItem:e}):(Dr({item:m,arr:d,enableJoin:u,isNeutral:!0,isLastItem:e}),Dr({item:m,arr:h,enableJoin:u,isNeutral:!0,isLastItem:e}))}let g=0;for(const m of d)1===m[0]&&o.push(Pr({line:n,spanStart:g,spanLength:m[1].length})),g+=m[1].length;g=0;for(const m of h)1===m[0]&&r.push(Pr({line:i,spanStart:g,spanLength:m[1].length})),g+=m[1].length}({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[i.lineIndex],deletionLineIndex:s.deletionContent.length,additionLineIndex:s.additionContent.length,deletionDecorations:s.deletionDecorations,additionDecorations:s.additionDecorations,lineDiffType:c,maxLineDiffLength:p}),null!=i&&(b(e.deletionLines[i.lineIndex],i.lineIndex,s.deletionSegments,s.deletionContent),s.deletionInfo.push({type:"change"===o?"change-deletion":o,lineNumber:i.lineNumber,altLineNumber:"change"===o?void 0:null!=(r=n.lineNumber)?r:void 0,lineIndex:`${i.unifiedLineIndex},${a}`})),null!=n&&(b(e.additionLines[n.lineIndex],n.lineIndex,s.additionSegments,s.additionContent),s.additionInfo.push({type:"change"===o?"change-addition":o,lineNumber:n.lineNumber,altLineNumber:"change"===o?void 0:null!=(l=i.lineNumber)?l:void 0,lineIndex:`${n.unifiedLineIndex},${a}`}))}});for(const S of v.values()){if(0===S.deletionContent.length&&0===S.additionContent.length)continue;const o={name:null!=(a=e.prevName)?a:e.name,contents:S.deletionContent.value},r={name:e.name,contents:S.additionContent.value},{deletionLines:l,additionLines:s}=Kr({deletionFile:o,deletionInfo:S.deletionInfo,deletionDecorations:S.deletionDecorations,additionFile:r,additionInfo:S.additionInfo,additionDecorations:S.additionDecorations,highlighter:t,options:n,languageOverride:i?"text":e.lang});if(g)f.deletionLines=l,f.additionLines=s;else{if(S.deletionSegments.length>0)for(const e of S.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=l[e.originalOffset+t];else f.deletionLines.push(...l);if(S.additionSegments.length>0)for(const e of S.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=s[e.originalOffset+t];else f.additionLines.push(...s)}}return{code:f,themeStyles:u,baseThemeType:h}}function Kr(e){var{deletionFile:t,additionFile:n,deletionInfo:i,additionInfo:o,highlighter:r,deletionDecorations:l,additionDecorations:s,languageOverride:a,options:d}=e,h=d,{theme:u=O}=h,c=b(h,["theme"]);const f=null!=a?a:bi(t.name),p=null!=a?a:bi(n.name),{state:g,transformers:S}=Ii(c.useTokenTransformer),y=v(m({},c),"string"==typeof u?{lang:"text",theme:u,transformers:S,decorations:void 0,defaultColor:!1,cssVariablePrefix:Mi("token"),tokenizeTimeLimit:0}:{lang:"text",themes:u,transformers:S,decorations:void 0,defaultColor:!1,cssVariablePrefix:Mi("token"),tokenizeTimeLimit:0});return{deletionLines:""===t.contents?[]:(y.lang=f,g.lineInfo=i,y.decorations=l,$i(r.codeToHast(Ci(t.contents),y))),additionLines:""===n.contents?[]:(y.lang=p,y.decorations=s,g.lineInfo=o,$i(r.codeToHast(Ci(n.contents),y)))}}function Xr(e){var t,n;const i=null!=(t=e.lang)?t:bi(e.name),o=null!=(n=e.lang)?n:null!=e.prevName?bi(e.prevName):"text";return"text"===i&&"text"===o}let Yr=-1;var Jr=class{constructor(e={theme:O},t,n){var i;S(this,"options"),S(this,"onRenderUpdate"),S(this,"workerManager"),S(this,"__id","diff-hunks-renderer:"+ ++Yr),S(this,"highlighter"),S(this,"diff"),S(this,"expandedHunks",new Map),S(this,"deletionAnnotations",{}),S(this,"additionAnnotations",{}),S(this,"computedLang","text"),S(this,"renderCache"),S(this,"createAnnotationElement",e=>ai(e)),this.options=e,this.onRenderUpdate=t,this.workerManager=n,!0!==(null==n?void 0:n.isWorkingPool())&&(this.highlighter=ii(null!=(i=e.theme)?i:O)?ei():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){var e;this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},null==(e=this.workerManager)||e.cleanUpTasks(this)}clearRenderCache(){this.renderCache=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options=m(m({},this.options),e)}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){var i,o;const r=m({},null!=(i=this.expandedHunks.get(e))?i:{fromStart:0,fromEnd:0});"up"!==t&&"both"!==t||(r.fromStart+=n),"down"!==t&&"both"!==t||(r.fromEnd+=n),!0!==(null==(o=this.renderCache)?void 0:o.highlighted)&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){var t;return null!=(t=this.expandedHunks.get(e))?t:W}getExpandedHunksMap(){return this.expandedHunks}setLineAnnotations(e){var t;this.additionAnnotations={},this.deletionAnnotations={};for(const n of e){const e=(()=>{switch(n.side){case"deletions":return this.deletionAnnotations;case"additions":return this.additionAnnotations}})(),i=null!=(t=e[n.lineNumber])?t:[];e[n.lineNumber]=i,i.push(n)}}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e}}getSplitLineDecoration({side:e,type:t}){return"change"!==t?{gutterLineType:t}:{gutterLineType:"deletions"===e?"change-deletion":"change-addition"}}getOptionsWithDefaults(){var e,t;const{diffIndicators:n="bars",diffStyle:i="split",disableBackground:o=!1,disableFileHeader:r=!1,disableLineNumbers:l=!1,disableVirtualizationBuffers:s=!1,collapsed:a=!1,expandUnchanged:d=!1,collapsedContextThreshold:h=1,expansionLineCount:u=100,hunkSeparators:c="line-info",lineDiffType:f="word-alt",maxLineDiffLength:p=1e3,overflow:g="scroll",stickyHeader:m=!1,theme:v=O,headerRenderMode:b="default",tokenizeMaxLineLength:S=1e3,tokenizeMaxLength:y=j,useTokenTransformer:x=!1,useCSSClasses:C=!1}=this.options;return{diffIndicators:n,diffStyle:i,disableBackground:o,disableFileHeader:r,disableLineNumbers:l,disableVirtualizationBuffers:s,collapsed:a,expandUnchanged:d,collapsedContextThreshold:h,expansionLineCount:u,hunkSeparators:c,lineDiffType:f,maxLineDiffLength:p,overflow:g,stickyHeader:m,theme:null!=(t=null==(e=this.workerManager)?void 0:e.getDiffRenderOptions().theme)?t:v,headerRenderMode:b,tokenizeMaxLineLength:S,tokenizeMaxLength:y,useTokenTransformer:x,useCSSClasses:C}}initializeHighlighter(){return y(this,null,function*(){return this.highlighter=yield Qn(yi(this.computedLang,this.options)),this.highlighter})}hydrate(e){var t,n,i;if(null==e)return;this.diff=e;const{options:o}=this.getRenderOptions(e),r=ll(e,this.getTokenizeMaxLength());let l=null==(t=this.workerManager)?void 0:t.getDiffResultCache(e);null==l||wr(o,l.options)||(l=void 0),null!=this.renderCache||(this.renderCache={diff:e,highlighted:!r&&!Xr(e),options:o,result:r||null==l?void 0:l.result,renderRange:void 0}),!0===(null==(n=this.workerManager)?void 0:n.isWorkingPool())?null!=this.renderCache.result||r||this.workerManager.highlightDiffAST(this,this.diff):null==this.highlighter&&(this.computedLang=null!=(i=e.lang)?i:bi(e.name),this.initializeHighlighter())}getRenderOptions(e){const t=(()=>{var e;if(!0===(null==(e=this.workerManager)?void 0:e.isWorkingPool()))return this.workerManager.getDiffRenderOptions();const{theme:t,tokenizeMaxLineLength:n,lineDiffType:i,maxLineDiffLength:o}=this.getOptionsWithDefaults();return{theme:t,useTokenTransformer:Qi(this.options),tokenizeMaxLineLength:n,lineDiffType:i,maxLineDiffLength:o}})();this.getOptionsWithDefaults();const{renderCache:n}=this;return null==(null==n?void 0:n.result)?{options:t,forceHighlight:!0}:Fo(e,n.diff)&&wr(t,n.options)?{options:t,forceHighlight:!1}:{options:t,forceHighlight:!0}}renderDiff(e=(e=>null==(e=this.renderCache)?void 0:e.diff)(),t=G){var n,i;if(null==e)return;const{expandUnchanged:o=!1,collapsedContextThreshold:r}=this.getOptionsWithDefaults();let{options:l,forceHighlight:s}=this.getRenderOptions(e);const a=this.getMatchingWorkerResultCache(e,l);null==a||this.hasHighlightedRenderCache(e,l)||(this.renderCache=m({diff:e,highlighted:!0,renderRange:void 0},a),s=!1),null!=this.renderCache||(this.renderCache={diff:e,highlighted:!1,options:l,result:void 0,renderRange:void 0});const d=e.additionLines.length>0||e.deletionLines.length>0,h=!d||Xr(e)||ll(e,this.getTokenizeMaxLength()),u=!Fo(e,this.renderCache.diff),c=!si(this.renderCache.renderRange,t);if(!0===(null==(n=this.workerManager)?void 0:n.isWorkingPool()))(h||null==this.renderCache.result||!this.renderCache.highlighted&&(u||c))&&(this.renderCache.diff=e,this.renderCache.options=l,this.renderCache.highlighted=!1,(null==this.renderCache.result||u||c||s)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,!!Hr(t)||!!o||this.expandedHunks,r)),this.renderCache.renderRange=t),h||!d||this.renderCache.highlighted&&!s||this.workerManager.highlightDiffAST(this,e);else{this.computedLang=null!=(i=e.lang)?i:bi(e.name);const t=null!=this.highlighter&&ii(l.theme),n=null!=this.highlighter&&fn(this.computedLang),o=!h&&n;if(null!=this.highlighter&&t&&(s||h||!this.renderCache.highlighted&&o||null==this.renderCache.result)){const{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,h||!n);this.renderCache={diff:e,options:i,highlighted:o,result:t,renderRange:void 0}}t&&(h||n)||this.asyncHighlight(e).then(({result:t,options:n})=>{null!=this.renderCache&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n,!h)})}return null!=this.renderCache.result?this.processDiffResult(this.renderCache.diff,t,this.renderCache.result):void 0}asyncRender(e){return y(this,arguments,function*(e,t=G){const{result:n}=yield this.asyncHighlight(e);return this.processDiffResult(e,t,n)})}createPreElement(e,t,n){const{diffIndicators:i,disableBackground:o,disableLineNumbers:r,overflow:l}=this.getOptionsWithDefaults();return fi({type:"diff",diffIndicators:i,disableBackground:o,disableLineNumbers:r,overflow:l,split:e,totalLines:t,customProperties:n})}asyncHighlight(e){return y(this,null,function*(){var t,n;const i=ll(e,this.getTokenizeMaxLength());this.computedLang=i?"text":null!=(t=e.lang)?t:bi(e.name);const o=null!=this.highlighter&&ii(null!=(n=this.options.theme)?n:O),r=i||null!=this.highlighter&&fn(this.computedLang);return null!=this.highlighter&&o&&r||(this.highlighter=yield this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,i)})}renderDiffWithHighlighter(e,t,n=!1){const{options:i}=this.getRenderOptions(e),{collapsedContextThreshold:o}=this.getOptionsWithDefaults();return{result:Gr(e,t,i,{forcePlainText:n,expandedHunks:!!n||void 0,collapsedContextThreshold:o}),options:i}}onHighlightSuccess(e,t,n,i=!0){var o;if(null==this.renderCache)return;const r=!this.renderCache.highlighted||!wr(this.renderCache.options,n)||!Fo(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:i,result:t,renderRange:void 0},r&&(null==(o=this.onRenderUpdate)||o.call(this))}getMatchingWorkerResultCache(e,t){var n;const i=null==(n=this.workerManager)?void 0:n.getDiffResultCache(e);if(null!=i&&wr(t,i.options))return i}hasHighlightedRenderCache(e,t){const{renderCache:n}=this;return null!=(null==n?void 0:n.result)&&n.highlighted&&Fo(e,n.diff)&&wr(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){var e;return null!=(e=this.options.tokenizeMaxLength)?e:1e5}processDiffResult(e,t,{code:n,themeStyles:i,baseThemeType:o}){var r,l;const{diffStyle:s,disableFileHeader:a,expandUnchanged:d,expansionLineCount:h,collapsedContextThreshold:u,hunkSeparators:c}=this.getOptionsWithDefaults();this.diff=e;const f="unified"===s;let p=[],g=[],b=[];const S=[],{additionLines:y,deletionLines:x}=n,C={rowCount:0,hunkSeparators:c,additionsContentAST:p,deletionsContentAST:g,unifiedContentAST:b,unifiedGutterAST:ue(),deletionsGutterAST:ue(),additionsGutterAST:ue(),expansionLineCount:h,hunkData:S,incrementRowCount(e=1){C.rowCount+=e},pushToGutter(e,t){switch(e){case"unified":C.unifiedGutterAST.children.push(t);break;case"deletions":C.deletionsGutterAST.children.push(t);break;case"additions":C.additionsGutterAST.children.push(t)}}},k=Nr({fileDiff:e,errorPrefix:"DiffHunksRenderer.processDiffResult"}),L={size:0,side:void 0,increment(){this.size+=1},flush(){if("unified"!==s){if(this.size<=0||null==this.side)return this.side=void 0,void(this.size=0);"additions"===this.side?(C.pushToGutter("additions",fe(void 0,"buffer",this.size)),null==p||p.push(Tr(this.size))):(C.pushToGutter("deletions",fe(void 0,"buffer",this.size)),null==g||g.push(Tr(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,i,o)=>{C.pushToGutter(e,ce(t,n,i,o))};function T(e){L.flush(),"unified"===s?ol("unified",e,C):(ol("deletions",e,C),ol("additions",e,C))}this.pushFileLevelAnnotations(e,s,t,C),$r({diff:e,diffStyle:s,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:!!d||this.expandedHunks,collapsedContextThreshold:u,callback:({hunkIndex:t,hunk:n,collapsedBefore:i,collapsedAfter:o,additionLine:r,deletionLine:l,type:a})=>{var d,h,u,f,p;const g=null!=l?l.splitLineIndex:r.splitLineIndex,b=null!=r?r.unifiedLineIndex:l.unifiedLineIndex;"split"===s&&"change"!==a&&L.flush(),i>0&&T({hunkIndex:t,collapsedLines:i,rangeSize:Math.max(null!=(d=null==n?void 0:n.collapsedBefore)?d:0,0),hunkSpecs:null==n?void 0:n.hunkSpecs,isFirstHunk:0===t,isLastHunk:!1,isExpandable:!e.isPartial});const S="unified"===s?b:g,E={type:a,hunkIndex:t,lineIndex:S,unifiedLineIndex:b,splitLineIndex:g,deletionLine:l,additionLine:r};if("unified"===s){const n=null==(h=this.getUnifiedInjectedRowsForLine)?void 0:h.call(this,E);null!=(null==n?void 0:n.before)&&tl(n.before,C);let i=null!=l?x[l.lineIndex]:void 0,o=null!=r?y[r.lineIndex]:void 0;if(null==i&&null==o){const t="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(t,{file:e.name}),new Error(t)}const s="change"===a?null!=r?"change-addition":"change-deletion":a,d=this.getUnifiedLineDecoration({type:a,lineType:s,additionLineIndex:null==r?void 0:r.lineIndex,deletionLineIndex:null==l?void 0:l.lineIndex});w("unified",d.gutterLineType,null!=r?r.lineNumber:l.lineNumber,`${b},${g}`,d.gutterProperties),null!=o?o=rl(o,d.contentProperties):null!=i&&(i=rl(i,d.contentProperties)),il({diffStyle:"unified",type:a,deletionLine:i,additionLine:o,unifiedSpan:this.getAnnotations("unified",null==l?void 0:l.lineNumber,null==r?void 0:r.lineNumber,t,S),createAnnotationElement:e=>this.createAnnotationElement(e),context:C}),null!=(null==n?void 0:n.after)&&tl(n.after,C)}else{const n=null==(u=this.getSplitInjectedRowsForLine)?void 0:u.call(this,E);null!=(null==n?void 0:n.before)&&nl(n.before,C,L);let i=null!=l?x[l.lineIndex]:void 0,o=null!=r?y[r.lineIndex]:void 0;const s=this.getSplitLineDecoration({side:"deletions",type:a,lineIndex:null==l?void 0:l.lineIndex}),d=this.getSplitLineDecoration({side:"additions",type:a,lineIndex:null==r?void 0:r.lineIndex});if(null==i&&null==o){const t="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(t,{file:e.name}),new Error(t)}const h=(()=>{if("change"===a){if(null==o)return"additions";if(null==i)return"deletions"}})();if(null!=h){if(null!=L.side&&L.side!==h)throw new Error("DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits");L.side=h,L.increment()}const c=this.getAnnotations("split",null==l?void 0:l.lineNumber,null==r?void 0:r.lineNumber,t,S);if(null!=c&&L.size>0&&L.flush(),null!=l){const e=rl(i,s.contentProperties);w("deletions",s.gutterLineType,l.lineNumber,`${l.unifiedLineIndex},${g}`,s.gutterProperties),null!=e&&(i=e)}if(null!=r){const e=rl(o,d.contentProperties);w("additions",d.gutterLineType,r.lineNumber,`${r.unifiedLineIndex},${g}`,d.gutterProperties),null!=e&&(o=e)}il(v(m({diffStyle:"split",type:a,additionLine:o,deletionLine:i},c),{createAnnotationElement:e=>this.createAnnotationElement(e),context:C})),null!=(null==n?void 0:n.after)&&nl(n.after,C,L)}const I="split"===s&&null!=n&&g===n.splitLineStart+n.splitLineCount-1,A=!!I&&n.noEOFCRDeletions,R=!!I&&n.noEOFCRAdditions,M=null!=(f=null==l?void 0:l.noEOFCR)&&f||A,H=null!=(p=null==r?void 0:r.noEOFCR)&&p||R;if(H||M){if("split"===s&&L.flush(),M){const e="context"===a||"context-expanded"===a?a:"change-deletion";"unified"===s?(C.unifiedContentAST.push(Er(e)),C.pushToGutter("unified",fe(e,"metadata",1))):(C.deletionsContentAST.push(Er(e)),C.pushToGutter("deletions",fe(e,"metadata",1)),H||(C.pushToGutter("additions",fe(void 0,"buffer",1)),C.additionsContentAST.push(Tr(1))))}if(H){const e="context"===a||"context-expanded"===a?a:"change-addition";"unified"===s?(C.unifiedContentAST.push(Er(e)),C.pushToGutter("unified",fe(e,"metadata",1))):(C.additionsContentAST.push(Er(e)),C.pushToGutter("additions",fe(e,"metadata",1)),M||(C.pushToGutter("deletions",fe(void 0,"buffer",1)),C.deletionsContentAST.push(Tr(1))))}C.incrementRowCount(1)}o>0&&"simple"!==c&&T({hunkIndex:"context-expanded"===a?t:t+1,collapsedLines:o,rangeSize:k,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!e.isPartial}),C.incrementRowCount(1)}}),"split"===s&&L.flush();const E=Math.max(Mr(e.hunks),null!=(r=e.additionLines.length)?r:0,null!=(l=e.deletionLines.length)?l:0),I=t.bufferBefore>0||t.bufferAfter>0,A=!f&&"deleted"!==e.type,R=!f&&"new"!==e.type,M=C.rowCount>0||I;p=A&&M?p:void 0,g=R&&M?g:void 0,b=f&&M?b:void 0;const H=this.createPreElement(null!=g&&null!=p,E);return{unifiedGutterAST:f&&M?C.unifiedGutterAST.children:void 0,unifiedContentAST:b,deletionsGutterAST:R&&M?C.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:A&&M?C.additionsGutterAST.children:void 0,additionsContentAST:p,hunkData:S,preNode:H,themeStyles:i,baseThemeType:o,headerElement:a?void 0:this.renderHeader(this.diff),totalLines:E,rowCount:C.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderCodeAST(e,t){const n="unified"===e?t.unifiedGutterAST:"deletions"===e?t.deletionsGutterAST:t.additionsGutterAST,i="unified"===e?t.unifiedContentAST:"deletions"===e?t.deletionsContentAST:t.additionsContentAST;if(null==n||null==i)return;const o=ue(n);return o.properties.style=`grid-row: span ${t.rowCount}`,[o,Ji(i,t.rowCount)]}renderFullAST(e,t=[]){const n="line-info"===this.getOptionsWithDefaults().hunkSeparators,i=this.renderCodeAST("unified",e);if(null!=i)return t.push(ae({tagName:"code",children:i,properties:{"data-code":"","data-container-size":n?"":void 0,"data-unified":""}})),v(m({},e.preNode),{children:t});const o=this.renderCodeAST("deletions",e);null!=o&&t.push(ae({tagName:"code",children:o,properties:{"data-code":"","data-container-size":n?"":void 0,"data-deletions":""}}));const r=this.renderCodeAST("additions",e);return null!=r&&t.push(ae({tagName:"code",children:r,properties:{"data-code":"","data-container-size":n?"":void 0,"data-additions":""}})),v(m({},e.preNode),{children:t})}renderFullHTML(e,t=[]){return Bt(this.renderFullAST(e,t))}renderPartialHTML(e,t){return Bt(null==t?e:ae({tagName:"code",children:e,properties:{"data-code":"","data-container-size":"line-info"===this.getOptionsWithDefaults().hunkSeparators?"":void 0,[`data-${t}`]:""}}))}pushFileLevelAnnotations(e,t,n,i){if(!Yi(n))return;const o="new"!==e.type?Zr(Xi(this.deletionAnnotations)):[],r="deleted"!==e.type?Zr(Xi(this.additionAnnotations)):[];if(0===o.length&&0===r.length)return;const{createAnnotationElement:l}=this;il("unified"!==t?{diffStyle:t,type:"context",deletionSpan:{type:"annotation",hunkIndex:-1,lineIndex:-1,annotations:o},additionSpan:{type:"annotation",hunkIndex:-1,lineIndex:-1,annotations:r},createAnnotationElement:l,context:i}:{diffStyle:t,type:"context",unifiedSpan:{type:"annotation",hunkIndex:-1,lineIndex:-1,annotations:o.concat(r)},createAnnotationElement:l,context:i})}getAnnotations(e,t,n,i,o){var r,l;const s={type:"annotation",hunkIndex:i,lineIndex:o,annotations:[]};if(null!=t)for(const d of null!=(r=this.deletionAnnotations[t])?r:[])s.annotations.push(xi(d));const a={type:"annotation",hunkIndex:i,lineIndex:o,annotations:[]};if(null!=n)for(const d of null!=(l=this.additionAnnotations[n])?l:[])("unified"===e?s:a).annotations.push(xi(d));return"unified"===e?s.annotations.length>0?s:void 0:0!==a.annotations.length||0!==s.annotations.length?{deletionSpan:s,additionSpan:a}:void 0}renderHeader(e){const{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return hi({fileOrDiff:e,mode:t,stickyHeader:n})}};function Zr(e){var t;return null!=(t=null==e?void 0:e.map(e=>xi(e)))?t:[]}const Qr=new Intl.PluralRules("en-US");function el(e){return`${e} unmodified line${"one"===Qr.select(e)?"":"s"}`}function tl(e,t){for(const n of e)t.unifiedContentAST.push(n.content),t.pushToGutter("unified",n.gutter),t.incrementRowCount(1)}function nl(e,t,n){for(const{deletion:i,addition:o}of e){if(null==i&&null==o)continue;const e=null!=i&&null!=o?void 0:null==i?"deletions":"additions";null!=e&&n.side===e||n.flush(),null!=i&&(t.deletionsContentAST.push(i.content),t.pushToGutter("deletions",i.gutter)),null!=o&&(t.additionsContentAST.push(o.content),t.pushToGutter("additions",o.gutter)),null!=e&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function il({diffStyle:e,type:t,deletionLine:n,additionLine:i,unifiedSpan:o,deletionSpan:r,additionSpan:l,createAnnotationElement:s,context:a}){let d=!1;if("unified"===e){if(null!=i?a.unifiedContentAST.push(i):null!=n&&a.unifiedContentAST.push(n),null!=o){const e="change"===t?null!=n?"change-deletion":"change-addition":t;a.unifiedContentAST.push(s(o)),a.pushToGutter("unified",fe(e,"annotation",1)),d=!0}}else if("split"===e){if(null!=n&&a.deletionsContentAST.push(n),null!=i&&a.additionsContentAST.push(i),null!=r){const e="change"===t?null!=n?"change-deletion":"context":t;a.deletionsContentAST.push(s(r)),a.pushToGutter("deletions",fe(e,"annotation",1)),d=!0}if(null!=l){const e="change"===t?null!=i?"change-addition":"context":t;a.additionsContentAST.push(s(l)),a.pushToGutter("additions",fe(e,"annotation",1)),d=!0}}d&&a.incrementRowCount(1)}function ol(e,{hunkIndex:t,collapsedLines:n,rangeSize:i,hunkSpecs:o,isFirstHunk:r,isLastHunk:l,isExpandable:s},a){if(n<=0)return;const d="unified"===e?a.unifiedContentAST:"deletions"===e?a.deletionsContentAST:a.additionsContentAST;if("metadata"===a.hunkSeparators)return void(null!=o&&(a.pushToGutter(e,Ar({type:"metadata",content:o,isFirstHunk:r,isLastHunk:l})),d.push(Ar({type:"metadata",content:o,isFirstHunk:r,isLastHunk:l})),"additions"!==e&&a.incrementRowCount(1)));if("simple"===a.hunkSeparators)return void(t>0&&(a.pushToGutter(e,Ar({type:"simple",isFirstHunk:r,isLastHunk:!1})),d.push(Ar({type:"simple",isFirstHunk:r,isLastHunk:!1})),"additions"!==e&&a.incrementRowCount(1)));const h=Rr(e,t),u=i>a.expansionLineCount,c=s?t:void 0;a.pushToGutter(e,Ar({type:a.hunkSeparators,content:el(n),expandIndex:c,chunked:u,slotName:h,isFirstHunk:r,isLastHunk:l})),d.push(Ar({type:a.hunkSeparators,content:el(n),expandIndex:c,chunked:u,slotName:h,isFirstHunk:r,isLastHunk:l})),"additions"!==e&&a.incrementRowCount(1),a.hunkData.push({slotName:h,hunkIndex:t,lines:n,type:e,expandable:s?{up:!r,down:!l,chunked:u}:void 0})}function rl(e,t){return null==e||"element"!==e.type||null==t?e:v(m({},e),{properties:m(m({},e.properties),t)})}function ll(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function sl(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function al(e,t){var n,i,o,r,l,s;return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.type===t.type&&(null==(n=e.expandable)?void 0:n.chunked)===(null==(i=t.expandable)?void 0:i.chunked)&&(null==(o=e.expandable)?void 0:o.up)===(null==(r=t.expandable)?void 0:r.up)&&(null==(l=e.expandable)?void 0:l.down)===(null==(s=t.expandable)?void 0:s.down)}let dl=-1;var hl=(i=class{constructor(e={theme:O},t,n=!1){var i,o;S(this,"options"),S(this,"workerManager"),S(this,"isContainerManaged"),S(this,"__id","file-diff:"+ ++dl),S(this,"type","file-diff"),S(this,"fileContainer"),S(this,"spriteSVG"),S(this,"pre"),S(this,"codeUnified"),S(this,"codeDeletions"),S(this,"codeAdditions"),S(this,"bufferBefore"),S(this,"bufferAfter"),S(this,"themeCSSStyle"),S(this,"appliedThemeCSS"),S(this,"hasAdoptedThemeCSS",!1),S(this,"unsafeCSSStyle"),S(this,"appliedUnsafeCSS"),S(this,"gutterUtilityContent"),S(this,"headerElement"),S(this,"headerPrefix"),S(this,"headerMetadata"),S(this,"headerCustom"),S(this,"separatorCache",new Map),S(this,"errorWrapper"),S(this,"placeHolder"),S(this,"hunksRenderer"),S(this,"resizeManager"),S(this,"scrollSyncManager"),S(this,"interactionManager"),S(this,"annotationCache",new Map),S(this,"lineAnnotations",[]),S(this,"managersDirty",!1),S(this,"deletionFile"),S(this,"additionFile"),S(this,"fileDiff"),S(this,"renderRange"),S(this,"appliedPreAttributes"),S(this,"lastRenderedHeaderHTML"),S(this,"cachedHeaderHTML"),S(this,"lastRowCount"),S(this,"mounted",!1),S(this,"enabled",!0),S(this,"handleHighlightRender",()=>{this.rerender()}),S(this,"getLineIndex",(e,t="additions")=>{if(null==this.fileDiff)return;const n=this.fileDiff.hunks.at(-1);let i,o;e:for(const r of this.fileDiff.hunks){let l="deletions"===t?r.deletionStart:r.additionStart;const s="deletions"===t?r.deletionCount:r.additionCount;let a=r.splitLineStart,d=r.unifiedLineStart;if(e<l){const t=l-e;i=Math.max(d-t,0),o=Math.max(a-t,0);break e}if(!(e>=l+s)){for(const n of r.hunkContent)if("context"===n.type){if(e<l+n.lines){const t=e-l;o=a+t,i=d+t;break e}l+=n.lines,a+=n.lines,d+=n.lines}else{const r="deletions"===t?n.deletions:n.additions;if(e<l+r){const r=e-l;i=d+("additions"===t?n.deletions:0)+r,o=a+r;break e}l+=r,a+=Math.max(n.deletions,n.additions),d+=n.deletions+n.additions}break e}if(r===n){const t=e-(l+s);i=d+r.unifiedLineCount+t,o=a+r.splitLineCount+t;break e}}return null!=i&&null!=o?[i,o]:void 0}),S(this,"getHoveredLine",()=>this.interactionManager.getHoveredLine()),S(this,"handleExpandHunk",(e,t,n)=>{this.expandHunk(e,t,n)}),S(this,"expandHunk",(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.rerender()}),this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new on,this.scrollSyncManager=new Lr,this.interactionManager=new Vt("diff",_t(e,"function"==typeof e.hunkSeparators||"line-info"===(null!=(i=e.hunkSeparators)?i:"line-info")||"line-info-basic"===e.hunkSeparators?this.handleExpandHunk:void 0,this.getLineIndex)),null==(o=this.workerManager)||o.subscribeToThemeChanges(this),this.enabled=!0}getHunksRendererOptions(e){return function(e){return{theme:null==e?void 0:e.theme,disableLineNumbers:null==e?void 0:e.disableLineNumbers,overflow:null==e?void 0:e.overflow,collapsed:null==e?void 0:e.collapsed,disableFileHeader:null==e?void 0:e.disableFileHeader,disableVirtualizationBuffers:null==e?void 0:e.disableVirtualizationBuffers,stickyHeader:null==e?void 0:e.stickyHeader,preferredHighlighter:null==e?void 0:e.preferredHighlighter,useCSSClasses:null==e?void 0:e.useCSSClasses,useTokenTransformer:null==e?void 0:e.useTokenTransformer,tokenizeMaxLineLength:null==e?void 0:e.tokenizeMaxLineLength,tokenizeMaxLength:null==e?void 0:e.tokenizeMaxLength,diffStyle:null==e?void 0:e.diffStyle,diffIndicators:null==e?void 0:e.diffIndicators,disableBackground:null==e?void 0:e.disableBackground,hunkSeparators:"function"==typeof(null==e?void 0:e.hunkSeparators)?"custom":null==e?void 0:e.hunkSeparators,expandUnchanged:null==e?void 0:e.expandUnchanged,collapsedContextThreshold:null==e?void 0:e.collapsedContextThreshold,lineDiffType:null==e?void 0:e.lineDiffType,maxLineDiffLength:null==e?void 0:e.maxLineDiffLength,expansionLineCount:null==e?void 0:e.expansionLineCount,headerRenderMode:null!=(null==e?void 0:e.renderCustomHeader)?"custom":"default"}}(e)}createHunksRenderer(e){return new Jr(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}setOptions(e){null!=e&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){var e;this.interactionManager.setOptions(_t(this.options,"function"==typeof this.options.hunkSeparators||"line-info"===(null!=(e=this.options.hunkSeparators)?e:"line-info")||"line-info-basic"===this.options.hunkSeparators?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options=m(m({},this.options),e)}setThemeType(e){var t;(null!=(t=this.options.themeType)?t:"system")!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){var t;if("string"==typeof this.options.theme||null==this.fileContainer||null==this.appliedThemeCSS)return!1;const n=null!=(t=this.appliedThemeCSS.baseThemeType)?t:e;return this.appliedThemeCSS.themeType!==n&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){var e;return null!=this.appliedThemeCSS&&!te(this.appliedThemeCSS.theme,null!=(e=this.options.theme)?e:O)}setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||"function"==typeof this.options.hunkSeparators)}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}flushManagers(){if(!this.managersDirty||null==this.pre)return void(this.managersDirty=!1);const{diffStyle:e="split",overflow:t="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,"wrap"===t),"scroll"===t&&"split"===e?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}cleanUp(e=!1){var t,n;this.emitPostRender(!0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,null==(t=this.workerManager)||t.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||null==(n=this.fileContainer)||n.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){var e;this.enabled=!0,null==(e=this.workerManager)||e.subscribeToThemeChanges(this)}hydrate(e){const{fileContainer:t,prerenderedHTML:n,preventEmit:i=!1,lineAnnotations:o,oldFile:r,newFile:l,fileDiff:s}=e;this.hydrateElements(t,n),function(e,t,n=!1){return!n&&null==e&&t}(this.pre,function({fileDiff:e,oldFile:t,newFile:n}){return null!=e&&e.hunks.length>0||null!=t||null!=n}({fileDiff:s,oldFile:r,newFile:l}),this.options.collapsed)||function(e,t,n=!1){return null==e&&t&&!n}(this.headerElement,function({fileDiff:e,oldFile:t,newFile:n}){return null!=e||null!=t||null!=n}({fileDiff:s,oldFile:r,newFile:l}),this.options.disableFileHeader)?this.render(v(m({},e),{preventEmit:!0})):this.hydrationSetup({fileDiff:s,oldFile:r,newFile:l,lineAnnotations:o}),i||this.emitPostRender()}hydrateElements(e,t){var n,i;this.fileContainer!==e&&this.emitPostRender(!0),ko(e,t);for(const o of null!=(i=null==(n=e.shadowRoot)?void 0:n.children)?i:[])if(o instanceof SVGElement)this.spriteSVG=o;else if(o instanceof HTMLElement)if(o instanceof HTMLPreElement){this.pre=o;for(const e of o.children)e instanceof HTMLElement&&"code"===e.tagName.toLowerCase()&&("deletions"in e.dataset&&(this.codeDeletions=e),"additions"in e.dataset&&(this.codeAdditions=e),"unified"in e.dataset&&(this.codeUnified=e))}else"diffsHeader"in o.dataset?this.headerElement=o:o instanceof HTMLStyleElement&&o.hasAttribute("data-theme-css")?this.themeCSSStyle=o:o instanceof HTMLStyleElement&&o.hasAttribute("data-unsafe-css")&&(this.unsafeCSSStyle=o,this.appliedUnsafeCSS=o.textContent);null!=this.pre&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute("data-dehydrated")),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:i}){this.lineAnnotations=null!=i?i:this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=null!=e?e:null!=t&&null!=n?kr(t,n,this.options.parseDiffOptions):void 0,null!=this.pre&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||null==this.fileDiff&&null==this.additionFile&&null==this.deletionFile||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}render({oldFile:e,newFile:t,fileDiff:n,deferManagers:i=!1,forceRender:o=!1,preventEmit:r=!1,lineAnnotations:l,fileContainer:s,containerWrapper:a,renderRange:d}){var h;if(!this.enabled)throw new Error("FileDiff.render: attempting to call render after cleaned up");const{collapsed:u=!1,themeType:c="system"}=this.options,f=u?void 0:d,p=this.hasThemeChanged(),g=!(null==e||null==t||li(e,this.deletionFile)&&li(t,this.additionFile));let m=null!=n&&n!==this.fileDiff;const v=null!=l&&(l.length>0||this.lineAnnotations.length>0)&&l!==this.lineAnnotations;if(!u&&si(f,this.renderRange)&&!o&&!v&&!p&&(null!=n&&n===this.fileDiff||null==n&&!g))return this.applyCachedThemeState(c);const{renderRange:b}=this;if(this.renderRange=f,this.deletionFile=e,this.additionFile=t,null!=n?this.fileDiff=n:null!=e&&null!=t&&g&&(m=!0,this.fileDiff=kr(e,t,this.options.parseDiffOptions)),m&&(this.cachedHeaderHTML=void 0),null!=l&&this.setLineAnnotations(l),null==this.fileDiff)return!1;this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);const{disableErrorHandling:S=!1,disableFileHeader:y=!1}=this.options;if(y&&(null!=this.headerElement&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),s=this.getOrCreateFileContainer(s,a),this.applyCachedThemeState(c),u){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{const e=this.hunksRenderer.renderDiff(this.fileDiff,K);null!=e&&this.applyThemeState(s,e.themeStyles,c,e.baseThemeType),null!=(null==e?void 0:e.headerElement)&&this.applyHeaderToDOM(e.headerElement,s),this.renderSeparators([]),this.injectUnsafeCSS()}catch(x){if(S)throw x;console.error(x),x instanceof Error&&this.applyErrorToDOM(x,s)}return r||this.emitPostRender(),!0}try{const e=this.getOrCreatePreNode(s);if(!this.canPartiallyRender(o,v,g||m||p)||!this.applyPartialRender({previousRenderRange:b,renderRange:f})){const t=this.hunksRenderer.renderDiff(this.fileDiff,f);if(null==t)return!1===(null==(h=this.workerManager)?void 0:h.isInitialized())&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(s,t.themeStyles,c,t.baseThemeType),null!=t.headerElement&&this.applyHeaderToDOM(t.headerElement,s),null!=t.additionsContentAST||null!=t.deletionsContentAST||null!=t.unifiedContentAST?this.applyHunksToDOM(e,t):null!=this.pre&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,f),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,i||this.flushManagers()}catch(x){if(S)throw x;console.error(x),x instanceof Error&&this.applyErrorToDOM(x,s)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){var t,n;const{fileContainer:i,options:{onPostRender:o}}=this;if(e){if(!this.mounted)return;if(this.mounted=!1,null==i)return;return void(null==(n=(t=this.options).onPostRender)||n.call(t,i,this,"unmount"))}if(null==i)return;const r=this.mounted?"update":"mount";this.mounted=!0,null==o||o(i,this,r)}removeRenderedCode(){var e,t,n,i,o,r;this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),null==(e=this.bufferBefore)||e.remove(),this.bufferBefore=void 0,null==(t=this.bufferAfter)||t.remove(),this.bufferAfter=void 0,null==(n=this.codeUnified)||n.remove(),this.codeUnified=void 0,null==(i=this.codeDeletions)||i.remove(),this.codeDeletions=void 0,null==(o=this.codeAdditions)||o.remove(),this.codeAdditions=void 0,null==(r=this.pre)||r.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){var e;for(const{element:t}of this.separatorCache.values())t.remove();this.separatorCache.clear();for(const{element:t}of this.annotationCache.values())t.remove();this.annotationCache.clear(),null==(e=this.gutterUtilityContent)||e.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){var t;if(null==this.fileContainer)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),null==this.placeHolder){const e=null!=(t=this.fileContainer.shadowRoot)?t:this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty("height",`${e}px`),!0}primeHighlightCache(){var e;const{fileDiff:t,workerManager:n}=this;if(null==t||null==n||Xr(t))return;const i=null!=(e=this.options.tokenizeMaxLength)?e:1e5;Math.max(t.additionLines.length,t.deletionLines.length)>i||n.primeDiffHighlightCache(t)}cleanChildNodes(){var e,t,n,i,o,r,l,s,a,d,h,u,c,f;this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),null==(e=this.bufferAfter)||e.remove(),null==(t=this.bufferBefore)||t.remove(),null==(n=this.codeAdditions)||n.remove(),null==(i=this.codeDeletions)||i.remove(),null==(o=this.codeUnified)||o.remove(),null==(r=this.errorWrapper)||r.remove(),null==(l=this.headerElement)||l.remove(),null==(s=this.headerPrefix)||s.remove(),null==(a=this.headerMetadata)||a.remove(),null==(d=this.headerCustom)||d.remove(),null==(h=this.pre)||h.remove(),null==(u=this.spriteSVG)||u.remove(),null==(c=this.themeCSSStyle)||c.remove(),null==(f=this.unsafeCSSStyle)||f.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){const{hunkSeparators:t}=this.options;if(this.isContainerManaged||null==this.fileContainer||"function"!=typeof t){for(const{element:e}of this.separatorCache.values())e.remove();return void this.separatorCache.clear()}const n=new Map(this.separatorCache);for(const i of e){const e=i.slotName;let o=this.separatorCache.get(e);if(null==o||!al(i,o.hunkData)){null==o||o.element.remove();const n=document.createElement("div");n.style.display="contents",n.slot=i.slotName;const r=t(i,this);null!=r&&n.appendChild(r),this.fileContainer.appendChild(n),o={element:n,hunkData:i},this.separatorCache.set(e,o)}n.delete(e)}for(const[i,{element:o}]of n.entries())this.separatorCache.delete(i),o.remove()}renderAnnotations(){if(this.isContainerManaged||null==this.fileContainer){for(const{element:e}of this.annotationCache.values())e.remove();return void this.annotationCache.clear()}const e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(null!=t&&this.lineAnnotations.length>0)for(const[n,i]of this.lineAnnotations.entries()){const o=`${n}-${xi(i)}`;let r=this.annotationCache.get(o);if(null==r||!sl(i,r.annotation)){null==r||r.element.remove();const e=t(i);if(null==e)continue;r={element:so(xi(i)),annotation:i},r.element.appendChild(e),this.fileContainer.appendChild(r.element),this.annotationCache.set(o,r)}e.delete(o)}for(const[n,{element:i}]of e.entries())this.annotationCache.delete(n),i.remove()}renderGutterUtility(){var e,t;const{renderGutterUtility:n}=this.options;if(null==this.fileContainer||null==n)return null==(e=this.gutterUtilityContent)||e.remove(),void(this.gutterUtilityContent=void 0);const i=n(this.interactionManager.getHoveredLine);if(null!=i&&null!=this.gutterUtilityContent)return;if(null==i)return null==(t=this.gutterUtilityContent)||t.remove(),void(this.gutterUtilityContent=void 0);const o=ao();o.appendChild(i),this.fileContainer.appendChild(o),this.gutterUtilityContent=o}getOrCreateFileContainer(e,t){var n;const{fileContainer:i}=this,o=null!=(n=null!=e?e:i)?n:document.createElement("diffs-container"),r=i!==o;return r&&this.emitPostRender(!0),this.fileContainer=o,null!=i&&r&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),null!=t&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),r&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){var t;const{shadowRoot:n}=e;if(null!=n)for(const i of n.children)i instanceof SVGElement?null!=this.spriteSVG||(this.spriteSVG=i):wo(i)&&i.hasAttribute("data-theme-css")?(null!=this.themeCSSStyle||(this.themeCSSStyle=i),this.hasAdoptedThemeCSS=!0):wo(i)&&i.hasAttribute("data-unsafe-css")&&(null!=this.unsafeCSSStyle||(this.unsafeCSSStyle=i),null!=this.appliedUnsafeCSS||(this.appliedUnsafeCSS=null!=(t=this.options.unsafeCSS)?t:void 0))}ensureSpriteSVG(e){var t;const n=null!=(t=e.shadowRoot)?t:e.attachShadow({mode:"open"});if(null==this.spriteSVG){const e=document.createElement("div");e.innerHTML=io;const t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}null!=this.spriteSVG&&this.spriteSVG.parentNode!==n&&n.appendChild(this.spriteSVG)}getOrCreatePreNode(e){var t,n;const i=null!=(t=e.shadowRoot)?t:e.attachShadow({mode:"open"});return null==this.pre?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,i.appendChild(this.pre)):this.pre.parentNode!==i&&(i.appendChild(this.pre),this.appliedPreAttributes=void 0),null==(n=this.placeHolder)||n.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(const 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){var n,i,o,r,l,s,a,d,h,u;this.cleanupErrorWrapper(),null==(n=this.placeHolder)||n.remove(),this.placeHolder=void 0;const{fileDiff:c}=this,f=null!=(i=this.cachedHeaderHTML)?i:Bt(e);if(this.cachedHeaderHTML=f,f!==this.lastRenderedHeaderHTML){const e=document.createElement("div");e.innerHTML=f;const n=e.firstElementChild;if(!(n instanceof HTMLElement))return;null!=this.headerElement?null==(o=t.shadowRoot)||o.replaceChild(n,this.headerElement):null==(r=t.shadowRoot)||r.prepend(n),this.headerElement=n,this.lastRenderedHeaderHTML=f}if(this.isContainerManaged||null==c)return;const{renderCustomHeader:p,renderHeaderPrefix:g,renderHeaderMetadata:m}=this.options;if(null!=p){const e=null!=(l=p(c))?l:void 0;return this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,D,e),null==(s=this.headerPrefix)||s.remove(),null==(a=this.headerMetadata)||a.remove(),this.headerPrefix=void 0,void(this.headerMetadata=void 0)}const v=null!=(d=null==g?void 0:g(c))?d:void 0,b=null!=(h=null==m?void 0:m(c))?h:void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,H,v),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,P,b),null==(u=this.headerCustom)||u.remove(),this.headerCustom=void 0}clearHeaderSlots(){var e,t,n;null==(e=this.headerPrefix)||e.remove(),null==(t=this.headerMetadata)||t.remove(),null==(n=this.headerCustom)||n.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,i){if(null==i)return void(null==t||t.remove());const o=null!=t?t:this.createHeaderSlotElement(n);return null==t&&e.appendChild(o),this.replaceHeaderSlotContent(o,i),o}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){const t=document.createElement("div");return t.slot=e,t}injectUnsafeCSS(){var e,t;const{unsafeCSS:n}=this.options,i=null==(e=this.fileContainer)?void 0:e.shadowRoot;if(null!=i)return null==n||""===n?(null!=this.unsafeCSSStyle&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),void(this.appliedUnsafeCSS=void 0)):void((null==(t=this.unsafeCSSStyle)?void 0:t.parentNode)===i&&this.appliedUnsafeCSS===n||(null!=this.unsafeCSSStyle||(this.unsafeCSSStyle=ho()),this.unsafeCSSStyle.parentNode!==i&&i.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=So(n),this.appliedUnsafeCSS=n))}applyThemeState(e,t,n,i){var o,r,l,s,a;const d=null!=(o=e.shadowRoot)?o:e.attachShadow({mode:"open"}),h=null!=i?i:n,u=null!=(r=this.options.theme)?r:O,c="string"==typeof u?u:m({},u),f=fo(d);if((null==(l=this.themeCSSStyle)?void 0:l.parentNode)!==d||(null==(s=this.appliedThemeCSS)?void 0:s.themeStyles)!==t||this.appliedThemeCSS.themeType!==h||this.appliedThemeCSS.scrollbarGutter!==f){if(this.hasAdoptedThemeCSS&&(null==(a=this.themeCSSStyle)?void 0:a.parentNode)===d)return this.hasAdoptedThemeCSS=!1,void(this.appliedThemeCSS={theme:c,themeStyles:t,themeType:h,baseThemeType:i,scrollbarGutter:f});this.themeCSSStyle=Eo({shadowRoot:d,currentNode:this.themeCSSStyle,themeCSS:yo(t,h,f)}),this.appliedThemeCSS=null!=this.themeCSSStyle?{theme:c,themeStyles:t,themeType:h,baseThemeType:i,scrollbarGutter:f}:void 0}else this.appliedThemeCSS.theme=c}hydrateMeasuredScrollbar(){var e,t;const n=null==(e=this.fileContainer)?void 0:e.shadowRoot;null!=n&&null!=this.themeCSSStyle&&(this.themeCSSStyle.textContent=xo(null!=(t=this.themeCSSStyle.textContent)?t:"",fo(n)))}applyHunksToDOM(e,t){var n,i,o,r,l,s,a,d,h,u;const{overflow:c="scroll"}=this.options,f="line-info"===(null!=(n=this.options.hunkSeparators)?n:"line-info"),p="wrap"===c?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let g=!1;const m=[],v=this.hunksRenderer.renderCodeAST("unified",t),b=this.hunksRenderer.renderCodeAST("deletions",t),S=this.hunksRenderer.renderCodeAST("additions",t);null!=v?(g=null==this.codeUnified||null!=this.codeAdditions||null!=this.codeDeletions,null==(i=this.codeDeletions)||i.remove(),this.codeDeletions=void 0,null==(o=this.codeAdditions)||o.remove(),this.codeAdditions=void 0,this.codeUnified=Co({code:this.codeUnified,columnType:"unified",rowSpan:p,containerSize:f}),this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(v),m.push(this.codeUnified)):null!=b||null!=S?(null!=b?(g=null==this.codeDeletions||null!=this.codeUnified,null==(r=this.codeUnified)||r.remove(),this.codeUnified=void 0,this.codeDeletions=Co({code:this.codeDeletions,columnType:"deletions",rowSpan:p,containerSize:f}),this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(b),m.push(this.codeDeletions)):(null==(l=this.codeDeletions)||l.remove(),this.codeDeletions=void 0),null!=S?(g=g||null==this.codeAdditions||null!=this.codeUnified,null==(s=this.codeUnified)||s.remove(),this.codeUnified=void 0,this.codeAdditions=Co({code:this.codeAdditions,columnType:"additions",rowSpan:p,containerSize:f}),this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(S),m.push(this.codeAdditions)):(null==(a=this.codeAdditions)||a.remove(),this.codeAdditions=void 0)):(null==(d=this.codeUnified)||d.remove(),this.codeUnified=void 0,null==(h=this.codeDeletions)||h.remove(),this.codeDeletions=void 0,null==(u=this.codeAdditions)||u.remove(),this.codeAdditions=void 0),0===m.length?e.textContent="":g&&e.replaceChildren(...m),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){const{pre:n,codeUnified:i,codeAdditions:o,codeDeletions:r,options:{diffStyle:l="split"}}=this;if(null==n||null==e||null==t||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||null==this.lastRowCount)return!1;const s=this.getCodeColumns(l,i,r,o);if(null==s)return!1;const a=e.startingLine,d=t.startingLine,h=a+e.totalLines,u=d+t.totalLines,c=Math.max(a,d),f=Math.min(h,u);if(f<=c)return!1;const p=Math.max(0,c-a),g=Math.max(0,h-f),m=this.trimColumns({columns:s,trimStart:p,trimEnd:g,previousStart:a,overlapStart:c,overlapEnd:f,diffStyle:l});if(m<0)throw new Error("applyPartialRender: failed to trim to overlap");if(this.lastRowCount<m)throw new Error("applyPartialRender: trimmed beyond DOM row count");let v=this.lastRowCount-m;const b=(e,t)=>{if(!(t<=0||null==this.fileDiff))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},S=b(d,Math.max(c-d,0));if(null==S&&d<c)return!1;const y=b(f,Math.max(u-f,0));if(null==y&&u>f)return!1;const x=(e,t)=>{if(null!=e){if("unified"!==l||Array.isArray(s)){if("split"!==l||!Array.isArray(s))throw new Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");this.insertPartialHTML(l,s,e,t)}else this.insertPartialHTML(l,s,e,t);v+=e.rowCount}};return this.cleanupErrorWrapper(),x(S,"afterbegin"),x(y,"beforeend"),this.lastRowCount!==v&&(this.applyRowSpan(l,s,v),this.lastRowCount=v),!0}insertPartialHTML(e,t,n,i){if("unified"!==e||Array.isArray(t)){if("split"!==e||!Array.isArray(t))throw new Error("FileDiff.insertPartialHTML: Invalid argument composition");{const e=this.hunksRenderer.renderCodeAST("deletions",n),o=this.hunksRenderer.renderCodeAST("additions",n);this.renderPartialColumn(t[0],e,i),this.renderPartialColumn(t[1],o,i)}}else{const e=this.hunksRenderer.renderCodeAST("unified",n);this.renderPartialColumn(t,e,i)}}renderPartialColumn(e,t,n){if(null==e||null==t)return;const i=ul(t[0]),o=ul(t[1]);if(null==i||null==o)throw new Error("FileDiff.insertPartialHTML: Unexpected AST structure");const r=o.at(0);"beforeend"===n&&"element"===(null==r?void 0:r.type)&&"number"==typeof r.properties["data-buffer-size"]&&this.mergeBuffersIfNecessary(r.properties["data-buffer-size"],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],i,o,!0);const l=o.at(-1);"afterbegin"===n&&"element"===(null==l?void 0:l.type)&&"number"==typeof l.properties["data-buffer-size"]&&this.mergeBuffersIfNecessary(l.properties["data-buffer-size"],e.content.children[0],e.gutter.children[0],i,o,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(o))}mergeBuffersIfNecessary(e,t,n,i,o,r){if(!(t instanceof HTMLElement&&n instanceof HTMLElement))return;const l=this.getBufferSize(t.dataset);null!=l&&(r?(i.shift(),o.shift()):(i.pop(),o.pop()),this.updateBufferSize(t,l+e),this.updateBufferSize(n,l+e))}applyRowSpan(e,t,n){const i=e=>{null!=e&&(e.gutter.style.setProperty("grid-row",`span ${n}`),e.content.style.setProperty("grid-row",`span ${n}`))};if("unified"!==e||Array.isArray(t)){if("split"!==e||!Array.isArray(t))throw new Error("dun fuuuuked up");i(t[0]),i(t[1])}else i(t)}trimColumnRows(e,t,n){let i=0,o=0,r=0,l=!1;const s=n>=0;if(null==e)return 0;const a=Array.from(e.content.children),d=Array.from(e.gutter.children);if(a.length!==d.length)throw new Error("FileDiff.trimColumnRows: columns do not match");for(;r<a.length&&(!(t<=0)||s||l);){const e=d[r],h=a[r];if(r++,!(e instanceof HTMLElement&&h instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:h}),new Error("FileDiff.trimColumnRows: invalid row elements");if(l&&(l=!1,"annotation"===e.dataset.gutterBuffer&&"lineAnnotation"in h.dataset||"metadata"===e.dataset.gutterBuffer&&"noNewline"in h.dataset))e.remove(),h.remove(),o++;else if("lineIndex"in e.dataset&&"lineIndex"in h.dataset)(t>0||s&&i>=n)&&(e.remove(),h.remove(),t>0&&0===--t&&(l=!0),o++),i++;else if("separator"in e.dataset&&"separator"in h.dataset)(t>0||s&&i>=n)&&(e.remove(),h.remove(),o++);else if("annotation"===e.dataset.gutterBuffer&&"lineAnnotation"in h.dataset)(t>0||s&&i>=n)&&(e.remove(),h.remove(),o++);else{if("metadata"!==e.dataset.gutterBuffer||!("noNewline"in h.dataset)){if("buffer"===e.dataset.gutterBuffer&&"contentBuffer"in h.dataset){const r=this.getBufferSize(h.dataset);if(null==r)throw new Error("FileDiff.trimColumnRows: invalid element");if(t>0){const n=Math.min(t,r),i=r-n;i>0?(this.updateBufferSize(e,i),this.updateBufferSize(h,i),o+=n):(e.remove(),h.remove(),o+=r),0===(t-=n)&&0===i&&(l=!0)}else if(s){const t=i+r-1;if(n<=i)e.remove(),h.remove(),o+=r;else if(n<=t){const i=t-n+1,l=r-i;this.updateBufferSize(e,l),this.updateBufferSize(h,l),o+=i}}i+=r;continue}throw console.error({gutterElement:e,contentElement:h}),new Error("FileDiff.trimColumnRows: unknown row elements")}(t>0||s&&i>=n)&&(e.remove(),h.remove(),o++)}}return o}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:i,previousStart:o,trimEnd:r,trimStart:l}){const s=Math.max(0,i-o),a=n-o;if(a<0)throw new Error("FileDiff.trimColumns: overlap ends before previous");const d=l>0,h=r>0;if(!d&&!h)return 0;const u=d?s:0,c=h?a:-1;if("unified"!==t||Array.isArray(e)){if("split"===t&&Array.isArray(e)){const t=this.trimColumnRows(e[0],u,c),n=this.trimColumnRows(e[1],u,c);if(null!=e[0]&&null!=e[1]&&t!==n)throw new Error("FileDiff.trimColumns: split columns out of sync");return null!=e[0]?t:n}throw console.error({diffStyle:t,columns:e}),new Error("FileDiff.trimColumns: Invalid columns for diffType")}return this.trimColumnRows(e,u,c)}getBufferSize(e){var t;const n=Number.parseInt(null!=(t=null==e?void 0:e.bufferSize)?t:"",10);return Number.isNaN(n)?void 0:n}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty("grid-row",`span ${t}`),e.style.setProperty("min-height",`calc(${t} * 1lh)`)}getCodeColumns(e,t,n,i){function o(e){if(null==e)return;const t=e.children[0],n=e.children[1];return t instanceof HTMLElement&&n instanceof HTMLElement&&null!=t.dataset.gutter&&null!=n.dataset.content?{gutter:t,content:n}:void 0}if("unified"===e)return o(t);{const e=o(n),t=o(i);return null!=e||null!=t?[e,t]:void 0}}applyBuffers(e,t){if(null==t||this.shouldDisableVirtualizationBuffers())return null!=this.bufferBefore&&(this.bufferBefore.remove(),this.bufferBefore=void 0),void(null!=this.bufferAfter&&(this.bufferAfter.remove(),this.bufferAfter=void 0));t.bufferBefore>0?(null==this.bufferBefore&&(this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",e.before(this.bufferBefore)),this.bufferBefore.style.setProperty("height",`${t.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")):null!=this.bufferBefore&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(null==this.bufferAfter&&(this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",e.after(this.bufferAfter)),this.bufferAfter.style.setProperty("height",`${t.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")):null!=this.bufferAfter&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){var e;return null!=(e=this.options.disableVirtualizationBuffers)&&e}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:i},o){const{diffIndicators:r="bars",disableBackground:l=!1,disableLineNumbers:s=!1,overflow:a="scroll",diffStyle:d="split"}=this.options,h={type:"diff",diffIndicators:r,disableBackground:l,disableLineNumbers:s,overflow:a,split:"unified"!==d&&null!=t&&null!=n,totalLines:i,customProperties:o};ro(h,this.appliedPreAttributes)||(Lo(e,h),this.appliedPreAttributes=h)}applyErrorToDOM(e,t){var n,i,o;this.cleanupErrorWrapper(),null==(n=this.pre)||n.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;const r=null!=(i=t.shadowRoot)?i:t.attachShadow({mode:"open"});null!=this.errorWrapper||(this.errorWrapper=document.createElement("div")),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",r.appendChild(this.errorWrapper);const l=document.createElement("div");l.dataset.errorMessage="",l.innerText=e.message,this.errorWrapper.appendChild(l);const s=document.createElement("pre");s.dataset.errorStack="",s.innerText=null!=(o=e.stack)?o:"No Error Stack",this.errorWrapper.appendChild(s)}cleanupErrorWrapper(){var e;null==(e=this.errorWrapper)||e.remove(),this.errorWrapper=void 0}},S(i,"LoadedCustomComponent",!0),i);function ul(e){var t;if(null!=e&&"element"===e.type)return null!=(t=e.children)?t:[]}function cl(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};const t=e.hunkContent.at(-1);if(null==t)return{split:0,unified:0};if("context"===t.type){const e=t.lines>0?1:0;return{split:e,unified:e}}return function(e,t){const n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),i=t.deletions>0&&e.noEOFCRDeletions,o=t.additions>0&&e.noEOFCRAdditions;return{split:i||o?1:0,unified:n}}(e,t)}const fl=5e3;let pl=-1;var gl=class extends hl{constructor(e,t,n,i,o=!1){super(e,i,o),S(this,"__id","little-virtualized-file-diff:"+ ++pl),S(this,"top"),S(this,"height",0),S(this,"metrics"),S(this,"cache",{heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0}),S(this,"isVisible",!1),S(this,"isSetup",!1),S(this,"virtualizer"),S(this,"layoutDirty",!0),S(this,"forceRenderOverride"),S(this,"currentCollapsed"),S(this,"onRender",e=>null!=this.fileContainer&&(e&&(this.top=this.getVirtualizedTop()),this.render())),S(this,"expandHunk",(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.forceRenderOverride=!0,this.resetLayoutCache({includeEstimatedHeights:!0}),this.isSimpleMode()&&this.computeApproximateSize(),this.virtualizer.instanceChanged(this,!0)}),this.virtualizer=t,this.metrics=Mo(n)}setMetrics(e,t=!1){const n=Mo(e);!t&&ee(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return null!=e&&e!==this.lineAnnotations&&(0!==e.length||0!==this.lineAnnotations.length)&&(super.setLineAnnotations(e),!0)}setFileAnnotationHeight(e){const t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e=this.fileDiff){return!(null==e||!Ki(this.lineAnnotations))&&this.lineAnnotations.some(t=>0===t.lineNumber&&("new"===e.type?"additions"===t.side:"deleted"!==e.type||"deletions"===t.side))}getLineHeight(e,t=!1){var n;return this.getEstimatedLineHeight(t)+(null!=(n=this.cache.heightDeltas.get(e))?n:0)}getEstimatedLineHeight(e=!1){const t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw new Error("VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(null==e)return;const{options:t}=this,n=!ne(t,e),i=n&&function(e,t){var n,i,o,r,l,s,a,d,h,u,c,f,p,g,m,v,b,S;return(null!=(n=e.diffStyle)?n:"split")!==(null!=(i=t.diffStyle)?i:"split")||(null!=(o=e.overflow)?o:"scroll")!==(null!=(r=t.overflow)?r:"scroll")||(null!=(l=e.collapsed)&&l)!==(null!=(s=t.collapsed)&&s)||(null!=(a=e.disableLineNumbers)&&a)!==(null!=(d=t.disableLineNumbers)&&d)||(null!=(h=e.disableFileHeader)&&h)!==(null!=(u=t.disableFileHeader)&&u)||(null!=(c=e.diffIndicators)?c:"bars")!==(null!=(f=t.diffIndicators)?f:"bars")||(null!=(p=e.hunkSeparators)?p:"line-info")!==(null!=(g=t.hunkSeparators)?g:"line-info")||(null!=(m=e.expandUnchanged)&&m)!==(null!=(v=t.expandUnchanged)&&v)||(null!=(b=e.collapsedContextThreshold)?b:1)!==(null!=(S=t.collapsedContextThreshold)?S:1)||e.unsafeCSS!==t.unsafeCSS}(t,e);super.setOptions(e),i&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:yl(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,i)}setThemeType(e){if(this.isAdvancedMode())throw new Error("VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.");super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.size>0&&this.cache.heightDeltas.clear(),0!==this.cache.measuredHeightDeltaTotal&&(this.cache.measuredHeightDeltaTotal=0),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),0!==this.cache.totalLines&&(this.cache.totalLines=0),t&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),null!=this.renderRange&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){var e,t;let n=!1;const{overflow:i="scroll"}=this.options;if(null==this.fileContainer||null==this.fileDiff)return 0!==this.height&&(n=!0),this.height=0,n;if(this.top=this.getVirtualizedTop(),"scroll"===i&&0===this.lineAnnotations.length&&!this.isResizeDebuggingEnabled())return n;const o=this.getDiffStyle(),r="split"===o?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],l=this.hasFileAnnotations(this.fileDiff);if(null!=this.renderRange&&l&&Yi(this.renderRange)){const t=null!=(e=function(e){let t;for(const n of e){if(null==n)continue;const e=n.children[1];if(e instanceof HTMLElement)for(const n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===Gi&&(t=Math.max(null!=t?t:0,n.getBoundingClientRect().height))}return t}(r))?e:0;this.setFileAnnotationHeight(t)&&(n=!0)}else!l&&this.setFileAnnotationHeight(0)&&(n=!0);for(const s of r){if(null==s)continue;const e=s.children[1];if(e instanceof HTMLElement)for(const i of e.children){if(!(i instanceof HTMLElement))continue;const e=i.dataset.lineIndex;if(null==e)continue;const r=xl(e,o);let l=i.getBoundingClientRect().height,s=!1;i.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in i.nextElementSibling.dataset||"noNewline"in i.nextElementSibling.dataset)&&("noNewline"in i.nextElementSibling.dataset&&(s=!0),l+=i.nextElementSibling.getBoundingClientRect().height);const a=this.getEstimatedLineHeight(s),d=null!=(t=this.cache.heightDeltas.get(r))?t:0,h=l-a;h!==d&&(n=!0,this.cache.measuredHeightDeltaTotal+=h-d,0===h?this.cache.heightDeltas.delete(r):this.cache.heightDeltas.set(r,h))}}return(n||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),n}prepareCodeViewItem(e,t,n,i){const o=!Fo(this.fileDiff,e),r=this.syncLineAnnotations(i);let l=!0===(null==n?void 0:n.resetDiffLayoutCache)||o||r,s=o||!0===(null==n?void 0:n.resetDiffLayoutCache)&&n.includeEstimatedDiffHeights;null!=(null==n?void 0:n.metrics)&&(this.metrics=Mo(n.metrics),l=!0,s=!0);const{collapsed:a=!1}=this.options;return this.currentCollapsed!==a&&(this.currentCollapsed=a,l=!0),l&&this.resetLayoutCache({includeEstimatedHeights:s}),this.fileDiff=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e,t="additions"){var n,i;if(null==this.fileDiff||e<1)return;const o=this.getLineIndex(e,t);if(null==o)return;const{disableFileHeader:r=!1,expandUnchanged:l=!1,collapsed:s=!1,collapsedContextThreshold:a=1}=this.options,d=this.getDiffStyle(),h=this.getHunkSeparatorType(),u="split"===d?o[1]:o[0];this.approximateLayoutCheckpoints();const c=Ho(this.metrics,r),f=this.getLayoutCheckpointBeforeLineIndex(u);let p,g=null!=(n=null==f?void 0:f.top)?n:c+this.cache.fileAnnotationHeight;return s?{top:c,height:0}:($r({diff:this.fileDiff,diffStyle:d,startingLine:null!=(i=null==f?void 0:f.renderedLineIndex)?i:0,expandedHunks:!!l||this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:i,deletionLine:o,additionLine:r})=>{var l,s,a,c;const f="split"===d?null!=(l=null==r?void 0:r.splitLineIndex)?l:null==o?void 0:o.splitLineIndex:null!=(s=null==r?void 0:r.unifiedLineIndex)?s:null==o?void 0:o.unifiedLineIndex;if(null==f)throw new Error("VirtualizedFileDiff.getLinePosition: missing line index data");if(n>0){const i=Br({type:h,metrics:this.metrics,hunkIndex:e,hunkSpecs:null==t?void 0:t.hunkSpecs});if(null!=i){if(g+=i.gapBefore,u>=f-n&&u<f)return p={top:g,height:i.height},!0;g+=i.height+i.gapAfter}}const m=this.getLineHeight(f,null!=(a=null==r?void 0:r.noEOFCR)&&a||null!=(c=null==o?void 0:o.noEOFCR)&&c);if(f===u)return p={top:g,height:m},!0;if(g+=m,i>0){const e=jr({type:h,metrics:this.metrics});if(null!=e){if(u>f&&u<=f+i)return p={top:g+e.gapBefore,height:e.height},!0;g+=e.totalHeight}}return!1}}),p)}getNumericScrollAnchor(e){var t,n;if(null==this.fileDiff)return;const{disableFileHeader:i=!1,expandUnchanged:o=!1,collapsed:r=!1,collapsedContextThreshold:l=1}=this.options;if(r)return;const s=this.getDiffStyle(),a=this.getHunkSeparatorType();this.approximateLayoutCheckpoints();const d=this.getLayoutCheckpointBeforeTop(e);let h,u=null!=(t=null==d?void 0:d.top)?t:Ho(this.metrics,i)+this.cache.fileAnnotationHeight;return $r({diff:this.fileDiff,diffStyle:s,startingLine:null!=(n=null==d?void 0:d.renderedLineIndex)?n:0,expandedHunks:!!o||this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:i,collapsedAfter:o,deletionLine:r,additionLine:l})=>{var d,c,f,p;const g="split"===s?null!=(d=null==l?void 0:l.splitLineIndex)?d:null==r?void 0:r.splitLineIndex:null!=(c=null==l?void 0:l.unifiedLineIndex)?c:null==r?void 0:r.unifiedLineIndex;if(null==g)throw new Error("VirtualizedFileDiff.getNumericScrollAnchor: missing line index data");if(i>0){const e=Br({type:a,metrics:this.metrics,hunkIndex:t,hunkSpecs:null==n?void 0:n.hunkSpecs});null!=e&&(u+=e.totalHeight)}if(u>=e&&(null!=r?h={lineNumber:r.lineNumber,side:"deletions",top:u}:null!=l&&(h={lineNumber:l.lineNumber,side:"additions",top:u}),null!=h))return!0;const m=this.getLineHeight(g,null!=(f=null==l?void 0:l.noEOFCR)&&f||null!=(p=null==r?void 0:r.noEOFCR)&&p);if(u+=m,o>0){const e=jr({type:a,metrics:this.metrics});null!=e&&(u+=e.totalHeight)}return!1}}),h}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(null==this.top||null==this.fileDiff)return;if(!0===this.options.collapsed)return{topOffset:this.top,height:this.height};const t=null!=e?this.computeRenderRangeFromWindow(this.fileDiff,this.top,e):this.renderRange;if(null==t)return;const{bufferBefore:n,bufferAfter:i,totalLines:o}=t;let r=0;if(0===o){const t=null!=e?e:this.virtualizer.getWindowSpecs();this.top<t.top&&(r=i)}return{topOffset:this.top+n+r,height:this.height-(n+i)}}cleanUp(e=!1){var t;null!=this.fileContainer&&this.isSimpleMode()&&(null==(t=this.getSimpleVirtualizer())||t.disconnect(this.fileContainer)),e||this.resetLayoutCache({includeEstimatedHeights:!0}),this.isSetup=!1,super.cleanUp(e)}setVisibility(e){this.isAdvancedMode()||null==this.fileContainer||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||null==this.fileDiff&&null==this.additionFile&&null==this.deletionFile||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}computeApproximateSize(e=!1){const t=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!t)return;const n=0===this.height;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,null==this.fileDiff)return void(this.layoutDirty=!1);const{disableFileHeader:i=!1,collapsed:o=!1}=this.options,r=Ho(this.metrics,i);this.height+=r,o||(this.height=this.getActiveEstimatedHeight()+this.cache.measuredHeightDeltaTotal,t&&!n&&this.validateComputedHeight()),this.layoutDirty=!1}getActiveEstimatedHeight(){this.ensureEstimatedDiffHeights();const e="split"===this.getDiffStyle()?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(null==e)throw new Error("VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height");return e}ensureEstimatedDiffHeights(){if(null==this.fileDiff)return this.cache.estimatedSplitHeight=void 0,void(this.cache.estimatedUnifiedHeight=void 0);if(null!=this.cache.estimatedSplitHeight&&null!=this.cache.estimatedUnifiedHeight)return;const{disableFileHeader:e=!1,expandUnchanged:t=!1,collapsedContextThreshold:n=1}=this.options,{splitHeight:i,unifiedHeight:o}=function({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:i,expandUnchanged:o,expandedHunks:r,collapsedContextThreshold:l}){var s,a,d,h;let u=Ho(t,n),c=u;const f=!!o||r,p=e.hunks.length-1;for(let g=0;g<e.hunks.length;g++){const n=e.hunks[g];if(null==n)throw new Error("computeEstimatedDiffHeights: invalid hunk index");const o=Or({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:f,hunkIndex:g,collapsedContextThreshold:l}),r=(o.fromStart+o.fromEnd)*t.lineHeight;if(u+=r,c+=r,o.collapsedLines>0){const e=null!=(a=null==(s=Br({type:i,metrics:t,hunkIndex:g,hunkSpecs:n.hunkSpecs}))?void 0:s.totalHeight)?a:0;u+=e,c+=e}u+=n.splitLineCount*t.lineHeight,c+=n.unifiedLineCount*t.lineHeight;const m=cl(n);u+=m.split*t.lineHeight,c+=m.unified*t.lineHeight;const v=g===p?Fr({fileDiff:e,hunkIndex:g,expandedHunks:f,collapsedContextThreshold:l,errorPrefix:"computeEstimatedDiffHeights"}):void 0;if(null!=v){const e=(v.fromStart+v.fromEnd)*t.lineHeight;if(u+=e,c+=e,v.collapsedLines>0){const e=null!=(h=null==(d=jr({type:i,metrics:t}))?void 0:d.totalHeight)?h:0;u+=e,c+=e}}}if(e.hunks.length>0){const e=Po(t);u+=e,c+=e}return{splitHeight:u,unifiedHeight:c}}({fileDiff:this.fileDiff,metrics:this.metrics,disableFileHeader:e,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:t,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:n});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=o}validateComputedHeight(){if(null==this.fileContainer||null==this.fileDiff)return;const e=this.fileContainer.getBoundingClientRect();e.height!==this.height&&(this.fileDiff.name,e.height,this.height)}render(e={}){var t,n,i=e,{fileContainer:o,oldFile:r,newFile:l,fileDiff:s,forceRender:a=!1,lineAnnotations:d}=i,h=b(i,["fileContainer","oldFile","newFile","fileDiff","forceRender","lineAnnotations"]);const{forceRenderOverride:u,isSetup:c}=this;this.forceRenderOverride=void 0;const f=this.syncLineAnnotations(d);if(f&&this.resetLayoutCache({includeEstimatedHeights:!1}),null!=this.fileDiff||(this.fileDiff=null!=s?s:null!=r&&null!=l?kr(r,l,this.options.parseDiffOptions):void 0),o=this.getOrCreateFileContainer(o),null==this.fileDiff)return console.error("VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data"),!1;if(c)null!=this.top||(this.top=this.getVirtualizedTop());else{this.computeApproximateSize();const e=this.getSimpleVirtualizer();if(null!=this.top||(this.top=this.getVirtualizedTop()),this.isAdvancedMode())this.isVisible=!0;else{if(null==e)throw new Error("VirtualizedFileDiff.render: simple virtualizer is not available");e.connect(o,this),this.isVisible=e.isInstanceVisible(null!=(t=this.top)?t:0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode())return this.renderPlaceholder(this.height);const p=this.virtualizer.getWindowSpecs(),g=null!=(n=this.top)?n:0,v=this.computeRenderRangeFromWindow(this.fileDiff,g,p);return super.render(m({fileDiff:this.fileDiff,fileContainer:o,renderRange:v,oldFile:r,newFile:l,lineAnnotations:d,forceRender:(null!=u?u:a)||f},h))}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}isSimpleMode(){return"simple"===this.virtualizer.type}isAdvancedMode(){return"advanced"===this.virtualizer.type}getVirtualizedTop(){return"advanced"===this.virtualizer.type?this.virtualizer.getLocalTopForInstance(this):null!=this.fileContainer?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}getSimpleVirtualizer(){return"simple"===this.virtualizer.type?this.virtualizer:void 0}isResizeDebuggingEnabled(){var e,t;return null!=(t=null==(e=this.getSimpleVirtualizer())?void 0:e.config.resizeDebugging)&&t}getDiffStyle(){var e;return null!=(e=this.options.diffStyle)?e:"split"}getHunkSeparatorType(){return"function"==typeof(e=this.options.hunkSeparators)?"custom":null!=e?e:"line-info";var e}approximateLayoutCheckpoints(){var e,t,n,i;if(this.cache.checkpoints.length>0||null==this.fileDiff||0===this.fileDiff.hunks.length||!0===this.options.collapsed)return;const{disableFileHeader:o=!1,expandUnchanged:r=!1,collapsedContextThreshold:l=1}=this.options,s=this.fileDiff.hunks.length-1,a=this.getDiffStyle(),d=this.getHunkSeparatorType(),h=!!r||this.hunksRenderer.getExpandedHunksMap(),u=function(e){const t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],i=[0];let o=0;for(const[r,l]of t)n.push(r),o+=l,i.push(o);return{lineIndexes:n,prefixTotals:i}}(this.cache.heightDeltas);let c=Ho(this.metrics,o)+this.cache.fileAnnotationHeight,f=0;const p=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:i=0,metadataOffsets:o=[]})=>{if(e<=0)return;const r=f,l=f+e;let s=function(e){return Math.ceil(e/fl)*fl}(r);for(;s<l;){const e=s-r,i=c+(e>0?n:0)+e*this.metrics.lineHeight+bl(o,e)*this.metrics.lineHeight+ml(u,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:i}),s+=fl}c+=n+e*this.metrics.lineHeight+o.length*this.metrics.lineHeight+ml(u,t,t+e)+i,f=l};for(let g=0;g<this.fileDiff.hunks.length;g++){const o=this.fileDiff.hunks[g];if(null==o)throw new Error("VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index");const r=Or({isPartial:this.fileDiff.isPartial,rangeSize:o.collapsedBefore,expandedHunks:h,hunkIndex:g,collapsedContextThreshold:l}),u=r.collapsedLines>0&&null!=(t=null==(e=Br({type:d,metrics:this.metrics,hunkIndex:g,hunkSpecs:o.hunkSpecs}))?void 0:e.totalHeight)?t:0;p({rowCount:r.fromStart,startLineIndex:("split"===a?o.splitLineStart:o.unifiedLineStart)-r.rangeSize});let c=u;p({rowCount:r.fromEnd,startLineIndex:("split"===a?o.splitLineStart:o.unifiedLineStart)-r.fromEnd,preSeparatorHeight:c}),r.fromEnd>0&&(c=0);const f=g===s?Fr({fileDiff:this.fileDiff,hunkIndex:g,expandedHunks:h,collapsedContextThreshold:l,errorPrefix:"VirtualizedFileDiff"}):void 0,m=null!=f&&f.collapsedLines>0&&null!=(i=null==(n=jr({type:d,metrics:this.metrics}))?void 0:n.totalHeight)?i:0,v=null!=f?f.fromStart+f.fromEnd:0,b="split"===a?o.splitLineCount:o.unifiedLineCount,S="split"===a?o.splitLineStart:o.unifiedLineStart;p({rowCount:b,startLineIndex:S,preSeparatorHeight:c,postSeparatorHeight:0===v?m:0,metadataOffsets:Sl({diffStyle:a,hunk:o,rowCount:b})}),null!=f&&v>0&&p({rowCount:v,startLineIndex:S+b,postSeparatorHeight:m})}this.cache.totalLines=f}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||0===this.cache.checkpoints.length)return;let t,n=0,i=this.cache.checkpoints.length-1;for(;n<=i;){const o=n+i>>1,r=this.cache.checkpoints[o];if(null==r)throw new Error("VirtualizedFileDiff: invalid checkpoint index");r.lineIndex<=e?(t=r,n=o+1):i=o-1}return t}getLayoutCheckpointBeforeTop(e,t){let n=0,i=this.cache.checkpoints.length-1,o=-1;for(;n<=i;){const t=n+i>>1,r=this.cache.checkpoints[t];if(null==r)throw new Error("VirtualizedFileDiff: invalid checkpoint index");r.top<=e?(o=t,n=t+1):i=t-1}if(null==t)return o>=0?this.cache.checkpoints[o]:void 0;for(let r=o;r>=0;r--){const e=this.cache.checkpoints[r];if(null==e)throw new Error("VirtualizedFileDiff: invalid checkpoint index");if(e.renderedLineIndex%t===0)return e}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(const i of e.hunks)n+="split"===t?i.splitLineCount:i.unifiedLineCount;return n}const{expandUnchanged:i=!1,collapsedContextThreshold:o=1}=this.options,r=!!i||this.hunksRenderer.getExpandedHunksMap();for(const[s,a]of e.hunks.entries()){n+="split"===t?a.splitLineCount:a.unifiedLineCount;const i=Math.max(a.collapsedBefore,0),{fromStart:l,fromEnd:d,renderAll:h}=Or({isPartial:e.isPartial,rangeSize:i,expandedHunks:r,hunkIndex:s,collapsedContextThreshold:o});i>0&&(n+=h?i:l+d)}const l=Fr({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:o,errorPrefix:"VirtualizedFileDiff"});return null!=l&&(n+=l.fromStart+l.fromEnd),n}computeRenderRangeFromWindow(e,t,{top:n,bottom:i}){var o,r,l,s;const{disableFileHeader:a=!1,expandUnchanged:d=!1,collapsedContextThreshold:h=1}=this.options,{hunkLineCount:u,lineHeight:c}=this.metrics,f=this.getDiffStyle(),p=this.getHunkSeparatorType(),g=this.height;let m=this.cache.totalLines>0?this.cache.totalLines:this.getExpandedLineCount(e,f);const v=Ho(this.metrics,a),b=e.hunks.length>0?Po(this.metrics):0,{fileAnnotationHeight:S}=this.cache,y=v+S,x=Math.max(0,g-v-S-b),C=this.hasFileAnnotations(e),k=t+v,L=S>0&&C&&k<i&&k+S>n;if(t<n-g||t>i)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:g-v-b};if(m<=u||0===e.hunks.length)return{startingLine:0,totalLines:u,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(),m=this.cache.totalLines>0?this.cache.totalLines:m;const w=Math.ceil(Math.max(i-n,0)/c),T=Math.ceil(w/u)*u+u,E=T/u,I=E,A=[],R=(n+i)/2,M=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-T*c*2),u);let H,P,D,O=t+(null!=(o=null==M?void 0:M.top)?o:y),N=null!=(r=null==M?void 0:M.renderedLineIndex)?r:0;if($r({diff:e,diffStyle:f,startingLine:null!=(l=null==M?void 0:M.renderedLineIndex)?l:0,expandedHunks:!!d||this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:h,callback:({hunkIndex:e,hunk:o,collapsedBefore:r,collapsedAfter:l,deletionLine:s,additionLine:a})=>{var d,h,c,g,m,v;const b=null!=a?a.splitLineIndex:s.splitLineIndex,S=null!=a?a.unifiedLineIndex:s.unifiedLineIndex,x=null!=(d=null==a?void 0:a.noEOFCR)&&d||null!=(h=null==s?void 0:s.noEOFCR)&&h,C=null!=(g=null==(c=r>0?Br({type:p,metrics:this.metrics,hunkIndex:e,hunkSpecs:null==o?void 0:o.hunkSpecs}):void 0)?void 0:c.totalHeight)?g:0;O+=C;const k=N%u===0,L=Math.floor(N/u);if(k&&(A[L]=O-(t+y+C),null!=D)){if(D<=0)return!0;D--}const w=this.getLineHeight("split"===f?b:S,x);return O>n-w&&O<i&&(null!=H||(H=L)),null==P&&O+w>R&&(P=L),null==D&&O>=i&&k&&(D=I),N++,O+=w,l>0&&(O+=null!=(v=null==(m=jr({type:p,metrics:this.metrics}))?void 0:m.totalHeight)?v:0),!1}}),null==H){if(!L)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:g-v-b};H=0,P=0}null!=P||(P=H);const F=Math.round(P-E/2),z=Math.max(0,Math.ceil(m/u)-E),U=Math.max(0,Math.min(F,z)),B=U*u,j=F<0?T+F*u:T,$=null!=(s=A[U])?s:0,V=0===B?0:S+$,_=U+j/u,q=_<A.length?x-A[_]:x-(O-t-y);return{startingLine:B,totalLines:j,bufferBefore:V,bufferAfter:Math.max(0,q)}}};function ml({lineIndexes:e,prefixTotals:t},n,i){var o,r;if(n>=i||0===e.length)return 0;const l=vl(e,n);return(null!=(o=t[vl(e,i)])?o:0)-(null!=(r=t[l])?r:0)}function vl(e,t){let n=0,i=e.length;for(;n<i;){const o=n+i>>1,r=e[o];if(null==r)throw new Error("VirtualizedFileDiff: invalid prefix index");r<t?n=o+1:i=o}return n}function bl(e,t){let n=0;for(const i of e)i<t&&n++;return n}function Sl({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];const i=t.hunkContent.at(-1);if(null==i)return[];if("context"===i.type)return[n-1];const o=Math.max(i.deletions,i.additions),r=i.deletions+i.additions;if("split"===e)return o>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];const l=[],s=n-r;return i.deletions>0&&t.noEOFCRDeletions&&l.push(s+i.deletions-1),i.additions>0&&t.noEOFCRAdditions&&l.push(n-1),l}function yl(e,t){var n,i,o,r,l,s,a,d;return(null!=(n=e.disableFileHeader)&&n)!==(null!=(i=t.disableFileHeader)&&i)||(null!=(o=e.hunkSeparators)?o:"line-info")!==(null!=(r=t.hunkSeparators)?r:"line-info")||(null!=(l=e.expandUnchanged)&&l)!==(null!=(s=t.expandUnchanged)&&s)||(null!=(a=e.collapsedContextThreshold)?a:1)!==(null!=(d=t.collapsedContextThreshold)?d:1)}function xl(e,t){const[n,i]=e.split(",").map(Number);return"split"===t?i:n}function Cl(e){var t;const n=null!=(t=window.devicePixelRatio)?t:1;return Math.round(e*n)/n}const kl=["theme","disableLineNumbers","overflow","themeType","disableFileHeader","disableVirtualizationBuffers","preferredHighlighter","useCSSClasses","useTokenTransformer","tokenizeMaxLineLength","tokenizeMaxLength","unsafeCSS","diffStyle","diffIndicators","disableBackground","expandUnchanged","collapsedContextThreshold","lineDiffType","maxLineDiffLength","expansionLineCount","lineHoverHighlight","enableTokenInteractionsOnWhitespace","enableGutterUtility","__debugPointerEvents","enableLineSelection","controlledSelection","disableErrorHandling"],Ll=["theme","disableLineNumbers","overflow","themeType","disableFileHeader","disableVirtualizationBuffers","preferredHighlighter","useCSSClasses","useTokenTransformer","tokenizeMaxLineLength","tokenizeMaxLength","unsafeCSS","lineHoverHighlight","enableTokenInteractionsOnWhitespace","enableGutterUtility","__debugPointerEvents","enableLineSelection","controlledSelection","disableErrorHandling"],wl=["renderCustomHeader","renderHeaderPrefix","renderHeaderMetadata","renderAnnotation","renderGutterUtility","onPostRender","onGutterUtilityClick","onLineClick","onLineNumberClick","onLineEnter","onLineLeave","onTokenClick","onTokenEnter","onTokenLeave"],Tl=["onLineSelected","onLineSelectionStart","onLineSelectionChange","onLineSelectionEnd"],El=Symbol("CodeView.itemOptionsState");function Il(e,t){Object.defineProperty(e,El,{configurable:!1,enumerable:!1,value:t})}function Al(e){return e[El]}function Rl(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}const Ml="--diffs-overflow-override",Hl=11e6,Pl=(()=>{const{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),i="MacIntel"===e.platform&&e.maxTouchPoints>1;return(n||i)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})();var Dl=(o=class{constructor(e={theme:O},t,n=!1){S(this,"type","advanced"),S(this,"config",{overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1}),S(this,"items",[]),S(this,"idToItem",new Map),S(this,"selectedLines",null),S(this,"instanceToItem",new Map),S(this,"layoutDirtyIndex"),S(this,"pendingLayoutReset"),S(this,"renderOptionsRevision",0),S(this,"slotCoordinator"),S(this,"slotSnapshot"),S(this,"scrollListeners",new Set),S(this,"scrollHeight",0),S(this,"containerHeight",-1),S(this,"scrollTop",0),S(this,"scrollPageOffset",0),S(this,"scrollDirty",!0),S(this,"scrollInteractionFixTimer"),S(this,"pointerEventsDisabled",!1),S(this,"codeOverflowFix",!1),S(this,"height",0),S(this,"heightDirty",!0),S(this,"windowSpecs",{top:0,bottom:0}),S(this,"renderState",{scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1}),S(this,"itemMetricsCache",V),S(this,"fileOptionsPrototype"),S(this,"diffOptionsPrototype"),S(this,"pendingScrollTarget"),S(this,"pendingLayoutAnchor"),S(this,"shouldFixContainerFocus",!1),S(this,"scrollAnimation"),S(this,"root"),S(this,"resizeObserver"),S(this,"container",document.createElement("div")),S(this,"stickyContainer",document.createElement("div")),S(this,"stickyOffset",document.createElement("div")),S(this,"elementPool",[]),S(this,"elementPoolVersion",0),S(this,"elementPoolTracker",new WeakMap),S(this,"pendingElementPool",[]),S(this,"options"),S(this,"workerManager"),S(this,"isContainerManaged"),S(this,"restoreScrollInteractions",()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&(this.stickyContainer.style.removeProperty("pointer-events"),this.pointerEventsDisabled=!1),this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Ml,"auto"),this.codeOverflowFix=!1)}),S(this,"computeRenderRangeAndEmit",(e=performance.now())=>{if(o.__STOP||null==this.container)return;const t=this.getHeight(),n=this.getScrollTop();let i=n,r=null!=this.pendingLayoutAnchor,l=this.getScrollAnchor(i);if(null!=this.layoutDirtyIndex&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,r=!0),r&&null!=l){const e=this.resolveAnchoredScrollTop(l);if(null!=e){const t=e-i;i=e,null!=this.scrollAnimation&&(this.scrollAnimation.position+=t)}}r&&(i=this.clampScrollTop(i),this.syncContainerHeight());const s=this.computeTargetScrollTopForFrame(i,e),a=!r&&(-1===this.renderState.scrollTop||Math.abs(s-this.renderState.scrollTop)>t+2*this.config.overscrollSize);a&&(l=void 0),this.windowSpecs=re({scrollTop:s,height:t,scrollHeight:this.getScrollHeight(),fitPerfectly:a,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let d=n;(null!=this.pendingScrollTarget&&s!==d||this.needsScrollPageUpdate(s))&&(this.applyScrollFix(s,d,this.windowSpecs),d=s);const{top:h,bottom:u}=this.windowSpecs,{firstIndex:c,lastIndex:f}=this.renderState;if(c>=0)for(let o=c;o<=f;o++){const e=this.items[o];if(null==e)throw new Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${o}`);e.top>h-e.height&&e.top<=u||this.releaseRenderedItem(e)}let p;const g=new Set,m=this.findFirstVisibleIndex(h),v=this.findLastVisibleIndex(u);for(let o=m;o<=v;o++){const e=this.items[o];if(null==e)throw new Error("CodeView.computeRenderRangeAndEmit: missing item");const{instance:t}=e;null==e.element?(e.element=this.acquireElement(),jl(this.stickyContainer,e.element,p),t.virtualizedSetup(),Bl(e,e.element)&&(e.renderedOptionsRevision=this.renderOptionsRevision,g.add(e)),p=e.element):(jl(this.stickyContainer,e.element,p),Bl(e,void 0,e.renderedOptionsRevision!==this.renderOptionsRevision)&&(e.renderedOptionsRevision=this.renderOptionsRevision,g.add(e)),p=e.element)}this.renderState.firstIndex=m<=v?m:-1,this.renderState.lastIndex=v,this.flushSlotCoordinator(),this.reconcileRenderedItems(g),this.syncContainerHeight(),this.updateStickyPositioning();const b=null!=l?this.resolveAnchoredScrollTop(l):void 0;l===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);const S=null!=b?b-i:0;let y=s,x=!1;if(null!=this.pendingScrollTarget){const t=this.advanceScrollAnimation(e,S);null!=t?(y=t,x=!0):y=i}else y=null!=b?b:s;y!==d&&(this.applyScrollFix(y,d,this.windowSpecs),d=y),x&&null!=this.pendingScrollTarget&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=Cl(d),this.flushManagers(g),this.validateStickyContainerHeight(),this.fixContainerFocus(),(a||null!=this.scrollAnimation)&&this.render()}),S(this,"handleScroll",()=>{o.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())}),S(this,"clearPendingScroll",()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0}),S(this,"handleResize",e=>{for(const t of e)if(t.target===this.stickyContainer){if(t.borderBoxSize[0].blockSize!==this.renderState.stickyHeight){const e=this.getScrollTop(),t=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();const n=null!=t?this.resolveAnchoredScrollTop(t):void 0;if(null!=n){const t=n-e;this.applyScrollFix(n,e,this.windowSpecs),null!=this.scrollAnimation&&(this.scrollAnimation.position+=t)}null!=this.pendingScrollTarget&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0)}}else this.scrollDirty=!0,this.heightDirty=!0,this.render()}),this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isContainerManaged=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(){var e;return null!=(e=this.options.layout)?e:_}computeMetricsCache(e){var t,n,i,o;return this.itemMetricsCache={hunkLineCount:null!=(t=null==e?void 0:e.hunkLineCount)?t:V.hunkLineCount,lineHeight:null!=(n=null==e?void 0:e.lineHeight)?n:V.lineHeight,diffHeaderHeight:null!=(i=null==e?void 0:e.diffHeaderHeight)?i:V.diffHeaderHeight,hunkSeparatorHeight:null==e?void 0:e.hunkSeparatorHeight,spacing:null!=(o=null==e?void 0:e.spacing)?o:V.spacing,paddingTop:null==e?void 0:e.paddingTop,paddingBottom:null==e?void 0:e.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){var e;return null!=(e=this.options.smoothScrollSettings)?e:q}shouldDisablePointerEvents(){return!0!==this.options.pointerEventsOnScroll}shouldValidateItemHeights(){return k&&!0===this.options.__devOnlyValidateItemHeights}validateRenderedItemHeight(e){if(!this.shouldValidateItemHeights()||null==e.element)return;const t=e.instance.getAdvancedStickySpecs();if(null==t)return;const n=t.height,i=e.element.getBoundingClientRect().height;n!==i&&console.error("CodeView: reconciled item height does not match DOM height",{id:e.item.id,type:e.type,index:e.index,version:e.version,expectedHeight:n,actualHeight:i,delta:i-n,stickyTopOffset:t.topOffset,virtualizedHeight:e.instance.getVirtualizedHeight(),top:e.top,scrollTop:this.getScrollTop(),windowSpecs:m({},this.windowSpecs),element:e.element,instance:e.instance})}validateStickyContainerHeight(){var e,t;if(!this.shouldValidateItemHeights())return;const{firstIndex:n,lastIndex:i,stickyHeight:o,stickyTop:r,stickyBottom:l}=this.renderState;if(-1===n||-1===i)return;const s=this.stickyContainer.getBoundingClientRect().height;Math.abs(s-o)<1||console.error("CodeView: sticky container height does not match computed layout",{computedStickyHeight:o,actualStickyHeight:s,delta:s-o,stickyTop:r,stickyBottom:l,firstIndex:n,lastIndex:i,firstStickySpecs:null==(e=this.items[n])?void 0:e.instance.getAdvancedStickySpecs(),lastStickySpecs:null==(t=this.items[i])?void 0:t.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:m({},this.windowSpecs),stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){null!=this.scrollInteractionFixTimer&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents="none",this.pointerEventsDisabled=!0),Pl&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Ml,"hidden"),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,120)}syncLayout(){var e,t;const{gap:n,paddingBottom:i,paddingTop:o}=this.getLayout();this.stickyContainer.style.gap=`${n}px`,null==(e=this.container)||e.style.setProperty("margin-top",`${o}px`),null==(t=this.container)||t.style.setProperty("margin-bottom",`${i}px`)}setup(e){var t;if(null!=this.root)throw new Error("CodeView.setup: already setup");null==(t=this.workerManager)||t.subscribeToThemeChanges(this),this.root=e,this.root.style.overflowAnchor="none",this.root.hasAttribute("tabindex")||(this.root.tabIndex=-1),null!=this.container||(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.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{o.__STOP?(o.__STOP=!1,this.scrollTo({type:"position",position:o.__lastScrollPosition,behavior:"instant"})):(o.__lastScrollPosition=this.getScrollTop(),o.__STOP=!0)}}reset(){var e;this.restoreScrollInteractions(),this.cleanAllRenderedItems(),this.selectedLines=null,this.items.length=0,this.idToItem.clear(),this.instanceToItem.clear(),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent="",this.stickyOffset.style.height="",null==(e=this.container)||e.style.removeProperty("height"),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator()}cleanUp(){var e,t,n,i,o,r,l,s,a;this.reset(),this.clearElementPool(),this.restoreScrollInteractions(),null==(e=this.workerManager)||e.unsubscribeToThemeChanges(this),null==(t=this.resizeObserver)||t.disconnect(),this.resizeObserver=void 0,null==(n=this.root)||n.removeEventListener("scroll",this.handleScroll),null==(i=this.root)||i.removeEventListener("wheel",this.clearPendingScroll),null==(o=this.root)||o.removeEventListener("touchstart",this.clearPendingScroll),null==(r=this.root)||r.removeEventListener("pointerdown",this.clearPendingScroll),null==(l=this.root)||l.removeEventListener("keydown",this.clearPendingScroll),null==(s=this.root)||s.style.removeProperty("overflow-anchor"),null==(a=this.container)||a.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent="",this.root=void 0,this.container=void 0}cleanAllRenderedItems(){if(-1!==this.renderState.firstIndex)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){const t=this.items[e];if(null==t)throw new Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){if("position"===e.type)return;const t=this.idToItem.get(e.id);null!=t&&t.instance.primeHighlightCache()}getElementPoolLimit(){const e=this.getHeight()+2*this.config.overscrollSize,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;null!=e&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return null!=e||(e=document.createElement(C)),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){const{element:t}=e;null!=t&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0),e.instance.cleanUp(!0),e.element=void 0,null!=t&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){var t;const{activeElement:n}=document;return n===e||e.contains(n)||null!=(null==(t=e.shadowRoot)?void 0:t.activeElement)}fixContainerFocus(){var e;this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,null==(e=this.root)||e.focus({preventScroll:!0}))}cleanElement(e){const{shadowRoot:t}=e;if(null!=t)for(const n of Array.from(t.children))Fl(n)||n.remove();this.isContainerManaged||e.replaceChildren()}queueElementForPool(e){const t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(0===this.pendingElementPool.length)return;const{pendingElementPool:e}=this;this.pendingElementPool=[];const t=this.getElementPoolLimit();for(const 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 0===e.childNodes.length}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){var n;return le()?"instant":"smooth-auto"!==e.behavior?null!=(n=e.behavior)?n:"instant":Math.abs(t-this.getScrollTop())<=10*this.getHeight()?"smooth":"instant"}scrollTo(e){if(null==this.root)return;const t=this.normalizeScrollTarget(e);if(null==t)return;const n=this.resolveScrollTargetTop(t);null!=n&&(this.primeScrollTarget(t),"smooth"===this.resolveEffectiveScrollBehavior(t,n)?null!=this.scrollAnimation||(this.scrollAnimation={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}):this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=t,this.render())}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}getItem(e){var t;return null==(t=this.idToItem.get(e))?void 0:t.item}updateItem(e){const t=this.idToItem.get(e.id);return null==t?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):!!this.syncItemRecord(t,e)&&(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncSelection(),!0)}updateItemId(e,t){var n,i,o;if(e===t)return!0;const r=this.idToItem.get(e);return null==r?(console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1):this.idToItem.has(t)?(console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1):(this.idToItem.delete(e),r.item.id=t,this.idToItem.set(t,r),this.updateItemOptionsId(r.instance.options,t),(null==(n=this.selectedLines)?void 0:n.id)===e&&(this.selectedLines=v(m({},this.selectedLines),{id:t}),null==(o=(i=this.options).onSelectedLinesChange)||o.call(i,this.selectedLines)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.render(),!0)}addItem(e){this.addItems([e]),this.syncSelection()}addItems(e){this.appendItemsInternal(e),this.syncSelection()}setItems(e){0===e.length?this.reset():0===this.items.length?this.appendItemsInternal(e):this.tryAppendItems(e)||this.reconcileItems(e),this.syncSelection()}appendItemsInternal(e,t=!0){if(0===e.length)return;const n=this.getLayout();let i=0===this.items.length?0:this.scrollHeight+n.gap;const o=i;for(let r=0;r<e.length;r++){const t=e[r];if(null==t)throw new Error("CodeView.appendItemsInternal: missing input item");if(this.idToItem.has(t.id))throw new Error(`CodeView.addItem: duplicate id "${t.id}"`);const o=this.createItem(t,this.items.length,i);this.items.push(o),this.idToItem.set(o.item.id,o),this.instanceToItem.set(o.instance,o),o.height=Ol(o),i+=o.height+n.gap}this.scrollHeight=i-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(o)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return null!=this.container&&-1!==this.renderState.firstIndex&&null==this.pendingScrollTarget&&null==this.scrollAnimation&&null==this.layoutDirtyIndex&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(e){if(null==e)return;this.capturePendingLayoutAnchor();const{options:t}=this,n=this.getLayout(),{itemMetricsCache:i}=this;var o,r,l,s,a,d;r=e,te(null!=(l=(o=t).theme)?l:O,null!=(s=r.theme)?s:O)&&(null!=(a=o.themeType)?a:"system")===(null!=(d=r.themeType)?d:"system")&&o.unsafeCSS===r.unsafeCSS||this.invalidateElementPool(),this.options=e;const h=this.computeMetricsCache(e.itemMetrics),u=!ee(i,h),c=!ee(n,this.getLayout());c&&this.syncLayout();const f=u||function(e,t){var n,i,o,r,l,s,a,d,h,u,c,f,p,g,m,v;return(null!=(n=e.overflow)?n:"scroll")!==(null!=(i=t.overflow)?i:"scroll")||(null!=(o=e.disableLineNumbers)&&o)!==(null!=(r=t.disableLineNumbers)&&r)||(null!=(l=e.disableFileHeader)&&l)!==(null!=(s=t.disableFileHeader)&&s)||e.unsafeCSS!==t.unsafeCSS||(null!=(a=e.diffStyle)?a:"split")!==(null!=(d=t.diffStyle)?d:"split")||(null!=(h=e.diffIndicators)?h:"bars")!==(null!=(u=t.diffIndicators)?u:"bars")||(null!=(c=e.hunkSeparators)?c:"line-info")!==(null!=(f=t.hunkSeparators)?f:"line-info")||(null!=(p=e.expandUnchanged)&&p)!==(null!=(g=t.expandUnchanged)&&g)||(null!=(m=e.collapsedContextThreshold)?m:1)!==(null!=(v=t.collapsedContextThreshold)?v:1)}(t,e);if(f){const n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:u?h:null==n?void 0:n.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:!0===(null==n?void 0:n.includeEstimatedDiffHeights)||u||Nl(t,e)}}(c||f)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),ne(t,e)||this.renderOptionsRevision++,!this.isContainerManaged&&this.items.length>0&&this.render()}capturePendingLayoutAnchor(){null!=this.root&&0!==this.items.length&&null==this.pendingScrollTarget&&(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop()))}render(e=!1){o.__STOP||(e?(Z(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):J(this.computeRenderRangeAndEmit))}instanceChanged(e,t){const n=this.instanceToItem.get(e);if(null==n)throw new Error("CodeView.instanceChanged: An instance has changed that is not registered");t&&this.markItemLayoutDirty(n),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getRenderedItems(){const{firstIndex:e,lastIndex:t}=this.renderState;if(-1===e||-1===t||t<e)return[];const n=[];for(let i=e;i<=t;i++){const e=this.items[i];null!=(null==e?void 0:e.element)&&("diff"===e.type?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 Vl(this.getRenderedItems(),e)}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){const t=this.instanceToItem.get(e);if(null==t)throw new Error("CodeView.getLocalTopForInstance: unknown virtualized instance");return t.top}getTopForItem(e){const t=this.idToItem.get(e);if(null!=t)return t.top+this.getLayout().paddingTop}createItem(e,t,n){const{itemMetricsCache:i}=this;if("diff"===e.type){const o=new gl(this.createDiffOptions(e.id),this,i,this.workerManager,this.isContainerManaged);return{type:"diff",item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:o}}const o=new Oo(this.createFileOptions(e.id),this,i,this.workerManager,this.isContainerManaged);return{type:"file",item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:o}}applySelectedLines(e,t){var n,i,o,r;const{selectedLines:l}=this;null==e&&null==l||null!=e&&(null==l?void 0:l.id)===e.id&&oe(l.range,e.range)||(null!=l&&l.id!==(null==e?void 0:e.id)&&(null==(n=this.idToItem.get(l.id))||n.instance.setSelectedLines(null,{notify:!1})),this.selectedLines=e,null==(r=this.idToItem.get(null!=(i=null==e?void 0:e.id)?i:""))||r.instance.setSelectedLines(null!=(o=null==e?void 0:e.range)?o:null,t))}syncSelection(){if(null==this.selectedLines)return;const e=this.idToItem.get(this.selectedLines.id);null!=e?e.instance.setSelectedLines(this.selectedLines.range,{notify:!1}):this.selectedLines=null}renamePendingScrollTarget(e,t){const{pendingScrollTarget:n}=this;null!=n&&"position"!==n.type&&n.id===e&&(this.pendingScrollTarget=v(m({},n),{id:t}))}renamePendingLayoutAnchor(e,t){var n;(null==(n=this.pendingLayoutAnchor)?void 0:n.id)===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){const e={};for(const t of Ll)Rl(e,t,()=>this.options[t]);Rl(e,"stickyHeader",()=>this.options.stickyHeaders),Rl(e,"collapsed",e=>{var t;return!0===(null==(t=this.getItemOptions(Al(e),"file"))?void 0:t.item.collapsed)});for(const t of wl)this.defineItemSharedCallback(e,"file",t);for(const t of Tl)this.defineItemSelectionCallback(e,"file",t);return e}createDiffOptionsPrototype(){const e={};for(const t of kl)Rl(e,t,()=>this.options[t]);Rl(e,"stickyHeader",()=>this.options.stickyHeaders),Rl(e,"hunkSeparators",()=>this.options.hunkSeparators),Rl(e,"collapsed",e=>{var t;return!0===(null==(t=this.getItemOptions(Al(e),"diff"))?void 0:t.item.collapsed)});for(const t of wl)this.defineItemSharedCallback(e,"diff",t);for(const t of Tl)this.defineItemSelectionCallback(e,"diff",t);return e}createFileOptions(e){const t=Object.create(this.fileOptionsPrototype);return Il(t,{id:e}),t}createDiffOptions(e){const t=Object.create(this.diffOptionsPrototype);return Il(t,{id:e}),t}updateItemOptionsId(e,t){Al(e).id=t}getItemOptions(e,t){const n=this.idToItem.get(e.id);if(null!=n&&n.type===t)return n}defineItemSharedCallback(e,t,n){Rl(e,n,e=>{var i;if(null==this.options[n])return;const o=Al(e),r=null!=(i=o.callbackCache)?i:o.callbackCache={};let l=r[n];return null==l&&(l=(...e)=>{const i=this.getItemOptions(o,t);if(null==i)return;const r=this.options[n];return null==r?void 0:r(...e,i)},r[n]=l),l})}defineItemSelectionCallback(e,t,n){Rl(e,n,e=>{var i;if(!0!==this.options.enableLineSelection)return;const o=Al(e),r=null!=(i=o.callbackCache)?i:o.callbackCache={};let l=r[n];return null==l&&(l=e=>{var i,r,l;const s=this.getItemOptions(o,t);if(null==s)return;const a=null==e?null:{id:s.item.id,range:e};!0!==this.options.controlledSelection&&(null==e&&(null==(i=this.selectedLines)?void 0:i.id)!==s.item.id||this.applySelectedLines(a,{notify:!1})),null==(l=(r=this.options).onSelectedLinesChange)||l.call(r,a);const d=this.options[n];return null==d?void 0:d(e,s)},r[n]=l),l})}markLayoutDirtyFromIndex(e){var t;this.layoutDirtyIndex=Math.min(null!=(t=this.layoutDirtyIndex)?t:e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw new 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++){const n=this.items[t];if(null==n)throw new Error("CodeView.tryAppendItems: missing existing item");const i=e[t];if(null==i||n.item.id!==i.id||n.type!==i.type)return!1}for(let t=0;t<this.items.length;t++){const n=this.items[t];if(null==n)throw new Error("CodeView.tryAppendItems: missing existing item");const i=e[t];if(null==i)throw new Error("CodeView.tryAppendItems: append candidate missing prefix item");this.syncItemRecord(n,i)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){const{items:t,idToItem:n}=this,i=new Set(t),o=[],r=new Map,l=new Map;let s;for(let a=0;a<e.length;a++){const d=e[a];if(null==d)throw new Error("CodeView.reconcileItems: missing input item");if(r.has(d.id))throw new Error(`CodeView.setItems: duplicate id "${d.id}"`);const h=n.get(d.id),u=null!=h&&h.type===d.type?h:this.createItem(d,a,0);u.index=a,null!=h&&h.type===d.type?(i.delete(h),this.syncItemRecord(u,d)&&(s=Math.min(null!=s?s:a,a))):s=Math.min(null!=s?s:a,a),t[a]!==u&&(s=Math.min(null!=s?s:a,a)),o.push(u),r.set(d.id,u),l.set(u.instance,u)}for(let a=0;a<t.length;a++){const e=t[a];if(null==e||!i.has(e))continue;this.releaseRenderedItem(e);const n=Math.max(o.length-1,0);s=Math.min(null!=s?s:n,n)}null!=s&&(this.items=o,this.idToItem=r,this.instanceToItem=l,this.renderState.firstIndex>=o.length?this.resetRenderState():this.renderState.lastIndex>=o.length&&(this.renderState.lastIndex=o.length-1),this.markLayoutDirtyFromIndex(s),this.scrollDirty=!0,this.render())}syncItemRecord(e,t){if(e.type!==t.type)throw new 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){const{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+e+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>Hl}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),12e6):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){const t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){const t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){const t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=Cl(this.clampPagedScrollTop(t)),i=this.clampScrollPageOffset(e-n);return n=Cl(this.clampPagedScrollTop(e-i)),i=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:i}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};const t=this.clampScrollPageOffset(this.scrollPageOffset),n=e-t,i=this.getMaxPagedScrollTop(),o=this.getMaxScrollPageOffset(),r=n<1e6&&t>0;return n<0||n>i||n>Hl&&t<o||r?this.resolveScrollPageWindow(e,r?Math.min(1e7,i):2e6):{pagedScrollTop:Cl(this.clampPagedScrollTop(n)),scrollPageOffset:t}}needsScrollPageUpdate(e){const t=Cl(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!0===this.options.stickyHeaders&&!0!==this.options.disableFileHeader?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){const t=this.idToItem.get(e.id);if(null==t)return void console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);if("item"===e.type)return{top:t.top,height:t.height};if("range"===e.type){const n=this.getRangeScrollPosition(t,e);return null==n?void console.warn(`CodeView.scrollTo: unable to resolve range ${zl(e.range)} for item "${e.id}"`):{top:t.top+n.top,height:n.height}}const n=this.getLineScrollPosition(t,e);if(null!=n)return{top:t.top+n.top,height:n.height};console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`)}normalizeScrollTarget(e){var t;if("position"===e.type||"nearest"!==e.align)return e;const n=this.getScrollTargetRect(e);if(null==n)return;const i=null!=(t=e.offset)?t:0,o=this.getLayout().paddingTop+n.top,r=o+n.height,l=this.getScrollTop(),s=l+("line"===e.type||"range"===e.type?this.getStickyHeaderOffset():0),a=l+this.getHeight();return o-i<=s&&r+i>=a?void 0:o-i<s?v(m({},e),{align:"start"}):r+i>a?v(m({},e),{align:"end"}):void 0}resolveScrollTargetTop(e){if("position"===e.type){const t=this.clampScrollTop(e.position);return t!==e.position?t:this.clampScrollTop(e.position-this.getStickyHeaderOffset())}const t=this.idToItem.get(e.id);if(null==t)return void console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);if("item"===e.type)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if("range"===e.type){const n=this.getRangeScrollPosition(t,e);return null==n?void console.warn(`CodeView.scrollTo: unable to resolve range ${zl(e.range)} for item "${e.id}"`):this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}const n=this.getLineScrollPosition(t,e);if(null!=n)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()));console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`)}resolveAlignedScrollPosition(e,t,n,i=0,o=0){e+=this.getLayout().paddingTop;const r=this.getHeight();return"center"===n&&t+i<r?e-(r-t)/2+i:"end"===n?e-(r-t)+i:e-o-i}getLineScrollPosition(e,t){return"diff"===e.type?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){var n;const{range:i}=t,o=this.getLineScrollPosition(e,{type:"line",id:t.id,lineNumber:i.start,side:i.side}),r=this.getLineScrollPosition(e,{type:"line",id:t.id,lineNumber:i.end,side:null!=(n=i.endSide)?n:i.side});if(null==o||null==r)return;const l=o.top,s=l+o.height,a=r.top,d=a+r.height,h=Math.min(l,a);return{top:h,height:Math.max(s,d)-h}}computeTargetScrollTopForFrame(e,t){if(null==this.pendingScrollTarget)return e;const n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(null==n)return e;const{scrollAnimation:i}=this;return null==i?n:this.computeSpringStep(i,n,t).position}computeSpringStep(e,t,n){const i=Math.max(0,n-e.lastTimestamp),{omega:o}=this.getSmoothScrollSettings(),r=Math.exp(-o*i),l=e.position-t,s=e.velocity+o*l;return{position:t+(l+s*i)*r,velocity:(s*(1-o*i)-o*l)*r}}advanceScrollAnimation(e,t){if(null==this.pendingScrollTarget)return;const n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(null==n)return this.pendingScrollTarget=void 0,void(this.scrollAnimation=void 0);const i=this.scrollAnimation;if(null==i)return n;i.position+=t;const{position:o,velocity:r}=this.computeSpringStep(i,n,e);i.lastTimestamp=e,i.position=o,i.velocity=r;const{positionEpsilon:l,velocityEpsilon:s}=this.getSmoothScrollSettings();return Math.abs(n-o)<=l&&Math.abs(r)<=s?(i.position=n,i.velocity=0,this.scrollAnimation=void 0,n):i.position}flushManagers(e){for(const t of e)t.instance.flushManagers()}syncContainerHeight(){const e=this.getPagedScrollHeight();null!=this.container&&this.containerHeight!==e&&(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){var t,n;const{firstIndex:i,lastIndex:o}=null!=e?{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)}:this.renderState;if(-1===i||-1===o||i>o)return;const r=null==(t=this.items[i])?void 0:t.instance.getAdvancedStickySpecs(e),l=null==(n=this.items[o])?void 0:n.instance.getAdvancedStickySpecs(e);return null!=r&&null!=l?{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(l.topOffset+l.height)}:void 0}applyStickyPositioning({stickyTop:e,stickyBottom:t}){const n=this.getHeight(),{itemMetricsCache:i}=this,o=t-e;this.renderState.stickyHeight=o,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;const r=-1*(Math.random()*i.lineHeight|0),l=-Math.max(o+r,0)+n;this.stickyContainer.style.top=`${l}px`,this.stickyContainer.style.bottom=`${l+i.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();const t=this.getStickyBounds(e);null!=t&&this.applyStickyPositioning(t)}reconcileRenderedItems(e){const{firstIndex:t,lastIndex:n}=this.renderState;if(-1===t)return;let i=-1,o=!1;for(let r=t;r<this.items.length&&(o||!(r>n));r++){const t=this.items[r];if(null==t)throw new Error("CodeView.reconcileRenderedItems: Invalid item");-1===i?i=t.top:t.top!==i&&(t.top=i,t.instance.syncVirtualizedTop(),o=!0),(null==e?r<=n:e.has(t))&&(t.instance.reconcileHeights()&&(o=!0,t.height=t.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(t)),i+=t.instance.getVirtualizedHeight(),r<this.items.length-1&&(i+=this.getLayout().gap)}o&&null!=i&&(this.scrollDirty=!0,this.scrollHeight=i)}updateStickyPositioning(){const e=this.getStickyBounds();if(null==e)return;const{stickyTop:t,stickyBottom:n}=e;n-t===this.renderState.stickyHeight&&t===this.renderState.stickyTop&&n===this.renderState.stickyBottom||this.applyStickyPositioning(e)}getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e){if(null!=this.pendingLayoutAnchor)return this.pendingLayoutAnchor;const{firstIndex:t,lastIndex:n,stickyTop:i,stickyBottom:o}=this.renderState;if(-1===t||-1===n)return;const r=this.getHeight();if(-1!==i&&-1!==o)for(let l=t;l<=n;l++){const t=this.items[l];if(null==t)continue;const n=this.getLayout().paddingTop+t.top;if(n+t.height<=e)continue;if(n>=e+r)break;if(n>=e)return{type:"item",id:t.item.id,viewportOffset:n-e};const i=this.getScrollAnchorViewportTop(n,e)-n,o=t.instance.getNumericScrollAnchor(i);if(null!=o){const i=n+o.top;return{type:"line",id:t.item.id,lineNumber:o.lineNumber,side:o.side,viewportOffset:i-e}}}}resolveAnchoredScrollTop(e){const t=this.idToItem.get(e.id);if(null==t)return;const{paddingTop:n}=this.getLayout();if("item"===e.type){const i=n+t.top;return this.clampScrollTop(i-e.viewportOffset)}const i="diff"===t.type?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(null==i)return;const o=n+t.top+i.top;return this.clampScrollTop(o-e.viewportOffset)}applyScrollFix(e,t,n){if(null==this.root)return;const i=Cl(this.clampScrollTop(e)),o=Cl(t),{scrollPageOffset:r}=this,l=Cl(this.clampPagedScrollTop(o-r)),{pagedScrollTop:s,scrollPageOffset:a}=this.resolvePagedScrollPosition(i),d=s,h=r!==a;(i!==this.renderState.scrollTop||i!==o||d!==l||h)&&(this.suspendScrollInteractions(),(d!==l||h)&&(this.scrollPageOffset=a,this.syncPagedScrollScaffolding(n)),d!==l&&this.root.scrollTo({top:d,behavior:"instant"}),this.renderState.scrollTop=i,this.scrollTop=i,this.scrollDirty=!1)}isPendingTargetSettled(e){const t=this.resolveScrollTargetTop(e);return null==t||Cl(this.getScrollTop())===Cl(t)}getScrollTop(){var e,t;if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;const n=null!=(t=null==(e=this.root)?void 0:e.scrollTop)?t:0;return this.scrollTop=this.clampScrollTop(n+this.scrollPageOffset),this.scrollTop}getHeight(){var e,t;return this.heightDirty?(this.heightDirty=!1,this.height=null!=(t=null==(e=this.root)?void 0:e.getBoundingClientRect().height)?t:0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(null==this.slotCoordinator)return;const{onSnapshotChange:e}=this.slotCoordinator,t=Vl(this.getRenderedItems(),this.slotCoordinator);(function(e,t){if(null==e||null==t)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const i=e[n],o=t[n];if(null==i||null==o||i.id!==o.id||i.type!==o.type||i.element!==o.element||i.version!==o.version)return!1}return!0})(this.slotSnapshot,t)||(this.slotSnapshot=t,e(t))}notifyScroll(){if(0===this.scrollListeners.size)return;const e=this.getScrollTop();for(const t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,i=this.items.length;for(;t<=n;){const o=t+n>>1,r=this.items[o];if(null==r)throw new Error("CodeView.findFirstVisibleIndex: invalid item index");r.top+r.height>e?(i=o,n=o-1):t=o+1}return i}findLastVisibleIndex(e){let t=0,n=this.items.length-1,i=-1;for(;t<=n;){const o=t+n>>1,r=this.items[o];if(null==r)throw new Error("CodeView.findLastVisibleIndex: invalid item index");r.top<=e?(i=o,t=o+1):n=o-1}return i}recomputeLayout(e=0,t){var n,i;if(0===this.items.length)return void(this.scrollHeight=0);const o=this.getLayout();let r=0;if(e>0){const t=this.items[e-1];if(null==t)throw new Error("CodeView.recomputeLayout: invalid dirty index");r=t.top+t.height+o.gap}for(let l=e;l<this.items.length;l++){const e=this.items[l];if(null==e)throw new Error("CodeView.recomputeLayout: invalid item index");e.top=r,"diff"===e.type?e.height=e.instance.prepareCodeViewItem(e.item.fileDiff,r,t,null!=(n=e.item.annotations)?n:[]):e.height=e.instance.prepareCodeViewItem(e.item.file,r,t,null!=(i=e.item.annotations)?i:[]),r+=e.height,l<this.items.length-1&&(r+=o.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}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}},S(o,"__STOP",!1),S(o,"__lastScrollPosition",0),o);function Ol(e){var t,n;return e.instance.cleanUp(!0),"diff"===e.type?e.instance.prepareCodeViewItem(e.item.fileDiff,e.top,void 0,null!=(t=e.item.annotations)?t:[]):e.instance.prepareCodeViewItem(e.item.file,e.top,void 0,null!=(n=e.item.annotations)?n:[])}function Nl(e,t){var n,i,o,r,l,s,a,d;return(null!=(n=e.disableFileHeader)&&n)!==(null!=(i=t.disableFileHeader)&&i)||(null!=(o=e.hunkSeparators)?o:"line-info")!==(null!=(r=t.hunkSeparators)?r:"line-info")||(null!=(l=e.expandUnchanged)&&l)!==(null!=(s=t.expandUnchanged)&&s)||(null!=(a=e.collapsedContextThreshold)?a:1)!==(null!=(d=t.collapsedContextThreshold)?d:1)}function Fl(e){return e instanceof SVGElement||wo(e)&&(e.hasAttribute("data-core-css")||e.hasAttribute("data-theme-css")||e.hasAttribute("data-unsafe-css"))}function zl(e){var t;const n=Ul(e.start,e.side),i=Ul(e.end,null!=(t=e.endSide)?t:e.side);return n===i?n:`${n}-${i}`}function Ul(e,t){return null==t?`${e}`:`${"deletions"===t?"D":"A"}${e}`}function Bl(e,t,n=!1){var i,o;return"diff"===e.type?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:null!=(i=e.item.annotations)?i:[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:null!=(o=e.item.annotations)?o:[]})}function jl(e,t,n){null!=n?n.nextSibling!==t&&n.after(t):e.firstChild!==t&&e.prepend(t)}function $l(e){var t,n;return(null!=(n=null==(t=e.annotations)?void 0:t.length)?n:0)>0}function Vl(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:i}){if(0===e.length)return;if(t||i)return e;if(!n)return;const o=[];for(const r of e)$l(r.item)&&o.push(r);return o.length>0?o:void 0}var _l=class e{constructor(e){S(this,"options"),S(this,"tokensStable",[]),S(this,"tokensUnstable",[]),S(this,"lastUnstableCodeChunk",""),S(this,"lastStableGrammarState"),this.options=e}enqueue(e){return y(this,null,function*(){const t=(this.lastUnstableCodeChunk+e).split("\n"),n=[];let i=[];const o=this.tokensUnstable.length;return t.forEach((e,o)=>{const r=o===t.length-1,l=this.options.highlighter.codeToTokens(e,v(m({},this.options),{grammarState:this.lastStableGrammarState})),s=l.tokens[0];r||s.push({content:"\n",offset:0}),r?(i=s,this.lastUnstableCodeChunk=e):(this.lastStableGrammarState=l.grammarState,n.push(...s))}),this.tokensStable.push(...n),this.tokensUnstable=i,{recall:o,stable:n,unstable:i}})}close(){const e=this.tokensUnstable;return this.tokensUnstable=[],this.lastUnstableCodeChunk="",this.lastStableGrammarState=void 0,{stable:e}}clear(){this.tokensStable=[],this.tokensUnstable=[],this.lastUnstableCodeChunk="",this.lastStableGrammarState=void 0}clone(){const t=new e(this.options);return t.lastUnstableCodeChunk=this.lastUnstableCodeChunk,t.tokensUnstable=this.tokensUnstable,t.tokensStable=this.tokensStable,t.lastStableGrammarState=this.lastStableGrammarState,t}},ql=class extends TransformStream{constructor(e){const t=new _l(e),{allowRecalls:n=!1}=e;super({transform(e,i){return y(this,null,function*(){const{stable:o,unstable:r,recall:l}=yield t.enqueue(e);n&&l>0&&i.enqueue({recall:l});for(const e of o)i.enqueue(e);if(n)for(const e of r)i.enqueue(e)})},flush(e){return y(this,null,function*(){const{stable:i}=t.close();if(!n)for(const t of i)e.enqueue(t)})}}),S(this,"tokenizer"),S(this,"options"),this.tokenizer=t,this.options=e}};function Wl(e){var t;const n=document.createElement("span");return n.style=x.stringifyTokenStyle(null!=(t=e.htmlStyle)?t:x.getTokenStyleObject(e)),n.textContent=e.content,n}let Gl=-1;function Kl(e,t){const{resolution:n,hunkIndex:i,startContentIndex:o,endContentIndex:r,indexesToDelete:l=new Set}=t,s=e.hunks[i];if(null==s)throw console.error({diff:e,hunkIndex:i}),new Error(`resolveRegion: Invalid hunk index: ${i}`);if(o<0||r>=s.hunkContent.length||o>r)throw new Error(`resolveRegion: Invalid content range, ${o}, ${r}`);const{hunks:a,additionLines:d,deletionLines:h}=e,u=v(m({},e),{hunks:[],deletionLines:[],additionLines:[],splitLineCount:0,unifiedLineCount:0,cacheKey:null!=e.cacheKey?`${e.cacheKey}:${n[0]}-${i}:${o}-${r}`:void 0}),c={nextAdditionLineIndex:0,nextDeletionLineIndex:0,nextAdditionStart:1,nextDeletionStart:1,splitLineCount:0,unifiedLineCount:0},f=i===a.length-1&&r===s.hunkContent.length-1,p=!e.isPartial;for(const[b,S]of a.entries()){Yl(e,u,c,S.deletionLineIndex-S.collapsedBefore,S.additionLineIndex-S.collapsedBefore,S.collapsedBefore,p);const t=v(m({},S),{hunkContent:[],additionStart:c.nextAdditionStart,deletionStart:c.nextDeletionStart,additionLineIndex:c.nextAdditionLineIndex,deletionLineIndex:c.nextDeletionLineIndex,additionCount:0,deletionCount:0,deletionLines:0,additionLines:0,splitLineStart:c.splitLineCount,unifiedLineStart:c.unifiedLineCount,splitLineCount:0,unifiedLineCount:0});for(const[e,s]of S.hunkContent.entries())if(b!==i||e<o||e>r){Jl(s,u,h,d);const e=v(m({},s),{additionLineIndex:c.nextAdditionLineIndex,deletionLineIndex:c.nextDeletionLineIndex});t.hunkContent.push(e),Ql(e,c,t)}else if(l.has(e))t.hunkContent.push({type:"context",lines:0,deletionLineIndex:c.nextDeletionLineIndex,additionLineIndex:c.nextAdditionLineIndex});else if("context"===s.type){Jl(s,u,h,d);const e=v(m({},s),{deletionLineIndex:c.nextDeletionLineIndex,additionLineIndex:c.nextAdditionLineIndex});t.hunkContent.push(e),Ql(e,c,t)}else{Zl(n,s,u,h,d);const e={type:"context",lines:"deletions"===n?s.deletions:"additions"===n?s.additions:s.deletions+s.additions,deletionLineIndex:c.nextDeletionLineIndex,additionLineIndex:c.nextAdditionLineIndex};t.hunkContent.push(e),Ql(e,c,t)}if(b===i&&f){const e="deletions"===n?S.noEOFCRDeletions:S.noEOFCRAdditions;t.noEOFCRAdditions=e,t.noEOFCRDeletions=e}u.hunks.push(t)}const g=a.at(-1);return null==g||e.isPartial||Xl(u,h,d,g.deletionLineIndex+g.deletionCount,g.additionLineIndex+g.additionCount,Math.min(h.length-(g.deletionLineIndex+g.deletionCount),d.length-(g.additionLineIndex+g.additionCount))),u.splitLineCount=c.splitLineCount,u.unifiedLineCount=c.unifiedLineCount,u}function Xl(e,t,n,i,o,r){for(let l=0;l<r;l++){const r=t[i+l],s=n[o+l];if(null==r||null==s)throw new Error("pushCollapsedContextLines: missing collapsed context line");e.deletionLines.push(r),e.additionLines.push(s)}}function Yl(e,t,n,i,o,r,l){r<=0||(l&&(Xl(t,e.deletionLines,e.additionLines,i,o,r),n.nextAdditionLineIndex+=r,n.nextDeletionLineIndex+=r),n.nextAdditionStart+=r,n.nextDeletionStart+=r,n.splitLineCount+=r,n.unifiedLineCount+=r)}function Jl(e,t,n,i){if("context"===e.type)for(let o=0;o<e.lines;o++){const n=i[e.additionLineIndex+o];if(null==n)throw console.error({additionLines:i,content:e,i:o}),new Error("pushContentLinesToDiff: Context line does not exist");t.deletionLines.push(n),t.additionLines.push(n)}else{const o=Math.max(e.deletions,e.additions);for(let r=0;r<o;r++){if(r<e.deletions){const i=n[e.deletionLineIndex+r];if(null==i)throw console.error({deletionLines:n,content:e,i:r}),new Error("pushContentLinesToDiff: Deletion line does not exist");t.deletionLines.push(i)}if(r<e.additions){const n=i[e.additionLineIndex+r];if(null==n)throw console.error({additionLines:i,content:e,i:r}),new Error("pushContentLinesToDiff: Addition line does not exist");t.additionLines.push(n)}}}}function Zl(e,t,n,i,o){if("deletions"===e||"both"===e)for(let r=0;r<t.deletions;r++){const e=i[t.deletionLineIndex+r];if(null==e)throw console.error({deletionLines:i,content:t,i:r}),new Error("pushResolveLinesToDiff: Deletion line does not exist");n.deletionLines.push(e),n.additionLines.push(e)}if("additions"===e||"both"===e)for(let r=0;r<t.additions;r++){const e=o[t.additionLineIndex+r];if(null==e)throw console.error({additionLines:o,content:t,i:r}),new Error("pushResolveLinesToDiff: Addition line does not exist");n.deletionLines.push(e),n.additionLines.push(e)}}function Ql(e,t,n){"context"===e.type?(t.nextAdditionLineIndex+=e.lines,t.nextDeletionLineIndex+=e.lines,t.nextAdditionStart+=e.lines,t.nextDeletionStart+=e.lines,t.splitLineCount+=e.lines,t.unifiedLineCount+=e.lines,n.additionCount+=e.lines,n.deletionCount+=e.lines,n.splitLineCount+=e.lines,n.unifiedLineCount+=e.lines):(t.nextAdditionLineIndex+=e.additions,t.nextDeletionLineIndex+=e.deletions,t.nextAdditionStart+=e.additions,t.nextDeletionStart+=e.deletions,t.splitLineCount+=Math.max(e.deletions,e.additions),t.unifiedLineCount+=e.deletions+e.additions,n.deletionCount+=e.deletions,n.deletionLines+=e.deletions,n.additionCount+=e.additions,n.additionLines+=e.additions,n.splitLineCount+=Math.max(e.deletions,e.additions),n.unifiedLineCount+=e.deletions+e.additions)}function es(e){const t="string"==typeof e?e:e.type;return"accept"===t||"incoming"===t?"additions":"reject"===t||"current"===t?"deletions":"both"}function ts(e,t,n){return Kl(e,{resolution:es(n),hunkIndex:t.hunkIndex,startContentIndex:t.startContentIndex,endContentIndex:t.endContentIndex,indexesToDelete:ns(t)})}function ns(e){const t=new Set;return null!=e.baseContentIndex&&t.add(e.baseContentIndex),e.endMarkerContentIndex!==e.endContentIndex&&t.add(e.endMarkerContentIndex),t}function is({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function os(e,t){const n=t.hunks[e.hunkIndex];if(null!=n)return{hunkIndex:e.hunkIndex,lineIndex:ys(n,e.startContentIndex)}}function rs(e,t=6){const n={deletionLines:[],additionLines:[],conflictStack:[],conflictBuilders:[],actions:[],hunks:[],nextConflictIndex:0,splitLineCount:0,unifiedLineCount:0,lastHunkEnd:0,activeHunk:void 0,maxContextLines:t=Math.max(t,1),maxContextLines2:2*t},i=e.contents,o=i.length;if(o>0){let e=0,t=0,r=i.indexOf("\n",e);for(;-1!==r;)ls(n,i.slice(e,r+1),t),e=r+1,t++,r=i.indexOf("\n",e);e<o&&ls(n,i.slice(e),t)}if(n.conflictStack.length>0)throw new Error("parseMergeConflictDiffFromFile: unfinished merge conflict marker stack");null!=n.activeHunk&&n.activeHunk.hunkContent.length>0&&(ds(n,n.activeHunk,"trailing"),hs(n));for(let u=0;u<n.conflictBuilders.length;u++){const e=n.conflictBuilders[u];if(null==e||!e.completed)throw new Error(`parseMergeConflictDiffFromFile: failed to build merge conflict action ${u}`)}if(n.hunks.length>0&&n.additionLines.length>0&&n.deletionLines.length>0){const e=n.hunks[n.hunks.length-1],t=Math.max(n.additionLines.length-(e.additionStart+e.additionCount-1),0);n.splitLineCount+=t,n.unifiedLineCount+=t}const r=n.deletionLines.join(""),l=n.additionLines.join(""),s=vs(e,"current",r),a=vs(e,"incoming",l);let d="change";""===l?d="deleted":""===r&&(d="new");const h={name:e.name,prevName:void 0,type:d,hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,isPartial:!1,deletionLines:n.deletionLines,additionLines:n.additionLines,cacheKey:null!=e.cacheKey?`${e.cacheKey}:merge-conflict-diff`:void 0};return{fileDiff:h,currentFile:s,incomingFile:a,actions:n.actions,markerRows:bs(h,n.actions)}}function ls(e,t,n){const i=e.conflictStack[e.conflictStack.length-1];if(null==i)return t.length>=7&&60===t.charCodeAt(0)&&"start"===ms(t)?void fs(e,t,n):void us(e,t);const o=ms(t);if("start"!==o){if("base"===o)return i.stage="base",i.baseMarkerLineIndex=n,void(i.markerLines.base=t);if("separator"===o)return i.stage="incoming",i.separatorLineIndex=n,void(i.markerLines.separator=t);if("end"===o){const i=e.conflictStack.pop();if(null==i)throw new Error("parseMergeConflictDiffFromFile: encountered end marker before start marker");return void function(e,t,n,i){var o;if(null==t.separatorLineIndex||null==t.markerLines.separator)throw new Error(`parseMergeConflictDiffFromFile: conflict ${t.conflictIndex} is missing a separator marker`);const r=e.conflictBuilders[t.conflictIndex];if(null==r)throw new Error(`parseMergeConflictDiffFromFile: failed to finalize conflict ${t.conflictIndex}`);const l=r.action;l.markerLines.separator=t.markerLines.separator,l.markerLines.end=i,null!=t.markerLines.base&&(l.markerLines.base=t.markerLines.base),l.conflict={conflictIndex:t.conflictIndex,startLineIndex:t.startLineIndex,startLineNumber:t.startLineIndex+1,separatorLineIndex:t.separatorLineIndex,separatorLineNumber:t.separatorLineIndex+1,endLineIndex:n,endLineNumber:n+1,baseMarkerLineIndex:t.baseMarkerLineIndex,baseMarkerLineNumber:null!=t.baseMarkerLineIndex?t.baseMarkerLineIndex+1:void 0};const s=null!=(o=l.currentContentIndex)?o:l.incomingContentIndex;if(null!=l.currentContentIndex||(l.currentContentIndex=s),null!=l.incomingContentIndex||(l.incomingContentIndex=s),l.startContentIndex<0&&null!=s&&(l.startContentIndex=s),l.endContentIndex<0&&null!=s&&(l.endContentIndex=s),l.endMarkerContentIndex<0&&null!=s&&(l.endMarkerContentIndex=s),l.hunkIndex<0||l.startContentIndex<0||l.endContentIndex<0||l.endMarkerContentIndex<0)throw new Error(`parseMergeConflictDiffFromFile: failed to anchor merge conflict ${t.conflictIndex}`);e.actions[l.conflictIndex]=l,r.completed=!0}(e,i,n,t)}"current"===i.stage?cs(e,"deletion",t,i.conflictIndex,"current"):"base"===i.stage?us(e,t,i.conflictIndex):cs(e,"addition",t,i.conflictIndex,"incoming")}else fs(e,t,n)}function ss(e){return null!=e.activeHunk||(e.activeHunk=ps(e.additionLines.length+1,e.deletionLines.length+1)),e.activeHunk}function as(e,t,n,i){const o=e.conflictBuilders[t];if(null==o)throw new Error(`parseMergeConflictDiffFromFile: failed to locate conflict action ${t}`);const r=o.action,l=e.hunks.length;if(r.hunkIndex<0)r.hunkIndex=l;else if(r.hunkIndex!==l)throw new Error(`parseMergeConflictDiffFromFile: conflict ${t} spans multiple hunks and cannot be anchored`);r.startContentIndex<0&&(r.startContentIndex=i),r.endContentIndex=i,r.endMarkerContentIndex=i,"current"!==n?"base"!==n?r.incomingContentIndex=i:null!=r.baseContentIndex||(r.baseContentIndex=i):null!=r.currentContentIndex||(r.currentContentIndex=i)}function ds(e,t,n){let i=t.contextBufferCount,o=t.contextBufferAdditionStart,r=t.contextBufferDeletionStart;if("leading"===n&&i>e.maxContextLines){const n=i-e.maxContextLines;o+=n,r+=n,i=e.maxContextLines,t.additionStart+=n,t.deletionStart+=n,t.additionLineIndex+=n,t.deletionLineIndex+=n}if("trailing"===n&&i>e.maxContextLines&&(i=e.maxContextLines),0===i)return t.contextBufferCount=0,void(t.contextBufferBaseConflicts=void 0);const l=t.hunkContent,s=l[l.length-1];let a;"context"===(null==s?void 0:s.type)?(s.lines+=i,a=l.length-1):(l.push({type:"context",lines:i,additionLineIndex:o,deletionLineIndex:r}),a=l.length-1),t.additionCount+=i,t.deletionCount+=i;const d=t.contextBufferBaseConflicts;if(null!=d){const n=o-t.contextBufferAdditionStart;for(const[t,o]of d)t>=n&&t<n+i&&as(e,o,"base",a)}t.contextBufferCount=0,t.contextBufferBaseConflicts=void 0}function hs(e){if(null==e.activeHunk)return;const t=e.activeHunk;if(e.activeHunk=void 0,0===t.hunkContent.length)return;let n=0,i=0;for(const l of t.hunkContent)"context"===l.type?(n+=l.lines,i+=l.lines):(n+=Math.max(l.additions,l.deletions),i+=l.additions+l.deletions);const o=Math.max(t.additionStart-1-e.lastHunkEnd,0),r={collapsedBefore:o,additionStart:t.additionStart,additionCount:t.additionCount,additionLines:t.additionLines,additionLineIndex:t.additionLineIndex,deletionStart:t.deletionStart,deletionCount:t.deletionCount,deletionLines:t.deletionLines,deletionLineIndex:t.deletionLineIndex,hunkContent:t.hunkContent,hunkContext:void 0,hunkSpecs:`@@ -${gs(t.deletionStart,t.deletionCount)} +${gs(t.additionStart,t.additionCount)} @@\n`,splitLineStart:e.splitLineCount+o,splitLineCount:n,unifiedLineStart:e.unifiedLineCount+o,unifiedLineCount:i,noEOFCRAdditions:!1,noEOFCRDeletions:!1};e.hunks.push(r),e.splitLineCount+=o+n,e.unifiedLineCount+=o+i,e.lastHunkEnd=t.additionStart+t.additionCount-1}function us(e,t,n=-1){const i=ss(e);0===i.contextBufferCount&&(i.contextBufferAdditionStart=e.additionLines.length,i.contextBufferDeletionStart=e.deletionLines.length),e.additionLines.push(t),e.deletionLines.push(t),n>=0&&(null!=i.contextBufferBaseConflicts||(i.contextBufferBaseConflicts=new Map),i.contextBufferBaseConflicts.set(i.contextBufferCount,n)),i.contextBufferCount++}function cs(e,t,n,i,o){let r=ss(e);r.hunkContent.length>0&&r.contextBufferCount>e.maxContextLines2&&(function(e){if(null==e.activeHunk)return;const t=e.activeHunk,n=t.contextBufferCount,i=n-e.maxContextLines2,o=t.contextBufferAdditionStart+n-e.maxContextLines,r=t.contextBufferDeletionStart+n-e.maxContextLines;let l;if(null!=t.contextBufferBaseConflicts){const i=n-e.maxContextLines;for(const[e,n]of t.contextBufferBaseConflicts)e>=i&&(null!=l||(l=new Map),l.set(e-i,n))}ds(e,t,"trailing");const s=t.additionCount,a=t.deletionCount;hs(e),e.activeHunk=ps(t.additionStart+s+i,t.deletionStart+a+i),e.activeHunk.contextBufferAdditionStart=o,e.activeHunk.contextBufferDeletionStart=r,e.activeHunk.contextBufferCount=e.maxContextLines,e.activeHunk.contextBufferBaseConflicts=l}(e),r=e.activeHunk),ds(e,r,0===r.hunkContent.length?"leading":"before-change");const l=e.additionLines.length,s=e.deletionLines.length;"addition"===t?e.additionLines.push(n):e.deletionLines.push(n);const a=function(e,t,n,i){const o=e.hunkContent,r=o[o.length-1];return"change"===(null==r?void 0:r.type)?("addition"===t?r.additions++:r.deletions++,o.length-1):(o.push({type:"change",additions:"addition"===t?1:0,deletions:"deletion"===t?1:0,additionLineIndex:n,deletionLineIndex:i}),o.length-1)}(r,t,l,s);"addition"===t?(r.additionCount++,r.additionLines++):(r.deletionCount++,r.deletionLines++),as(e,i,o,a)}function fs(e,t,n){const i=e.nextConflictIndex;e.nextConflictIndex++,e.conflictStack.push({conflictIndex:i,stage:"current",startLineIndex:n,markerLines:{start:t}}),e.conflictBuilders[i]={completed:!1,action:{conflict:{conflictIndex:i,startLineIndex:n,startLineNumber:n+1,separatorLineIndex:n,separatorLineNumber:n+1,endLineIndex:n,endLineNumber:n+1,baseMarkerLineIndex:void 0,baseMarkerLineNumber:void 0},conflictIndex:i,hunkIndex:-1,startContentIndex:-1,endContentIndex:-1,endMarkerContentIndex:-1,markerLines:{start:t,separator:"",end:""}}}}function ps(e,t){return{additionStart:e,deletionStart:t,additionCount:0,deletionCount:0,additionLines:0,deletionLines:0,additionLineIndex:Math.max(e-1,0),deletionLineIndex:Math.max(t-1,0),hunkContent:[],contextBufferAdditionStart:Math.max(e-1,0),contextBufferDeletionStart:Math.max(t-1,0),contextBufferCount:0,contextBufferBaseConflicts:void 0}}function gs(e,t){return 1===t?`${e}`:`${e},${t}`}function ms(e){if(e.length<7)return;const t=e.charCodeAt(0);if(60!==t&&62!==t&&61!==t&&124!==t)return;const n=function(e){let t=e.length;return t>0&&10===e.charCodeAt(t-1)&&t--,t>0&&13===e.charCodeAt(t-1)&&t--,t}(e);if(n<7)return;let i=1;for(;i<n&&e.charCodeAt(i)===t;)i++;if(!(i<7)){if(61===t)return i===n?"separator":void 0;var o;if(i===n||9===(o=e.charCodeAt(i))||10===o||11===o||12===o||13===o||32===o)return 60===t?"start":62===t?"end":"base"}}function vs(e,t,n){return v(m({},e),{contents:n,cacheKey:null!=e.cacheKey?`${e.cacheKey}:merge-conflict-${t}`:void 0})}function bs(e,t){const n=[],i=new Array(e.hunks.length),o=(t,n)=>{var o;const r=e.hunks[t];if(null==r)return 0;let l=i[t];if(null==l){l=new Array(r.hunkContent.length+1);let e=r.unifiedLineStart;l[0]=e;for(let t=0;t<r.hunkContent.length;t++){const n=r.hunkContent[t];e+="context"===n.type?n.lines:n.deletions+n.additions,l[t+1]=e}i[t]=l}return null!=(o=l[Math.max(n,0)])?o:r.unifiedLineStart},r=(e,t)=>{var n,r;const l=o(e,t),s=null!=(r=null==(n=i[e])?void 0:n[Math.max(t+1,0)])?r:o(e,t+1);return Math.max(l,s-1)};for(const l of t){if(null==l)continue;const t=e.hunks[l.hunkIndex];if(null==t)continue;const i=o(l.hunkIndex,l.startContentIndex);if(n.push(Ss(l,"marker-start",l.startContentIndex,l.markerLines.start,i)),null!=l.baseContentIndex){const e=l.currentContentIndex,i=l.incomingContentIndex;if(null==e||null==i)continue;const s=l.markerLines.base;if(null==s)continue;const a=t.hunkContent[e],d=t.hunkContent[l.baseContentIndex],h=t.hunkContent[i];if("change"!==(null==a?void 0:a.type)||"context"!==(null==d?void 0:d.type)||"change"!==(null==h?void 0:h.type))continue;const u=o(l.hunkIndex,e),c=o(l.hunkIndex,i);n.push(Ss(l,"marker-base",l.baseContentIndex,s,u+a.deletions)),n.push(Ss(l,"marker-separator",l.baseContentIndex,l.markerLines.separator,c),Ss(l,"marker-end",l.endMarkerContentIndex,l.markerLines.end,r(l.hunkIndex,l.endMarkerContentIndex)));continue}const s=l.currentContentIndex;if(null==s)continue;const a=t.hunkContent[s];if("change"!==(null==a?void 0:a.type))continue;const d=o(l.hunkIndex,s),h=a.deletions>0?d+a.deletions:i;n.push(Ss(l,"marker-separator",s,l.markerLines.separator,h),Ss(l,"marker-end",l.endMarkerContentIndex,l.markerLines.end,r(l.hunkIndex,l.endMarkerContentIndex)))}return n}function Ss(e,t,n,i,o){return{type:t,hunkIndex:e.hunkIndex,contentIndex:n,conflictIndex:e.conflictIndex,lineText:i,lineIndex:o}}function ys(e,t){let n=e.unifiedLineStart;for(let i=0;i<t;i++){const t=e.hunkContent[i];n+="context"===t.type?t.lines:t.deletions+t.additions}return n}var xs=class e extends Jr{constructor(e={theme:O},t,n){super(void 0,t,n),S(this,"pendingConflictActions",[]),S(this,"pendingMarkerRows",[]),S(this,"injectedRows",new Map),S(this,"options"),S(this,"getUnifiedInjectedRowsForLine",e=>{const t=this.injectedRows.get(`${e.hunkIndex}:${e.lineIndex}`);if(null==t||0===t.length)return;const{mergeConflictActionsType:n}=this.getOptionsWithDefaults(),i=[],o=[];for(const r of t)"actions"!==r.type?("marker-end"===r.type?o:i).push({content:Ts(r),gutter:Ls("marker",r.type)}):i.push({content:ws({row:r,includeDefaultActions:"default"===n,includeSlot:!0}),gutter:Ls("action")});return{before:i.length>0?i:void 0,after:o.length>0?o:void 0}}),this.options=e}setConflictState(e,t,n){this.pendingConflictActions=e,this.pendingMarkerRows=t,this.syncInjectedRows(e,t,n)}syncInjectedRows(e,t,n){this.injectedRows.clear();for(const i of e){const e=null!=i?os(i,n):void 0;if(null==i||null==e)continue;const t={type:"actions",hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:i.conflictIndex};this.addInjectedRow(t)}for(const i of t)this.addInjectedRow(i)}addInjectedRow(e){const t=`${e.hunkIndex}:${e.lineIndex}`,n=this.injectedRows.get(t);null==n?this.injectedRows.set(t,[e]):n.push(e)}renderDiff(e,t=G){return null!=e&&this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.renderDiff(e,t)}asyncRender(t){return y(this,arguments,function*(t,n=G){return this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,t),(i=e.prototype,f(h(i),"asyncRender",this)).call(this,t,n);var i})}createPreElement(e,t){return super.createPreElement(e,t,{"data-has-merge-conflict":""})}getUnifiedLineDecoration({type:e,lineType:t}){const n="change"===e?"change-deletion"===t?"current":"incoming":void 0;return{gutterLineType:"change"===e?"context":t,gutterProperties:Cs(n),contentProperties:ks(e,n)}}getSplitLineDecoration({side:e,type:t}){const n="change"===t?"deletions"===e?"current":"incoming":void 0;return{gutterLineType:"change"===t?"context":t,gutterProperties:Cs(n),contentProperties:ks(t,n)}}getOptionsWithDefaults(){var e;const t=super.getOptionsWithDefaults();return t.diffStyle="unified",t.lineDiffType="none",t.mergeConflictActionsType=null!=(e=this.options.mergeConflictActionsType)?e:"default",t}};function Cs(e){return null!=e?{"data-merge-conflict":e}:void 0}function ks(e,t){if(null!=t)return"change"===e?"current"===t||"incoming"===t?{"data-line-type":"context","data-merge-conflict":t}:void 0:"marker-start"===t||"marker-base"===t||"marker-separator"===t||"marker-end"===t?{"data-merge-conflict":t}:void 0}function Ls(e,t){const n=fe(void 0,"annotation",1);return n.properties["data-gutter-buffer"]="action"===e?"merge-conflict-action":`merge-conflict-${null!=t?t:"marker"}`,n}function ws({row:e,includeDefaultActions:t,includeSlot:n}){const i=t?[Es({resolution:"current",label:"Accept current change",conflictIndex:o=e.conflictIndex}),Is(),Es({resolution:"incoming",label:"Accept incoming change",conflictIndex:o}),Is(),Es({resolution:"both",label:"Accept both",conflictIndex:o})]:[];var o;return n&&i.push(ae({tagName:"slot",properties:{name:is({hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:e.conflictIndex}),"data-merge-conflict-action-slot":""}})),ae({tagName:"div",properties:{"data-merge-conflict-actions":""},children:[ae({tagName:"div",properties:{"data-merge-conflict-actions-content":""},children:i})]})}function Ts(e){return ae({tagName:"div",properties:{"data-merge-conflict":e.type,"data-merge-conflict-marker-row":""},children:[se(e.lineText.replace(/(?:\r\n|\n|\r)$/,""))]})}function Es({resolution:e,label:t,conflictIndex:n}){return ae({tagName:"button",properties:{type:"button","data-merge-conflict-action":e,"data-merge-conflict-conflict-index":`${n}`},children:[se(t)]})}function Is(){return ae({tagName:"span",properties:{"data-merge-conflict-action-separator":""},children:[se("|")]})}function As(e,t){return e.hunkIndex===t.hunkIndex&&e.startContentIndex===t.startContentIndex&&e.endContentIndex===t.endContentIndex&&e.currentContentIndex===t.currentContentIndex&&e.baseContentIndex===t.baseContentIndex&&e.incomingContentIndex===t.incomingContentIndex&&e.endMarkerContentIndex===t.endMarkerContentIndex&&e.conflictIndex===t.conflictIndex&&function(e,t){return e.conflictIndex===t.conflictIndex&&e.startLineIndex===t.startLineIndex&&e.startLineNumber===t.startLineNumber&&e.separatorLineIndex===t.separatorLineIndex&&e.separatorLineNumber===t.separatorLineNumber&&e.endLineIndex===t.endLineIndex&&e.endLineNumber===t.endLineNumber&&e.baseMarkerLineIndex===t.baseMarkerLineIndex&&e.baseMarkerLineNumber===t.baseMarkerLineNumber}(e.conflict,t.conflict)}let Rs=-1;function Ms({resolvedAction:e,resolvedConflictIndex:t,previousFile:n,fileDiff:i,resolution:o}){var r,l;const s=_i(null!=(r=null==n?void 0:n.contents)?r:""),{conflict:a}=e,d=function(e,t,n){var i;const o=e.slice(t.startLineIndex+1,null!=(i=t.baseMarkerLineIndex)?i:t.separatorLineIndex),r=e.slice(t.separatorLineIndex+1,t.endLineIndex);return"current"===n?o:"incoming"===n?r:[...o,...r]}(s,a,o),h=[...s.slice(0,a.startLineIndex),...d,...s.slice(a.endLineIndex+1)].join("");return{name:null!=(l=null==n?void 0:n.name)?l:i.name,contents:h,cacheKey:null!=(null==n?void 0:n.cacheKey)?`${n.cacheKey}:mc-${t}-${o}`:void 0}}function Hs(e,t){return v(m({},e),{startLineIndex:e.startLineIndex+t,startLineNumber:e.startLineNumber+t,separatorLineIndex:e.separatorLineIndex+t,separatorLineNumber:e.separatorLineNumber+t,endLineIndex:e.endLineIndex+t,endLineNumber:e.endLineNumber+t,baseMarkerLineIndex:null!=e.baseMarkerLineIndex?e.baseMarkerLineIndex+t:void 0,baseMarkerLineNumber:null!=e.baseMarkerLineNumber?e.baseMarkerLineNumber+t:void 0})}function Ps(e,t){return v(m(m({},t),e),{hunkSeparators:"function"==typeof(null==e?void 0:e.hunkSeparators)?"custom":null==e?void 0:e.hunkSeparators,mergeConflictActionsType:"function"==typeof(null==e?void 0:e.mergeConflictActionsType)?"custom":null==e?void 0:e.mergeConflictActionsType})}function Ds(e,t){return null==e||null==t?e===t:e.top===t.top&&e.bottom===t.bottom}const Os=[0,1e-6,.99999,1],Ns={overscrollSize:1e3,intersectionObserverMargin:4e3,resizeDebugging:!1};let Fs=0,zs=-1;var Us=(r=class{constructor(e){S(this,"__id","virtualizer-"+ ++zs),S(this,"config"),S(this,"type","simple"),S(this,"intersectionObserver"),S(this,"scrollTop",0),S(this,"height",0),S(this,"scrollHeight",0),S(this,"windowSpecs",{top:0,bottom:0}),S(this,"root"),S(this,"contentContainer"),S(this,"resizeObserver"),S(this,"observers",new Map),S(this,"visibleInstances",new Map),S(this,"visibleInstancesDirty",!1),S(this,"instancesChanged",new Set),S(this,"scrollDirty",!0),S(this,"heightDirty",!0),S(this,"scrollHeightDirty",!0),S(this,"renderedObservers",0),S(this,"connectQueue",new Map),S(this,"handleContainerResize",e=>{if(null==this.root)return;let t=!1;for(const n of e){const e=n.borderBoxSize[0].blockSize;this.root instanceof Document?e!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(this.__id,Fs=e)):n.target===this.root?e!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(this.__id,Fs=e))}t&&J(this.computeRenderRangeAndEmit)}),S(this,"handleWindowResize",()=>{r.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,J(this.computeRenderRangeAndEmit))}),S(this,"handleWindowScroll",()=>{!r.__STOP&&null!=this.root&&this.root instanceof Document&&(this.scrollDirty=!0,J(this.computeRenderRangeAndEmit))}),S(this,"handleElementScroll",()=>{r.__STOP||null==this.root||this.root instanceof Document||(this.scrollDirty=!0,J(this.computeRenderRangeAndEmit))}),S(this,"computeRenderRangeAndEmit",()=>{if(r.__STOP)return;const e=this.heightDirty||this.scrollHeightDirty;if(!(this.scrollDirty||this.scrollHeightDirty||this.heightDirty||this.renderedObservers!==this.observers.size||this.visibleInstancesDirty||0!==this.instancesChanged.size))return;let t=this.instancesChanged.size>0;if(0===this.instancesChanged.size){const t=re({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!e&&Ds(this.windowSpecs,t)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty)return;this.windowSpecs=t}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const n=this.getScrollAnchor(this.height),i=new Set;for(const o of e?this.observers.values():this.visibleInstances.values())o.onRender(e)&&i.add(o);for(const o of this.instancesChanged)i.has(o)||o.onRender(e)&&i.add(o);this.scrollFix(n);for(const o of i)o.reconcileHeights();t||(t=this.instancesChanged.size>0),t&&this.markDOMDirty(),(t||e)&&J(this.computeRenderRangeAndEmit),i.clear(),this.instancesChanged.clear()}),S(this,"handleIntersectionChange",e=>{this.scrollDirty=!0;for(const{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const e=this.observers.get(t);null!=e&&(n&&!this.visibleInstances.has(t)?(e.setVisibility(!0),this.visibleInstances.set(t,e),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(e.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&J(this.computeRenderRangeAndEmit)}),this.config=m(m({},Ns),e)}setup(e,t){if(null==this.root){this.root=e,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Os,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),e instanceof Document?this.setupWindow():this.setupElement(t),window.__INSTANCE=this,window.__TOGGLE=()=>{var e;r.__STOP?(r.__STOP=!1,(null!=(e=this.getScrollContainerElement())?e:window).scrollTo({top:r.__lastScrollPosition}),J(this.computeRenderRangeAndEmit)):(r.__lastScrollPosition=this.getScrollTop(),r.__STOP=!0)};for(const[e,t]of this.connectQueue.entries())this.connect(e,t);this.connectQueue.clear(),this.markDOMDirty(),J(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),J(this.computeRenderRangeAndEmit)}getWindowSpecs(){return 0===this.windowSpecs.top&&0===this.windowSpecs.bottom&&(this.windowSpecs=re({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){const n=this.getScrollTop(),i=this.getHeight(),o=this.config.intersectionObserverMargin;return!(e<n-o-t||e>n+i+o)}setupWindow(){var e;if(null==this.root||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),null==(e=this.resizeObserver)||e.observe(this.root.documentElement)}setupElement(e){var t,n,i;if(null==this.root||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),null==(t=this.resizeObserver)||t.observe(this.root),null!=e||(e=null!=(n=this.root.firstElementChild)?n:void 0),e instanceof HTMLElement&&(this.contentContainer=e,null==(i=this.resizeObserver)||i.observe(e))}cleanUp(){var e,t,n;null==(e=this.resizeObserver)||e.disconnect(),this.resizeObserver=void 0,null==(t=this.intersectionObserver)||t.disconnect(),this.intersectionObserver=void 0,null==(n=this.root)||n.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+Bs(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw new Error("Virtualizer.connect: instance is already connected...");return null==this.intersectionObserver?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),J(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){var t;const n=this.observers.get(e);this.connectQueue.delete(e),null!=n&&(null==(t=this.intersectionObserver)||t.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),J(this.computeRenderRangeAndEmit))}scrollFix(e){var t;if(null==e)return;const n=this.getScrollContainerElement(),{lineIndex:i,lineOffset:o,fileElement:r,fileOffset:l,fileTypeOffset:s}=e;if(null!=i&&null!=o){const e=null==(t=r.shadowRoot)?void 0:t.querySelector(`[data-line][data-line-index="${i}"]`);if(e instanceof HTMLElement){const t=Bs(e,n);if(t!==o){const e=t-o;this.applyScrollFix(e)}return}}const a=Bs(r,n);if("top"===s)a!==l&&this.applyScrollFix(a-l);else{const e=a+r.getBoundingClientRect().height;e!==l&&this.applyScrollFix(e-l)}}applyScrollFix(e){null==this.root||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(e){var t,n;const i=this.getScrollContainerElement();let o;for(const[r]of this.visibleInstances.entries()){const l=Bs(r,i),s=l+r.offsetHeight;let a,d,h,u;if(s<=0?(a=s,d="bottom"):(a=l,d="top"),s>0&&l<e)for(const e of null!=(n=null==(t=r.shadowRoot)?void 0:t.querySelectorAll("[data-line][data-line-index]"))?n:[]){if(!(e instanceof HTMLElement))continue;const t=e.dataset.lineIndex;if(null==t)continue;const n=Bs(e,i);if(!(n<0)){h=t,u=n;break}}if(null!=(null==o?void 0:o.lineOffset)&&null==u)continue;let c=!1;(null==o||null!=u&&(null==o.lineOffset||u<o.lineOffset)||null==u&&null==o.lineOffset&&(a>=0&&(o.fileOffset<0||a<o.fileOffset)||a<0&&o.fileOffset<0&&a>o.fileOffset))&&(c=!0),c&&(o={fileElement:r,fileTypeOffset:d,fileOffset:a,lineIndex:h,lineOffset:u})}return o}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=(()=>null==this.root?0:this.root instanceof Document?window.scrollY:this.root.scrollTop)();return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=(()=>null==this.root?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight)(),this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=(()=>null==this.root?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height)(),this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return null==this.root||this.root instanceof Document?void 0:this.root}},S(r,"__STOP",!1),S(r,"__lastScrollPosition",0),r);function Bs(e,t){var n;const i=e.getBoundingClientRect(),o=null!=(n=null==t?void 0:t.getBoundingClientRect().top)?n:0;return i.top-o}function js(e,t){try{const n=Pn({name:e,load:t});Tn.registerTheme(n.name,n.load)}catch(n){if(n instanceof kn)return void console.error("SharedHighlight.registerCustomTheme: theme name already registered",e);throw n}}function $s(e,t,n){if("leading"===n&&e.contextLines.length>t){const n=e.contextLines.length-t;e.contextLines.splice(0,n),e.additionStart+=n,e.deletionStart+=n}return"trailing"===n&&e.contextLines.length>t&&(e.contextLines.length=t),e.contextLines.length>0&&(e.hunkLines.push(...e.contextLines),e.additionCount+=e.contextLines.length,e.deletionCount+=e.contextLines.length,e.contextLines.length=0),e}function Vs(e,t){t.push(`@@ -${_s(e.deletionStart,e.deletionCount)} +${_s(e.additionStart,e.additionCount)} @@`),t.push(...e.hunkLines)}function _s(e,t){return 1===t?`${e}`:`${e},${t}`}Object.defineProperty(exports,"codeToHtml",{enumerable:!0,get:()=>x.codeToHtml}),Object.defineProperty(exports,"createCSSVariablesTheme",{enumerable:!0,get:()=>x.createCssVariablesTheme}),exports.ALTERNATE_FILE_NAMES_GIT=R,exports.AttachedLanguages=cn,exports.AttachedThemes=Sn,exports.COMMIT_METADATA_SPLIT=L,exports.CORE_CSS_ATTRIBUTE=z,exports.CUSTOM_HEADER_SLOT_ID=D,exports.CodeToTokenTransformStream=ql,exports.CodeView=Dl,exports.DEFAULT_CODE_VIEW_FILE_METRICS=V,exports.DEFAULT_CODE_VIEW_LAYOUT=_,exports.DEFAULT_COLLAPSED_CONTEXT_THRESHOLD=1,exports.DEFAULT_EXPANDED_REGION=W,exports.DEFAULT_RENDER_RANGE=G,exports.DEFAULT_SMOOTH_SCROLL_SETTINGS=q,exports.DEFAULT_THEMES=O,exports.DEFAULT_TOKENIZE_MAX_LENGTH=j,exports.DEFAULT_VIRTUAL_FILE_METRICS=$,exports.DIFFS_DEVELOPMENT_BUILD=k,exports.DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY=B,exports.DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE=U,exports.DIFFS_TAG_NAME=C,exports.DiffHunksRenderer=Jr,exports.EMPTY_RENDER_RANGE=K,exports.EXTENSION_TO_FILE_FORMAT=vi,exports.FILENAME_HEADER_REGEX=I,exports.FILENAME_HEADER_REGEX_GIT=A,exports.FILE_CONTEXT_BLOB=/(?=^@@ )/gm,exports.File=Ro,exports.FileDiff=hl,exports.FileRenderer=to,exports.FileStream=class{constructor(e={theme:O}){var t;S(this,"options"),S(this,"__id","file-stream:"+ ++Gl),S(this,"highlighter"),S(this,"stream"),S(this,"abortController"),S(this,"fileContainer"),S(this,"pre"),S(this,"code"),S(this,"gutterElement"),S(this,"contentElement"),S(this,"themeCSSStyle"),S(this,"appliedThemeCSS"),S(this,"currentRowCount",0),S(this,"queuedSetupArgs"),S(this,"queuedTokens",[]),S(this,"handleWrite",e=>{var t,n;"recall"in e&&this.queuedTokens.length>=e.recall?this.queuedTokens.length=this.queuedTokens.length-e.recall:this.queuedTokens.push(e),J(this.render),null==(n=(t=this.options).onStreamWrite)||n.call(t,e)}),S(this,"currentLineIndex"),S(this,"currentLineElement"),S(this,"render",()=>{var e,t,n,i,o,r;null==(t=(e=this.options).onPreRender)||t.call(e,this);const{gutter:l,content:s}=this.getOrCreateStreamColumns(),a=document.createDocumentFragment(),d=document.createDocumentFragment();for(const h of this.queuedTokens)if("recall"in h){if(null==this.currentLineElement)throw new Error("FileStream.render: no current line element, shouldnt be possible to get here");if(h.recall>this.currentLineElement.childNodes.length)throw new Error("FileStream.render: Token recall exceed the current line, there's probably a bug...");for(let e=0;e<h.recall;e++)null==(n=this.currentLineElement.lastChild)||n.remove()}else{const e=Wl(h);if(null==this.currentLineElement){const{gutterLine:e,contentLine:t}=this.createLine();a.appendChild(e),d.appendChild(t)}if(null==(i=this.currentLineElement)||i.appendChild(e),"\n"===h.content){this.currentLineIndex++;const{gutterLine:e,contentLine:t}=this.createLine();a.appendChild(e),d.appendChild(t)}}a.childNodes.length>0&&l.appendChild(a),d.childNodes.length>0&&s.appendChild(d),this.queuedTokens.length=0,null==(r=(o=this.options).onPostRender)||r.call(o,this)}),this.options=e,this.currentLineIndex=null!=(t=this.options.startingLineIndex)?t:1}cleanUp(){var e;null==(e=this.abortController)||e.abort(),this.abortController=void 0}setThemeType(e){var t;(null!=(t=this.options.themeType)?t:"system")!==e&&(this.options=v(m({},this.options),{themeType:e}),"string"!=typeof this.options.theme&&null!=this.fileContainer&&null!=this.appliedThemeCSS&&this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType))}initializeHighlighter(){return y(this,null,function*(){return this.highlighter=yield Qn(yi(this.options.lang,this.options)),this.highlighter})}setup(e,t){return y(this,null,function*(){const n=null!=this.queuedSetupArgs;if(this.queuedSetupArgs=[e,t],n)return;null!=this.highlighter||(this.highlighter=yield this.initializeHighlighter());const[i,o]=this.queuedSetupArgs;this.queuedSetupArgs=void 0;const r=i;this.setupStream(r,o,this.highlighter)})}setupStream(e,t,n){var i,o,r,l;const{disableLineNumbers:s=!1,overflow:a="scroll",theme:d=O,themeType:h="system"}=this.options,u=this.getOrCreateFileContainer();null==u.parentElement&&t.appendChild(u),null!=this.pre||(this.pre=document.createElement("pre")),null==this.pre.parentElement&&(null==(i=u.shadowRoot)||i.appendChild(this.pre));const c="string"==typeof d?n.getTheme(d).type:void 0,f=Bi({theme:d,highlighter:n});this.applyThemeState(u,f,h,c);const p=Lo(this.pre,{type:"file",diffIndicators:"none",disableBackground:!0,disableLineNumbers:s,overflow:a,split:!1,totalLines:0});p.textContent="",this.pre=p,this.code=Co({code:this.code,pre:p}),this.gutterElement=void 0,this.contentElement=void 0,this.currentRowCount=0,this.currentLineElement=void 0,this.currentLineIndex=null!=(o=this.options.startingLineIndex)?o:1,null==(r=this.abortController)||r.abort(),this.abortController=new AbortController;const{onStreamStart:g,onStreamClose:b,onStreamAbort:S}=this.options;null==(l=this.stream)||l.cancel().catch(()=>{}),this.stream=e,this.stream.pipeThrough(new ql(v(m({},this.options),"string"==typeof d?{theme:d,highlighter:n,allowRecalls:!0,defaultColor:!1,cssVariablePrefix:Mi("token"),tokenizeTimeLimit:0}:{themes:d,highlighter:n,allowRecalls:!0,defaultColor:!1,cssVariablePrefix:Mi("token"),tokenizeTimeLimit:0}))).pipeTo(new WritableStream({start(e){null==g||g(e)},close(){null==b||b()},abort(e){null==S||S(e)},write:this.handleWrite}),{signal:this.abortController.signal}).catch(e=>{"AbortError"!==e.name&&console.error("FileStream pipe error:",e)})}getOrCreateStreamColumns(){if(null==this.code)throw new Error("FileStream: expected code element to exist");if(null!=this.gutterElement&&null!=this.contentElement)return{gutter:this.gutterElement,content:this.contentElement};const e=document.createElement("div");e.dataset.gutter="";const t=document.createElement("div");return t.dataset.content="",this.code.appendChild(e),this.code.appendChild(t),this.gutterElement=e,this.contentElement=t,{gutter:e,content:t}}updateRowSpan(){null!=this.gutterElement&&(this.gutterElement.style.gridRow=`span ${this.currentRowCount}`),null!=this.contentElement&&(this.contentElement.style.gridRow=`span ${this.currentRowCount}`)}createLine(){const e=this.currentLineIndex,t=""+(e-1),n=document.createElement("div");n.dataset.columnNumber=`${e}`,n.dataset.lineType="context",n.dataset.lineIndex=t;const i=document.createElement("span");i.dataset.lineNumberContent="",i.textContent=`${e}`,n.appendChild(i);const o=document.createElement("div");return o.dataset.line=`${e}`,o.dataset.lineType="context",o.dataset.lineIndex=t,this.currentRowCount+=1,this.updateRowSpan(),this.currentLineElement=o,{gutterLine:n,contentLine:o}}getOrCreateFileContainer(e){return null!=e&&e===this.fileContainer||null==e&&null!=this.fileContainer||(null!=this.fileContainer&&null!=e&&e!==this.fileContainer&&(this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0),this.fileContainer=null!=e?e:document.createElement("diffs-container")),this.fileContainer}applyThemeState(e,t,n,i){var o,r,l,s;const a=null!=(o=e.shadowRoot)?o:e.attachShadow({mode:"open"}),d=null!=i?i:n,h=null!=(r=this.options.theme)?r:O,u="string"==typeof h?h:m({},h),c=fo(a);(null==(l=this.themeCSSStyle)?void 0:l.parentNode)!==a||(null==(s=this.appliedThemeCSS)?void 0:s.themeStyles)!==t||this.appliedThemeCSS.themeType!==d||this.appliedThemeCSS.scrollbarGutter!==c?(this.themeCSSStyle=Eo({shadowRoot:a,currentNode:this.themeCSSStyle,themeCSS:yo(t,d,c)}),this.appliedThemeCSS=null!=this.themeCSSStyle?{theme:u,themeStyles:t,themeType:d,baseThemeType:i,scrollbarGutter:c}:void 0):this.appliedThemeCSS.theme=u}},exports.GIT_DIFF_FILE_BREAK_REGEX=w,exports.HEADER_METADATA_SLOT_ID=P,exports.HEADER_PREFIX_SLOT_ID=H,exports.HUNK_HEADER=T,exports.INDEX_LINE_METADATA=M,exports.InteractionManager=Vt,exports.MERGE_CONFLICT_BASE_MARKER_REGEX=/^\|{7,}(?:\s.*)?$/,exports.MERGE_CONFLICT_END_MARKER_REGEX=/^>{7,}(?:\s.*)?$/,exports.MERGE_CONFLICT_SEPARATOR_MARKER_REGEX=/^={7,}$/,exports.MERGE_CONFLICT_START_MARKER_REGEX=/^<{7,}(?:\s.*)?$/,exports.RegisteredCustomLanguages=un,exports.ResizeManager=on,exports.ResolvedLanguages=dn,exports.ResolvingLanguages=hn,exports.SPLIT_WITH_NEWLINES=E,exports.SVGSpriteSheet=io,exports.ScrollSyncManager=Lr,exports.ShikiStreamTokenizer=_l,exports.THEME_CSS_ATTRIBUTE=N,exports.UNIFIED_DIFF_FILE_BREAK_REGEX=/(?=^---\s+\S)/gm,exports.UNSAFE_CSS_ATTRIBUTE=F,exports.UnresolvedFile=class extends hl{constructor(e={theme:O},t,n=!1){super(void 0,t,n),S(this,"options"),S(this,"__id","unresolved-file:"+ ++Rs),S(this,"type","unresolved-file"),S(this,"computedCache",{file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0}),S(this,"conflictActions",[]),S(this,"markerRows",[]),S(this,"conflictActionCache",new Map),S(this,"handleMergeConflictActionClick",e=>{const t=this.conflictActions[e.conflictIndex];if(null==t)return;if(t.conflictIndex!==e.conflictIndex)throw console.error({conflictIndex:e.conflictIndex,action:t}),new Error("UnresolvedFile.handleMergeConflictActionClick: conflictIndex and conflictAction don't match");const n={resolution:e.resolution,conflict:t.conflict};null==this.options.onMergeConflictAction?this.resolveConflictAndRender(e.conflictIndex,e.resolution):this.options.onMergeConflictAction(n,this)}),this.options=e,this.setOptions(e)}setOptions(e){if(null!=e){if(null!=e.onMergeConflictAction&&null!=e.onMergeConflictResolve)throw new Error("UnresolvedFile: onMergeConflictAction and onMergeConflictResolve are mutually exclusive. Use only one callback.");this.options=e,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions()}}syncInteractionOptions(){var e;this.interactionManager.setOptions(_t(this.options,"function"==typeof this.options.hunkSeparators||"line-info"===(null!=(e=this.options.hunkSeparators)?e:"line-info")||"line-info-basic"===this.options.hunkSeparators?this.handleExpandHunk:void 0,this.getLineIndex,this.handleMergeConflictActionClick))}createHunksRenderer(e){return new xs(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getHunksRendererOptions(e){return Ps(e,this.options)}applyPreNodeAttributes(e,t){super.applyPreNodeAttributes(e,t,{"data-has-merge-conflict":""})}cleanUp(){this.emitPostRender(!0),this.clearMergeConflictActionCache(),this.computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0},this.conflictActions=[],super.cleanUp()}getOrComputeDiff({file:e,fileDiff:t,actions:n,markerRows:i}){var o;const{maxContextLines:r,onMergeConflictAction:l}=this.options;e:{if(null!=l){const o=null!=t;if(o!==(null!=n)||o!==(null!=i))throw new Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows must be passed together");if(null!=t&&null!=n&&null!=i){this.computedCache={file:null!=e?e:this.computedCache.file,fileDiff:t,actions:n,markerRows:i};break e}if(null!=e||null!=this.computedCache.file){if(null!=e&&null!=this.computedCache.file&&!li(e,this.computedCache.file)&&null!=this.computedCache.fileDiff&&null!=this.computedCache.actions)throw new Error("UnresolvedFile.getOrComputeDiff: file can only be used to initialize unresolved state once. Pass fileDiff and actions for subsequent updates.");if(null!=e||(e=this.computedCache.file),null==e)throw new Error("UnresolvedFile.getOrComputeDiff: file is null, should be impossible");if(!li(e,this.computedCache.file)||null==this.computedCache.fileDiff||null==this.computedCache.actions){const t=rs(e,r);this.computedCache={file:e,fileDiff:t.fileDiff,actions:t.actions,markerRows:t.markerRows}}t=this.computedCache.fileDiff,n=this.computedCache.actions,i=this.computedCache.markerRows;break e}t=this.computedCache.fileDiff,n=this.computedCache.actions,i=this.computedCache.markerRows;break e}if(null!=t||null!=n||null!=i)throw new Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows are only usable in controlled mode, you must pass in `onMergeConflictAction`");if(null!=e&&null!=this.computedCache.file&&!li(e,this.computedCache.file))throw new Error("UnresolvedFile.getOrComputeDiff: uncontrolled unresolved files parse the file only once. Later updates must come from the cached diff state.");if(null!=(o=this.computedCache).file||(o.file=e),null==this.computedCache.fileDiff&&null!=this.computedCache.file){const e=rs(this.computedCache.file,r);this.computedCache.fileDiff=e.fileDiff,this.computedCache.actions=e.actions,this.computedCache.markerRows=e.markerRows}t=this.computedCache.fileDiff,n=this.computedCache.actions,i=this.computedCache.markerRows}if(null!=t&&null!=n&&null!=i)return{fileDiff:t,actions:n,markerRows:i}}hydrate(e){const{file:t,fileDiff:n,actions:i,markerRows:o,lineAnnotations:r,fileContainer:l,prerenderedHTML:s,preventEmit:a=!1}=e,d=this.getOrComputeDiff({file:t,fileDiff:n,actions:i,markerRows:o});null!=d&&(this.hydrateElements(l,s),this.setActiveMergeConflictState(d.actions,d.markerRows),function(e,t,n=!1){return!n&&null==e&&null!=t}(this.pre,d.fileDiff,this.options.collapsed)||function(e,t,n=!1){return null==e&&null!=t&&!n}(this.headerElement,d.fileDiff,this.options.disableFileHeader)?this.render(v(m({},e),{preventEmit:!0})):(this.hydrationSetup({fileDiff:d.fileDiff,lineAnnotations:r}),null!=this.pre&&this.renderMergeConflictActionSlots()),a||this.emitPostRender())}rerender(){this.enabled&&null!=this.fileDiff&&this.render({forceRender:!0,renderRange:this.renderRange})}render(e={}){const t=e,{file:n,fileDiff:i,actions:o,markerRows:r,lineAnnotations:l,preventEmit:s=!1}=t,a=b(t,["file","fileDiff","actions","markerRows","lineAnnotations","preventEmit"]),d=this.getOrComputeDiff({file:n,fileDiff:i,actions:o,markerRows:r});if(null==d)return!1;this.setActiveMergeConflictState(d.actions,d.markerRows);const h=super.render(v(m({},a),{fileDiff:d.fileDiff,lineAnnotations:l,preventEmit:!0}));return h&&(this.renderMergeConflictActionSlots(),s||this.emitPostRender()),h}resolveConflict(e,t,n=this.computedCache.fileDiff){const i=this.conflictActions[e];if(null==n||null==i)return;if(i.conflictIndex!==e)throw console.error({conflictIndex:e,action:i}),new Error("UnresolvedFile.resolveConflict: conflictIndex and conflictAction don't match");const o=ts(n,i,t),r=this.computedCache.file,{file:l,actions:s,markerRows:a}=function({fileDiff:e,previousActions:t,resolvedConflictIndex:n,previousFile:i,resolution:o}){const r=t[n];if(null==r)throw new Error("rebuildFileAndActions: missing resolved action for unresolved file rebuild");const l=function(e,t,n,i){const o=function(e,t){var n;const i=(null!=(n=e.baseMarkerLineIndex)?n:e.separatorLineIndex)-e.startLineIndex-1,o=e.endLineIndex-e.separatorLineIndex-1;return("current"===t?i:"incoming"===t?o:i+o)-(e.endLineIndex-e.startLineIndex+1)}(n.conflict,i);return e.map((e,i)=>{if(i!==t&&null!=e)return e.conflict.startLineIndex>n.conflict.endLineIndex?v(m({},e),{conflict:Hs(e.conflict,o)}):e})}(t,n,r,o),s=bs(e,l);return{file:Ms({fileDiff:e,resolvedAction:r,resolvedConflictIndex:n,previousFile:i,resolution:o}),actions:l,markerRows:s}}({fileDiff:o,previousActions:this.conflictActions,resolvedConflictIndex:e,previousFile:r,resolution:t});return{file:l,fileDiff:o,actions:s,markerRows:a}}resolveConflictAndRender(e,t){var n,i,o;const r=this.conflictActions[e];if(null==r)return;if(r.conflictIndex!==e)throw console.error({conflictIndex:e,action:r}),new Error("UnresolvedFile.resolveConflictAndRender: conflictIndex and conflictAction don't match");const l={resolution:t,conflict:r.conflict},{file:s,fileDiff:a,actions:d,markerRows:h}=null!=(n=this.resolveConflict(e,t))?n:{};null!=s&&null!=a&&null!=d&&null!=h&&(this.computedCache={file:s,fileDiff:a,actions:d,markerRows:h},this.setActiveMergeConflictState(d,h),null!=this.workerManager?this.hunksRenderer.renderDiff(a):this.render({forceRender:!0}),null==(o=(i=this.options).onMergeConflictResolve)||o.call(i,s,l))}setActiveMergeConflictState(e=this.conflictActions,t=this.markerRows){this.conflictActions=e,this.markerRows=t,null!=this.computedCache.fileDiff&&this.hunksRenderer instanceof xs&&this.hunksRenderer.setConflictState("none"===this.options.mergeConflictActionsType?[]:e,t,this.computedCache.fileDiff)}renderMergeConflictActionSlots(){const{fileDiff:e}=this.computedCache;if(this.isContainerManaged||null==this.fileContainer||"function"!=typeof this.options.mergeConflictActionsType||0===this.conflictActions.length||null==e)return void this.clearMergeConflictActionCache();const t=new Map(this.conflictActionCache);for(let n=0;n<this.conflictActions.length;n++){const i=this.conflictActions[n];if(null==i)continue;if(i.conflictIndex!==n)throw console.error({conflictIndex:n,action:i}),new Error("UnresolvedFile.renderMergeConflictActionSlots: conflictIndex and conflictAction don't match");const o=os(i,e);if(null==o)continue;const r=i.conflictIndex,l=is({hunkIndex:o.hunkIndex,lineIndex:o.lineIndex,conflictIndex:r}),s=`${n}-${l}`;let a=this.conflictActionCache.get(s);if(null==a||!As(a.action,i)){null==a||a.element.remove();const e=this.renderMergeConflictAction(i);if(null==e)continue;const t=so(l);t.appendChild(e),this.fileContainer.appendChild(t),a={element:t,action:i},this.conflictActionCache.set(s,a)}t.delete(s)}for(const[n,{element:i}]of t.entries())this.conflictActionCache.delete(n),i.remove()}renderMergeConflictAction(e){if("function"!=typeof this.options.mergeConflictActionsType)return;const t=this.options.mergeConflictActionsType(e,this);if(null!=t){if(t instanceof HTMLElement)return t;if("undefined"!=typeof DocumentFragment&&t instanceof DocumentFragment){const e=document.createElement("div");return e.style.display="contents",e.appendChild(t),e}}}clearMergeConflictActionCache(){for(const{element:e}of this.conflictActionCache.values())e.remove();this.conflictActionCache.clear()}},exports.VirtualizedFile=Oo,exports.VirtualizedFileDiff=gl,exports.Virtualizer=Us,exports.areDiffLineAnnotationsEqual=sl,exports.areDiffRenderOptionsEqual=wr,exports.areDiffTargetsEqual=Fo,exports.areFileRenderOptionsEqual=ri,exports.areFilesEqual=li,exports.areHunkDataEqual=al,exports.areLanguagesAttached=fn,exports.areLineAnnotationsEqual=oo,exports.areObjectsEqual=ee,exports.areOptionsEqual=ne,exports.arePrePropertiesEqual=ro,exports.areRenderRangesEqual=si,exports.areSelectionsEqual=oe,exports.areThemesAttached=ii,exports.areThemesEqual=te,exports.areVirtualWindowSpecsEqual=Ds,exports.areWorkerStatsEqual=function(e,t){return null==e||null==t?e===t:e.busyWorkers===t.busyWorkers&&e.diffCacheSize===t.diffCacheSize&&e.fileCacheSize===t.fileCacheSize&&e.managerState===t.managerState&&e.activeTasks===t.activeTasks&&e.queuedTasks===t.queuedTasks&&e.themeSubscribers===t.themeSubscribers&&e.totalWorkers===t.totalWorkers&&e.workersFailed===t.workersFailed},exports.attachResolvedLanguages=pn,exports.attachResolvedThemes=En,exports.cleanLastNewline=Ci,exports.cleanUpResolvedLanguages=gn,exports.cleanUpResolvedThemes=In,exports.createAnnotationElement=ai,exports.createAnnotationWrapperNode=so,exports.createDiffSpanDecoration=Pr,exports.createEmptyRowBuffer=Tr,exports.createFileHeaderElement=hi,exports.createGutterGap=fe,exports.createGutterItem=ce,exports.createGutterUtilityContentNode=ao,exports.createGutterUtilityElement=pe,exports.createGutterWrapper=ue,exports.createHastElement=ae,exports.createIconElement=de,exports.createNoNewlineElement=Er,exports.createPreElement=fi,exports.createPreWrapperProperties=pi,exports.createRowNodes=function(e){const t=document.createElement("div");t.dataset.line=`${e}`;const n=document.createElement("div");n.dataset.columnNumber="",n.textContent=`${e}`;const i=document.createElement("div");return i.dataset.columnContent="",t.appendChild(n),t.appendChild(i),{row:t,content:i}},exports.createSeparator=Ar,exports.createSpanFromToken=Wl,exports.createStyleElement=function(e,t=!1){return ae({tagName:"style",children:[se(t?bo(e):So(e))],properties:{[z]:t?"":void 0,[F]:t?void 0:""}})},exports.createTextNodeElement=se,exports.createThemeStyleElement=function(e){return ae({tagName:"style",children:[se(e)],properties:{[N]:""}})},exports.createTransformerWithState=Ii,exports.createUnsafeCSSStyleNode=ho,exports.createWindowFromScrollPosition=re,exports.dequeueRender=Z,exports.detachString=_o,exports.diffAcceptRejectHunk=function(e,t,n){const i=e.hunks[t];if(null==i)throw console.error({hunkIndex:t,diff:e}),new Error("diffAcceptRejectHunk: Invalid hunk index");return Kl(e,m({resolution:es(n),hunkIndex:t},"object"==typeof n?{startContentIndex:n.changeIndex,endContentIndex:n.changeIndex}:{startContentIndex:0,endContentIndex:Math.max(0,(null!=(o=i.hunkContent.length)?o:1)-1)}));var o},exports.disposeHighlighter=function(){return y(this,null,function*(){null!=Zn&&((yield Zn).dispose(),gn(),In(),Zn=void 0)})},exports.findCodeElement=he,exports.formatCSSVariablePrefix=Mi,exports.getCustomExtensionsMap=function(){return Object.fromEntries(gi)},exports.getCustomExtensionsVersion=function(){return mi},exports.getFiletypeFromFileName=bi,exports.getHighlighterIfLoaded=ei,exports.getHighlighterOptions=yi,exports.getHighlighterThemeStyles=Bi,exports.getHunkSeparatorSlotName=Rr,exports.getIconForType=di,exports.getLineAnnotationName=xi,exports.getLineEndingType=function(e){return e.includes("\r\n")?"CRLF":e.includes("\r")?"CR":e.includes("\n")?"LF":"none"},exports.getLineNodes=$i,exports.getOrCreateCodeNode=Co,exports.getResolvedLanguages=function(e){const t=[];for(const n of e){const e=dn.get(n);if(null==e)throw new Error(`getResolvedLanguages: ${n} is not resolved. Please resolve languages before calling getResolvedLanguages`);t.push(e)}return t},exports.getResolvedOrResolveLanguage=bn,exports.getResolvedOrResolveTheme=Jn,exports.getResolvedThemes=function(e){return Tn.getResolvedThemes(e)},exports.getSharedHighlighter=Qn,exports.getSingularPatch=function(e){const t=Ko(e);if(1!==t.length)throw console.error(t),new Error("PatchDiff: Provided patch must include only 1 patch, with 1 diff");const{files:n}=t[0];if(1!==n.length)throw console.error(n),new Error("FileDiff: Provided patch must contain exactly 1 file diff");return n[0]},exports.getThemes=ni,exports.getTotalLineCountFromHunks=Mr,exports.getUnresolvedDiffHunksRendererOptions=Ps,exports.hasResolvedLanguages=function(e){for(const t of Array.isArray(e)?e:[e])if(!dn.has(t))return!1;return!0},exports.hasResolvedThemes=oi,exports.isDefaultRenderRange=Hr,exports.isHighlighterLoaded=function(e=Zn){return null!=e&&!("then"in e)},exports.isHighlighterLoading=ti,exports.isHighlighterNull=function(e=Zn){return null==e},exports.isWorkerContext=mn,exports.parseDiffFromFile=kr,exports.parseLineType=function(e){const t=e[0];if("+"!==t&&"-"!==t&&" "!==t&&"\\"!==t)return void console.error(`parseLineType: Invalid firstChar: "${t}", full line: "${e}"`);const n=e.substring(1);return{line:""===n?"\n":n,type:" "===t?"context":"\\"===t?"metadata":"+"===t?"addition":"deletion"}},exports.parsePatchFiles=Ko,exports.patchScrollbarGutterSize=xo,exports.pluckInteractionOptions=_t,exports.prefersReducedMotion=le,exports.preloadHighlighter=function(e){return y(this,null,function*(){yield Qn(e)})},exports.prerenderHTMLIfNecessary=ko,exports.processFile=Wo,exports.processLine=ki,exports.processPatch=qo,exports.pushOrJoinSpan=Dr,exports.queueRender=J,exports.registerCustomCSSVariableTheme=function(e,t,n=!1){const i=x.createCssVariablesTheme({name:e,variablePrefix:Mi("global"),variableDefaults:t,fontStyle:n});js(e,()=>Promise.resolve(i))},exports.registerCustomLanguage=function(e,t,n=[]){if("text"===e||"ansi"===e)throw new Error("registerCustomLanguage: 'text' and 'ansi' are reserved language names");if(un.has(e))console.error(`registerCustomLanguage: lang: ${e} is already registered`);else{un.set(e,t);for(const t of n)Si(t,e)}},exports.registerCustomTheme=js,exports.releaseStringDetachBuffer=Vo,exports.renderDiffWithHighlighter=Gr,exports.renderFileWithHighlighter=Wi,exports.replaceCustomExtensions=function(e,t){if(e<=mi)return!1;gi.clear();for(const n in t){const e=t[n];null!=e&&gi.set(n,e)}return mi=e,!0},exports.resolveConflict=ts,exports.resolveLanguage=vn,exports.resolveLanguages=function(e){return y(this,null,function*(){var t;const n=[],i=[];for(const o of e){if("text"===o||"ansi"===o)continue;const e=null!=(t=bn(o))?t:vn(o);"then"in e?i.push(e):n.push(e)}return i.length>0&&(yield Promise.all(i).then(e=>{for(const t of e){if(null==t)throw new Error("resolvedLanguages: unable to resolve language");n.push(t)}})),n})},exports.resolveRegion=Kl,exports.resolveTheme=Yn,exports.resolveThemes=function(e){return y(this,null,function*(){for(const n of e)Kn(n);const t=yield Tn.resolveThemes(e);for(let n=0;n<e.length;n++)Xn(e[n],t[n]);return t})},exports.setCustomExtension=Si,exports.setLanguageOverride=function(e,t){return v(m({},e),{lang:t})},exports.setPreNodeProperties=Lo,exports.trimPatchContext=function(e,t=10){var n,i;const o=[];let r;for(const s of e.split("\n")){const e=s.match(T);if(null!=e){null!=r&&(r.hunkLines.length>0&&($s(r,t,"trailing"),Vs(r,o)),r=void 0);const l=parseInt(e[3]),a=parseInt(e[1]),d=parseInt(null!=(n=e[4])?n:"1"),h=parseInt(null!=(i=e[2])?i:"1");isNaN(l)||isNaN(a)||isNaN(d)||isNaN(h)?o.push(s):r={additionStart:l,deletionStart:a,additionCount:0,deletionCount:0,hunkLines:[],contextLines:[]};continue}if(null!=r){if(s.startsWith(" "))r.contextLines.push(s);else if(""!==s){if(r.hunkLines.length>0&&r.contextLines.length>2*t){const e=r.contextLines.length-2*t,n=r.contextLines.slice(-t);$s(r,t,"trailing");const{additionCount:i,deletionCount:l}=r;Vs(r,o),r={additionStart:r.additionStart+i+e,deletionStart:r.deletionStart+l+e,deletionCount:0,additionCount:0,contextLines:n,hunkLines:[]}}$s(r,t,0===r.hunkLines.length?"leading":"before-change"),r.hunkLines.push(s),s.startsWith("+")?r.additionCount+=1:s.startsWith("-")&&(r.deletionCount+=1)}}else o.push(s)}null!=r&&r.hunkLines.length>0&&($s(r,t,"trailing"),Vs(r,o));const l=o.join("\n");return e.endsWith("\n")?`${l}\n`:l},exports.wrapCoreCSS=bo,exports.wrapThemeCSS=yo,exports.wrapUnsafeCSS=So;
|