@fungi.computer/inkcap 0.2.3 → 0.2.4
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.
|
@@ -0,0 +1,2078 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./angular-html-B8mrqUL5.js","./rolldown-runtime-hePW80VL.js","./html-XwrE-1r6.js","./javascript-obGGvMPs.js","./css-CNuuLpMC.js","./angular-ts-Bzix210W.js","./scss-YesllqfO.js","./apl-Dhin1L29.js","./xml-BlnrEAEy.js","./java-DdHNQ9hk.js","./json-DAgxKhMr.js","./astro-B-4NNgOP.js","./typescript-BydbNFcO.js","./postcss-BXeXVLqQ.js","./tsx-CUOciP0b.js","./blade-C6Gedziy.js","./html-derivative-i4STDFnl.js","./sql-DdD7vxS4.js","./bsl-_VjlB9mv.js","./sdbl-bTVj8UrX.js","./c-iCihek07.js","./cairo-DLTphjLi.js","./python-gzcpVVnB.js","./chapel-DmtgEXO_.js","./cobol-Cw2-KvLW.js","./coffee-CiiSLhB6.js","./cpp-71xkOQct.js","./regexp-DR20uMnK.js","./glsl-D5MA2a_X.js","./crystal-DGPAtLeY.js","./shellscript-Da78Ox-3.js","./edge-DCY0a-ow.js","./elixir-DP304Xio.js","./elm-o4NJxfws.js","./erb-C7MPl934.js","./ruby-B8JcIHv0.js","./haml-CwEpbK1d.js","./graphql-Ctjuxyvl.js","./jsx-gTgmArGx.js","./lua-FONpmTUP.js","./yaml-Du_6cdrH.js","./erlang-Cphh6RMH.js","./markdown-BYOwaDjH.js","./fortran-fixed-form-DEKoE2YW.js","./fortran-free-form-CYNrtFtB.js","./fsharp-D13ZGOAj.js","./gdresource-xMC7jr7x.js","./gdshader-CBce3t8t.js","./gdscript-DYvRD3hg.js","./git-commit-BSykSTBG.js","./diff-woXpYk--.js","./git-rebase-BDPpS8w6.js","./glimmer-js-BONyzAsu.js","./glimmer-ts-f9c0GCOe.js","./hack-Dh_ZLRbs.js","./handlebars-ryMP1rBR.js","./http-kmH8AyfE.js","./hurl-DCZHXKU4.js","./csv-Dx-8-gkx.js","./hxml-Dcm88srW.js","./haxe-C8oCnwJJ.js","./jinja-B-tLrNsM.js","./jison-CBjhYtSs.js","./julia-CXJVy74_.js","./r-BHcO8Vjq.js","./just-B9Xn_Dp4.js","./perl-DEgXgjuC.js","./latex-o9DRzaEe.js","./tex-BK-H2Wn4.js","./liquid-G0MH4h_m.js","./marko-DV5GrDmo.js","./less-DVTAwKKz.js","./mdc-BKfPFPZw.js","./nextflow-BJtWHP5T.js","./nextflow-groovy-DJMQeKeT.js","./nginx-BTMw9COX.js","./nim-B6yJ_yaC.js","./org-Ddi8Gs6E.js","./clojure-DqKBuwfJ.js","./csharp-oqKa8noW.js","./dart-CnvKMtbv.js","./docker-IyjqRm3v.js","./go-rLFTqkRN.js","./groovy-CacY0gHj.js","./ini-B5eOa1yu.js","./make-Dixweg8N.js","./objective-c-D1A_Heim.js","./ocaml-O90oeIOV.js","./php-B9UPq-vz.js","./vb-DOwzaHZ0.js","./raku-B3gFvitq.js","./rust-Cfkwpbl8.js","./scala-BiFt_7mu.js","./zig-CMLA9XwU.js","./xsl-BOPS8gLt.js","./pug-DkgDHZci.js","./qml-_a-QhfPD.js","./razor-BMJ0eI3p.js","./rst-BQCbfb9V.js","./cmake-Bj61d0ZC.js","./sas-CBpMWA2M.js","./shaderlab-TOUzSsQk.js","./hlsl-Cvrh5tZx.js","./shellsession-CVsQGYfZ.js","./soy-DEd-qcad.js","./sparql-D_iOobhT.js","./turtle-ByJddavk.js","./stata-CMv7m7Gi.js","./surrealql-BZoq2lXR.js","./svelte-Bj3Hmc9F.js","./templ-TjxbArHn.js","./ts-tags-Cc5do7zu.js","./twig-BVSnuTf-.js","./typst-C40W_gC6.js","./bat-qdxAdBWQ.js","./bibtex-Ci_nEsc7.js","./jsonc-CYpm1nAK.js","./log-BNLmms1o.js","./powershell-CCSX75yM.js","./swift-CyEgAFGc.js","./system-verilog-Dh5ihWbf.js","./verilog-B2gwz-sJ.js","./vue-BNQF7r6F.js","./vue-html-DkKkQnZL.js","./vue-vine-DFaKYU4X.js","./stylus-B6D30XZt.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{$t as n,A as r,Bn as i,C as a,Dn as o,E as s,Et as c,Fn as l,Ft as u,Gt as d,I as f,In as p,Jt as m,Ln as h,Lr as g,M as _,Mn as v,N as y,Qt as b,R as x,Rn as S,Rr as C,St as w,T,Tt as E,Vn as D,X as O,Xt as k,Yt as ee,_ as A,a as j,b as te,ct as ne,en as re,ht as ie,i as ae,j as oe,kn as se,l as ce,lt as le,n as ue,o as de,q as fe,r as pe,rt as me,s as he,st as ge,t as _e,u as ve,v as ye,vt as be,w as xe,xt as Se,y as Ce,zn as we}from"./dialog-jssrzu-h.js";import{_ as Te,a as Ee,g as De,h as Oe,m as ke,p as Ae,r as je,t as Me,w as Ne}from"./useForm-JWOEk10W.js";import{b as Pe,h as Fe,l as Ie,o as Le,r as M,u as Re,y as ze}from"./index-vhv6oHyQ.js";var Be=S(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),Ve=S(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),He=S(`SaveAll`,[[`path`,{d:`M10 2v3a1 1 0 0 0 1 1h5`,key:`1xspal`}],[`path`,{d:`M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6`,key:`1ra60u`}],[`path`,{d:`M18 22H4a2 2 0 0 1-2-2V6`,key:`pblm9e`}],[`path`,{d:`M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z`,key:`1yve0x`}]]),Ue=S(`Save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),N=t(C(),1);function We(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,(!i||c)&&(d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function Ge(e){return e!=null&&e.clientX!=null}function Ke(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=e.useState(`open`),a=e.useState(`floatingElement`),o=e.useState(`domReferenceElement`),s=e.context.dataRef,l=N.useRef(!1),d=N.useRef(null),[f,p]=N.useState(),[m,h]=N.useState([]),g=c(t=>{e.set(`positionReference`,t)}),_=c((t,n,i)=>{l.current||s.current.openEvent&&!Ge(s.current.openEvent)||e.set(`positionReference`,We(i??o,{x:t,y:n,axis:r,dataRef:s,pointerType:f}))}),v=c(e=>{i?d.current||(_(e.clientX,e.clientY,e.currentTarget),h([])):_(e.clientX,e.clientY,e.currentTarget)}),y=le(f)?a:i;N.useEffect(()=>{if(!n){g(o);return}if(!y)return;function e(){d.current?.(),d.current=null}let t=u(a);function r(t){let n=ne(t);ge(a,n)?e():_(t.clientX,t.clientY)}return!s.current.openEvent||Ge(s.current.openEvent)?d.current=me(t,`mousemove`,r):g(o),e},[y,n,a,s,o,e,_,g,m]),N.useEffect(()=>()=>{e.set(`positionReference`,null)},[e]),N.useEffect(()=>{n&&!a&&(l.current=!1)},[n,a]),N.useEffect(()=>{!n&&i&&(l.current=!0)},[n,i]);let b=N.useMemo(()=>{function e(e){p(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:v,onMouseEnter:v}},[v]);return N.useMemo(()=>n?{reference:b,trigger:b}:{},[n,b])}function qe(e){let t=(0,N.useRef)(e);return(0,N.useInsertionEffect)(()=>void(t.current=e)),(0,N.useCallback)((...e)=>t.current(...e),[])}var P=g(),Je=(0,N.createContext)(void 0);function Ye({children:e,createEditor:t}){let n=(0,N.useRef)(new WeakMap),r=qe(e=>{let r=n.current.get(e);if(r!=null)return r;let i=t(e);return n.current.set(e,i),i});return(0,P.jsx)(Je.Provider,{value:r,children:e})}function Xe(){return(0,N.useContext)(Je)}var Ze={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},Qe={display:`contents`};function $e(){return null}var et=`diffs-container`,tt=/(?=^diff --git)/gm,nt=/(?<=\n)/,rt=/^(---|\+\+\+)\s+([^\t\r\n]+)/,it=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,at=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,ot=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,st=`header-prefix`,ct=`header-filename-suffix`,lt=`header-metadata`,ut=`header-custom`,F={dark:`pierre-dark`,light:`pierre-light`},dt=`data-theme-css`,ft=`data-unsafe-css`,pt=`data-diffs-scrollbar-measure`,mt=`--diffs-scrollbar-gutter-measured`,ht=1e5,gt={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8};({...gt});var _t=Object.freeze({fromStart:0,fromEnd:0}),vt={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},yt={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function bt(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function xt({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function St(e,t){return e-(t===0?0:1)}function Ct(e,t){return St(e,t)+t}function wt(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:Tt(n,e.startContentIndex)}}function Tt(e,t){let n=e.unifiedLineStart;for(let r=0;r<t;r++){let t=e.hunkContent[r];n+=t.type===`context`?t.lines:t.deletions+t.additions}return n}function Et({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,renderGutterUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d}){let f=n?.(e),p=r?.(e),m=i?.(e),h=a?.(e);return(0,P.jsxs)(P.Fragment,{children:[f==null?(0,P.jsxs)(P.Fragment,{children:[p!=null&&(0,P.jsx)(`div`,{slot:`header-prefix`,children:p}),m!=null&&(0,P.jsx)(`div`,{slot:`header-filename-suffix`,children:m}),h!=null&&(0,P.jsx)(`div`,{slot:`header-metadata`,children:h})]}):(0,P.jsx)(`div`,{slot:ut,children:f}),o!=null&&l?.map((e,t)=>(0,P.jsx)(`div`,{slot:bt(e),children:o(e)},t)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=Dt(t,e);return(0,P.jsx)(`div`,{slot:n,style:Qe,children:c(t,d)},n)}),s!=null&&(0,P.jsx)(`div`,{slot:`gutter-utility-slot`,style:Ze,children:s(u)})]})}function Dt(e,t){let n=wt(e,t);return n==null?void 0:xt({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}function Ot({file:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderFilenameSuffix:r,renderHeaderMetadata:i,renderAnnotation:a,lineAnnotations:o,renderGutterUtility:s,getHoveredLine:c}){let l=t?.(e),u=n?.(e),d=r?.(e),f=i?.(e);return(0,P.jsxs)(P.Fragment,{children:[l==null?(0,P.jsxs)(P.Fragment,{children:[u!=null&&(0,P.jsx)(`div`,{slot:`header-prefix`,children:u}),d!=null&&(0,P.jsx)(`div`,{slot:`header-filename-suffix`,children:d}),f!=null&&(0,P.jsx)(`div`,{slot:`header-metadata`,children:f})]}):(0,P.jsx)(`div`,{slot:ut,children:l}),a!=null&&o?.map((e,t)=>(0,P.jsx)(`div`,{slot:bt(e),children:a(e)},t)),s!=null&&(0,P.jsx)(`div`,{slot:`gutter-utility-slot`,style:Ze,children:s(c)})]})}function kt(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function At(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}var jt=new Set;function Mt(e){let t=[],n=new Set;for(let r of Nt(e.themes)){let e=It(r)?r.getThemes():[r];for(let r of e){if(n.has(r.name))throw Error(`Theme collection already contains theme "${r.name}"`);n.add(r.name),t.push(r)}}let r=Object.freeze([...t]),i=Object.freeze(r.filter(e=>e.colorScheme===`light`)),a=Object.freeze(r.filter(e=>e.colorScheme===`dark`)),o=new Map(r.map(e=>[e.name,e])),s=Object.freeze(r.map(e=>e.name)),c=Object.freeze(i.map(e=>e.name)),l=Object.freeze(a.map(e=>e.name));function u(e){if(e==null)return r;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?i:t===`dark`?a:r:r.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return o.get(e)},getThemes(e){return u(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?c:e?.colorScheme===`dark`?l:s:u(e).map(e=>e.name)},hasTheme(e){return o.has(e)},orderBy(e){return Mt({themes:r.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],n=new Set;for(let r of e){if(n.has(r))throw Error(`Theme collection pick already includes theme "${r}"`);n.add(r);let e=o.get(r);if(e==null)throw Error(`Theme collection does not contain theme "${r}"`);t.push(e)}return Mt({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function Nt(e){return Pt(e)?[e]:e}function Pt(e){return It(e)||Ft(e)}function Ft(e){return typeof e.name==`string`&&typeof e.load==`function`}function It(e){return typeof e.getThemes==`function`}function Lt(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var Rt=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},zt=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},Bt=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function Vt(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new Rt(t);e.set(t,n)}function a(t,n){return!e.has(t)&&(e.set(t,n),!0)}function o(t){return e.has(t)}function s(i){let a=t.get(i);if(a!==void 0)return Promise.resolve(a);let o=n.get(i);if(o!==void 0)return o;let s=e.get(i);if(s===void 0)return Promise.reject(new zt(i));let c=r,l=s().then(e=>{let a=Lt(e);return c===r&&t.set(i,a),n.get(i)===l&&n.delete(i),a}).catch(e=>{throw n.get(i)===l&&n.delete(i),e});return n.set(i,l),l}function c(e){return Promise.all(e.map(e=>s(e)))}function l(e,n){t.set(e,n)}function u(e){for(let[t,n]of e)l(t,n)}function d(e){return t.get(e)}function f(e){let n=[];for(let r of e){let e=t.get(r);if(e===void 0)throw new Bt(r);n.push(e)}return n}function p(e){return t.has(e)}function m(e){for(let n of e)if(!t.has(n))return!1;return!0}function h(e){let n=t.get(e);return n===void 0?s(e):n}function g(){r++,t.clear(),n.clear()}return{clearResolvedThemes:g,getResolvedOrResolveTheme:h,getResolvedTheme:d,getResolvedThemes:f,hasRegisteredTheme:o,hasResolvedTheme:p,hasResolvedThemes:m,registerTheme:i,registerThemeIfAbsent:a,resolveTheme:s,resolveThemes:c,seedResolvedTheme:l,seedResolvedThemes:u}}var Ht=Vt();function Ut(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=Ht.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,Ht.getResolvedTheme(n)??Ht.seedResolvedTheme(n,e);jt.has(n)||(jt.add(n),t.loadThemeSync(e))}}var Wt=new Map,Gt=new Map,Kt=new Map,qt=new Set;function Jt(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(qt.has(n.name))continue;let e=Wt.get(n.name);e??(e=n,Wt.set(n.name,e)),qt.add(e.name),t.loadLanguageSync(e.data)}}function Yt(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var Xt=Object.defineProperty,Zt=Object.getOwnPropertyDescriptor,Qt=Object.getOwnPropertyNames,$t=Object.prototype.hasOwnProperty,en=(e,t)=>{let n={};for(var r in e)Xt(n,r,{get:e[r],enumerable:!0});return t||Xt(n,Symbol.toStringTag,{value:`Module`}),n},tn=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Qt(t),a=0,o=i.length,s;a<o;a++)s=i[a],!$t.call(e,s)&&s!==n&&Xt(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Zt(t,s))||r.enumerable});return e},nn=(e,t,n)=>(tn(e,t,`default`),n&&tn(n,t,`default`)),rn=[{id:`abap`,name:`ABAP`,import:(()=>M(()=>import(`./abap-CLvhMVsD.js`),[],import.meta.url))},{id:`actionscript-3`,name:`ActionScript`,aliases:[`actionscript`,`as3`],import:(()=>M(()=>import(`./actionscript-3-Cs6JJXT5.js`),[],import.meta.url))},{id:`ada`,name:`Ada`,import:(()=>M(()=>import(`./ada-C5qYipkI.js`),[],import.meta.url))},{id:`ahk`,name:`AutoHotkey`,aliases:[`ahk1`],import:(()=>M(()=>import(`./ahk-CA9gdOdF.js`),[],import.meta.url))},{id:`ahk2`,name:`AutoHotkey2`,import:(()=>M(()=>import(`./ahk2-_6rzW9BS.js`),[],import.meta.url))},{id:`angular-html`,name:`Angular HTML`,import:(()=>M(()=>import(`./angular-html-B8mrqUL5.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4]),import.meta.url))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>M(()=>import(`./angular-ts-Bzix210W.js`),__vite__mapDeps([5,0,1,2,3,4,6]),import.meta.url))},{id:`apache`,name:`Apache Conf`,import:(()=>M(()=>import(`./apache-U0d_L8uA.js`),[],import.meta.url))},{id:`apex`,name:`Apex`,import:(()=>M(()=>import(`./apex-KFGFyKwG.js`),[],import.meta.url))},{id:`apl`,name:`APL`,import:(()=>M(()=>import(`./apl-Dhin1L29.js`),__vite__mapDeps([7,3,1,4,2,8,9,10]),import.meta.url))},{id:`applescript`,name:`AppleScript`,import:(()=>M(()=>import(`./applescript-CCn79oCD.js`),[],import.meta.url))},{id:`ara`,name:`Ara`,import:(()=>M(()=>import(`./ara-4CJ0cIlV.js`),[],import.meta.url))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>M(()=>import(`./asciidoc-SCjQUq34.js`),[],import.meta.url))},{id:`asm`,name:`Assembly`,import:(()=>M(()=>import(`./asm-Cmm7eHzH.js`),[],import.meta.url))},{id:`astro`,name:`Astro`,import:(()=>M(()=>import(`./astro-B-4NNgOP.js`),__vite__mapDeps([11,3,1,4,10,12,13,14]),import.meta.url))},{id:`awk`,name:`AWK`,import:(()=>M(()=>import(`./awk-BWXHIvNe.js`),[],import.meta.url))},{id:`ballerina`,name:`Ballerina`,import:(()=>M(()=>import(`./ballerina-B7ZEbQpA.js`),[],import.meta.url))},{id:`bat`,name:`Batch File`,aliases:[`batch`,`cmd`],import:(()=>M(()=>import(`./bat-qdxAdBWQ.js`),[],import.meta.url))},{id:`beancount`,name:`Beancount`,import:(()=>M(()=>import(`./beancount-D-usSTwE.js`),[],import.meta.url))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>M(()=>import(`./berry-DKpUyyne.js`),[],import.meta.url))},{id:`bibtex`,name:`BibTeX`,import:(()=>M(()=>import(`./bibtex-Ci_nEsc7.js`),[],import.meta.url))},{id:`bicep`,name:`Bicep`,import:(()=>M(()=>import(`./bicep-CUHmPFLl.js`),[],import.meta.url))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>M(()=>import(`./bird2-CYIUgYqB.js`),[],import.meta.url))},{id:`blade`,name:`Blade`,import:(()=>M(()=>import(`./blade-C6Gedziy.js`),__vite__mapDeps([15,3,1,4,2,8,9,10,16,17]),import.meta.url))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>M(()=>import(`./bsl-_VjlB9mv.js`),__vite__mapDeps([18,19]),import.meta.url))},{id:`c`,name:`C`,import:(()=>M(()=>import(`./c-iCihek07.js`).then(e=>e.n),__vite__mapDeps([20,1]),import.meta.url))},{id:`c3`,name:`C3`,import:(()=>M(()=>import(`./c3-D0apG41V.js`),[],import.meta.url))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>M(()=>import(`./cadence-CQ2zXKGN.js`),[],import.meta.url))},{id:`cairo`,name:`Cairo`,import:(()=>M(()=>import(`./cairo-DLTphjLi.js`),__vite__mapDeps([21,22]),import.meta.url))},{id:`chapel`,name:`Chapel`,aliases:[`chpl`],import:(()=>M(()=>import(`./chapel-DmtgEXO_.js`),__vite__mapDeps([23,20,1]),import.meta.url))},{id:`clarity`,name:`Clarity`,import:(()=>M(()=>import(`./clarity-CtfBBspg.js`),[],import.meta.url))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>M(()=>import(`./clojure-DqKBuwfJ.js`),[],import.meta.url))},{id:`cmake`,name:`CMake`,import:(()=>M(()=>import(`./cmake-Bj61d0ZC.js`),[],import.meta.url))},{id:`cobol`,name:`COBOL`,import:(()=>M(()=>import(`./cobol-Cw2-KvLW.js`),__vite__mapDeps([24,2,1,3,4,9]),import.meta.url))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>M(()=>import(`./codeowners-C8r90Shi.js`),[],import.meta.url))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>M(()=>import(`./codeql-oeQT6MSM.js`),[],import.meta.url))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>M(()=>import(`./coffee-CiiSLhB6.js`),__vite__mapDeps([25,3,1]),import.meta.url))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>M(()=>import(`./common-lisp-Cv5bFMCO.js`),[],import.meta.url))},{id:`coq`,name:`Rocq`,import:(()=>M(()=>import(`./coq-DuBRPxYg.js`),[],import.meta.url))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>M(()=>import(`./cpp-71xkOQct.js`).then(e=>e.n),__vite__mapDeps([26,1,27,28,20]),import.meta.url))},{id:`crystal`,name:`Crystal`,import:(()=>M(()=>import(`./crystal-DGPAtLeY.js`),__vite__mapDeps([29,3,1,4,2,17,20,30]),import.meta.url))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>M(()=>import(`./csharp-oqKa8noW.js`),[],import.meta.url))},{id:`css`,name:`CSS`,import:(()=>M(()=>import(`./css-CNuuLpMC.js`).then(e=>e.n),__vite__mapDeps([4,1]),import.meta.url))},{id:`csv`,name:`CSV`,import:(()=>M(()=>import(`./csv-Dx-8-gkx.js`),[],import.meta.url))},{id:`cue`,name:`CUE`,import:(()=>M(()=>import(`./cue-CE9AQfxI.js`),[],import.meta.url))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>M(()=>import(`./cypher-ClKdZ_lG.js`),[],import.meta.url))},{id:`d`,name:`D`,import:(()=>M(()=>import(`./d-qD-0Kul2.js`),[],import.meta.url))},{id:`dart`,name:`Dart`,import:(()=>M(()=>import(`./dart-CnvKMtbv.js`),[],import.meta.url))},{id:`dax`,name:`DAX`,import:(()=>M(()=>import(`./dax-BkyTk9wS.js`),[],import.meta.url))},{id:`desktop`,name:`Desktop`,import:(()=>M(()=>import(`./desktop-Dlh5hvp9.js`),[],import.meta.url))},{id:`diff`,name:`Diff`,import:(()=>M(()=>import(`./diff-woXpYk--.js`),[],import.meta.url))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>M(()=>import(`./docker-IyjqRm3v.js`),[],import.meta.url))},{id:`dotenv`,name:`dotEnv`,import:(()=>M(()=>import(`./dotenv-_5a1GRtc.js`),[],import.meta.url))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>M(()=>import(`./dream-maker-DW3nJb8Q.js`),[],import.meta.url))},{id:`edge`,name:`Edge`,import:(()=>M(()=>import(`./edge-DCY0a-ow.js`),__vite__mapDeps([31,2,1,3,4,12,16]),import.meta.url))},{id:`elixir`,name:`Elixir`,import:(()=>M(()=>import(`./elixir-DP304Xio.js`),__vite__mapDeps([32,2,1,3,4]),import.meta.url))},{id:`elm`,name:`Elm`,import:(()=>M(()=>import(`./elm-o4NJxfws.js`),__vite__mapDeps([33,28,1,20]),import.meta.url))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>M(()=>import(`./emacs-lisp-c_oH4hRZ.js`),[],import.meta.url))},{id:`erb`,name:`ERB`,import:(()=>M(()=>import(`./erb-C7MPl934.js`),__vite__mapDeps([34,2,1,3,4,35,8,9,17,20,26,27,28,30,36,37,12,14,38,39,40]),import.meta.url))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>M(()=>import(`./erlang-Cphh6RMH.js`),__vite__mapDeps([41,42]),import.meta.url))},{id:`fennel`,name:`Fennel`,import:(()=>M(()=>import(`./fennel-DQxkIbk2.js`),[],import.meta.url))},{id:`fish`,name:`Fish`,import:(()=>M(()=>import(`./fish-BJitypiv.js`),[],import.meta.url))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>M(()=>import(`./fluent-C03EYrpw.js`),[],import.meta.url))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>M(()=>import(`./fortran-fixed-form-DEKoE2YW.js`),__vite__mapDeps([43,44]),import.meta.url))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>M(()=>import(`./fortran-free-form-CYNrtFtB.js`),[],import.meta.url))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>M(()=>import(`./fsharp-D13ZGOAj.js`),__vite__mapDeps([45,42]),import.meta.url))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>M(()=>import(`./gdresource-xMC7jr7x.js`),__vite__mapDeps([46,47,48]),import.meta.url))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>M(()=>import(`./gdscript-DYvRD3hg.js`),[],import.meta.url))},{id:`gdshader`,name:`GDShader`,import:(()=>M(()=>import(`./gdshader-CBce3t8t.js`),[],import.meta.url))},{id:`genie`,name:`Genie`,import:(()=>M(()=>import(`./genie-CV2tkWYe.js`),[],import.meta.url))},{id:`gherkin`,name:`Gherkin`,import:(()=>M(()=>import(`./gherkin-DExj1W_8.js`),[],import.meta.url))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>M(()=>import(`./git-commit-BSykSTBG.js`),__vite__mapDeps([49,50]),import.meta.url))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>M(()=>import(`./git-rebase-BDPpS8w6.js`),__vite__mapDeps([51,30,1]),import.meta.url))},{id:`gleam`,name:`Gleam`,import:(()=>M(()=>import(`./gleam-CSRkHgEL.js`),[],import.meta.url))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>M(()=>import(`./glimmer-js-BONyzAsu.js`),__vite__mapDeps([52,3,1,4,2,12]),import.meta.url))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>M(()=>import(`./glimmer-ts-f9c0GCOe.js`),__vite__mapDeps([53,3,1,4,2,12]),import.meta.url))},{id:`glsl`,name:`GLSL`,import:(()=>M(()=>import(`./glsl-D5MA2a_X.js`).then(e=>e.n),__vite__mapDeps([28,1,20]),import.meta.url))},{id:`gn`,name:`GN`,import:(()=>M(()=>import(`./gn-ilITqXS6.js`),[],import.meta.url))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>M(()=>import(`./gnuplot-7GGW24-e.js`),[],import.meta.url))},{id:`go`,name:`Go`,import:(()=>M(()=>import(`./go-rLFTqkRN.js`),[],import.meta.url))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>M(()=>import(`./graphql-Ctjuxyvl.js`).then(e=>e.n),__vite__mapDeps([37,1,3,12,14,38]),import.meta.url))},{id:`groovy`,name:`Groovy`,import:(()=>M(()=>import(`./groovy-CacY0gHj.js`),[],import.meta.url))},{id:`hack`,name:`Hack`,import:(()=>M(()=>import(`./hack-Dh_ZLRbs.js`),__vite__mapDeps([54,2,1,3,4,17]),import.meta.url))},{id:`haml`,name:`Ruby Haml`,import:(()=>M(()=>import(`./haml-CwEpbK1d.js`).then(e=>e.n),__vite__mapDeps([36,1,3,4]),import.meta.url))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>M(()=>import(`./handlebars-ryMP1rBR.js`),__vite__mapDeps([55,3,1,4,2,40]),import.meta.url))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>M(()=>import(`./haskell-D8IpX4py.js`),[],import.meta.url))},{id:`haxe`,name:`Haxe`,import:(()=>M(()=>import(`./haxe-C8oCnwJJ.js`),[],import.meta.url))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>M(()=>import(`./hcl-Dh228itO.js`),[],import.meta.url))},{id:`hjson`,name:`Hjson`,import:(()=>M(()=>import(`./hjson-CxZEssPk.js`),[],import.meta.url))},{id:`hlsl`,name:`HLSL`,import:(()=>M(()=>import(`./hlsl-Cvrh5tZx.js`),[],import.meta.url))},{id:`html`,name:`HTML`,import:(()=>M(()=>import(`./html-XwrE-1r6.js`).then(e=>e.n),__vite__mapDeps([2,1,3,4]),import.meta.url))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>M(()=>import(`./html-derivative-i4STDFnl.js`),__vite__mapDeps([16,2,1,3,4]),import.meta.url))},{id:`http`,name:`HTTP`,import:(()=>M(()=>import(`./http-kmH8AyfE.js`),__vite__mapDeps([56,8,1,9,10,30,37,3,12,14,38]),import.meta.url))},{id:`hurl`,name:`Hurl`,import:(()=>M(()=>import(`./hurl-DCZHXKU4.js`),__vite__mapDeps([57,8,1,9,58,37,3,12,14,38]),import.meta.url))},{id:`hxml`,name:`HXML`,import:(()=>M(()=>import(`./hxml-Dcm88srW.js`),__vite__mapDeps([59,60]),import.meta.url))},{id:`hy`,name:`Hy`,import:(()=>M(()=>import(`./hy-CZbG8q4J.js`),[],import.meta.url))},{id:`imba`,name:`Imba`,import:(()=>M(()=>import(`./imba-DsUTQ-LC.js`),[],import.meta.url))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>M(()=>import(`./ini-B5eOa1yu.js`),[],import.meta.url))},{id:`java`,name:`Java`,import:(()=>M(()=>import(`./java-DdHNQ9hk.js`).then(e=>e.n),__vite__mapDeps([9,1]),import.meta.url))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>M(()=>import(`./javascript-obGGvMPs.js`).then(e=>e.n),__vite__mapDeps([3,1]),import.meta.url))},{id:`jinja`,name:`Jinja`,import:(()=>M(()=>import(`./jinja-B-tLrNsM.js`),__vite__mapDeps([61,2,1,3,4]),import.meta.url))},{id:`jison`,name:`Jison`,import:(()=>M(()=>import(`./jison-CBjhYtSs.js`),__vite__mapDeps([62,3,1]),import.meta.url))},{id:`json`,name:`JSON`,import:(()=>M(()=>import(`./json-DAgxKhMr.js`).then(e=>e.n),__vite__mapDeps([10,1]),import.meta.url))},{id:`json5`,name:`JSON5`,import:(()=>M(()=>import(`./json5-BR5RXkoi.js`),[],import.meta.url))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>M(()=>import(`./jsonc-CYpm1nAK.js`),[],import.meta.url))},{id:`jsonl`,name:`JSON Lines`,import:(()=>M(()=>import(`./jsonl-CmCQp5Yx.js`),[],import.meta.url))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>M(()=>import(`./jsonnet-CJTPZ8u_.js`),[],import.meta.url))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>M(()=>import(`./jssm-DXw9l8Rf.js`),[],import.meta.url))},{id:`jsx`,name:`JSX`,import:(()=>M(()=>import(`./jsx-gTgmArGx.js`).then(e=>e.n),__vite__mapDeps([38,1]),import.meta.url))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>M(()=>import(`./julia-CXJVy74_.js`),__vite__mapDeps([63,3,1,17,22,26,27,28,20,64]),import.meta.url))},{id:`just`,name:`Just`,aliases:[`justfile`],import:(()=>M(()=>import(`./just-B9Xn_Dp4.js`),__vite__mapDeps([65,3,1,12,22,30,35,4,2,8,9,17,20,26,27,28,36,37,14,38,39,40,66]),import.meta.url))},{id:`kdl`,name:`KDL`,import:(()=>M(()=>import(`./kdl-CsD5j6eV.js`),[],import.meta.url))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>M(()=>import(`./kotlin-DhhofPvG.js`),[],import.meta.url))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>M(()=>import(`./kusto-C7mF5XQf.js`),[],import.meta.url))},{id:`latex`,name:`LaTeX`,import:(()=>M(()=>import(`./latex-o9DRzaEe.js`),__vite__mapDeps([67,68,1,64]),import.meta.url))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>M(()=>import(`./lean-CewbzKMR.js`),[],import.meta.url))},{id:`less`,name:`Less`,import:(()=>M(()=>import(`./less-DVTAwKKz.js`),[],import.meta.url))},{id:`liquid`,name:`Liquid`,import:(()=>M(()=>import(`./liquid-G0MH4h_m.js`),__vite__mapDeps([69,3,1,4,2,10]),import.meta.url))},{id:`llvm`,name:`LLVM IR`,import:(()=>M(()=>import(`./llvm-DqHOMS-s.js`),[],import.meta.url))},{id:`log`,name:`Log file`,import:(()=>M(()=>import(`./log-BNLmms1o.js`),[],import.meta.url))},{id:`logo`,name:`Logo`,import:(()=>M(()=>import(`./logo-Cluzi2Zq.js`),[],import.meta.url))},{id:`lua`,name:`Lua`,import:(()=>M(()=>import(`./lua-FONpmTUP.js`).then(e=>e.n),__vite__mapDeps([39,1,20]),import.meta.url))},{id:`luau`,name:`Luau`,import:(()=>M(()=>import(`./luau-C2pBCSgt.js`),[],import.meta.url))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>M(()=>import(`./make-Dixweg8N.js`),[],import.meta.url))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>M(()=>import(`./markdown-BYOwaDjH.js`),[],import.meta.url))},{id:`marko`,name:`Marko`,import:(()=>M(()=>import(`./marko-DV5GrDmo.js`),__vite__mapDeps([70,4,1,6,12,71]),import.meta.url))},{id:`matlab`,name:`MATLAB`,import:(()=>M(()=>import(`./matlab-D7qyCx1q.js`),[],import.meta.url))},{id:`mdc`,name:`MDC`,import:(()=>M(()=>import(`./mdc-BKfPFPZw.js`),__vite__mapDeps([72,16,2,1,3,4,40,42]),import.meta.url))},{id:`mdx`,name:`MDX`,import:(()=>M(()=>import(`./mdx-DQZ5AkYe.js`),[],import.meta.url))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>M(()=>import(`./mermaid-BxpfTIzt.js`),[],import.meta.url))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>M(()=>import(`./mipsasm-BMqwQI7S.js`),[],import.meta.url))},{id:`mojo`,name:`Mojo`,import:(()=>M(()=>import(`./mojo-fg40_ntQ.js`),[],import.meta.url))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>M(()=>import(`./moonbit-DgjMoLWr.js`),[],import.meta.url))},{id:`move`,name:`Move`,import:(()=>M(()=>import(`./move-BYnGhZoM.js`),[],import.meta.url))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>M(()=>import(`./narrat-_X_XdTYD.js`),[],import.meta.url))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>M(()=>import(`./nextflow-BJtWHP5T.js`),__vite__mapDeps([73,74]),import.meta.url))},{id:`nextflow-groovy`,name:`Nextflow Groovy`,import:(()=>M(()=>import(`./nextflow-groovy-DJMQeKeT.js`),[],import.meta.url))},{id:`nginx`,name:`Nginx`,import:(()=>M(()=>import(`./nginx-BTMw9COX.js`),__vite__mapDeps([75,39,1,20]),import.meta.url))},{id:`nim`,name:`Nim`,import:(()=>M(()=>import(`./nim-B6yJ_yaC.js`),__vite__mapDeps([76,3,1,4,2,8,9,20,28,42]),import.meta.url))},{id:`nix`,name:`Nix`,import:(()=>M(()=>import(`./nix-IvuFDN5E.js`),[],import.meta.url))},{id:`nsis`,name:`NSIS`,import:(()=>M(()=>import(`./nsis-CjNLYCLg.js`),[],import.meta.url))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>M(()=>import(`./nushell-DHYfO66s.js`),[],import.meta.url))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>M(()=>import(`./objective-c-D1A_Heim.js`),[],import.meta.url))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>M(()=>import(`./objective-cpp-BsSzOQcm.js`),[],import.meta.url))},{id:`ocaml`,name:`OCaml`,import:(()=>M(()=>import(`./ocaml-O90oeIOV.js`),[],import.meta.url))},{id:`odin`,name:`Odin`,import:(()=>M(()=>import(`./odin-B1RWQWA5.js`),[],import.meta.url))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>M(()=>import(`./openscad-BUDT5pXO.js`),[],import.meta.url))},{id:`org`,name:`Org Markup`,import:(()=>M(()=>import(`./org-Ddi8Gs6E.js`),__vite__mapDeps([77,3,1,4,2,6,9,8,10,12,14,17,20,22,78,25,27,26,28,30,79,80,50,81,32,39,40,35,36,37,38,42,41,49,51,82,83,84,64,66,67,68,71,85,76,86,87,88,89,90,91,92,93,94]),import.meta.url))},{id:`pascal`,name:`Pascal`,import:(()=>M(()=>import(`./pascal-4ZHwLPI5.js`),[],import.meta.url))},{id:`perl`,name:`Perl`,import:(()=>M(()=>import(`./perl-DEgXgjuC.js`),__vite__mapDeps([66,3,1,4,2,8,9,17]),import.meta.url))},{id:`php`,name:`PHP`,import:(()=>M(()=>import(`./php-B9UPq-vz.js`),__vite__mapDeps([88,3,1,4,2,8,9,10,17]),import.meta.url))},{id:`pkl`,name:`Pkl`,import:(()=>M(()=>import(`./pkl-ot-7Btpt.js`),[],import.meta.url))},{id:`plsql`,name:`PL/SQL`,import:(()=>M(()=>import(`./plsql-DGHpHOYJ.js`),[],import.meta.url))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>M(()=>import(`./po-BiJDBrnU.js`),[],import.meta.url))},{id:`polar`,name:`Polar`,import:(()=>M(()=>import(`./polar-C7UOKdEL.js`),[],import.meta.url))},{id:`postcss`,name:`PostCSS`,import:(()=>M(()=>import(`./postcss-BXeXVLqQ.js`),[],import.meta.url))},{id:`powerquery`,name:`PowerQuery`,import:(()=>M(()=>import(`./powerquery-DNMTfnFr.js`),[],import.meta.url))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`,`pwsh`],import:(()=>M(()=>import(`./powershell-CCSX75yM.js`),[],import.meta.url))},{id:`prisma`,name:`Prisma`,import:(()=>M(()=>import(`./prisma-DMgNhnYS.js`),[],import.meta.url))},{id:`prolog`,name:`Prolog`,import:(()=>M(()=>import(`./prolog-iXnhIJG7.js`),[],import.meta.url))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>M(()=>import(`./proto-DB4EqR-F.js`),[],import.meta.url))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>M(()=>import(`./pug-DkgDHZci.js`),__vite__mapDeps([95,3,1,4,2]),import.meta.url))},{id:`puppet`,name:`Puppet`,import:(()=>M(()=>import(`./puppet-CDv2pdJW.js`),[],import.meta.url))},{id:`purescript`,name:`PureScript`,import:(()=>M(()=>import(`./purescript-9MfHhQsQ.js`),[],import.meta.url))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>M(()=>import(`./python-gzcpVVnB.js`),[],import.meta.url))},{id:`qml`,name:`QML`,import:(()=>M(()=>import(`./qml-_a-QhfPD.js`),__vite__mapDeps([96,3,1]),import.meta.url))},{id:`qmldir`,name:`QML Directory`,import:(()=>M(()=>import(`./qmldir-DCQb3MpD.js`),[],import.meta.url))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>M(()=>import(`./qss-Fe1Jh2GI.js`),[],import.meta.url))},{id:`r`,name:`R`,import:(()=>M(()=>import(`./r-BHcO8Vjq.js`).then(e=>e.n),__vite__mapDeps([64,1]),import.meta.url))},{id:`racket`,name:`Racket`,import:(()=>M(()=>import(`./racket-DcIDlBhZ.js`),[],import.meta.url))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>M(()=>import(`./raku-B3gFvitq.js`),[],import.meta.url))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>M(()=>import(`./razor-BMJ0eI3p.js`),__vite__mapDeps([97,2,1,3,4,79]),import.meta.url))},{id:`rbs`,name:`RBS`,aliases:[`ruby-signature`],import:(()=>M(()=>import(`./rbs-C0MpOrj4.js`),[],import.meta.url))},{id:`reg`,name:`Windows Registry Script`,import:(()=>M(()=>import(`./reg-CRGYupPL.js`),[],import.meta.url))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>M(()=>import(`./regexp-DR20uMnK.js`).then(e=>e.n),__vite__mapDeps([27,1]),import.meta.url))},{id:`rel`,name:`Rel`,import:(()=>M(()=>import(`./rel-BtDbiS_P.js`),[],import.meta.url))},{id:`riscv`,name:`RISC-V`,import:(()=>M(()=>import(`./riscv-Ckw8ddFX.js`),[],import.meta.url))},{id:`ron`,name:`RON`,import:(()=>M(()=>import(`./ron-VUp2lXgN.js`),[],import.meta.url))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>M(()=>import(`./rosmsg-CAekHB0j.js`),[],import.meta.url))},{id:`rst`,name:`reStructuredText`,import:(()=>M(()=>import(`./rst-BQCbfb9V.js`),__vite__mapDeps([98,3,1,16,2,4,22,99,26,27,28,20,30,40,35,8,9,17,36,37,12,14,38,39]),import.meta.url))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>M(()=>import(`./ruby-B8JcIHv0.js`),__vite__mapDeps([35,3,1,4,2,8,9,17,20,26,27,28,30,36,37,12,14,38,39,40]),import.meta.url))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>M(()=>import(`./rust-Cfkwpbl8.js`),[],import.meta.url))},{id:`sas`,name:`SAS`,import:(()=>M(()=>import(`./sas-CBpMWA2M.js`),__vite__mapDeps([100,17,1]),import.meta.url))},{id:`sass`,name:`Sass`,import:(()=>M(()=>import(`./sass-DXrisJhu.js`),[],import.meta.url))},{id:`scala`,name:`Scala`,import:(()=>M(()=>import(`./scala-BiFt_7mu.js`),[],import.meta.url))},{id:`scheme`,name:`Scheme`,import:(()=>M(()=>import(`./scheme-DQCgrYNe.js`),[],import.meta.url))},{id:`scss`,name:`SCSS`,import:(()=>M(()=>import(`./scss-YesllqfO.js`).then(e=>e.n),__vite__mapDeps([6,1,4]),import.meta.url))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>M(()=>import(`./sdbl-bTVj8UrX.js`),[],import.meta.url))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>M(()=>import(`./shaderlab-TOUzSsQk.js`),__vite__mapDeps([101,102]),import.meta.url))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>M(()=>import(`./shellscript-Da78Ox-3.js`).then(e=>e.n),__vite__mapDeps([30,1]),import.meta.url))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>M(()=>import(`./shellsession-CVsQGYfZ.js`),__vite__mapDeps([103,30,1]),import.meta.url))},{id:`smalltalk`,name:`GNU Smalltalk`,import:(()=>M(()=>import(`./smalltalk-BHpQb5nM.js`),[],import.meta.url))},{id:`smithy`,name:`Smithy`,import:(()=>M(()=>import(`./smithy-Dgaz7aur.js`),[],import.meta.url))},{id:`solidity`,name:`Solidity`,import:(()=>M(()=>import(`./solidity-Bj7E1mRn.js`),[],import.meta.url))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>M(()=>import(`./soy-DEd-qcad.js`),__vite__mapDeps([104,2,1,3,4]),import.meta.url))},{id:`sparql`,name:`SPARQL`,import:(()=>M(()=>import(`./sparql-D_iOobhT.js`),__vite__mapDeps([105,106]),import.meta.url))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>M(()=>import(`./splunk-BC2Px7Mm.js`),[],import.meta.url))},{id:`sql`,name:`SQL`,import:(()=>M(()=>import(`./sql-DdD7vxS4.js`).then(e=>e.n),__vite__mapDeps([17,1]),import.meta.url))},{id:`ssh-config`,name:`SSH Config`,import:(()=>M(()=>import(`./ssh-config-BgfXC-Er.js`),[],import.meta.url))},{id:`stata`,name:`Stata`,import:(()=>M(()=>import(`./stata-CMv7m7Gi.js`),__vite__mapDeps([107,17,1]),import.meta.url))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>M(()=>import(`./stylus-B6D30XZt.js`),[],import.meta.url))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>M(()=>import(`./surrealql-BZoq2lXR.js`),__vite__mapDeps([108,3,1]),import.meta.url))},{id:`svelte`,name:`Svelte`,import:(()=>M(()=>import(`./svelte-Bj3Hmc9F.js`),__vite__mapDeps([109,3,1,4,12,13]),import.meta.url))},{id:`swift`,name:`Swift`,import:(()=>M(()=>import(`./swift-CyEgAFGc.js`),[],import.meta.url))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>M(()=>import(`./system-verilog-Dh5ihWbf.js`),[],import.meta.url))},{id:`systemd`,name:`Systemd Units`,import:(()=>M(()=>import(`./systemd-BxMlprV5.js`),[],import.meta.url))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>M(()=>import(`./talonscript-CohzipZa.js`),[],import.meta.url))},{id:`tasl`,name:`Tasl`,import:(()=>M(()=>import(`./tasl-DMoTqEGO.js`),[],import.meta.url))},{id:`tcl`,name:`Tcl`,import:(()=>M(()=>import(`./tcl-CZd0xW_V.js`),[],import.meta.url))},{id:`templ`,name:`Templ`,import:(()=>M(()=>import(`./templ-TjxbArHn.js`),__vite__mapDeps([110,3,1,4,82]),import.meta.url))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>M(()=>import(`./terraform-DswuEJGm.js`),[],import.meta.url))},{id:`tex`,name:`TeX`,import:(()=>M(()=>import(`./tex-BK-H2Wn4.js`).then(e=>e.n),__vite__mapDeps([68,1,64]),import.meta.url))},{id:`toml`,name:`TOML`,import:(()=>M(()=>import(`./toml-CcmNWLt0.js`),[],import.meta.url))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>M(()=>import(`./ts-tags-Cc5do7zu.js`),__vite__mapDeps([111,3,1,4,2,8,9,12,17,28,20]),import.meta.url))},{id:`tsv`,name:`TSV`,import:(()=>M(()=>import(`./tsv-sltzmVWM.js`),[],import.meta.url))},{id:`tsx`,name:`TSX`,import:(()=>M(()=>import(`./tsx-CUOciP0b.js`).then(e=>e.n),__vite__mapDeps([14,1]),import.meta.url))},{id:`turtle`,name:`Turtle`,import:(()=>M(()=>import(`./turtle-ByJddavk.js`),[],import.meta.url))},{id:`twig`,name:`Twig`,import:(()=>M(()=>import(`./twig-BVSnuTf-.js`),__vite__mapDeps([112,3,1,4,6,22,35,2,8,9,17,20,26,27,28,30,36,37,12,14,38,39,40,88,10]),import.meta.url))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>M(()=>import(`./typescript-BydbNFcO.js`).then(e=>e.n),__vite__mapDeps([12,1]),import.meta.url))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>M(()=>import(`./typespec-BRdr0IET.js`),[],import.meta.url))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>M(()=>import(`./typst-C40W_gC6.js`),__vite__mapDeps([113,3,1,4,2,6,9,8,10,12,14,114,115,17,20,22,78,25,27,26,28,30,79,80,50,81,32,39,40,35,36,37,38,42,41,45,49,51,82,83,55,84,116,64,63,66,67,68,71,117,85,86,88,89,90,91,92,94,118,95,119,120,112,121]),import.meta.url))},{id:`v`,name:`V`,import:(()=>M(()=>import(`./v-DBj4K9d_.js`),[],import.meta.url))},{id:`vala`,name:`Vala`,import:(()=>M(()=>import(`./vala-zf12oZj6.js`),[],import.meta.url))},{id:`vb`,name:`Visual Basic`,import:(()=>M(()=>import(`./vb-DOwzaHZ0.js`),[],import.meta.url))},{id:`verilog`,name:`Verilog`,import:(()=>M(()=>import(`./verilog-B2gwz-sJ.js`),[],import.meta.url))},{id:`vhdl`,name:`VHDL`,import:(()=>M(()=>import(`./vhdl-BroJfC0k.js`),[],import.meta.url))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>M(()=>import(`./viml-DvXPmvsu.js`),[],import.meta.url))},{id:`vue`,name:`Vue`,import:(()=>M(()=>import(`./vue-BNQF7r6F.js`),__vite__mapDeps([122,3,1,4,2,10,12,16]),import.meta.url))},{id:`vue-html`,name:`Vue HTML`,import:(()=>M(()=>import(`./vue-html-DkKkQnZL.js`),__vite__mapDeps([123,3,1]),import.meta.url))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>M(()=>import(`./vue-vine-DFaKYU4X.js`),__vite__mapDeps([124,3,1,4,6,13,71,125]),import.meta.url))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>M(()=>import(`./vyper-CgoNMtux.js`),[],import.meta.url))},{id:`wasm`,name:`WebAssembly`,import:(()=>M(()=>import(`./wasm-ByWQv1Qj.js`),[],import.meta.url))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>M(()=>import(`./wenyan-C8pVoKbM.js`),[],import.meta.url))},{id:`wgsl`,name:`WGSL`,import:(()=>M(()=>import(`./wgsl-BsKzXJz4.js`),[],import.meta.url))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>M(()=>import(`./wikitext-ClFFjSW2.js`),[],import.meta.url))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>M(()=>import(`./wit-DdvCle-K.js`),[],import.meta.url))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>M(()=>import(`./wolfram-DLL8P-h_.js`),[],import.meta.url))},{id:`xml`,name:`XML`,import:(()=>M(()=>import(`./xml-BlnrEAEy.js`).then(e=>e.n),__vite__mapDeps([8,1,9]),import.meta.url))},{id:`xsl`,name:`XSL`,import:(()=>M(()=>import(`./xsl-BOPS8gLt.js`),__vite__mapDeps([94,8,1,9]),import.meta.url))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>M(()=>import(`./yaml-Du_6cdrH.js`).then(e=>e.n),__vite__mapDeps([40,1]),import.meta.url))},{id:`zenscript`,name:`ZenScript`,import:(()=>M(()=>import(`./zenscript-BnlCZFoB.js`),[],import.meta.url))},{id:`zig`,name:`Zig`,import:(()=>M(()=>import(`./zig-CMLA9XwU.js`),[],import.meta.url))}],an=Object.fromEntries(rn.map(e=>[e.id,e.import])),on=Object.fromEntries(rn.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),sn={...an,...on},cn=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>M(()=>import(`./andromeeda-vGVdxbeo.js`),[],import.meta.url))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>M(()=>import(`./aurora-x-CDeNXAV0.js`),[],import.meta.url))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>M(()=>import(`./ayu-dark-DluEY0Gj.js`),[],import.meta.url))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>M(()=>import(`./ayu-light-C3h-C4tm.js`),[],import.meta.url))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>M(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[],import.meta.url))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>M(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[],import.meta.url))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>M(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[],import.meta.url))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>M(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[],import.meta.url))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>M(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[],import.meta.url))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>M(()=>import(`./dark-plus-Cs2F2srj.js`),[],import.meta.url))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>M(()=>import(`./dracula-BHWKrbxM.js`),[],import.meta.url))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>M(()=>import(`./dracula-soft-5eyTD99u.js`),[],import.meta.url))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>M(()=>import(`./everforest-dark-sB-x3p7T.js`),[],import.meta.url))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>M(()=>import(`./everforest-light-Df2xbC6M.js`),[],import.meta.url))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>M(()=>import(`./github-dark-C-LZuMrd.js`),[],import.meta.url))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>M(()=>import(`./github-dark-default-DXG-b-1a.js`),[],import.meta.url))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>M(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[],import.meta.url))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>M(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[],import.meta.url))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>M(()=>import(`./github-light-EUqPIrTm.js`),[],import.meta.url))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>M(()=>import(`./github-light-default-BXViO-2h.js`),[],import.meta.url))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>M(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[],import.meta.url))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>M(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[],import.meta.url))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>M(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[],import.meta.url))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>M(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[],import.meta.url))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>M(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[],import.meta.url))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>M(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[],import.meta.url))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>M(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[],import.meta.url))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>M(()=>import(`./horizon-CE9ld1lL.js`),[],import.meta.url))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`light`,import:(()=>M(()=>import(`./horizon-bright-DSNQnXHK.js`),[],import.meta.url))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>M(()=>import(`./houston-CsvMBhTu.js`),[],import.meta.url))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>M(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[],import.meta.url))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>M(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[],import.meta.url))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>M(()=>import(`./kanagawa-wave-BML5mF2J.js`),[],import.meta.url))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>M(()=>import(`./laserwave-C_8bwKvT.js`),[],import.meta.url))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>M(()=>import(`./light-plus-DVQuIRkW.js`),[],import.meta.url))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>M(()=>import(`./material-theme-Bm3Qr25_.js`),[],import.meta.url))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>M(()=>import(`./material-theme-darker-2IIEA8gg.js`),[],import.meta.url))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>M(()=>import(`./material-theme-lighter-uhdI0v04.js`),[],import.meta.url))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>M(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[],import.meta.url))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>M(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[],import.meta.url))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>M(()=>import(`./min-dark-BSWPekZh.js`),[],import.meta.url))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>M(()=>import(`./min-light-DDpmG2fV.js`),[],import.meta.url))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>M(()=>import(`./monokai-B_bV9PQ9.js`),[],import.meta.url))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>M(()=>import(`./night-owl-DhmEMT88.js`),[],import.meta.url))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>M(()=>import(`./night-owl-light-eJ-hLW7d.js`),[],import.meta.url))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>M(()=>import(`./nord-Cb4Vim4T.js`),[],import.meta.url))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>M(()=>import(`./one-dark-pro-CLwyXe_n.js`),[],import.meta.url))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>M(()=>import(`./one-light-D7Lr4KcI.js`),[],import.meta.url))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>M(()=>import(`./plastic-DQwYfKfQ.js`),[],import.meta.url))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>M(()=>import(`./poimandres-DRFjx7u4.js`),[],import.meta.url))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>M(()=>import(`./red-DX1BQOs8.js`),[],import.meta.url))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>M(()=>import(`./rose-pine-aMsaMD1D.js`),[],import.meta.url))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>M(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[],import.meta.url))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>M(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[],import.meta.url))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>M(()=>import(`./slack-dark-DnToyrRv.js`),[],import.meta.url))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>M(()=>import(`./slack-ochin-B2OO5cIa.js`),[],import.meta.url))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>M(()=>import(`./snazzy-light-4G7pJPwS.js`),[],import.meta.url))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>M(()=>import(`./solarized-dark-UdsmMDCL.js`),[],import.meta.url))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>M(()=>import(`./solarized-light-C1IUL_tW.js`),[],import.meta.url))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>M(()=>import(`./synthwave-84-nFMaYfgc.js`),[],import.meta.url))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>M(()=>import(`./tokyo-night-oM2G3aXe.js`),[],import.meta.url))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>M(()=>import(`./vesper-DdrHHSXu.js`),[],import.meta.url))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>M(()=>import(`./vitesse-black-fwtXNY1n.js`),[],import.meta.url))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>M(()=>import(`./vitesse-dark-BZCL-v6S.js`),[],import.meta.url))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>M(()=>import(`./vitesse-light-VbXTXTou.js`),[],import.meta.url))}].map(e=>[e.id,e.import])),ln=e({createOnigurumaEngine:()=>Fn,getDefaultWasmLoader:()=>Pn,loadWasm:()=>On,setDefaultWasmLoader:()=>Nn}),un=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function dn(){return 2147483648}function fn(){return typeof performance<`u`?performance.now():Date.now()}var pn=(e,t)=>e+(t-e%t)%t;async function mn(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}function a(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function s(e){let t=r.HEAPU8.length;e>>>=0;let n=dn();if(e>n)return!1;for(let r=1;r<=4;r*=2){let i=t*(1+.2/r);if(i=Math.min(i,e+100663296),o(Math.min(n,pn(Math.max(e,i),65536))))return!0}return!1}let c=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0;function l(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&c)return c.decode(e.subarray(t,i));let a=``;for(;t<i;){let n=e[t++];if(!(n&128)){a+=String.fromCharCode(n);continue}let r=e[t++]&63;if((n&224)==192){a+=String.fromCharCode((n&31)<<6|r);continue}let i=e[t++]&63;if(n=(n&240)==224?(n&15)<<12|r<<6|i:(n&7)<<18|r<<12|i<<6|e[t++]&63,n<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:fn,emscripten_memcpy_big:a,emscripten_resize_heap:s,fd_write:()=>0};async function f(){let n=await e({env:d,wasi_snapshot_preview1:d});t=n.memory,i(t.buffer),Object.assign(r,n),r.UTF8ToString=u}return await f(),r}var hn=Object.defineProperty,gn=(e,t,n)=>t in e?hn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I=(e,t,n)=>gn(e,typeof t==`symbol`?t:t+``,n),L=null;function _n(e){throw new un(e.UTF8ToString(e.getLastOnigError()))}var vn=class e{constructor(t){I(this,`utf16Length`),I(this,`utf8Length`),I(this,`utf16Value`),I(this,`utf8Value`),I(this,`utf16OffsetToUtf8`),I(this,`utf8OffsetToUtf16`);let n=t.length,r=e._utf8ByteLength(t),i=r!==n,a=i?new Uint32Array(n+1):null;i&&(a[n]=r);let o=i?new Uint32Array(r+1):null;i&&(o[r]=n);let s=new Uint8Array(r),c=0;for(let e=0;e<n;e++){let r=t.charCodeAt(e),l=r,u=!1;if(r>=55296&&r<=56319&&e+1<n){let n=t.charCodeAt(e+1);n>=56320&&n<=57343&&(l=(r-55296<<10)+65536|n-56320,u=!0)}i&&(a[e]=c,u&&(a[e+1]=c),l<=127?o[c+0]=e:l<=2047?(o[c+0]=e,o[c+1]=e):l<=65535?(o[c+0]=e,o[c+1]=e,o[c+2]=e):(o[c+0]=e,o[c+1]=e,o[c+2]=e,o[c+3]=e)),l<=127?s[c++]=l:l<=2047?(s[c++]=192|(l&1984)>>>6,s[c++]=128|(l&63)>>>0):l<=65535?(s[c++]=224|(l&61440)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0):(s[c++]=240|(l&1835008)>>>18,s[c++]=128|(l&258048)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0),u&&e++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),a=i,o=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}t+=a<=127?1:a<=2047?2:a<=65535?3:4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},yn=class e{constructor(t){if(I(this,`id`,++e.LAST_ID),I(this,`_onigBinding`),I(this,`content`),I(this,`utf16Length`),I(this,`utf8Length`),I(this,`utf16OffsetToUtf8`),I(this,`utf8OffsetToUtf16`),I(this,`ptr`),!L)throw new un(`Must invoke loadWasm first.`);this._onigBinding=L,this.content=t;let n=new vn(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=L.omalloc(1e4),e._sharedPtrInUse=!0,L.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(L)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};I(yn,`LAST_ID`,0),I(yn,`_sharedPtr`,0),I(yn,`_sharedPtrInUse`,!1);var bn=yn,xn=class{constructor(e){if(I(this,`_onigBinding`),I(this,`_ptr`),!L)throw new un(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new vn(e[r]);t[r]=i.createString(L),n[r]=i.utf8Length}let r=L.omalloc(4*e.length);L.HEAPU32.set(t,r/4);let i=L.omalloc(4*e.length);L.HEAPU32.set(n,i/4);let a=L.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)L.ofree(t[n]);L.ofree(i),L.ofree(r),a===0&&_n(L),this._onigBinding=L,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if(typeof n==`number`&&(r=n),typeof e==`string`){e=new bn(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(a===0)return null;let o=i.HEAPU32,s=a/4,c=o[s++],l=o[s++],u=[];for(let t=0;t<l;t++){let n=e.convertUtf8OffsetToUtf16(o[s++]),r=e.convertUtf8OffsetToUtf16(o[s++]);u[t]={start:n,end:r,length:r-n}}return{index:c,captureIndices:u}}};function Sn(e){return typeof e.instantiator==`function`}function Cn(e){return typeof e.default==`function`}function wn(e){return e.data!==void 0}function Tn(e){return typeof Response<`u`&&e instanceof Response}function En(e){return typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<`u`&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||typeof Uint32Array<`u`&&e instanceof Uint32Array}var Dn;function On(e){if(Dn)return Dn;async function t(){L=await mn(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),Sn(n)?n=await n.instantiator(t):Cn(n)?n=await n.default(t):(wn(n)&&(n=n.data),Tn(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await An(n)(t):await jn(n)(t):En(n)||n instanceof WebAssembly.Module?n=await kn(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await kn(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Dn=t(),Dn}function kn(e){return t=>WebAssembly.instantiate(e,t)}function An(e){return t=>WebAssembly.instantiateStreaming(e,t)}function jn(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var Mn;function Nn(e){Mn=e}function Pn(){return Mn}async function Fn(e){return e&&await On(e),{createScanner(e){return new xn(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new bn(e)}}}var In=en({});nn(In,ln);var R=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Ln(e){return Rn(e)}function Rn(e){return Array.isArray(e)?zn(e):e instanceof RegExp?e:typeof e==`object`?Bn(e):e}function zn(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Rn(e[n]);return t}function Bn(e){let t={};for(let n in e)t[n]=Rn(e[n]);return t}function Vn(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function Hn(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?Hn(e.substring(0,e.length-1)):e.substr(~t+1)}var Un=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Wn=class{static hasCaptures(e){return e!==null&&(Un.lastIndex=0,Un.test(e))}static replaceCaptures(e,t,n){return e.replace(Un,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function Gn(e,t){return e<t?-1:+(e>t)}function Kn(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=Gn(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function qn(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Jn(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Yn=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},Xn=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(tr(e),t)}static createFromParsedTheme(e,t){return ir(e,t)}_cachedMatchRoot=new Yn(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>Qn(e.parent,t.parentScopes));return n?new er(n.fontStyle,n.foreground,n.background):null}},Zn=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function Qn(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!$n(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function $n(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var er=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function tr(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8}}let s=null;typeof i.settings.foreground==`string`&&qn(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&qn(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new nr(l,u,e,o,s,c)}}return n}var nr=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},rr=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(rr||{});function ir(e,t){e.sort((e,t)=>{let n=Gn(e.scope,t.scope);return n!==0||(n=Kn(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new ar(t),o=new er(n,a.getId(r),a.getId(i)),s=new cr(new sr(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new Xn(a,o,s)}var ar=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},or=Object.freeze([]),sr=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||or,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},cr=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),sr.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(Kn(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new sr(e,t,n,r,i))}},lr=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return!!(e&1024)}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=dr(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function ur(e){return e}function dr(e){return e}function fr(e,t){let n=[],r=mr(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(pr(i)){let e=[];do e.push(i),i=r.next();while(pr(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function pr(e){return!!e&&!!e.match(/[\w\.:]+/)}function mr(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function hr(e){typeof e.dispose==`function`&&e.dispose()}var gr=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},_r=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},vr=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},yr=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new gr(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new vr;for(let n of e)br(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof gr){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function br(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof gr?Sr({baseGrammar:a,selfGrammar:i},r):xr(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new gr(e))}function xr(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];Cr([r],t,n)}}function Sr(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Cr(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Cr(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Cr(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Vn({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&Cr(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=kr(i);switch(a.kind){case 0:Sr({...t,selfGrammar:t.baseGrammar},n);break;case 1:Sr(t,n);break;case 2:xr(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?xr(a.ruleName,i,n):Sr(i,n)}else a.kind===4?n.add(new _r(a.scopeName,a.ruleName)):n.add(new gr(a.scopeName))}}}var wr=class{kind=0},Tr=class{kind=1},Er=class{constructor(e){this.ruleName=e}kind=2},Dr=class{constructor(e){this.scopeName=e}kind=3},Or=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function kr(e){if(e===`$base`)return new wr;if(e===`$self`)return new Tr;let t=e.indexOf(`#`);return t===-1?new Dr(e):t===0?new Er(e.substring(1)):new Or(e.substring(0,t),e.substring(t+1))}var Ar=/\\(\d+)/,jr=/\\(\d+)/g,Mr=-1,Nr=-2;function Pr(e){return e}function Fr(e){return e}var Ir=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Wn.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Wn.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${Hn(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:Wn.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Wn.replaceCaptures(this._contentName,e,t)}},Lr=class extends Ir{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},Rr=class extends Ir{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new Ur(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Wr,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},zr=class extends Ir{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Wr,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Br=class extends Ir{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new Ur(i,this.id),this.beginCaptures=a,this._end=new Ur(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Wr;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Vr=class extends Ir{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new Ur(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new Ur(o,Nr),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Wr;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Wr,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},Hr=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new Lr(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new Rr(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Vn({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new zr(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new Vr(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new Br(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=kr(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l){if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof zr||e instanceof Br||e instanceof Vr)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},Ur=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this._anchorCache=this.hasAnchor?this._buildAnchorCache():null,this.ruleId=t,this.hasBackReferences=typeof this.source==`string`&&Ar.test(this.source)}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return jr.lastIndex=0,this.source.replace(jr,(e,t)=>Jn(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Wr=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new Gr(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new Gr(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},Gr=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
3
|
+
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Kr=class{constructor(e,t){this.languageId=e,this.tokenType=t}},qr=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Kr(e,8),this._embeddedLanguagesMatcher=new Jr(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Kr(0,0);_getBasicScopeAttributes=new Yn(e=>new Kr(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Jr=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>Jn(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Yr=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Xr(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Zr(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new Yr(i,!0);f()}return new Yr(i,!1);function f(){let o=Qr(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===Mr){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),ri(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof Br){let r=o;ri(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof Vr){let r=o;ri(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(ri(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Zr(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof Vr&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=ni(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==Nr){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),ri(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function Qr(e,t,n,r,i,a){let o=$r(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=ei(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function $r(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=ti(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function ei(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=ti(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function ti(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function ni(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function ri(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));Xr(e,p,n&&d.start===0,d.start,f,i,!1,0),hr(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new ii(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var ii=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function ai(e,t,n,r,i,a,o,s){return new li(e,t,n,r,i,a,o,s)}function oi(e,t,n,r,i){let a=fr(t,si),o=Hr.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function si(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(ci(t[r],e))return n=r+1,!0;return!1})}function ci(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var li=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new qr(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=ui(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=fr(e,si);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)oi(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&oi(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(Pr(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[Fr(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=ui(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=Hr.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===fi.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=lr.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?di.createRootAndLookUpScopeName(a,r,this):di.createRoot(`unknown`,r),t=new fi(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
|
|
4
|
+
`;let a=this.createOnigString(e),o=a.content.length,s=new mi(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Xr(this,a,i,0,t,s,!0,r);return hr(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function ui(e,t){return e=Ln(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var di=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=Zn.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Zn(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Zn(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),lr.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},fi=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?di.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.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(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,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(){return{ruleId:Fr(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=di.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,Pr(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,di.fromExtension(r,n.contentNameScopesList))}},pi=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):fr(e,si).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>fr(e,si).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},mi=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=lr.set(n,0,ur(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=lr.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},hi=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,ai(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},gi=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new hi(Xn.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Xn.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new pi(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new yr(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},_i=fi.NULL;function vi(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function yi(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function bi(e){return Array.isArray(e)?e:[e]}async function xi(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function Si(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function Ci(e){return e===`ansi`||Si(e)}function wi(e){return e===`none`}function Ti(e){return wi(e)}var Ei=/(\r?\n)/g;function Di(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(Ei),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}var Oi={light:`#333333`,dark:`#bbbbbb`},ki={light:`#fffffe`,dark:`#1e1e1e`},Ai=`__shiki_resolved`;function ji(e){if(e?.[Ai])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?Oi.light:Oi.dark,n||=t.type===`light`?ki.light:ki.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,Ai,{enumerable:!1,writable:!1,value:!0}),t}async function Mi(e){return[...new Set((await Promise.all(e.filter(e=>!Ci(e)).map(async e=>await xi(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function Ni(e){return(await Promise.all(e.map(async e=>Ti(e)?null:ji(await xi(e))))).filter(e=>!!e)}function Pi(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new R(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var Fi=class extends gi{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=ji(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=Xn.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Pi(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new R(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},Ii=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},Li=0;function Ri(e){Li+=1,e.warnings!==!1&&Li>=10&&Li%10==0&&console.warn(`[Shiki] ${Li} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new R("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(ji),i=new Fi(new Ii(e.engine,n),r,n,e.langAlias),a;function o(t){return Pi(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new R(`Language \`${e}\` not found, you may need to load it first`);return t}function c(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};g();let t=i.getTheme(e);if(!t)throw new R(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(e){g();let t=c(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function u(){return g(),i.getLoadedThemes()}function d(){return g(),i.getLoadedLanguages()}function f(...e){g(),i.loadLanguages(e.flat(1))}async function p(...e){return f(await Mi(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await Ni(e))}function g(){if(t)throw new R(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--Li)}return{setTheme:l,getTheme:c,getLanguage:s,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:o,loadLanguage:p,loadLanguageSync:f,loadTheme:h,loadThemeSync:m,dispose:_,[Symbol.dispose]:_}}async function zi(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([Ni(e.themes||[]),Mi(e.langs||[]),e.engine]);return Ri({...e,themes:t,langs:n,engine:r})}var Bi=new WeakMap;function Vi(e,t){Bi.set(e,t)}function Hi(e){return Bi.get(e)}var Ui=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries(bi(n).map(e=>[e,_i])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return Wi(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Wi(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function Gi(e,t){if(!(e instanceof Ui))throw new R(`Invalid grammar state`);return e.getInternalStack(t)}var Ki=/,/,qi=/ /;function Ji(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(Si(e.resolveLangAlias(n.lang||`text`))||wi(r))return Di(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:i,colorMap:a}=e.setTheme(r),o=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new R(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new R(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Xi(t,o,i,a,n)}function Yi(...e){if(e.length===2)return Hi(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(Si(i)||wi(a))throw new R(`Plain language does not have grammar state`);if(i===`ansi`)throw new R(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new Ui(Zi(n,c,o,s,r).stateStack,c.name,o.name)}function Xi(e,t,n,r,i){let a=Zi(e,t,n,r,i),o=new Ui(a.stateStack,t.name,n.name);return Vi(a.tokens,o),a.tokens}function Zi(e,t,n,r,i){let a=vi(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=Di(e),u=i.grammarState?Gi(i.grammarState,n.name)??_i:i.grammarContextCode==null?_i:Zi(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,d=[],f=[];for(let e=0,i=l.length;e<i;e++){let[i,p]=l[e];if(i===``){d=[],f.push([]);continue}if(o>0&&i.length>=o){d=[],f.push([{content:i,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;c&&c!==`tokenType`&&(m=t.tokenizeLine(i,u,s),h=m.tokens,g=0);let _=t.tokenizeLine2(i,u,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:i.length;if(t===o)continue;let s=_.tokens[2*e+1],l=yi(r[lr.getForeground(s)],a),u=lr.getFontStyle(s),f={content:i.substring(t,o),offset:p+t,color:l,fontStyle:u};if(c===`tokenType`)f.type=lr.getTokenType(s);else if(c){let e=[];if(c!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split(Ki).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(qi))})}f.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=i.substring(t.startIndex,t.endIndex);r+=n.length,f.explanation.push({content:n,scopes:c===`scopeName`?Qi(t.scopes):$i(e,t.scopes)}),g+=1}}d.push(f)}f.push(d),d=[],u=_.ruleStack}return{tokens:f,stateStack:u}}function Qi(e){return e.map(e=>({scopeName:e}))}function $i(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:na(e,i,t.slice(0,r))}}return n}function ea(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function ta(e,t,n){if(!ea(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)ea(e[r],n[i])&&--r,--i;return r===-1}function na(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(ta(e,t,n)){r.push(a);break}return r}function ra(e,t,n,r=Ji){let i=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),a=i.map(i=>{let a=r(e,t,{...n,theme:i.theme});return{tokens:a,state:Hi(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=ia(...a.map(e=>e.tokens)),s=o[0].map((e,t)=>e.map((e,r)=>{let a={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(a.explanation=e.explanation),o.forEach((e,n)=>{let{content:o,explanation:s,offset:c,...l}=e[t][r];a.variants[i[n].color]=l}),a})),c=a[0].state?new Ui(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&Vi(s,c),s}function ia(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}var aa=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],oa=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};oa.prototype.normal={},oa.prototype.property={},oa.prototype.space=void 0;function sa(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new oa(n,r,t)}function ca(e){return e.toLowerCase()}var la=class{constructor(e,t){this.attribute=t,this.property=e}};la.prototype.attribute=``,la.prototype.booleanish=!1,la.prototype.boolean=!1,la.prototype.commaOrSpaceSeparated=!1,la.prototype.commaSeparated=!1,la.prototype.defined=!1,la.prototype.mustUseProperty=!1,la.prototype.number=!1,la.prototype.overloadedBoolean=!1,la.prototype.property=``,la.prototype.spaceSeparated=!1,la.prototype.space=void 0;var ua=e({boolean:()=>z,booleanish:()=>B,commaOrSpaceSeparated:()=>ma,commaSeparated:()=>pa,number:()=>V,overloadedBoolean:()=>fa,spaceSeparated:()=>H}),da=0,z=ha(),B=ha(),fa=ha(),V=ha(),H=ha(),pa=ha(),ma=ha();function ha(){return 2**++da}var ga=Object.keys(ua),_a=class extends la{constructor(e,t,n,r){let i=-1;if(super(e,t),va(this,`space`,r),typeof n==`number`)for(;++i<ga.length;){let e=ga[i];va(this,ga[i],(n&ua[e])===ua[e])}}};_a.prototype.defined=!0;function va(e,t,n){n&&(e[t]=n)}function ya(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new _a(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[ca(r)]=r,n[ca(a.attribute)]=r}return new oa(t,n,e.space)}var ba=ya({properties:{ariaActiveDescendant:null,ariaAtomic:B,ariaAutoComplete:null,ariaBusy:B,ariaChecked:B,ariaColCount:V,ariaColIndex:V,ariaColSpan:V,ariaControls:H,ariaCurrent:null,ariaDescribedBy:H,ariaDetails:null,ariaDisabled:B,ariaDropEffect:H,ariaErrorMessage:null,ariaExpanded:B,ariaFlowTo:H,ariaGrabbed:B,ariaHasPopup:null,ariaHidden:B,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:H,ariaLevel:V,ariaLive:null,ariaModal:B,ariaMultiLine:B,ariaMultiSelectable:B,ariaOrientation:null,ariaOwns:H,ariaPlaceholder:null,ariaPosInSet:V,ariaPressed:B,ariaReadOnly:B,ariaRelevant:null,ariaRequired:B,ariaRoleDescription:H,ariaRowCount:V,ariaRowIndex:V,ariaRowSpan:V,ariaSelected:B,ariaSetSize:V,ariaSort:null,ariaValueMax:V,ariaValueMin:V,ariaValueNow:V,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function xa(e,t){return t in e?e[t]:t}function Sa(e,t){return xa(e,t.toLowerCase())}var Ca=ya({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:pa,acceptCharset:H,accessKey:H,action:null,allow:null,allowFullScreen:z,allowPaymentRequest:z,allowUserMedia:z,alpha:z,alt:null,as:null,async:z,autoCapitalize:null,autoComplete:H,autoFocus:z,autoPlay:z,blocking:H,capture:null,charSet:null,checked:z,cite:null,className:H,closedBy:null,colorSpace:null,cols:V,colSpan:V,command:null,commandFor:null,content:null,contentEditable:B,controls:z,controlsList:H,coords:V|pa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:z,defer:z,dir:null,dirName:null,disabled:z,download:fa,draggable:B,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:z,formTarget:null,headers:H,height:V,hidden:fa,high:V,href:null,hrefLang:null,htmlFor:H,httpEquiv:H,id:null,imageSizes:null,imageSrcSet:null,inert:z,inputMode:null,integrity:null,is:null,isMap:z,itemId:null,itemProp:H,itemRef:H,itemScope:z,itemType:H,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:z,low:V,manifest:null,max:null,maxLength:V,media:null,method:null,min:null,minLength:V,multiple:z,muted:z,name:null,nonce:null,noModule:z,noValidate:z,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:z,optimum:V,pattern:null,ping:H,placeholder:null,playsInline:z,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:z,referrerPolicy:null,rel:H,required:z,reversed:z,rows:V,rowSpan:V,sandbox:H,scope:null,scoped:z,seamless:z,selected:z,shadowRootClonable:z,shadowRootCustomElementRegistry:z,shadowRootDelegatesFocus:z,shadowRootMode:null,shadowRootSerializable:z,shape:null,size:V,sizes:null,slot:null,span:V,spellCheck:B,src:null,srcDoc:null,srcLang:null,srcSet:null,start:V,step:null,style:null,tabIndex:V,target:null,title:null,translate:null,type:null,typeMustMatch:z,useMap:null,value:B,width:V,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:H,axis:null,background:null,bgColor:null,border:V,borderColor:null,bottomMargin:V,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:z,declare:z,event:null,face:null,frame:null,frameBorder:null,hSpace:V,leftMargin:V,link:null,longDesc:null,lowSrc:null,marginHeight:V,marginWidth:V,noResize:z,noHref:z,noShade:z,noWrap:z,object:null,profile:null,prompt:null,rev:null,rightMargin:V,rules:null,scheme:null,scrolling:B,standby:null,summary:null,text:null,topMargin:V,valueType:null,version:null,vAlign:null,vLink:null,vSpace:V,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:z,disablePictureInPicture:z,disableRemotePlayback:z,exportParts:pa,part:H,prefix:null,property:null,results:V,security:null,unselectable:null},space:`html`,transform:Sa}),wa=ya({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`,maskType:`mask-type`,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:ma,accentHeight:V,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:V,amplitude:V,arabicForm:null,ascent:V,attributeName:null,attributeType:null,azimuth:V,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:V,by:null,calcMode:null,capHeight:V,className:H,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:V,diffuseConstant:V,direction:null,display:null,dur:null,divisor:V,dominantBaseline:null,download:z,dx:null,dy:null,edgeMode:null,editable:null,elevation:V,enableBackground:null,end:null,event:null,exponent:V,externalResourcesRequired:null,fill:null,fillOpacity:V,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:pa,g2:pa,glyphName:pa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:V,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:V,horizOriginX:V,horizOriginY:V,id:null,ideographic:V,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:V,k:V,k1:V,k2:V,k3:V,k4:V,kernelMatrix:ma,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:V,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:V,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:V,overlineThickness:V,paintOrder:null,panose1:null,path:null,pathLength:V,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:H,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:V,pointsAtY:V,pointsAtZ:V,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ma,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ma,rev:ma,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ma,requiredFeatures:ma,requiredFonts:ma,requiredFormats:ma,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:V,specularExponent:V,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:V,strikethroughThickness:V,string:null,stroke:null,strokeDashArray:ma,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:V,strokeOpacity:V,strokeWidth:null,style:null,surfaceScale:V,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ma,tabIndex:V,tableValues:null,target:null,targetX:V,targetY:V,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ma,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:V,underlineThickness:V,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:V,values:null,vAlphabetic:V,vMathematical:V,vectorEffect:null,vHanging:V,vIdeographic:V,version:null,vertAdvY:V,vertOriginX:V,vertOriginY:V,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:V,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:xa}),Ta=ya({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Ea=ya({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Sa}),Da=ya({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Oa=/[A-Z]/g,ka=/-[a-z]/g,Aa=/^data[-\w.:]+$/i;function ja(e,t){let n=ca(t),r=t,i=la;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Aa.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(ka,Na);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!ka.test(e)){let n=e.replace(Oa,Ma);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=_a}return new i(r,t)}function Ma(e){return`-`+e.toLowerCase()}function Na(e){return e.charAt(1).toUpperCase()}var Pa=sa([ba,Ca,Ta,Ea,Da],`html`),Fa=sa([ba,wa,Ta,Ea,Da],`svg`),Ia={}.hasOwnProperty;function La(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&Ia.call(t,e)){let n=String(t[e]);i=Ia.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var Ra=/["&'<>`]/g,za=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ba=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Va=/[|\\{}()[\]^$+*?.]/g,Ha=new WeakMap;function Ua(e,t){if(e=e.replace(t.subset?Wa(t.subset):Ra,r),t.subset||t.escapeOnly)return e;return e.replace(za,n).replace(Ba,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function Wa(e){let t=Ha.get(e);return t||(t=Ga(e),Ha.set(e,t)),t}function Ga(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(Va,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var Ka=/[\dA-Fa-f]/;function qa(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!Ka.test(String.fromCharCode(t))?r:r+`;`}var Ja=/\d/;function Ya(e,t,n){let r=`&#`+String(e);return n&&t&&!Ja.test(String.fromCharCode(t))?r:r+`;`}var Xa=`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`.split(`.`),Za={nbsp:`\xA0`,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:`€`},Qa=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],$a={}.hasOwnProperty,eo={},to;for(to in Za)$a.call(Za,to)&&(eo[Za[to]]=to);var no=/[^\dA-Za-z]/;function ro(e,t,n,r){let i=String.fromCharCode(e);if($a.call(eo,i)){let e=eo[i],a=`&`+e;return n&&Xa.includes(e)&&!Qa.includes(e)&&(!r||t&&t!==61&&no.test(String.fromCharCode(t)))?a:a+`;`}return``}function io(e,t,n){let r=qa(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=ro(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=Ya(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function ao(e,t){return Ua(e,Object.assign({format:io},t))}var oo=/^>|^->|<!--|-->|--!>|<!-$/g,so=[`>`],co=[`<`,`>`];function lo(e,t,n,r){return r.settings.bogusComments?`<?`+ao(e.value,Object.assign({},r.settings.characterReferences,{subset:so}))+`>`:`<!--`+e.value.replace(oo,i)+`-->`;function i(e){return ao(e,Object.assign({},r.settings.characterReferences,{subset:co}))}}function uo(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function fo(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function po(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function mo(e){return e.join(` `).trim()}var ho=/[ \t\n\f\r]/g;function go(e){return typeof e==`object`?e.type===`text`&&_o(e.value):_o(e)}function _o(e){return e.replace(ho,``)===``}var U=bo(1),vo=bo(-1),yo=[];function bo(e){return t;function t(t,n,r){let i=t?t.children:yo,a=(n||0)+e,o=i[a];if(!r)for(;o&&go(o);)a+=e,o=i[a];return o}}var xo={}.hasOwnProperty;function So(e){return t;function t(t,n,r){return xo.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var Co=So({body:Eo,caption:wo,colgroup:wo,dd:Ao,dt:ko,head:wo,html:To,li:Oo,optgroup:Mo,option:No,p:Do,rp:jo,rt:jo,tbody:Fo,td:Ro,tfoot:Io,th:Ro,thead:Po,tr:Lo});function wo(e,t,n){let r=U(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&go(r.value.charAt(0)))}function To(e,t,n){let r=U(n,t);return!r||r.type!==`comment`}function Eo(e,t,n){let r=U(n,t);return!r||r.type!==`comment`}function Do(e,t,n){let r=U(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function Oo(e,t,n){let r=U(n,t);return!r||r.type===`element`&&r.tagName===`li`}function ko(e,t,n){let r=U(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function Ao(e,t,n){let r=U(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function jo(e,t,n){let r=U(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function Mo(e,t,n){let r=U(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function No(e,t,n){let r=U(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function Po(e,t,n){let r=U(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function Fo(e,t,n){let r=U(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function Io(e,t,n){return!U(n,t)}function Lo(e,t,n){let r=U(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function Ro(e,t,n){let r=U(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var zo=So({body:Ho,colgroup:Uo,head:Vo,html:Bo,tbody:Wo});function Bo(e){let t=U(e,-1);return!t||t.type!==`comment`}function Vo(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function Ho(e){let t=U(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&go(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function Uo(e,t,n){let r=vo(n,t),i=U(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&Co(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function Wo(e,t,n){let r=vo(n,t),i=U(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&Co(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var Go={name:[[`
|
|
5
|
+
\f\r &/=>`.split(``),`
|
|
6
|
+
\f\r "&'/=>\``.split(``)],[`\0
|
|
7
|
+
\f\r "&'/<=>`.split(``),`\0
|
|
8
|
+
\f\r "&'/<=>\``.split(``)]],unquoted:[[`
|
|
9
|
+
\f\r &>`.split(``),`\0
|
|
10
|
+
\f\r "&'<=>\``.split(``)],[`\0
|
|
11
|
+
\f\r "&'<=>\``.split(``),`\0
|
|
12
|
+
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function Ko(e,t,n,r){let i=r.schema,a=i.space!==`svg`&&r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=Fa);let l=qo(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!zo(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!Co(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function qo(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=Jo(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function Jo(e,t,n){let r=ja(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=ao(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Go.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?po:mo)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=ao(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Go.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&fo(n,o)>fo(n,e.alternative)&&(o=e.alternative),s=o+ao(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?Go.single:Go.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var Yo=[`<`,`&`];function Xo(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:ao(e.value,Object.assign({},r.settings.characterReferences,{subset:Yo}))}function Zo(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Xo(e,t,n,r)}function Qo(e,t,n,r){return r.all(e)}var $o=La(`type`,{invalid:es,unknown:ts,handlers:{comment:lo,doctype:uo,element:Ko,raw:Zo,root:Qo,text:Xo}});function es(e){throw Error("Expected node, not `"+e+"`")}function ts(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var ns={},rs={},is=[];function as(e,t){let n=t||ns,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:os,all:ss,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||aa,characterReferences:n.characterReferences||rs,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?Fa:Pa,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function os(e,t,n){return $o(e,t,n,this)}function ss(e){let t=[],n=e&&e.children||is,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var cs=/\s+/g;function ls(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(cs)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(cs);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}var us=/:?lang=["']([^"']+)["']/g,ds=/(?:```|~~~)([\w-]+)/g,fs=/\\begin\{([\w-]+)\}/g,ps=/<script\s+(?:type|lang)=["']([^"']+)["']/gi,ms=/^\s*---\r?\n[\s\S]*?\r?\n---(?:\r?\n|\s*$)/;function hs(e){let t=Di(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}function gs(e,t,n){let r=new Set;for(let t of e.matchAll(us)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(ds)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(fs)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(ps)){let e=t[1].toLowerCase().trim(),n=e.includes(`/`)?e.split(`/`).pop():e;n&&r.add(n)}if(ms.test(e)&&r.add(`yaml`),!n)return[...r];let i=n.getBundledLanguages();return[...r].filter(e=>e&&i[e])}var _s=[`color`,`background-color`];function vs(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function ys(e,t){let n=0,r=e.length;for(;n<r;){let i=n+(r-n>>1);e[i]<=t?n=i+1:r=i}return n}function bs(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=e.offset+e.content.length,r=ys(n,e.offset),i=r;for(;i<n.length&&n[i]<t;)i++;if(r===i)return e;let a=n.slice(r,i);for(let t=0;t<a.length;t++)a[t]-=e.offset;return vs(e,a)})):e}function xs(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>Ss(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),c={},l=(e,r)=>{let i=r===`color`?``:r===`background-color`?`-bg`:`-${r}`;return n+t[e]+(r===`color`?``:i)};return o.forEach((e,n)=>{for(let a of s){let s=e[a]||`inherit`;if(n===0&&r&&_s.includes(a)){if(r===`light-dark()`&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new R('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let u=o[e][a]||`inherit`,d=o[r][a]||`inherit`;c[a]=`light-dark(${u}, ${d})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s}else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function Ss(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&rr.Italic&&(t[`font-style`]=`italic`),e.fontStyle&rr.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&rr.Underline&&n.push(`underline`),e.fontStyle&rr.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function Cs(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function ws(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=hs(t.source);function r(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new R(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...n.indexToPos(e),offset:e}}{let t=n.lines[e.line];if(t===void 0)throw new R(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${n.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new R(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:n.posToIndex(e.line,r)}}}let i=(t.options.decorations||[]).map(e=>({...e,start:r(e.start),end:r(e.end)}));Ts(i),e.set(t.meta,{decorations:i,converter:n,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return bs(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=[...e.children].filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new R(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let a=r[e],s=``,c=-1,l=-1;if(t===0&&(c=0),n===0&&(l=0),n===1/0&&(l=a.children.length),c===-1||l===-1)for(let e=0;e<a.children.length;e++)s+=Es(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new R(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new R(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(c,l);if(!i.alwaysWrap&&u.length===a.children.length)o(a,i,`line`);else if(!i.alwaysWrap&&u.length===1&&u[0].type===`element`)o(u[0],i,`token`);else{let e={type:`element`,tagName:`span`,properties:{},children:u};o(e,i,`wrapper`),a.children.splice(c,u.length,e)}}function a(e,t){r[e]=o(r[e],t,`line`)}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&ls(e,t.properties.class),e=i(e,n)||e,e}let s=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(let e of c){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let r=t.line+1;r<n.line;r++)s.unshift(()=>a(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function Ts(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new R(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new R(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function Es(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(Es).join(``):``}var Ds=[ws()];function Os(e){let t=ks(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...Ds]}function ks(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case`pre`:t.push(i);break;case`post`:n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}var As=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],js={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function Ms(e,t){let n=e.indexOf(`\x1B`,t);if(n!==-1&&e[n+1]===`[`){let t=e.indexOf(`m`,n);if(t!==-1)return{sequence:e.substring(n+2,t).split(`;`),startPosition:n,position:t+1}}return{position:e.length}}function Ns(e){let t=e.shift();if(t===`2`){let t=e.splice(0,3).map(e=>Number.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function Ps(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r)){if(r===0)t.push({type:`resetAll`});else if(r<=9)js[r]&&t.push({type:`setDecoration`,value:js[r]});else if(r<=29){let e=js[r-20];e&&(t.push({type:`resetDecoration`,value:e}),e===`dim`&&t.push({type:`resetDecoration`,value:`bold`}))}else if(r<=37)t.push({type:`setForegroundColor`,value:{type:`named`,name:As[r-30]}});else if(r===38){let n=Ns(e);n&&t.push({type:`setForegroundColor`,value:n})}else if(r===39)t.push({type:`resetForegroundColor`});else if(r<=47)t.push({type:`setBackgroundColor`,value:{type:`named`,name:As[r-40]}});else if(r===48){let n=Ns(e);n&&t.push({type:`setBackgroundColor`,value:n})}else r===49?t.push({type:`resetBackgroundColor`}):r===53?t.push({type:`setDecoration`,value:`overline`}):r===55?t.push({type:`resetDecoration`,value:`overline`}):r>=90&&r<=97?t.push({type:`setForegroundColor`,value:{type:`named`,name:As[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:As[r-100+8]}})}}return t}function Fs(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=Ms(r,a),s=o.sequence?r.substring(a,o.startPosition):r.substring(a);if(s.length>0&&i.push({value:s,foreground:e,background:t,decorations:new Set(n)}),o.sequence){let r=Ps(o.sequence);for(let i of r)i.type===`resetAll`?(e=null,t=null,n.clear()):i.type===`resetForegroundColor`?e=null:i.type===`resetBackgroundColor`?t=null:i.type===`resetDecoration`&&n.delete(i.value);for(let i of r)i.type===`setForegroundColor`?e=i.value:i.type===`setBackgroundColor`?t=i.value:i.type===`setDecoration`&&n.add(i.value)}a=o.position}while(a<r.length);return i}}}var Is={black:`#000000`,red:`#bb0000`,green:`#00bb00`,yellow:`#bbbb00`,blue:`#0000bb`,magenta:`#ff00ff`,cyan:`#00bbbb`,white:`#eeeeee`,brightBlack:`#555555`,brightRed:`#ff5555`,brightGreen:`#00ff00`,brightYellow:`#ffff55`,brightBlue:`#5555ff`,brightMagenta:`#ff55ff`,brightCyan:`#55ffff`,brightWhite:`#ffffff`};function Ls(e=Is){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,`0`)).join(``)}`}let r;function i(){if(r)return r;r=[];for(let e=0;e<As.length;e++)r.push(t(As[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)r.push(n([e[t],e[i],e[a]]));let i=8;for(let e=0;e<24;e++,i+=10)r.push(n([i,i,i]));return r}function a(e){return i()[e]}function o(e){switch(e.type){case`named`:return t(e.name);case`rgb`:return n(e.rgb);case`table`:return a(e.index)}}return{value:o}}var Rs=/#([0-9a-f]{3,8})/i,zs=/var\((--[\w-]+-ansi-[\w-]+)\)/,Bs={black:`#000000`,red:`#cd3131`,green:`#0DBC79`,yellow:`#E5E510`,blue:`#2472C8`,magenta:`#BC3FBC`,cyan:`#11A8CD`,white:`#E5E5E5`,brightBlack:`#666666`,brightRed:`#F14C4C`,brightGreen:`#23D18B`,brightYellow:`#F5F543`,brightBlue:`#3B8EEA`,brightMagenta:`#D670D6`,brightCyan:`#29B8DB`,brightWhite:`#FFFFFF`};function Vs(e,t,n){let r=vi(e,n),i=Di(t),a=Ls(Object.fromEntries(As.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||Bs[t]]}))),o=Fs();return i.map(t=>o.parse(t[0]).map(n=>{let i,o;n.decorations.has(`reverse`)?(i=n.background?a.value(n.background):e.bg,o=n.foreground?a.value(n.foreground):e.fg):(i=n.foreground?a.value(n.foreground):e.fg,o=n.background?a.value(n.background):void 0),i=yi(i,r),o=yi(o,r),n.decorations.has(`dim`)&&(i=Hs(i));let s=rr.None;return n.decorations.has(`bold`)&&(s|=rr.Bold),n.decorations.has(`italic`)&&(s|=rr.Italic),n.decorations.has(`underline`)&&(s|=rr.Underline),n.decorations.has(`strikethrough`)&&(s|=rr.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function Hs(e){let t=e.match(Rs);if(t){let e=t[1];if(e.length===8){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,`0`);return`#${e.slice(0,6)}${t}`}if(e.length===6)return`#${e}80`;if(e.length===4){let t=e[0],n=e[1],r=e[2],i=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,`0`)}`}if(e.length===3){let t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}let n=e.match(zs);return n?`var(${n[1]}-dim)`:e}function Us(e,t,n={}){let r=e.resolveLangAlias(n.lang||`text`),{theme:i=e.getLoadedThemes()[0]}=n;if(!Si(r)&&!wi(i)&&r===`ansi`){let{theme:r}=e.setTheme(i);return Vs(r,t,n)}return Ji(e,t,n)}function Ws(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:+(t.color===l));if(f.length===0)throw new R("`themes` option must not be empty");let p=ra(e,t,n,Us);if(c=Hi(p),l&&l!==`light-dark()`&&!f.some(e=>e.color===l))throw new R(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(t=>e.getTheme(t.theme)),h=f.map(e=>e.color);a=p.map(e=>e.map(e=>xs(e,h,u,l,d))),c&&Vi(a,c);let g=f.map(e=>vi(e.theme,n));i=Gs(f,m,g,u,l,`fg`,d),r=Gs(f,m,g,u,l,`bg`,d),o=`shiki-themes ${m.map(e=>e.name).join(` `)}`,s=l?void 0:[i,r].join(`;`)}else if(`theme`in n){let s=vi(n.theme,n);a=Us(e,t,n);let l=e.getTheme(n.theme);r=yi(l.bg,s),i=yi(l.fg,s),o=l.name,c=Hi(a)}else throw new R("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function Gs(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=yi(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===`light-dark()`&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new R('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${yi(t[r][a],n[r])||`inherit`}, ${yi(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}var Ks=/^\s+$/,qs=/^(\s*)(.*?)(\s*)$/;function Js(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>Js(e,t,n),codeToTokens:(t,n)=>Ws(e,t,n)}){let i=t;for(let e of Os(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=Ws(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=Xs(a):d===`never`&&(a=Zs(a)),f&&(a=Qs(a));let p={...r,get source(){return i}};for(let e of Os(n))a=e.tokens?.call(p,a)||a;return Ys(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function Ys(e,t,n,r=Hi(e)){let i=Os(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(l.style=t.rootStyle==null?`background-color:${t.bg};color:${t.fg}`:t.rootStyle),c!==!1&&c!=null&&(l.tabindex=c.toString());for(let[e,n]of Object.entries(t.meta||{}))e.startsWith(`_`)||(l[e]=n);let u={type:`element`,tagName:`pre`,properties:l,children:[],data:t.data},d={type:`element`,tagName:`code`,properties:{},children:a},f=[],p={...n,structure:s,addClassToHast:ls,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return f}};if(e.forEach((e,t)=>{t&&(s===`inline`?o.children.push({type:`element`,tagName:`br`,properties:{},children:[]}):s===`classic`&&a.push({type:`text`,value:`
|
|
13
|
+
`}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=Cs(a.htmlStyle||Ss(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&Vi(m,r),m}function Xs(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&rr.Underline||i.fontStyle&rr.Strikethrough));o&&Ks.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function Zs(e){return e.map(e=>e.flatMap(e=>{if(Ks.test(e.content))return e;let t=e.content.match(qs);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function Qs(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=Cs(e.htmlStyle||Ss(e)),i=Cs(n.htmlStyle||Ss(n)),a=e.fontStyle&&(e.fontStyle&rr.Underline||e.fontStyle&rr.Strikethrough),o=n.fontStyle&&(n.fontStyle&rr.Underline||n.fontStyle&rr.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var $s=as;function ec(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>Js(e,t,n),codeToTokens:(t,n)=>Ws(e,t,n)},i=$s(Js(e,t,n,r));for(let e of Os(n))i=e.postprocess?.call(r,i,n)||i;return i}async function tc(e){let t=await zi(e);return{getLastGrammarState:(...e)=>Yi(t,...e),codeToTokensBase:(e,n)=>Us(t,e,n),codeToTokensWithThemes:(e,n)=>ra(t,e,n),codeToTokens:(e,n)=>Ws(t,e,n),codeToHast:(e,n)=>Js(t,e,n),codeToHtml:(e,n)=>ec(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function nc(e){let t=e.langs,n=e.themes,r=e.engine;async function i(e){function i(n){if(typeof n==`string`){if(n=e.langAlias?.[n]||n,Ci(n))return[];let r=t[n];if(!r)throw new R(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function a(e){if(Ti(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new R(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let o=(e.themes??[]).map(e=>a(e)),s=(e.langs??[]).map(e=>i(e)),c=await tc({engine:e.engine??r(),...e,themes:o,langs:s});return{...c,loadLanguage(...e){return c.loadLanguage(...e.map(i))},loadTheme(...e){return c.loadTheme(...e.map(a))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return i}function rc(e){let t;async function n(n={}){if(t){let e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}{t=e({...n,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...n.themes||[]),r.loadLanguage(...n.langs||[])]),r}}return n}function ic(e,t){let n=rc(e);async function r(e,r){let i=await n({langs:[r.lang],themes:`theme`in r?[r.theme]:Object.values(r.themes)}),a=await t?.guessEmbeddedLanguages?.(e,r.lang,i);return a&&await i.loadLanguage(...a),i}return{getSingletonHighlighter(e){return n(e)},async codeToHtml(e,t){return(await r(e,t)).codeToHtml(e,t)},async codeToHast(e,t){return(await r(e,t)).codeToHast(e,t)},async codeToTokens(e,t){return(await r(e,t)).codeToTokens(e,t)},async codeToTokensBase(e,t){return(await r(e,t)).codeToTokensBase(e,t)},async codeToTokensWithThemes(e,t){return(await r(e,t)).codeToTokensWithThemes(e,t)},async getLastGrammarState(e,t){return(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}}var ac=nc({langs:sn,themes:cn,engine:()=>(0,In.createOnigurumaEngine)(M(()=>import(`./wasm-BnjxR4X6.js`),[],import.meta.url))}),{codeToHtml:oc,codeToHast:sc,codeToTokens:cc,codeToTokensBase:lc,codeToTokensWithThemes:uc,getSingletonHighlighter:dc,getLastGrammarState:fc}=ic(ac,{guessEmbeddedLanguages:gs}),pc=4294967295,mc=class{patterns;options;regexps;constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}})}findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=[];function a(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>e==null?{start:pc,end:pc,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{n.lastIndex=t;let o=n.exec(r);if(!o)continue;if(o.index===t)return a(e,o,0);i.push([e,o,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(i.length){let e=Math.min(...i.map(e=>e[1].index));for(let[t,n,r]of i)if(n.index===e)return a(t,n,r)}return null}};function hc(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function gc(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var _c=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),vc=String.raw;function yc(e,t){if(e==null)throw Error(t??`Value expected`);return e}var bc=vc`\[\^?`,xc=`c.? | C(?:-.?)?|${vc`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${vc`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${vc`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${vc`o\{[^\}]*\}?`}|${vc`\d{1,3}`}`,Sc=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Cc=new RegExp(vc`
|
|
14
|
+
\\ (?:
|
|
15
|
+
${xc}
|
|
16
|
+
| [gk]<[^>]*>?
|
|
17
|
+
| [gk]'[^']*'?
|
|
18
|
+
| .
|
|
19
|
+
)
|
|
20
|
+
| \( (?:
|
|
21
|
+
\? (?:
|
|
22
|
+
[:=!>({]
|
|
23
|
+
| <[=!]
|
|
24
|
+
| <[^>]*>
|
|
25
|
+
| '[^']*'
|
|
26
|
+
| ~\|?
|
|
27
|
+
| #(?:[^)\\]|\\.?)*
|
|
28
|
+
| [^:)]*[:)]
|
|
29
|
+
)?
|
|
30
|
+
| \*[^\)]*\)?
|
|
31
|
+
)?
|
|
32
|
+
| (?:${Sc.source})+
|
|
33
|
+
| ${bc}
|
|
34
|
+
| .
|
|
35
|
+
`.replace(/\s+/g,``),`gsu`),wc=new RegExp(vc`
|
|
36
|
+
\\ (?:
|
|
37
|
+
${xc}
|
|
38
|
+
| .
|
|
39
|
+
)
|
|
40
|
+
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
41
|
+
| ${bc}
|
|
42
|
+
| &&
|
|
43
|
+
| .
|
|
44
|
+
`.replace(/\s+/g,``),`gsu`);function Tc(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=tl(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for(Cc.lastIndex=0;s=Cc.exec(e);){let t=Ec(a,e,s[0],Cc.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(Cc.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?rl(e,u):e).flat(),flags:r}}function Ec(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=Dc(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:jc(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:Gc(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:Mc(n)}}if(a===`K`)return{token:zc(`keep`,n)};if(a===`N`||a===`R`)return{token:Rc(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:Rc(`any`,n)};if(a===`X`)return{token:Rc(`text_segment`,n)};let e=kc(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:Xc(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:Yc(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:Hc(`group`,n)};if(n===`(?>`)return{token:Hc(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:Hc(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:Hc(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:Hc(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:Vc(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
|
|
45
|
+
`,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:Rc(`dot`,n)}:n===`^`||n===`$`?{token:jc(e.singleline?{"^":vc`\A`,$:vc`\Z`}[n]:n,n)}:n===`|`?{token:Ac(n)}:Sc.test(n)?{tokens:il(n)}:{token:Nc(hc(n),n)}}function Dc(e,t,n){let r=[Lc(t[1]===`^`,t)],i=1,a;for(wc.lastIndex=n;a=wc.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(Lc(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(Nc(93,e));else if(i--,r.push(Pc(e)),!i)break}else{let t=Oc(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:wc.lastIndex||e.length}}function Oc(e){if(e[0]===`\\`)return kc(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!_c.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return Rc(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?Fc(e):e===`&&`?Ic(e):Nc(hc(e),e)}function kc(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return Jc(e);if(`dDhHsSwW`.includes(n))return Qc(e);if(e.startsWith(vc`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return $c(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return Nc(hc(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return Nc(nl(e),e);if(qc.has(n))return Nc(qc.get(n),e);if(/\d/.test(n))return Bc(t,e);if(e===`\\`)throw Error(vc`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return Nc(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function Ac(e){return{type:`Alternator`,raw:e}}function jc(e,t){return{type:`Assertion`,kind:e,raw:t}}function Mc(e){return{type:`Backreference`,raw:e}}function Nc(e,t){return{type:`Character`,value:e,raw:t}}function Pc(e){return{type:`CharacterClassClose`,raw:e}}function Fc(e){return{type:`CharacterClassHyphen`,raw:e}}function Ic(e){return{type:`CharacterClassIntersector`,raw:e}}function Lc(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function Rc(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function zc(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:yc(n.flags),raw:t}}function Bc(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function Vc(e){return{type:`GroupClose`,raw:e}}function Hc(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function Uc(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function Wc(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function Gc(e){return{type:`Subroutine`,raw:e}}var Kc=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),qc=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function Jc(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return Nc(hc(t.toUpperCase())-64,e)}function Yc(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=el(n),o=el(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),zc(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,Hc(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function Xc(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=Kc.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(a.length===1&&(typeof o==`number`||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case`cmp`:if(a.length!==3)throw Error(`Named callout must have three arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof s==`number`||!/^(?:[<>!=]=|[<>])$/.test(s))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${s}"`);if(typeof c==`string`&&!/^[A-Za-z_]\w*$/.test(c))throw Error(`Named callout argument three must be a tag or number "${c}"`);break;case`custom`:throw Error(`Undefined callout name "${n}"`);default:throw Error(`Unexpected named callout kind "${l}"`)}return Uc(l,r??null,i?.split(`,`)??null,e)}function Zc(e){let t=null,n,r;if(e[0]===`{`){let{minStr:i,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+i>o||a&&+a>o)throw Error(`Quantifier value unsupported in Oniguruma`);if(n=+i,r=a===void 0?+i:a===``?1/0:+a,n>r&&(t=`possessive`,[n,r]=[r,n]),e.endsWith(`?`)){if(t===`possessive`)throw Error(`Unsupported possessive interval quantifier chain with "?"`);t=`lazy`}else t||=`greedy`}else n=+(e[0]===`+`),r=e[0]===`?`?1:1/0,t=e[1]===`+`?`possessive`:e[1]===`?`?`lazy`:`greedy`;return Wc(t,n,r,e)}function Qc(e){let t=e[1].toLowerCase();return Rc({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function $c(e){let{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return Rc(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function el(e){let t={};return e.includes(`i`)&&(t.ignoreCase=!0),e.includes(`m`)&&(t.dotAll=!0),e.includes(`x`)&&(t.extended=!0),Object.keys(t).length?t:null}function tl(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){let r=e[n];if(!`imxDPSWy`.includes(r))throw Error(`Invalid flag "${r}"`);if(r===`y`){if(!/^y{[gw]}/.test(e.slice(n)))throw Error(`Invalid or unspecified flag "y" mode`);t.textSegmentMode=e[n+2]===`g`?`grapheme`:`word`,n+=3;continue}t[{i:`ignoreCase`,m:`dotAll`,x:`extended`,D:`digitIsAscii`,P:`posixIsAscii`,S:`spaceIsAscii`,W:`wordIsAscii`}[r]]=!0}return t}function nl(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);let t=e[2]===`{`?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function rl(e,t){let{raw:n,inCharClass:r}=e,i=n.slice(1);if(!r&&(i!==`0`&&i.length===1||i[0]!==`0`&&+i<=t))return[Mc(n)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e<o.length;e++){let t=o[e],r;if(e===0&&t!==`8`&&t!==`9`){if(r=parseInt(t,8),r>127)throw Error(vc`Octal encoded byte above 177 unsupported "${n}"`)}else r=hc(t);a.push(Nc(r,(e===0?`\\`:``)+t))}return a}function il(e){let t=[],n=new RegExp(Sc,`gy`),r;for(;r=n.exec(e);){let e=r[0];if(e[0]===`{`){let r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){let{min:i,max:a}=r.groups;if(+i>+a&&e.endsWith(`?`)){n.lastIndex--,t.push(Zc(e.slice(0,-1)));continue}}}t.push(Zc(e))}return t}function al(e,t){if(!Array.isArray(e.body))throw Error(`Expected node with body array`);if(e.body.length!==1)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}function ol(e){return sl.has(e.type)}var sl=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function cl(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=Tc(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),i=(e,t)=>{let n=r.tokens[a.nextIndex];switch(a.parent=e,a.nextIndex++,n.type){case`Alternator`:return vl();case`Assertion`:return ll(n);case`Backreference`:return ul(n,a);case`Character`:return Sl(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return dl(n,a,t);case`CharacterClassOpen`:return fl(n,a,t);case`CharacterSet`:return pl(n,a);case`Directive`:return El(n.kind,{flags:n.flags});case`GroupOpen`:return ml(n,a,t);case`NamedCallout`:return Al(n.kind,n.tag,n.arguments);case`Quantifier`:return hl(n,a);case`Subroutine`:return gl(n,a);default:throw Error(`Unexpected token type "${n.type}"`)}},a={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:i},o=Nl(Dl(r.flags)),s=o.body[0];for(;a.nextIndex<r.tokens.length;){let e=i(s,{});e.type===`Alternative`?(o.body.push(e),s=e):s.body.push(e)}let{capturingGroups:c,hasNumberedRef:l,namedGroupsByName:u,subroutines:d}=a;if(l&&u.size&&!n.rules.captureGroup)throw Error(`Numbered backref/subroutine not allowed when using named capture`);for(let{ref:e}of d)if(typeof e==`number`){if(e>c.length)throw Error(`Subroutine uses a group number that's not defined`);e&&(c[e-1].isSubroutined=!0)}else if(u.has(e)){if(u.get(e).length>1)throw Error(vc`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(vc`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function ll({kind:e}){return yl(yc({"^":`line_start`,$:`line_end`,"\\A":`string_start`,"\\b":`word_boundary`,"\\B":`word_boundary`,"\\G":`search_start`,"\\y":`text_segment_boundary`,"\\Y":`text_segment_boundary`,"\\z":`string_end`,"\\Z":`string_end_newline`}[e],`Unexpected assertion kind "${e}"`),{negate:e===vc`\B`||e===vc`\Y`})}function ul({raw:e},t){let n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),i=(n,r=!1)=>{let i=t.capturingGroups.length,a=!1;if(n>i){if(t.skipBackrefValidation)a=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`)}return t.hasNumberedRef=!0,bl(r?i+1-n:n,{orphan:a})};if(n){let n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return i(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw Error(`Group name not defined to the left "${e}"`);return bl(r)}return i(+r)}function dl(e,t,n){let{tokens:r,walk:i}=t,a=t.parent,o=a.body.at(-1),s=r[t.nextIndex];if(!n.isCheckingRangeEnd&&o&&o.type!==`CharacterClass`&&o.type!==`CharacterClassRange`&&s&&s.type!==`CharacterClassOpen`&&s.type!==`CharacterClassClose`&&s.type!==`CharacterClassIntersector`){let e=i(a,{...n,isCheckingRangeEnd:!0});if(o.type===`Character`&&e.type===`Character`)return a.body.pop(),wl(o,e);throw Error(`Invalid character class range`)}return Sl(hc(`-`))}function fl({negate:e},t,n){let{tokens:r,walk:i}=t,a=[Cl()],o=r[t.nextIndex],s=Wl(o);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)a.push(Cl()),t.nextIndex++;else{let e=a.at(-1);e.body.push(i(e,n))}s=Wl(r[t.nextIndex],o)}let c=Cl({negate:e});return a.length===1?c.body=a[0].body:(c.kind=`intersection`,c.body=a.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function pl({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=Ul(n);if(_c.has(r)&&!o?.has(r))e=`posix`,n=r;else return Fl(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?jl(n,{negate:t}):Tl(e,{negate:t})}function ml(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=Il(e),l=c.type===`AbsenceFunction`,u=Bl(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&gc(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=Gl(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push(vl()),t.nextIndex++;else{let e=c.body.at(-1),t=s(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||l,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||d});if(e.body.push(t),(u||n.isInLookbehind)&&!o){let e=`Lookbehind includes a pattern not allowed by Oniguruma`;if(d||n.isInNegLookbehind){if(zl(t)||t.type===`CapturingGroup`)throw Error(e)}else if(zl(t)||Bl(t)&&t.negate)throw Error(e)}}f=Gl(r[t.nextIndex])}return t.nextIndex++,c}function hl({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!ol(a))throw Error(`Quantifier requires a repeatable token`);let o=Ml(e,t,n,a);return i.body.pop(),o}function gl({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(a){let e=+a.groups.num,r=n.length;if(t.hasNumberedRef=!0,i={"":e,"+":r+e,"-":r+1-e}[a.groups.sign],i<1)throw Error(`Invalid subroutine number`)}else i===`0`&&(i=0);let o=Pl(i);return r.push(o),o}function _l(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:Ll(t?.body)}}function vl(e){return{type:`Alternative`,body:Rl(e?.body)}}function yl(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function bl(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function xl(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!Vl(n.name))throw Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:`CapturingGroup`,number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:Ll(t?.body)}}function Sl(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(n.useLastValid)e=1114111;else throw Error(e>1310719?`Invalid code point out of range "\\x{${t}}"`:`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:`Character`,value:e}}function Cl(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:Rl(e?.body)}}function wl(e,t){if(t.value<e.value)throw Error(`Character class range out of order`);return{type:`CharacterClassRange`,min:e,max:t}}function Tl(e,t){let n=!!t?.negate,r={type:`CharacterSet`,kind:e};return(e===`digit`||e===`hex`||e===`newline`||e===`space`||e===`word`)&&(r.negate=n),(e===`text_segment`||e===`newline`&&!n)&&(r.variableLength=!0),r}function El(e,t={}){if(e===`keep`)return{type:`Directive`,kind:e};if(e===`flags`)return{type:`Directive`,kind:e,flags:yc(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}function Dl(e){return{type:`Flags`,...e}}function Ol(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw Error(`Atomic group cannot have flags`);return{type:`Group`,...t&&{atomic:t},...n&&{flags:n},body:Ll(e?.body)}}function kl(e){let t={behind:!1,negate:!1,...e};return{type:`LookaroundAssertion`,kind:t.behind?`lookbehind`:`lookahead`,negate:t.negate,body:Ll(e?.body)}}function Al(e,t,n){return{type:`NamedCallout`,kind:e,tag:t,arguments:n}}function jl(e,t){let n=!!t?.negate;if(!_c.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:`CharacterSet`,kind:`posix`,value:e,negate:n}}function Ml(e,t,n,r){if(t>n)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function Nl(e,t){return{type:`Regex`,body:Ll(t?.body),flags:e}}function Pl(e){return{type:`Subroutine`,ref:e}}function Fl(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(Ul(e));if(!r){if(n.normalizeUnknownPropertyNames)r=Hl(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(vc`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function Il({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return _l(`repeater`);case`atomic`:return Ol({atomic:!0});case`capturing`:return xl(i,{name:n});case`group`:return Ol({flags:e});case`lookahead`:case`lookbehind`:return kl({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function Ll(e){if(e===void 0)e=[vl()];else if(!Array.isArray(e)||!e.length||!e.every(e=>e.type===`Alternative`))throw Error(`Invalid body; expected array of one or more Alternative nodes`);return e}function Rl(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error(`Invalid body; expected array of nodes`);return e}function zl(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function Bl(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function Vl(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function Hl(e){return e.trim().replace(/[- _]+/g,`_`).replace(/[A-Z][a-z]+(?=[A-Z])/g,`$&_`).replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function Ul(e){return e.replace(/[- _]+/g,``).toLowerCase()}function Wl(e,t){let n=t;return yc(e,`Unclosed character class${n?.type===`Character`&&n.value===93&&n.raw===`]`?` (started with "]")`:``}`)}function Gl(e){return yc(e,`Unclosed group`)}function Kl(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){let r=i(e[n],t,n,e);n=Math.max(-1,n+r)}}function i(a,o=null,s=null,c=null){let l=0,u=!1,d={node:a,parent:o,key:s,container:c,root:e,remove(){ql(c).splice(Math.max(0,Jl(s)+l),1),l--,u=!0},removeAllNextSiblings(){return ql(c).splice(Jl(s)+1)},removeAllPrevSiblings(){let e=Jl(s)+l;return l-=e,ql(c).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;c?c[Math.max(0,Jl(s)+l)]=e:yc(o,`Can't replace root node`)[s]=e,n&&i(e,o,s,c),u=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(ql(c).splice(Math.max(0,Jl(s)+l),1,...e),l+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=i(e[n],o,Jl(s)+n+t,c)}u=!0},skip(){u=!0}},{type:f}=a,p=t[`*`],m=t[f],h=typeof p==`function`?p:p?.enter,g=typeof m==`function`?m:m?.enter;if(h?.(d,n),g?.(d,n),!u)switch(f){case`AbsenceFunction`:case`Alternative`:case`CapturingGroup`:case`CharacterClass`:case`Group`:case`LookaroundAssertion`:r(a.body,a);break;case`Assertion`:case`Backreference`:case`Character`:case`CharacterSet`:case`Directive`:case`Flags`:case`NamedCallout`:case`Subroutine`:break;case`CharacterClassRange`:i(a.min,a,`min`),i(a.max,a,`max`);break;case`Quantifier`:i(a.body,a,`body`);break;case`Regex`:r(a.body,a),i(a.flags,a,`flags`);break;default:throw Error(`Unexpected node type "${f}"`)}return m?.exit?.(d,n),p?.exit?.(d,n),l}return i(e),e}function ql(e){if(!Array.isArray(e))throw Error(`Container expected`);return e}function Jl(e){if(typeof e!=`number`)throw Error(`Numeric key expected`);return e}var Yl=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Xl(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Zl(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var Ql=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function $l(e,t,n,r){let i=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,`gsu`),a=[!1],o=0,s=``;for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;if(!i&&(!r||r===Ql.DEFAULT==!o)){n instanceof Function?s+=n(t,{context:o?Ql.CHAR_CLASS:Ql.DEFAULT,negated:a[a.length-1]}):s+=n;continue}e[0]===`[`?(o++,a.push(e[1]===`^`)):e===`]`&&o&&(o--,a.pop()),s+=e}return s}function eu(e,t,n,r){$l(e,t,n,r)}function tu(e,t,n=0,r){if(!new RegExp(t,`su`).test(e))return null;let i=RegExp(`${t}|(?<$skip>\\\\?.)`,`gsu`);i.lastIndex=n;let a=0,o;for(;o=i.exec(e);){let{0:e,groups:{$skip:t}}=o;if(!t&&(!r||r===Ql.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function nu(e,t,n){return!!tu(e,t,0,n)}function ru(e,t){let n=/\\?./gsu;n.lastIndex=t;let r=e.length,i=0,a=1,o;for(;o=n.exec(e);){let[e]=o;if(e===`[`)i++;else if(i)e===`]`&&i--;else if(e===`(`)a++;else if(e===`)`&&(a--,!a)){r=o.index;break}}return e.slice(t,r)}var iu=new RegExp(String.raw`(?<noncapturingStart>${Yl})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function au(e,t){let n=t?.hiddenCaptures??[],r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};let i=[0],a=[],o=0,s=0,c=NaN,l;do{l=!1;let t=0,u=0,d=!1,f;for(iu.lastIndex=Number.isNaN(c)?0:c+7;f=iu.exec(e);){let{0:p,index:m,groups:{capturingStart:h,noncapturingStart:g}}=f;if(p===`[`)t++;else if(t)p===`]`&&t--;else if(p===`(?>`&&!d)c=m,d=!0;else if(d&&g)u++;else if(h)d?u++:(o++,i.push(o+s));else if(p===`)`&&d){if(!u){s++;let t=o+s;if(e=`${e.slice(0,c)}(?:(?=(${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,l=!0,a.push(t),Xl(n,t),r.size){let e=new Map;r.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),r=e}break}u--}}}while(l);return n.push(...a),e=$l(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>i.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${i[n]}`}return`\\${n}`},Ql.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var ou=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,su=new RegExp(String.raw`
|
|
46
|
+
\\(?: \d+
|
|
47
|
+
| c[A-Za-z]
|
|
48
|
+
| [gk]<[^>]+>
|
|
49
|
+
| [pPu]\{[^\}]+\}
|
|
50
|
+
| u[A-Fa-f\d]{4}
|
|
51
|
+
| x[A-Fa-f\d]{2}
|
|
52
|
+
)
|
|
53
|
+
| \((?: \? (?: [:=!>]
|
|
54
|
+
| <(?:[=!]|[^>]+>)
|
|
55
|
+
| [A-Za-z\-]+:
|
|
56
|
+
| \(DEFINE\)
|
|
57
|
+
))?
|
|
58
|
+
| (?<qBase>${ou})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
59
|
+
| \\?.
|
|
60
|
+
`.replace(/\s+/g,``),`gsu`);function cu(e){if(!RegExp(`${ou}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(su.lastIndex=0;o=su.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a){if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=Zl(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}su.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var lu=String.raw,uu=lu`\(\?R=(?<rDepth>[^\)]+)\)|${lu`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,du=lu`\(\?<(?![=!])(?<captureName>[^>]+)>`,fu=lu`${du}|(?<unnamed>\()(?!\?)`,pu=new RegExp(lu`${du}|${uu}|\(\?|\\?.`,`gsu`),mu=`Cannot use multiple overlapping recursions`;function hu(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(uu,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&nu(e,lu`\(\?\(DEFINE\)`,Ql.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=nu(e,lu`\\[1-9]`,Ql.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(pu.lastIndex=0;f=pu.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else{if(m){if(gu(m),l)throw Error(mu);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice(pu.lastIndex);if(nu(s,uu,Ql.DEFAULT))throw Error(mu);let c=m-1;e=_u(t,s,c,!1,n,a,d),i=bu(i,t,c,a.length,0,d);break}if(h){gu(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(mu);break}if(!u)throw Error(lu`Recursive \g cannot be used outside the referenced group "${r===`external`?h:lu`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=ru(e,p);if(o&&nu(m,lu`${du}|\((?!\?)`,Ql.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),y=a.length,b=g-1,x=_u(_,v,b,!0,n,a,d);i=bu(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,pu.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),pu.lastIndex),s.set(p,pu.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),pu.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function gu(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function _u(e,t,n,r,i,a,o){let s=new Set;r&&eu(e+t,du,({groups:{captureName:e}})=>{s.add(e)},Ql.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${vu(`(?:${e}`,`forward`,...c)}(?:)${vu(`${t})`,`backward`,...c)}${t}`}function vu(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=$l(e,lu`${fu}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),yu(i,n),s?e:`(?<${t}${l}>`}return lu`\k<${c}${l}>`},Ql.DEFAULT)}return c}function yu(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function bu(e,t,n,r,i,a){if(e.size&&r){let o=0;eu(t,fu,()=>o++,Ql.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var W=String.fromCodePoint,G=String.raw,xu={},Su=globalThis.RegExp;xu.flagGroups=(()=>{try{new Su(`(?i:)`)}catch{return!1}return!0})(),xu.unicodeSets=(()=>{try{new Su(`[[]]`,`v`)}catch{return!1}return!0})(),xu.bugFlagVLiteralHyphenIsRange=xu.unicodeSets?(()=>{try{new Su(G`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,xu.bugNestedClassIgnoresNegation=xu.unicodeSets&&new Su(`[[^a]]`,`v`).test(`a`);function Cu(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function wu(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function Tu(e,t){return Du[e]>=Du[t]}function Eu(e,t){if(e==null)throw Error(t??`Value expected`);return e}var Du={ES2025:2025,ES2024:2024,ES2018:2018},Ou={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function ku(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!Ou[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:`default`,avoidSubclass:!1,flags:``,global:!1,hasIndices:!1,lazyCompileLength:1/0,target:`auto`,verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target===`auto`&&(t.target=xu.flagGroups?`ES2025`:xu.unicodeSets?`ES2024`:`ES2018`),t}var Au=`[ -\r ]`,ju=new Set([W(304),W(305)]),Mu=G`[\p{L}\p{M}\p{N}\p{Pc}]`;function Nu(e){if(ju.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=Lu.get(n),a=Fu.get(n),o=Iu.get(n);return[...r].length===1&&t.add(r),o&&t.add(o),i&&t.add(i),t.add(n),a&&t.add(a),[...t]}var Pu=new Map(`C Other
|
|
61
|
+
Cc Control cntrl
|
|
62
|
+
Cf Format
|
|
63
|
+
Cn Unassigned
|
|
64
|
+
Co Private_Use
|
|
65
|
+
Cs Surrogate
|
|
66
|
+
L Letter
|
|
67
|
+
LC Cased_Letter
|
|
68
|
+
Ll Lowercase_Letter
|
|
69
|
+
Lm Modifier_Letter
|
|
70
|
+
Lo Other_Letter
|
|
71
|
+
Lt Titlecase_Letter
|
|
72
|
+
Lu Uppercase_Letter
|
|
73
|
+
M Mark Combining_Mark
|
|
74
|
+
Mc Spacing_Mark
|
|
75
|
+
Me Enclosing_Mark
|
|
76
|
+
Mn Nonspacing_Mark
|
|
77
|
+
N Number
|
|
78
|
+
Nd Decimal_Number digit
|
|
79
|
+
Nl Letter_Number
|
|
80
|
+
No Other_Number
|
|
81
|
+
P Punctuation punct
|
|
82
|
+
Pc Connector_Punctuation
|
|
83
|
+
Pd Dash_Punctuation
|
|
84
|
+
Pe Close_Punctuation
|
|
85
|
+
Pf Final_Punctuation
|
|
86
|
+
Pi Initial_Punctuation
|
|
87
|
+
Po Other_Punctuation
|
|
88
|
+
Ps Open_Punctuation
|
|
89
|
+
S Symbol
|
|
90
|
+
Sc Currency_Symbol
|
|
91
|
+
Sk Modifier_Symbol
|
|
92
|
+
Sm Math_Symbol
|
|
93
|
+
So Other_Symbol
|
|
94
|
+
Z Separator
|
|
95
|
+
Zl Line_Separator
|
|
96
|
+
Zp Paragraph_Separator
|
|
97
|
+
Zs Space_Separator
|
|
98
|
+
ASCII
|
|
99
|
+
ASCII_Hex_Digit AHex
|
|
100
|
+
Alphabetic Alpha
|
|
101
|
+
Any
|
|
102
|
+
Assigned
|
|
103
|
+
Bidi_Control Bidi_C
|
|
104
|
+
Bidi_Mirrored Bidi_M
|
|
105
|
+
Case_Ignorable CI
|
|
106
|
+
Cased
|
|
107
|
+
Changes_When_Casefolded CWCF
|
|
108
|
+
Changes_When_Casemapped CWCM
|
|
109
|
+
Changes_When_Lowercased CWL
|
|
110
|
+
Changes_When_NFKC_Casefolded CWKCF
|
|
111
|
+
Changes_When_Titlecased CWT
|
|
112
|
+
Changes_When_Uppercased CWU
|
|
113
|
+
Dash
|
|
114
|
+
Default_Ignorable_Code_Point DI
|
|
115
|
+
Deprecated Dep
|
|
116
|
+
Diacritic Dia
|
|
117
|
+
Emoji
|
|
118
|
+
Emoji_Component EComp
|
|
119
|
+
Emoji_Modifier EMod
|
|
120
|
+
Emoji_Modifier_Base EBase
|
|
121
|
+
Emoji_Presentation EPres
|
|
122
|
+
Extended_Pictographic ExtPict
|
|
123
|
+
Extender Ext
|
|
124
|
+
Grapheme_Base Gr_Base
|
|
125
|
+
Grapheme_Extend Gr_Ext
|
|
126
|
+
Hex_Digit Hex
|
|
127
|
+
IDS_Binary_Operator IDSB
|
|
128
|
+
IDS_Trinary_Operator IDST
|
|
129
|
+
ID_Continue IDC
|
|
130
|
+
ID_Start IDS
|
|
131
|
+
Ideographic Ideo
|
|
132
|
+
Join_Control Join_C
|
|
133
|
+
Logical_Order_Exception LOE
|
|
134
|
+
Lowercase Lower
|
|
135
|
+
Math
|
|
136
|
+
Noncharacter_Code_Point NChar
|
|
137
|
+
Pattern_Syntax Pat_Syn
|
|
138
|
+
Pattern_White_Space Pat_WS
|
|
139
|
+
Quotation_Mark QMark
|
|
140
|
+
Radical
|
|
141
|
+
Regional_Indicator RI
|
|
142
|
+
Sentence_Terminal STerm
|
|
143
|
+
Soft_Dotted SD
|
|
144
|
+
Terminal_Punctuation Term
|
|
145
|
+
Unified_Ideograph UIdeo
|
|
146
|
+
Uppercase Upper
|
|
147
|
+
Variation_Selector VS
|
|
148
|
+
White_Space space
|
|
149
|
+
XID_Continue XIDC
|
|
150
|
+
XID_Start XIDS`.split(/\s/).map(e=>[Ul(e),e])),Fu=new Map([[`s`,W(383)],[W(383),`s`]]),Iu=new Map([[W(223),W(7838)],[W(107),W(8490)],[W(229),W(8491)],[W(969),W(8486)]]),Lu=new Map([Bu(453),Bu(456),Bu(459),Bu(498),...Vu(8072,8079),...Vu(8088,8095),...Vu(8104,8111),Bu(8124),Bu(8140),Bu(8188)]),Ru=new Map([[`alnum`,G`[\p{Alpha}\p{Nd}]`],[`alpha`,G`\p{Alpha}`],[`ascii`,G`\p{ASCII}`],[`blank`,G`[\p{Zs}\t]`],[`cntrl`,G`\p{Cc}`],[`digit`,G`\p{Nd}`],[`graph`,G`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,G`\p{Lower}`],[`print`,G`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,G`[\p{P}\p{S}]`],[`space`,G`\p{space}`],[`upper`,G`\p{Upper}`],[`word`,G`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,G`\p{AHex}`]]);function zu(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function Bu(e){let t=W(e);return[t.toLowerCase(),t]}function Vu(e,t){return zu(e,t).map(e=>Bu(e))}var Hu=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function Uu(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};qu(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:Tu(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};Kl(e,Wu,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return Kl(e,Gu,a),Kl(e,Ku,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var Wu={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=Ol();e.body[0].body.push(kl({negate:!0,body:r}),Fl(`Any`));let i=Ol();i.body[0].body.push(Ml(`greedy`,0,1/0,e)),n(K(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];wu(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=ed(t.get(e));if(n){let t=Ol({flags:n});t.body[0].body=e.body,e.body=[K(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(K(kl({body:[vl({body:[yl(`string_end`)]}),vl({body:[Sl(10)]})]}),t));else if(c===`line_start`)o(K(ld(G`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`){if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&od(e))o(K(kl({negate:!0}),t));else if(d)throw Error(G`Uses "\G" in a way that requires a subclass`);else o(dd(yl(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(K(ld(G`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${Mu})(?!${Mu})|(?<!${Mu})(?=${Mu}))`,n=`(?:(?<=${Mu})(?=${Mu})|(?<!${Mu})(?!${Mu}))`;o(K(ld(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!cd(n)&&(n=$u(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!cd(r)&&(r=$u(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(K(Cl({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`)){n(dd(Tl(`digit`,{negate:l}),t));return}if(o&&(c===`space`||u===`space`)){n(K(ud(ld(Au),l),t));return}if(s&&(c===`word`||u===`word`)){n(dd(Tl(`word`,{negate:l}),t));return}if(c===`any`)n(dd(Fl(`Any`),t));else if(c===`digit`)n(dd(Fl(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(G`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=G`\p{RI}{2}|${e}(?:\u200D${e})*`;n(K(ld(G`(?>\r\n|${i?G`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(dd(Fl(`AHex`,{negate:l}),t));else if(c===`newline`)n(K(ld(l?`[^
|
|
151
|
+
]`:`(?>\r
|
|
152
|
+
?|[
|
|
153
|
+
\v\f
\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${W(e.codePointAt(0)-1)}${W(e.codePointAt(2)+1)}-\u{10FFFF}`),n(K(ld(`[${e}]`),t))}else n(K(ud(ld(Ru.get(u)),l),t))}else if(c===`property`)Pu.has(Ul(u))||(e.key=`sc`);else if(c===`space`)n(dd(Fl(`space`,{negate:l}),t));else if(c===`word`)n(K(ud(ld(Mu),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=Ol({flags:c});e.body[0].body=o(),i(K(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&al(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(G`Uses "\K" in a way that's unsupported`);let o=kl({behind:!0});o.body[0].body=a(),i(K(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(K(kl({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=Ol();t.body[0].body.push(e.body),e.body=K(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=rd(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(G`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!cd(n)&&(n=$u(n,t),e.ref=n)}},Gu={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=dd(Zu(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&wu(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=wu(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=Cu(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?Zu(0):Xu(o,r.groupOriginByCopy,null),l=c;if(!s){let e=ed(Qu(o,e=>e.type===`Group`&&!!e.flags)),t=e?Cu(r.globalFlags,e):r.globalFlags;Ju(t,r.currentFlags)||(l=Ol({flags:td(t)}),l.body[0].body.push(c))}n(K(l,t),{traverse:!s})}},Ku={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>Yu(t,e));i.length?i.length>1?n(K(Ol({atomic:!0,body:i.reverse().map(e=>vl({body:[bl(e.number)]}))}),t)):e.ref=i[0].number:n(K(kl({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=xl();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function qu(e){Kl(e,{"*"({node:e,parent:t}){e.parent=t}})}function Ju(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function Yu(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=nd(n.parent);for(let r of t){if(r===n)break;if(r===e||id(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function Xu(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=Xu(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function Zu(e){let t=Pl(e);return t.isRecursive=!0,t}function Qu(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function $u(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function ed(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function td({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function nd(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function rd(e){let t=e.find(e=>e.kind===`search_start`||sd(e,{negate:!1})||!ad(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=rd(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function id(e,t){let n=nd(e)??[];for(let e of n)if(e===t||id(e,t))return!0;return!1}function ad({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function od(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function sd(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&al(e.body[0],{type:`Assertion`,kind:`search_start`})}function cd(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function ld(e,t){let n=cl(e,{...t,unicodePropertyMap:Pu}).body;return n.length>1||n[0].body.length>1?Ol({body:n}):n[0].body[0]}function ud(e,t){return e.negate=t,e}function dd(e,t){return e.parent=t,e}function K(e,t){return qu(e),e.parent=t,e}function fd(e,t){let n=ku(t),r=Tu(n.target,`ES2024`),i=Tu(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];Kl(e,pd,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,Eu(md[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&wu(f._captureTransfers,e.transferTo,[]).push(t)}),f}var pd={"*":{enter({node:e},t){if(Ed(e)){let n=t.getCurrentModI();t.pushModI(e.flags?Cu({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){Ed(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){bd(W(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),xd(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&Hu.has(e.value)&&t.setHasCasedChar()}},md={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?G`\B`:G`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=W(e),r=Sd(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&bd(n)){let e=Nu(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of character class intersection requires min target ES2024`);xu.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(Od)&&(o=[Sl(45),...o.filter(e=>!Od(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||xu.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=Ol(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=vl({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(xu.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Uses nested character class in a way that requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=Sd(n,i),o=Sd(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Cd(xd(e)).forEach(e=>{s.add(Array.isArray(e)?`${Sd(e[0],i)}-${Sd(e[1],i)}`:Sd(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:G`[^\n]`;if(e===`digit`)return t?G`\D`:G`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&Hu.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?G`\P`:G`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?G`\W`:G`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=Cu(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${wd(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+Td(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:G`\g<${t}&R=${r}>`}},hd=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),gd=new Set([`-`,`\\`,`]`,`^`,`[`]),_d=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),vd=new Map([[9,G`\t`],[10,G`\n`],[11,G`\v`],[12,G`\f`],[13,G`\r`],[8232,G`\u2028`],[8233,G`\u2029`],[65279,G`\uFEFF`]]),yd=/^\p{Cased}$/u;function bd(e){return yd.test(e)}function xd(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=W(e);if(!bd(t))continue;let o=Nu(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function Sd(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(vd.has(e))return vd.get(e);if(e<32||e>126&&e<160||e>262143||t&&Dd(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?_d:gd:hd,a=W(e);return(i.has(a)?`\\`:``)+a}function Cd(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function wd(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function Td({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function Ed({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function Dd(e){return e>47&&e<58}function Od({type:e,value:t}){return e===`Character`&&t===45}var kd=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=jd(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(Ad(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=Md(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function Ad(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function jd(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)wu(n,t,{}).transferTo=e;return n}function Md(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function Nd(e,t){let n=Pd(e,t);return n.options?new kd(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function Pd(e,t){let n=ku(t),r=Uu(cl(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Pu}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=fd(r,n),a=hu(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=au(cu(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}function Fd(e,t){return Nd(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function Id(e={}){let t={target:`auto`,cache:new Map,...e};return t.regexConstructor||=e=>Fd(e,{target:t.target}),{createScanner(e){return new mc(e,t)},createString(e){return{content:e}}}}async function Ld(e){if(Yt())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=Gt.get(e);if(t!=null)return t;try{let t=Kt.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(sn,e)&&(t=sn[e]),t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return Wt.has(e)||Wt.set(e,n),n});return Gt.set(e,n),await n}finally{Gt.delete(e)}}function Rd(e){return Wt.get(e)??Ld(e)}function zd({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:Bd(t)}}function Bd(e){return async()=>ji(Lt(await e()))}var Vd=`pierre`,Hd=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],Ud=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],Wd=[...Ud,...Hd],Gd=new Set(Ud);function Kd(e){return Gd.has(e)?`light`:`dark`}var qd={"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`},Jd={"pierre-dark":()=>M(()=>import(`./pierre-dark-CpLgRqie.js`),[],import.meta.url),"pierre-dark-soft":()=>M(()=>import(`./pierre-dark-soft-kZQmAZld.js`),[],import.meta.url),"pierre-dark-vibrant":()=>M(()=>import(`./pierre-dark-vibrant-CpQYzh95.js`),[],import.meta.url),"pierre-dark-protanopia-deuteranopia":()=>M(()=>import(`./pierre-dark-protanopia-deuteranopia-B35FxJx-.js`),[],import.meta.url),"pierre-dark-tritanopia":()=>M(()=>import(`./pierre-dark-tritanopia-CpjhbsIL.js`),[],import.meta.url),"pierre-light":()=>M(()=>import(`./pierre-light-CoaEpmwp.js`),[],import.meta.url),"pierre-light-soft":()=>M(()=>import(`./pierre-light-soft-lWLdNTOI.js`),[],import.meta.url),"pierre-light-vibrant":()=>M(()=>import(`./pierre-light-vibrant-D80Fkn33.js`),[],import.meta.url),"pierre-light-protanopia-deuteranopia":()=>M(()=>import(`./pierre-light-protanopia-deuteranopia-0fSaH845.js`),[],import.meta.url),"pierre-light-tritanopia":()=>M(()=>import(`./pierre-light-tritanopia-CEbqgOJL.js`),[],import.meta.url)};function Yd(e){return zd({name:e,collection:Vd,colorScheme:Kd(e),displayName:qd[e],load:Jd[e]})}var Xd=Mt({themes:Wd.map(e=>Yd(e))}),Zd=`shiki`,Qd=[`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`],$d=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),ef=new Set(Qd);function tf(e){return ef.has(e)?`light`:`dark`}var nf={andromeeda:()=>M(()=>import(`./andromeeda-vGVdxbeo.js`),[],import.meta.url),"aurora-x":()=>M(()=>import(`./aurora-x-CDeNXAV0.js`),[],import.meta.url),"ayu-dark":()=>M(()=>import(`./ayu-dark-DluEY0Gj.js`),[],import.meta.url),"ayu-light":()=>M(()=>import(`./ayu-light-C3h-C4tm.js`),[],import.meta.url),"ayu-mirage":()=>M(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[],import.meta.url),"catppuccin-frappe":()=>M(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[],import.meta.url),"catppuccin-latte":()=>M(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[],import.meta.url),"catppuccin-macchiato":()=>M(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[],import.meta.url),"catppuccin-mocha":()=>M(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[],import.meta.url),"dark-plus":()=>M(()=>import(`./dark-plus-Cs2F2srj.js`),[],import.meta.url),dracula:()=>M(()=>import(`./dracula-BHWKrbxM.js`),[],import.meta.url),"dracula-soft":()=>M(()=>import(`./dracula-soft-5eyTD99u.js`),[],import.meta.url),"everforest-dark":()=>M(()=>import(`./everforest-dark-sB-x3p7T.js`),[],import.meta.url),"everforest-light":()=>M(()=>import(`./everforest-light-Df2xbC6M.js`),[],import.meta.url),"github-dark":()=>M(()=>import(`./github-dark-C-LZuMrd.js`),[],import.meta.url),"github-dark-default":()=>M(()=>import(`./github-dark-default-DXG-b-1a.js`),[],import.meta.url),"github-dark-dimmed":()=>M(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[],import.meta.url),"github-dark-high-contrast":()=>M(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[],import.meta.url),"github-light":()=>M(()=>import(`./github-light-EUqPIrTm.js`),[],import.meta.url),"github-light-default":()=>M(()=>import(`./github-light-default-BXViO-2h.js`),[],import.meta.url),"github-light-high-contrast":()=>M(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[],import.meta.url),"gruvbox-dark-hard":()=>M(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[],import.meta.url),"gruvbox-dark-medium":()=>M(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[],import.meta.url),"gruvbox-dark-soft":()=>M(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[],import.meta.url),"gruvbox-light-hard":()=>M(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[],import.meta.url),"gruvbox-light-medium":()=>M(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[],import.meta.url),"gruvbox-light-soft":()=>M(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[],import.meta.url),horizon:()=>M(()=>import(`./horizon-CE9ld1lL.js`),[],import.meta.url),"horizon-bright":()=>M(()=>import(`./horizon-bright-DSNQnXHK.js`),[],import.meta.url),houston:()=>M(()=>import(`./houston-CsvMBhTu.js`),[],import.meta.url),"kanagawa-dragon":()=>M(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[],import.meta.url),"kanagawa-lotus":()=>M(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[],import.meta.url),"kanagawa-wave":()=>M(()=>import(`./kanagawa-wave-BML5mF2J.js`),[],import.meta.url),laserwave:()=>M(()=>import(`./laserwave-C_8bwKvT.js`),[],import.meta.url),"light-plus":()=>M(()=>import(`./light-plus-DVQuIRkW.js`),[],import.meta.url),"material-theme":()=>M(()=>import(`./material-theme-Bm3Qr25_.js`),[],import.meta.url),"material-theme-darker":()=>M(()=>import(`./material-theme-darker-2IIEA8gg.js`),[],import.meta.url),"material-theme-lighter":()=>M(()=>import(`./material-theme-lighter-uhdI0v04.js`),[],import.meta.url),"material-theme-ocean":()=>M(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[],import.meta.url),"material-theme-palenight":()=>M(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[],import.meta.url),"min-dark":()=>M(()=>import(`./min-dark-BSWPekZh.js`),[],import.meta.url),"min-light":()=>M(()=>import(`./min-light-DDpmG2fV.js`),[],import.meta.url),monokai:()=>M(()=>import(`./monokai-B_bV9PQ9.js`),[],import.meta.url),"night-owl":()=>M(()=>import(`./night-owl-DhmEMT88.js`),[],import.meta.url),"night-owl-light":()=>M(()=>import(`./night-owl-light-eJ-hLW7d.js`),[],import.meta.url),nord:()=>M(()=>import(`./nord-Cb4Vim4T.js`),[],import.meta.url),"one-dark-pro":()=>M(()=>import(`./one-dark-pro-CLwyXe_n.js`),[],import.meta.url),"one-light":()=>M(()=>import(`./one-light-D7Lr4KcI.js`),[],import.meta.url),plastic:()=>M(()=>import(`./plastic-DQwYfKfQ.js`),[],import.meta.url),poimandres:()=>M(()=>import(`./poimandres-DRFjx7u4.js`),[],import.meta.url),red:()=>M(()=>import(`./red-DX1BQOs8.js`),[],import.meta.url),"rose-pine":()=>M(()=>import(`./rose-pine-aMsaMD1D.js`),[],import.meta.url),"rose-pine-dawn":()=>M(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[],import.meta.url),"rose-pine-moon":()=>M(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[],import.meta.url),"slack-dark":()=>M(()=>import(`./slack-dark-DnToyrRv.js`),[],import.meta.url),"slack-ochin":()=>M(()=>import(`./slack-ochin-B2OO5cIa.js`),[],import.meta.url),"snazzy-light":()=>M(()=>import(`./snazzy-light-4G7pJPwS.js`),[],import.meta.url),"solarized-dark":()=>M(()=>import(`./solarized-dark-UdsmMDCL.js`),[],import.meta.url),"solarized-light":()=>M(()=>import(`./solarized-light-C1IUL_tW.js`),[],import.meta.url),"synthwave-84":()=>M(()=>import(`./synthwave-84-nFMaYfgc.js`),[],import.meta.url),"tokyo-night":()=>M(()=>import(`./tokyo-night-oM2G3aXe.js`),[],import.meta.url),vesper:()=>M(()=>import(`./vesper-DdrHHSXu.js`),[],import.meta.url),"vitesse-black":()=>M(()=>import(`./vitesse-black-fwtXNY1n.js`),[],import.meta.url),"vitesse-dark":()=>M(()=>import(`./vitesse-dark-BZCL-v6S.js`),[],import.meta.url),"vitesse-light":()=>M(()=>import(`./vitesse-light-VbXTXTou.js`),[],import.meta.url)};function rf(e){return zd({name:e,collection:Zd,colorScheme:tf(e),load:nf[e]})}var af=Mt({themes:Object.freeze([...Qd.map(e=>rf(e)),...$d.map(e=>rf(e))])});function of(e){if(Yt())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(Ht.hasRegisteredTheme(e))return;let t=af.getTheme(e);if(t!=null){Ht.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function sf(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function cf(e){of(e);let t=await Ht.resolveTheme(e);return sf(e,t),t}function lf(e){return Ht.getResolvedTheme(e)??cf(e)}var uf;async function df({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){uf??=ac({themes:[],langs:[`text`],engine:n===`shiki-wasm`?Fn(M(()=>import(`./wasm-BnjxR4X6.js`),[],import.meta.url)):Id()});let r=pf(uf)?await uf:uf;uf=r;let i=[];for(let e of t){if(e===`text`||e===`ansi`)continue;let t=Rd(e);`then`in t?i.push(t):Jt(t,r)}let a=[];for(let t of e){let e=lf(t);`then`in e?a.push(e):Ut(e,uf)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{Jt(e,r)}),Promise.all(a).then(e=>{Ut(e,r)})]),r}function ff(){if(uf!=null&&!(`then`in uf))return uf}function pf(e=uf){return e!=null&&`then`in e}for(let e of Xd.getThemes())Ht.registerThemeIfAbsent(e.name,e.load);function mf(e=F){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}function hf(e){return Ht.hasResolvedThemes(e)}function gf(e,t){return kt(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}var _f=new Map,vf={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function yf(e){if(_f.has(e))return _f.get(e)??`text`;if(vf[e]!=null)return vf[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(_f.has(t[1]))return _f.get(t[1])??`text`;if(vf[t[1]]!=null)return vf[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return _f.has(n)?_f.get(n)??`text`:vf[n]??`text`}function bf(e){return(e.lang??yf(e.name))===`text`}var xf=10,Sf=13,Cf=4,wf=40;function Tf(e){let t=[0],n=e.indexOf(`\r`),r=e.indexOf(`
|
|
154
|
+
`),i=0,a=0;for(;n!==-1||r!==-1;){let o;if(n!==-1&&(r===-1||n<r)?r===n+1?(o=r+1,n=e.indexOf(`\r`,o),r=e.indexOf(`
|
|
155
|
+
`,o)):(o=n+1,n=e.indexOf(`\r`,o)):(o=r+1,r=e.indexOf(`
|
|
156
|
+
`,o)),t.push(o),++a===Cf){if(o-i<=wf){for(let n=o;n<e.length;n++){let r=e.charCodeAt(n);(r===xf||r===Sf)&&(r===Sf&&n+1<e.length&&e.charCodeAt(n+1)===xf&&n++,t.push(n+1))}return t}i=o,a=0}}return t}function Ef(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);(r===xf||r===Sf)&&(r===Sf&&n+1<e.length&&e.charCodeAt(n+1)===xf&&n++,t++)}return t}function Df(e){let t=Tf(e);return Array.from({length:t.length},(n,r)=>{let i=t[r],a=t[r+1]??e.length;return e.slice(i,a)})}function Of(e){return{type:`text`,value:e}}function q({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function kf({name:e,width:t=16,height:n=16,properties:r}){return q({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[q({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function Af(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function jf(e){return q({tagName:`div`,properties:{"data-gutter":``},children:e})}function Mf(e,t,n,r={}){return q({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[q({tagName:`span`,properties:{"data-line-number-content":``},children:[Of(`${t}`)]})]})}function Nf(e,t,n){return q({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function Pf(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(Of(`
|
|
157
|
+
`)),e}var Ff=Symbol(`no-token`),If=Symbol(`multiple-tokens`);function Lf(e){let t=Rf(e);if(t!=null)return t;let n=Ff,r=[],i=[],a,o=()=>{if(i.length===0||a==null){i=[],a=void 0;return}if(i.length===1){let e=i[0];if(e?.type===`element`){Bf(e,a);for(let t of e.children)zf(t)}else zf(e);r.push(e),i=[],a=void 0;return}for(let e of i)zf(e);r.push(q({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==Ff){if(e===If){n=If;return}if(n===Ff){n=e;return}n!==e&&(n=If)}};for(let t of e.children){let e=t.type===`element`?Lf(t):Ff;if(s(e),typeof e!=`number`){o(),r.push(t);continue}a!=null&&a!==e&&o(),a??=e,i.push(t)}return o(),e.children=r,n}function Rf(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function zf(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)zf(t)}}function Bf(e,t){e.properties[`data-char`]=t}function Vf(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=typeof e==`string`?e:a(e),s=t+Hf(o)+n;return s=r(s),i.has(s)||i.set(s,typeof e==`string`?e:{...e}),s}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function Hf(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}function Uf(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=Af(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&Lf(a),i.push(Pf(a,t,n)),t++);r.children=i}return t},...e?{tokens(e){for(let t of e){let e=0;for(let n of t){let t=n;t.__lineChar??=e,e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces=`never`},span(e,t,n,r,i){if(i?.offset!=null&&i.content!=null){let t=i.__lineChar;return t!=null&&(e.properties[`data-char`]=t),e}return e}}:null}];return t&&r.push(Gf,Wf),e&&r.push({line:e=>(e.type===`element`&&e.children.length===0&&e.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),e)}),{state:n,transformers:r,toClass:Wf}}var Wf=Vf({classPrefix:`hl-`}),Gf={name:`token-style-normalizer`,tokens(e){for(let t of e)for(let e of t){if(e.htmlStyle!=null)continue;let t={};e.color!=null&&(t.color=e.color),e.bgColor!=null&&(t[`background-color`]=e.bgColor),e.fontStyle!=null&&e.fontStyle!==0&&(e.fontStyle&1&&(t[`font-style`]=`italic`),e.fontStyle&2&&(t[`font-weight`]=`bold`),e.fontStyle&4&&(t[`text-decoration`]=`underline`)),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function Kf(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var qf=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Jf=/^0(?:\.0+)?%?$/;function Yf(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function Xf(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let n=t[1],r,i=1;return n.length===3?r=n.split(``).map(e=>e+e).join(``):n.length===6?r=n:(r=n.slice(0,6),i=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),i]}function Zf(e){if(e==null)return null;let t=Xf(e);if(t==null)return null;let n=t[0]/255,r=t[1]/255,i=t[2]/255,a=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*a(n)+.7152*a(r)+.0722*a(i)}function Qf(e,t){let[n,r]=e>t?[e,t]:[t,e];return(n+.05)/(r+.05)}function $f(e,t){if(t==null)return;let n=Xf(e),r=Xf(t);if(n==null||r==null)return;let[i,a,o,s]=n,[c,l,u]=r;return`#`+[Math.round(i*s+c*(1-s)),Math.round(a*s+l*(1-s)),Math.round(o*s+u*(1-s))].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function ep(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||qf.test(t))return!0;let n=Yf(t);return n!=null&&Jf.test(n)}function tp(e,t){let n=Zf(e);if(n!=null)return n<.4;let r=Zf(t);return r!=null&&r>.6}function np(e,t){if(e==null||t==null)return!1;if(e.trim().toLowerCase()===t.trim().toLowerCase())return!0;let n=Zf(e),r=Zf(t);return n==null||r==null?!1:Math.abs(n-r)<.06}function rp(e,t,n){if(t==null||n==null)return!1;let r=Zf(e),i=Zf(t),a=Zf(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}function ip(e,t){let n=Zf(e),r=t.find(e=>e!=null&&e!==``);if(n==null)return r;let i,a=-1;for(let e of t){if(e==null||e===``)continue;let t=Zf(e);if(t==null)continue;let r=Qf(n,t);if(r>=3)return e;r>a&&(i=e,a=r)}return i??r}function ap(e,t){if(t==null)return e;let n=Xf(e),r=Xf(t),i=Zf(t);if(n==null||r==null||i==null)return`color-mix(in srgb, ${e} 70%, ${t})`;let[a,o,s]=n,[c,l,u]=r;for(let e of[.6,.7,.8,.9]){let t=`#`+[Math.round(a*e+c*(1-e)),Math.round(o*e+l*(1-e)),Math.round(s*e+u*(1-e))].map(e=>e.toString(16).padStart(2,`0`)).join(``),n=Zf(t);if(n!=null&&Qf(i,n)>=4.5)return t}return e}var op=new WeakMap;function sp(e){let t=op.get(e);if(t!=null)return t;let n=e.colors??{},r={...n},i=n[`editor.background`]??e.bg,a=n[`editor.foreground`]??e.fg,o=n[`sideBar.background`]??i,s=n[`sideBar.foreground`]??a;cp(r,`editor.background`,i),cp(r,`editor.foreground`,a),cp(r,`sideBar.background`,o),cp(r,`sideBar.foreground`,s),cp(r,`input.background`,n[`input.background`]??o),cp(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),cp(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),cp(r,`gitDecoration.addedResourceForeground`,lp(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),cp(r,`gitDecoration.modifiedResourceForeground`,lp(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),cp(r,`gitDecoration.deletedResourceForeground`,lp(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(ep(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(ep(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(up(l,o)||rp(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return op.set(e,u),u}function cp(e,t,n){n!=null&&n!==``&&(e[t]=n)}function lp(...e){for(let t of e)if(t!=null&&t!==``)return t}function up(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}var dp={compositeOverBg:$f,contrastRatio:Qf,deriveMutedFg:ap,hoverWouldEraseText:rp,isDarkSurface:tp,isFullyTransparent:ep,pickReadableForeground:ip,relativeLuminance:Zf,surfacesMatch:np};function fp({theme:e=F,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=sp(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${Kf(`global`)}fg:${a.fg};`,r+=`${Kf(`global`)}bg:${a.bg};`,r+=pp(i,n)}else{let n=t.getTheme(e.dark),i=sp(n);r+=`${Kf(`global`)}dark:${i.fg};`,r+=`${Kf(`global`)}dark-bg:${i.bg};`,r+=pp(n,`dark`),n=t.getTheme(e.light),i=sp(n),r+=`${Kf(`global`)}light:${i.fg};`,r+=`${Kf(`global`)}light-bg:${i.bg};`,r+=pp(n,`light`)}return r}function pp(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${Kf(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${Kf(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${Kf(`global`)}${t}modified-color:${a};`),n}function mp(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}var hp={forcePlainText:!1};function gp(e,t,{theme:n=F,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,startingLine:o,totalLines:s,lines:c}=hp){a?(o??=0,s??=1/0):(o=0,s=1/0);let l=o>0||s<1/0,{state:u,transformers:d}=Uf(i),f=a?`text`:e.lang??yf(e.name),p=typeof n==`string`?t.getTheme(n).type:void 0,m=fp({theme:n,highlighter:t});u.lineInfo=e=>({type:`context`,lineIndex:e-1+o,lineNumber:e+o});let h=typeof n==`string`?{lang:f,theme:n,transformers:d,defaultColor:!1,cssVariablePrefix:Kf(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:d,defaultColor:!1,cssVariablePrefix:Kf(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},g=mp(t.codeToHast(l?_p(c??Df(e.contents),o,s):e.contents,h)),_=l?Array(o):g;return l&&_.push(...g),{code:_,themeStyles:m,baseThemeType:p}}function _p(e,t,n){if(e.length===0)return``;let r=Math.min(t+n,e.length);return e.slice(t,r).join(``)}function vp(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}function yp(e,t){return kt(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function bp(e){let t=e.lang??yf(e.name),n=e.lang??(e.prevName==null?`text`:yf(e.prevName));return t===`text`&&n===`text`}function xp(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}function Sp(e){return{...gt,...e}}function Cp(e,t){let n=wp(e,t);return t?n:e.diffHeaderHeight+n}function wp(e,t){return e.paddingTop??(t?e.spacing:0)}function Tp(e){return e.paddingBottom??e.spacing}function Ep(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}function Dp(e){return[St(e.additionStart,e.additionCount)+1,Ct(e.additionStart,e.additionCount)+1]}function Op({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function kp(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-Ct(t.additionStart,t.additionCount),r=e.deletionLines.length-Ct(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function Ap({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-Ct(n.additionStart,n.additionCount),i=e.deletionLines.length-Ct(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function jp({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=Ap({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function Mp({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=Dp(a);if(t<o){let s=Op({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=jp({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=Dp(a);return t<o+i.fromStart||t>=o+i.rangeSize}function Np({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=Dp(n),l=Op({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=jp({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function Pp({type:e,metrics:t}){return t.hunkSeparatorHeight??Ep(e)}function Fp({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function Ip({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function Lp(e){return e!==`simple`&&e!==`metadata`}function Rp({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!Ip({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=Pp({type:e,metrics:t}),a=Fp({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function zp({type:e,metrics:t}){if(!Lp(e))return;let n=Pp({type:e,metrics:t}),r=Fp({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function Bp({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=Vp({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=St(r.deletionStart,r.deletionCount),s=St(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=Op({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?jp({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(Wp(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,Wp(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(Wp(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=Gp(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(Kp({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(Wp(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function Vp({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=Hp({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function Hp({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=Op({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?jp({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function Up(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function Wp(e,t,n,r,i,a){let[o,s]=Up(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function Gp(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function Kp({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}var qp=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},Jp=new class extends qp{};function Yp(e,t,n){return Jp.diff(e,t,n)}function Xp(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function Zp(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function Qp(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function $p(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function em(e,t){return Qp(e,t,``)}function tm(e,t){return $p(e,t,``)}function nm(e,t){return t.slice(0,rm(e,t))}function rm(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function im(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function am(e,t){if(t)return sm(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function om(e,t){if(t)return sm(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function sm(e,t){if(!t)return[om(e),am(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=im(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var cm=`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}`,lm=RegExp(`[${cm}]+|\\s+|[^${cm}]`,`ug`);new class extends qp{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=im(e,r)}else n=e.match(lm)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&um(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&um(n,i,r,null,t.intlSegmenter),e}};function um(e,t,n,r,i){if(t&&n){let[a,o]=sm(t.value,i),[s,c]=sm(n.value,i);if(e){let r=Xp(a,s);e.value=$p(e.value,s,r),t.value=em(t.value,r),n.value=em(n.value,r)}if(r){let e=Zp(o,c);r.value=Qp(r.value,c,e),t.value=tm(t.value,e),n.value=tm(n.value,e)}}else if(n){if(e){let e=om(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=om(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=om(r.value,i),[a,o]=sm(t.value,i),s=Xp(n,a);t.value=em(t.value,s);let c=Zp(em(n,s),o);t.value=tm(t.value,c),r.value=Qp(r.value,n,c),e.value=$p(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=om(r.value,i),n=nm(am(t.value,i),e);t.value=tm(t.value,n)}else if(e){let n=nm(am(e.value,i),om(t.value,i));t.value=em(t.value,n)}}var dm=new class extends qp{tokenize(e){let t=RegExp(`(\\r?\\n)|[${cm}]+|[^\\S\\n\\r]+|[^${cm}]`,`ug`);return e.match(t)||[]}};function fm(e,t,n){return dm.diff(e,t,n)}var pm=new class extends qp{constructor(){super(...arguments),this.tokenize=hm}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
158
|
+
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
159
|
+
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
160
|
+
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
161
|
+
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function mm(e,t,n){return pm.diff(e,t,n)}function hm(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
162
|
+
`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function gm(e){return e==`.`||e==`!`||e==`?`}new class extends qp{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(gm(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends qp{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends qp{constructor(){super(...arguments),this.tokenize=hm}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(_m(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function _m(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=_m(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=_m(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends qp{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function vm(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function ym(e){if(!vm(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var bm={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function xm(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;mm(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(mm(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||wm(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
|
|
163
|
+
`)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function Sm(e,t){if(t||=bm,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>Sm(e,t)).join(`
|
|
164
|
+
`)}let n=[];if(e.isGit){if(t=bm,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+ym(r)+` `+ym(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+ym((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+ym((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+ym((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+ym((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+ym(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+ym(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
|
|
165
|
+
`)+`
|
|
166
|
+
`}function Cm(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;xm(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Sm(e,o.headerOptions):void 0)}}))}else{let s=xm(e,t,n,r,i,a,o);return s?Sm(s,o?.headerOptions):void 0}}function wm(e){let t=e.endsWith(`
|
|
167
|
+
`),n=e.split(`
|
|
168
|
+
`).map(e=>e+`
|
|
169
|
+
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Tm({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 Em({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;if(r===o||r&&e.value.length===1&&!o){a[1]+=e.value;return}t.push([+!r,e.value])}var Dm={forcePlainText:!1};function Om(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=Dm){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=fp({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??Am();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}Bp({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&km({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=jm({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else f.deletionLines.push(...s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else f.additionLines.push(...c)}return{code:f,themeStyles:u,baseThemeType:l}}function km({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=xp(e),t=xp(t),e.length>s||t.length>s))return;let c=o===`char`?Yp(e,t):fm(e,t),l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(Em({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),Em({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?Em({item:e,arr:l,enableJoin:d,isLastItem:t}):Em({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(Tm({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(Tm({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function Am(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function jm({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c=F,...l}}){let u=s??yf(e.name),d=s??yf(t.name),{state:f,transformers:p}=Uf(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Kf(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Kf(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,mp(i.codeToHast(xp(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,mp(i.codeToHast(xp(t.contents),m)))}}var Mm=(0,N.createContext)(void 0);function Nm(e,t,n){if(e===t||e==null||t==null)return e===t;let r=new Set(n),i=Object.keys(e),a=new Set(Object.keys(t));for(let n of i)if(a.delete(n),!r.has(n)&&(!(n in t)||e[n]!==t[n]))return!1;for(let e of Array.from(a))if(!r.has(e))return!1;return!0}function Pm(e,t){let n=e?.theme??F,r=t?.theme??F,i=Fm(e),a=Fm(t);return kt(n,r)&&Nm(e,t,[`theme`,`parseDiffOptions`])&&Nm(i,a)}function Fm(e){if(e!=null&&`parseDiffOptions`in e)return e.parseDiffOptions}var Im=new Set,Lm=null;function Rm(e){Im.add(e),Lm??=requestAnimationFrame(Bm)}function zm(e){Im.delete(e)&&Im.size===0&&Lm!=null&&(cancelAnimationFrame(Lm),Lm=null)}function Bm(e){let t=new Set(Im);Im.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}Lm=Im.size>0?requestAnimationFrame(Bm):null}function Vm(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}var Hm=new TextEncoder,Um=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Wm=/[\uD800-\uDFFF]/,Gm=1024,Km=new Uint8Array(Gm);function qm(){Km.length!==Gm&&(Km=new Uint8Array(Gm))}function Jm(e){if(e.length===0)return e;if(Wm.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Km.length<t&&(Km=new Uint8Array(t));let{written:n}=Hm.encodeInto(e,Km);return Um.decode(Km.subarray(0,n))}var Ym=4096,Xm=.5;function Zm(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=$m(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}Qm(t,e)}}function Qm(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let r=n[e],i=n[e-1];if(r.type!==`change`||r.additions>0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;e<c;e++)if(o[s+e]!==l){u=!1;break}if(!u)continue;let d=0;for(;d<i.lines&&t.additionLines[i.additionLineIndex+i.lines-1-d]===l;)d++;if(d===0||e===1&&d===i.lines)continue;r.additionLineIndex-=d,r.deletionLineIndex-=d;let f=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,m=n[e+1];m?.type===`context`?(m.lines+=d,m.additionLineIndex=f,m.deletionLineIndex=p):n.splice(e+1,0,{type:`context`,lines:d,additionLineIndex:f,deletionLineIndex:p}),i.lines-=d,i.lines===0&&(n.splice(e-1,1),e--)}}function $m(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>Ym)return null;let c=[];for(let t=0;t<n;t++)c.push(th(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(th(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=nh(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*Xm:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var eh=/\s+/g;function th(e){return e.replace(eh,``)}function nh(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}function rh(e,t){try{return ih(e,t)}finally{qm()}}function ih(e,{cacheKey:t,isGitDiff:n=tt.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=fh(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=oh(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=lh(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?ah(i.contents):[],deletionLines:!l&&r!=null&&i!=null?ah(r.contents):[],cacheKey:mh(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(at),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=Jm(r.trim()),n!==r&&(c.prevName=Jm(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?it:rt):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=Jm(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=Jm(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=Jm(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=Jm(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=Jm(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=Jm(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(ot)??[];t!=null&&(c.prevObjectId=Jm(t)),n!=null&&(c.newObjectId=Jm(n)),r!=null&&(c.mode=Jm(r))}e.startsWith(`rename from `)&&(c.prevName=Jm(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=Jm(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
|
|
170
|
+
`||s[s.length-1]===`\r`||s[s.length-1]===`\r
|
|
171
|
+
`||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:mh(p.hunkContext),hunkSpecs:Jm(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(a&&sh(t)&&!ch(t))throw Error(`parsePatchContent: hunk has more lines than expected`);break}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=hh(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=gh(t);(g==null||g.type!==`change`)&&(g=_h(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=gh(t);(g==null||g.type!==`change`)&&(g=_h(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=gh(t);(g==null||g.type!==`context`)&&(g=_h(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=xp(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=xp(c.deletionLines[e]))}}}if(a&&(x!==b.additionCount||S!==b.deletionCount))throw Error(`parsePatchContent: hunk line count mismatch`);b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(St(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=Ct(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=Ct(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),Zm(c),c}}function ah(e){let t=oh(e);for(let e=0;e<t.length;e++)t[e]=Jm(t[e]);return t}function oh(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
|
|
172
|
+
`,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function sh(e){let t=e[0];return t===`+`||t===`-`||t===` `}function ch(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
|
|
173
|
+
`&&n!==`\r`)return!1}return!0}function lh(e){if(!e.startsWith(`@@ -`))return;let t=4,n=uh(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=uh(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=uh(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=uh(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=dh(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function uh(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function dh(e){return e.endsWith(`\r
|
|
174
|
+
`)?e.slice(0,-2):e.endsWith(`
|
|
175
|
+
`)?e.slice(0,-1):e}function fh(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:ph(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=ph(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function ph(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function mh(e){return e==null?e:Jm(e)}function hh(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function gh(e){let t=e.slice(1);return Jm(t===``?`
|
|
176
|
+
`:t)}function _h(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var vh=`/dev/null`;function yh(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??bh(),a=t??bh(),o=rh(Cm(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey??e?.name,r=t?.cacheKey??t?.name;return n!=null&&r!=null?n+`:`+r:n??r})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function bh(){return{name:vh,contents:``}}function xh(e,t){let n=yh({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function Sh(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function Ch(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function wh(e,t){return t.length>0&&t.length<e.deletionLines.length&&Ch(t)}function Th(e,t,n){let r=e.deletionLines.join(``),i=Sh(t.length,r),a=yh({name:e.prevName??e.name,contents:r},{name:e.name,contents:i,lang:e.lang},n);return{hunks:a.hunks,splitLineCount:a.splitLineCount,unifiedLineCount:a.unifiedLineCount,additionLines:t,deletionLines:a.deletionLines,type:a.type}}function Eh(e,t){return Th(e,[``],t)}function Dh(e,t){if(e.additionLines.length===0)return Eh(e,t);if(wh(e,e.additionLines))return Th(e,e.additionLines,t);let n=e.additionLines,r=xh(e,t);return kh(r,n),r}function Oh(e){return e.length>1&&e.at(-1)===``}function kh(e,t){if(!Oh(t))return;let n=t.length-e.additionLines.length;if(n<=0)return;let r=e.additionLines.length,i=e.hunks.at(-1);if(i!=null&&Ct(i.additionStart,i.additionCount)===r){for(let a of i.hunkContent)if(a.type===`change`&&a.additions<a.deletions&&a.additionLineIndex+a.additions===r){e.additionLines=t,a.additions+=n,i.additionCount+=n,i.additionLines+=n,zh(e);return}}}function Ah(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return jh(e,xh(e,n));let r=Array.from(t);if(r.length===0)return jh(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||xp(r)===xp(i))return jh(e,xh(e,n))}let i=Mh(e,r);if(i.size===0)return jh(e,xh(e,n));for(let t of i)if(!Ph(e,t,n))return jh(e,xh(e,n));return zh(e),kp(e)?jh(e,xh(e,n)):jh(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function jh(e,t){return Object.assign(e,t),t}function Mh(e,t){let n=new Set;for(let r of t){let t=Nh(e,r);if(t==null)return new Set;n.add(t)}return n}function Nh(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function Ph(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=yh({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:(Ih(r,s),Fh(e,t),!0)}function Fh(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(`
|
|
177
|
+
`),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
|
|
178
|
+
`)}function Ih(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>Lh(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,Rh(e)}function Lh(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function Rh(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function zh(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(St(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,Rh(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=Ct(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-Ct(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var Bh=new WeakMap;function Vh(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function Hh(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function Uh(e,t){let n=e.hunks,r=e.additionLines,i=Vh(r),a=i===r?e:{...e,additionLines:i},o=$h(n,Qh(a,t),e.deletionLines.length),s=ng(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,fg(e),kh(e,r),ag(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function Wh(e,t,n,r){let i=Array.from(new Set(t)).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(i.length===0)return;let{hunks:a}=e,o,s=0;for(let t of i){for(;s<a.length;){let e=a[s];if(t<cg(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:cg(r);if(i==null||t<i||o!=null&&o!==s)return Uh(e,n);o=s}if(o!=null){if(Gh(e,i,o,r,n)){e.editSessionDirty=!0;return}return Uh(e,n)}}function Gh(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=Kh(e),o=e.hunks[n];if(o.hunkContent.some(qh))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function Kh(e){let t=Bh.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return Bh.set(e,{lines:e.deletionLines,set:n}),n}function qh(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function Jh(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function Yh(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=Op({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=lg(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=jp({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=lg(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function Xh(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=lg(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,lg(i)+i.deletionCount,e.deletionLines.length),n}function Zh(e,t){return e.editSessionDirty===!0&&(e.editSessionDirty=void 0,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?xh(e,t):Dh(e,t)),!0)}function Qh(e,t){if(Hh(e.deletionLines,e.additionLines)==null)return[];let n=yh({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),r=[],i=0,a=0;for(let e of n.hunks){let t=e.additionCount>0?e.additionLineIndex-i:e.deletionLineIndex-a;i+=t,a+=t;for(let t of e.hunkContent){if(t.type===`context`){i+=t.lines,a+=t.lines;continue}let e=Lh(t,0,0);e.additions===0&&(e.additionLineIndex=i),e.deletions===0&&(e.deletionLineIndex=a),r.push(e),i+=e.additions,a+=e.deletions}}return r}function $h(e,t,n){let r=e.map((e,t)=>{let n=lg(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&eg(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=tg(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function eg(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function tg(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function ng(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);ig(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);ig(s,c,i,r),r+=c,i+=c,n.push(rg(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function rg(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:ug(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:dg(t.additionStart,r),deletionStart:ug(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:dg(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${ug(t.deletionStart,i)},${i} +${ug(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return Rh(s),s}function ig(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function ag(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(lg(r)!==lg(i)||r.deletionCount!==i.deletionCount||cg(r)!==cg(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!og(r,i))return!0}return!1}function og(e,t){let n=sg(e),r=sg(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*sg(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function cg(e){return St(e.additionStart,e.additionCount)}function lg(e){return St(e.deletionStart,e.deletionCount)}function ug(e,t){return t===0?e:e+1}function dg(e,t){return t===0?e-1:e}function fg(e){zh(e);for(let t=0;t<e.hunks.length;t++)Fh(e,t)}function pg(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}var mg=`-1,-1`;function hg(e){return e?.some(e=>e.lineNumber===0)??!1}function gg(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function _g(e){return e.startingLine===0&&e.totalLines>0}function vg(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function yg(){return q({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[kf({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function bg(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var xg=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),zm(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let n=!(e===this.selectedRange||Vm(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!n&&!i||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!r&&!i||(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&bg(e.composedPath())||(Bg(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;t===`disabled`&&!o&&n==null&&r==null&&i==null&&a==null||(Bg(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(Bg(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){Bg(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();Bg(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);Bg(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=Eg(i)&&this.hoveredLine?.lineElement===i.lineElement;Tg(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),Tg(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Eg(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(Og(i)&&p!=null){p(i);break}if(Dg(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Eg(i))break;Tg(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!this.hasPointerListeners?(e.addEventListener(`click`,this.handlePointerClick),e.addEventListener(`pointerdown`,this.handlePointerDown),e.addEventListener(`pointermove`,this.handlePointerMove),e.addEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!0,Bg(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),Bg(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),Bg(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&this.hasPointerListeners&&(e.removeEventListener(`click`,this.handlePointerClick),e.removeEventListener(`pointerdown`,this.handlePointerDown),e.removeEventListener(`pointermove`,this.handlePointerMove),e.removeEventListener(`pointerleave`,this.handlePointerLeave),this.hasPointerListeners=!1);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();bg(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(vg(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=as(yg());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);wg(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(jg(t));if(wg(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(wg(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(wg(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&bg(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=jg(e);if(t&&bg(n))return;let r=Mg(e);return r==null?this.pathFromAnnotationSlot(e):jg(r)}pathFromAnnotationSlot(e){let t=Pg(Ng(e));if(t==null)return;let n=this.targetForSelectionPoint(t);return n==null?void 0:jg(n.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=Fg(t)?t:Fg(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}Vm(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,Rm(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{zm(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!Lg(this.renderedSelectedLinesState,n),i=!Lg(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);kg(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=zg(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=zg(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:Ag(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:Ag(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:Rg(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:Rg(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Sg({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:Cg({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function Cg({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function wg(e){return e!=null&&`kind`in e&&e.kind===`line`}function Tg(e){return e!=null&&`kind`in e&&e.kind===`token`}function Eg(e){return wg(e)||Tg(e)}function Dg(e){return`type`in e&&e.type===`line-info`}function Og(e){return`kind`in e&&e.kind===`merge-conflict-action`}function kg(e){return e===`current`||e===`incoming`||e===`both`}function Ag(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function jg(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Mg(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function Ng(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function Pg(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function Fg(e){return e!=null&&typeof e.elementFromPoint==`function`}function Ig(e,t){return e===t||Vm(e??void 0,t??void 0)}function Lg(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&Ig(e?.range??null,t.range)}function Rg(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function zg(e){let t=e.getAttribute(`data-line-type`);if(t!=null)switch(t){case`change-deletion`:case`change-addition`:case`context`:case`context-expanded`:return t;default:return}}function Bg(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}console.log(...n)}var Vg=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),Wg(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?qg(t):Jg(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:Hg(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:Ug(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;!i&&!a||(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&Gg(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function Hg(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function Ug(e){return Math.max(Math.ceil(e),0)}function Wg(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?Gg(e,{codeWidthChanged:!0,numberWidthChanged:!0}):Kg(e))}function Gg(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function Kg(e){e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`)}function qg(e){e.codeElement.isConnected&&Kg(e)}function Jg(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}function Yg(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function Xg(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!qt.has(t))return!1;return!0}function Zg(e){for(let t of mf(e))if(!jt.has(t))return!1;return!0}function Qg(e,t){return e.endsWith(`\r
|
|
179
|
+
`)?t+`\r
|
|
180
|
+
`:e.endsWith(`\r`)?t+`\r`:e.endsWith(`
|
|
181
|
+
`)?t+`
|
|
182
|
+
`:t}function $g(e){return q({tagName:`div`,children:[q({tagName:`div`,children:e.annotations?.map(e=>q({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function e_(e,t){return q({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function t_(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 n_({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return q({tagName:`div`,children:[t===`custom`?q({tagName:`slot`,properties:{name:ut}}):r_({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[i_(r)]],properties:i})}function r_({name:e,prevName:t,iconType:n}){let r=[q({tagName:`slot`,properties:{name:st}}),kf({name:t_(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(q({tagName:`div`,children:[q({tagName:`bdi`,children:[Of(t)]})],properties:{"data-prev-name":``}})),r.push(kf({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(q({tagName:`div`,children:[q({tagName:`bdi`,children:[Of(e)]})],properties:{"data-title":``}})),r.push(q({tagName:`slot`,properties:{name:ct}})),q({tagName:`div`,children:r,properties:{"data-header-content":``}})}function i_(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(q({tagName:`span`,children:[Of(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(q({tagName:`span`,children:[Of(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(q({tagName:`slot`,properties:{name:lt}})),q({tagName:`div`,children:t,properties:{"data-metadata":``}})}function a_(e){return q({tagName:`pre`,properties:o_(e)})}function o_({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}function s_(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:mf(t),preferredHighlighter:n}}function c_(e,t){return t.cacheKey==null?e.file===t&&e.sourceContents===t.contents:e.cacheKey===t.cacheKey}var l_=-1,u_=class{options;onRenderUpdate;workerManager;__id=`file-renderer:${++l_}`;highlighter;renderCache;computedLang=`text`;lineAnnotations={};lineCache;pendingStructuralRows;textDocumentCache=new WeakMap;editSessionActive=!1;constructor(e={theme:F},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Zg(e.theme??F)?ff():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}beginEditSession(){this.editSessionActive=!0}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0,this.endEditSession(),this.textDocumentCache=new WeakMap}syncEditedContentsToFile(){let{renderCache:e,lineCache:t}=this;e?.isDirty!==!0||t==null||!c_(t,e.file)||(e.file.contents=t.lines.join(``))}hasUnkeyedFileContentsChanged(e){let{lineCache:t}=this;return e.cacheKey==null&&t!=null&&t.file===e&&t.sourceContents!==e.contents}invalidateChangedUnkeyedFile(e){this.hasUnkeyedFileContentsChanged(e)&&(this.workerManager?.cleanUpTasks(this),this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap)}clearRenderCache(){this.syncEditedContentsToFile(),this.pendingStructuralRows=void 0;let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.file.cacheKey!=null&&this.workerManager?.evictFileFromCache(e.file.cacheKey)}hydrate(e){let{options:t}=this.getRenderOptions(e),n=d_(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!gf(t,r.options)&&(r=void 0),this.renderCache??={file:e,options:t,highlighted:!n&&!bf(e),result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter??(this.computedLang=e.lang??yf(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??F}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getFileRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getFileRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{tokenizeMaxLineLength:e=1e3}=this.options;return{theme:this.getLocalHighlightTheme(),useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:e}})(),{renderCache:n}=this;return n?.result==null||!At(e,n.file)||!gf(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getOrCreateLineCache(e){this.invalidateChangedUnkeyedFile(e);let{lineCache:t}=this;return(t==null||!c_(t,e))&&(t={cacheKey:e.cacheKey,file:e,sourceContents:e.contents,lines:Df(e.contents)}),this.lineCache=t,t.lines}getLineCount(e){let t=this.getOrCreateLineCache(e);return this.textDocumentCache.get(e)?.lineCount??t.length}updateRenderCache(e,t,n=!1){if(this.pendingStructuralRows=void 0,this.renderCache==null)return;let{file:r,result:i}=this.renderCache;if(i==null)return;let a=n?new Map:void 0;this.pendingStructuralRows=a;let o=this.lineCache!=null&&c_(this.lineCache,r)?this.lineCache:void 0;for(let[t,n]of e){if(a===void 0&&o!=null&&t<o.lines.length){let e=n.map(e=>e[2]).join(``);o.lines[t]=Qg(o.lines[t]??``,e)}let e={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};a===void 0?i.code[t]=e:a.set(t,e)}i.baseThemeType=t,this.renderCache.isDirty=!0}applyDocumentChange(e){let t=this.pendingStructuralRows;if(this.pendingStructuralRows=void 0,this.renderCache==null)return;let{file:n,result:r}=this.renderCache;if(r==null)return;let i=this.lineCache!=null&&c_(this.lineCache,n)?this.lineCache.lines:Df(n.contents),a=Df(e.getText());if(i.length!==a.length){let n=Math.min(i.length,a.length),o=0;for(;o<n&&i[o]===a[o];)o++;let s=0;for(;s<n-o&&i[i.length-1-s]===a[a.length-1-s];)s++;let c=r.code;r.code=Array(a.length);for(let e=0;e<o;e++)r.code[e]=c[e];for(let e=0;e<s;e++)r.code[a.length-1-e]=c[i.length-1-e];if(t!==void 0)for(let[e,n]of t)e<a.length&&(r.code[e]=n);for(let t=o;t<a.length-s;t++)r.code[t]??={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:e.getLineText(t)}]}]};for(let e=0;e<r.code.length;e++){let t=r.code[e];t?.type===`element`&&(t.properties[`data-line`]=e+1,t.properties[`data-line-index`]=e)}this.renderCache.isDirty=!0}this.lineCache={cacheKey:n.cacheKey,file:n,sourceContents:n.contents,lines:a},this.textDocumentCache.set(n,e)}renderFile(e=this.renderCache?.file,t=vt){if(e==null)return;this.invalidateChangedUnkeyedFile(e),this.renderCache?.isDirty===!0&&!At(e,this.renderCache.file)&&(this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap);let{options:n,forceHighlight:r}=this.getRenderOptions(e);this.renderCache?.isDirty===!0&&!gf(n,this.renderCache.options)&&this.clearRenderCache();let i=this.getMatchingWorkerResultCache(e,n);i!=null&&!this.hasHighlightedRenderCache(e,n)&&(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...i},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=this.getOrCreateLineCache(e),o=e.contents.length>0,s=!o||bf(e)||d_(a.length,this.getTokenizeMaxLength()),c=!At(e,this.renderCache.file),l=!Yg(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0)(s||this.renderCache.result==null||!this.renderCache.highlighted&&(c||l))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||c||l||r)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,a)),this.renderCache.renderRange=t),!s&&o&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??yf(e.name);let t=this.highlighter!=null&&Zg(n.theme),i=this.highlighter!=null&&Xg(this.computedLang),a=!s&&i;if(this.highlighter!=null&&t&&(r||s||!this.renderCache.highlighted&&a||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,s||!i);this.renderCache={file:e,options:n,highlighted:a,result:t,renderRange:void 0}}(!t||!s&&!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.applyHighlightResult(e,t,n,!s)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,t,this.renderCache.result)}async asyncRender(e,t=vt){let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=d_(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??yf(e.name);let n=this.highlighter!=null&&hf(mf(this.getLocalHighlightTheme())),r=t||this.highlighter!=null&&Xg(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:gp(e,t,r,{forcePlainText:n}),options:r}}processFileResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let a=this.getLineCount(e),{disableFileHeader:o=!1}=this.options,s=[],c=jf(),l=Math.min(t.startingLine+t.totalLines,a),u=0,d=_g(t)?gg(this.lineAnnotations):void 0;d!=null&&(c.children.push(Nf(`context`,`annotation`,1)),s.push($g({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:d.map(e=>bt(e))})),u++);for(let r=t.startingLine;r<l;r++){let t=r+1,i=n[r];if(i==null){let n=`FileRenderer.processFileResult: Line doesnt exist`;throw console.error(n,{name:e.name,lineIndex:r,lineNumber:t}),Error(n)}c.children.push(Mf(`context`,t,`${r}`)),s.push(i),u++;let a=this.lineAnnotations[t];a!=null&&(c.children.push(Nf(`context`,`annotation`,1)),s.push($g({type:`annotation`,hunkIndex:0,lineIndex:t,annotations:a.map(e=>bt(e))})),u++)}return c.properties.style=`grid-row: span ${u}`,{gutterAST:c.children??[],contentAST:s,preAST:this.createPreElement(a),headerAST:o?void 0:this.renderHeader(e),totalLines:a,rowCount:u,themeStyles:r,baseThemeType:i,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return n_({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return as(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(q({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=jf();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,e_(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return as(t?q({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await df(s_(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){if(this.renderCache==null)return;let i=!At(e,this.renderCache.file)||!this.renderCache.highlighted||!gf(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getFileResultCache(e);if(!(n==null||!gf(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&At(e,n.file)&&gf(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return a_({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function d_(e,t){return e>t}var f_=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
183
|
+
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
184
|
+
<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"/>
|
|
185
|
+
</symbol>
|
|
186
|
+
<symbol id="diffs-icon-brand-github" viewBox="0 0 16 16">
|
|
187
|
+
<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"/>
|
|
188
|
+
</symbol>
|
|
189
|
+
<symbol id="diffs-icon-chevron" viewBox="0 0 16 16">
|
|
190
|
+
<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"/>
|
|
191
|
+
</symbol>
|
|
192
|
+
<symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16">
|
|
193
|
+
<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"/>
|
|
194
|
+
</symbol>
|
|
195
|
+
<symbol id="diffs-icon-diff-split" viewBox="0 0 16 16">
|
|
196
|
+
<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"/>
|
|
197
|
+
</symbol>
|
|
198
|
+
<symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16">
|
|
199
|
+
<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"/>
|
|
200
|
+
</symbol>
|
|
201
|
+
<symbol id="diffs-icon-expand" viewBox="0 0 16 16">
|
|
202
|
+
<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"/>
|
|
203
|
+
</symbol>
|
|
204
|
+
<symbol id="diffs-icon-expand-all" viewBox="0 0 16 16">
|
|
205
|
+
<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"/>
|
|
206
|
+
</symbol>
|
|
207
|
+
<symbol id="diffs-icon-file-code" viewBox="0 0 16 16">
|
|
208
|
+
<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"/>
|
|
209
|
+
</symbol>
|
|
210
|
+
<symbol id="diffs-icon-plus" viewBox="0 0 16 16">
|
|
211
|
+
<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"/>
|
|
212
|
+
</symbol>
|
|
213
|
+
<symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16">
|
|
214
|
+
<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"/>
|
|
215
|
+
</symbol>
|
|
216
|
+
<symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16">
|
|
217
|
+
<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"/>
|
|
218
|
+
</symbol>
|
|
219
|
+
<symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16">
|
|
220
|
+
<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"/>
|
|
221
|
+
</symbol>
|
|
222
|
+
<symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16">
|
|
223
|
+
<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"/>
|
|
224
|
+
</symbol>
|
|
225
|
+
<symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16">
|
|
226
|
+
<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"/>
|
|
227
|
+
</symbol>
|
|
228
|
+
<symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16">
|
|
229
|
+
<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"/>
|
|
230
|
+
</symbol>
|
|
231
|
+
<symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
|
|
232
|
+
<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"/>
|
|
233
|
+
</symbol>
|
|
234
|
+
</svg>`;function p_(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function m_(e,t){return e==null||t==null?e===t:g_(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}var h_={};function g_(e=h_,t=h_){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function __(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function v_(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}function y_(){let e=document.createElement(`style`);return e.setAttribute(ft,``),e}var b_;function x_(e){if(b_!=null)return b_;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(pt,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),b_=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),b_}function S_(e){return`${mt}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var C_=`@layer base {
|
|
235
|
+
:host {
|
|
236
|
+
--diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
|
|
237
|
+
"Courier New", monospace;
|
|
238
|
+
--diffs-header-font-fallback: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
|
|
239
|
+
"Noto Sans", "Liberation Sans", Arial, sans-serif;
|
|
240
|
+
--diffs-mixer: light-dark(#000, #fff);
|
|
241
|
+
--diffs-gap-fallback: 8px;
|
|
242
|
+
--diffs-scrollbar-gutter-fallback: 6px;
|
|
243
|
+
--diffs-scrollbar-gutter: var(--diffs-scrollbar-gutter-override, var(--diffs-scrollbar-gutter-measured, var(--diffs-scrollbar-gutter-fallback)));
|
|
244
|
+
--diffs-added-light: #0dbe4e;
|
|
245
|
+
--diffs-added-dark: #5ecc71;
|
|
246
|
+
--diffs-modified-light: #009fff;
|
|
247
|
+
--diffs-modified-dark: #69b1ff;
|
|
248
|
+
--diffs-deleted-light: #ff2e3f;
|
|
249
|
+
--diffs-deleted-dark: #ff6762;
|
|
250
|
+
--diffs-warning-light: #d5a910;
|
|
251
|
+
--diffs-warning-dark: #ffd452;
|
|
252
|
+
color-scheme: light dark;
|
|
253
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
254
|
+
font-size: var(--diffs-font-size, 13px);
|
|
255
|
+
line-height: var(--diffs-line-height, 20px);
|
|
256
|
+
font-feature-settings: var(--diffs-font-features);
|
|
257
|
+
--diffs-bg: light-dark(var(--diffs-light-bg, #fff), var(--diffs-dark-bg, #000));
|
|
258
|
+
--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))));
|
|
259
|
+
--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))));
|
|
260
|
+
--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))));
|
|
261
|
+
--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))));
|
|
262
|
+
--diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff));
|
|
263
|
+
--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))));
|
|
264
|
+
--diffs-fg-conflict-marker: var(--diffs-fg-conflict-marker-override, var(--diffs-fg-number));
|
|
265
|
+
--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)))));
|
|
266
|
+
--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)))));
|
|
267
|
+
--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)))));
|
|
268
|
+
--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))));
|
|
269
|
+
--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)));
|
|
270
|
+
--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))));
|
|
271
|
+
--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)));
|
|
272
|
+
--diffs-selection-base: var(--diffs-modified-base);
|
|
273
|
+
--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)));
|
|
274
|
+
background-color: var(--diffs-bg);
|
|
275
|
+
color: var(--diffs-fg);
|
|
276
|
+
display: block;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
pre, code, [data-error-wrapper] {
|
|
280
|
+
isolation: isolate;
|
|
281
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
282
|
+
outline: none;
|
|
283
|
+
margin: 0;
|
|
284
|
+
padding: 0;
|
|
285
|
+
display: block;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
pre, code {
|
|
289
|
+
background-color: var(--diffs-bg);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
code {
|
|
293
|
+
contain: content;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
input, button {
|
|
297
|
+
font-family: inherit;
|
|
298
|
+
font-size: inherit;
|
|
299
|
+
line-height: inherit;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
*, :before, :after {
|
|
303
|
+
box-sizing: border-box;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
[data-icon-sprite] {
|
|
307
|
+
display: none;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
[data-diffs-header], [data-separator] {
|
|
311
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
[data-diffs-header][data-sticky] {
|
|
315
|
+
z-index: 1;
|
|
316
|
+
background-color: var(--diffs-bg);
|
|
317
|
+
position: sticky;
|
|
318
|
+
top: 0;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
[data-file-info] {
|
|
322
|
+
color: var(--fg);
|
|
323
|
+
background-color: color-mix(in lab, var(--bg) 98%, var(--fg));
|
|
324
|
+
border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg));
|
|
325
|
+
padding: 10px;
|
|
326
|
+
font-weight: 700;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
[data-diff], [data-file] {
|
|
330
|
+
--diffs-grid-number-column-width: minmax(min-content, max-content);
|
|
331
|
+
--diffs-code-grid: var(--diffs-grid-number-column-width) 1fr;
|
|
332
|
+
|
|
333
|
+
&[data-dehydrated] {
|
|
334
|
+
--diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
&:hover [data-code]::-webkit-scrollbar-thumb {
|
|
338
|
+
background-color: var(--diffs-bg-context);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
@supports (-webkit-touch-callout: none) {
|
|
343
|
+
:host {
|
|
344
|
+
--diffs-scrollbar-gutter-fallback: 0px;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
[data-line] span {
|
|
349
|
+
color: light-dark(var(--diffs-token-light, var(--diffs-light)), var(--diffs-token-dark, var(--diffs-dark)));
|
|
350
|
+
background-color: light-dark(var(--diffs-token-light-bg, inherit), var(--diffs-token-dark-bg, inherit));
|
|
351
|
+
font-weight: light-dark(var(--diffs-token-light-font-weight, inherit), var(--diffs-token-dark-font-weight, inherit));
|
|
352
|
+
font-style: light-dark(var(--diffs-token-light-font-style, inherit), var(--diffs-token-dark-font-style, inherit));
|
|
353
|
+
text-decoration: light-dark(var(--diffs-token-light-text-decoration, inherit), var(--diffs-token-dark-text-decoration, inherit));
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
[data-line], [data-gutter-buffer], [data-column-number], [data-line-annotation], [data-no-newline], [data-merge-conflict], [data-merge-conflict-actions], [data-editor-overlay] {
|
|
357
|
+
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
358
|
+
--diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg);
|
|
359
|
+
--diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg);
|
|
360
|
+
--diffs-computed-editor-active-line-bg: var(--diffs-computed-selected-line-bg);
|
|
361
|
+
--diffs-computed-hovered-line-bg: var(--diffs-computed-editor-active-line-bg);
|
|
362
|
+
--diffs-hover-mix-target: var(--diffs-bg-hover-override, var(--diffs-mixer));
|
|
363
|
+
--diffs-line-bg: var(--diffs-computed-hovered-line-bg);
|
|
364
|
+
color: var(--diffs-fg);
|
|
365
|
+
background-color: var(--diffs-line-bg, var(--diffs-bg));
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
[data-line], [data-no-newline] {
|
|
369
|
+
&[data-decoration-bg] {
|
|
370
|
+
--mix-deco-light: 92%;
|
|
371
|
+
--mix-deco-dark: 85%;
|
|
372
|
+
|
|
373
|
+
&[data-decoration-bg-depth="2"] {
|
|
374
|
+
--mix-deco-light: 88%;
|
|
375
|
+
--mix-deco-dark: 80%;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
&[data-decoration-bg-depth="3"] {
|
|
379
|
+
--mix-deco-light: 85%;
|
|
380
|
+
--mix-deco-dark: 78%;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
--diffs-hover-mix-target: var(--diffs-decoration-bg);
|
|
384
|
+
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
385
|
+
var(--diffs-bg) var(--mix-deco-light),
|
|
386
|
+
var(--diffs-decoration-bg)), color-mix(in lab,
|
|
387
|
+
var(--diffs-bg) var(--mix-deco-dark),
|
|
388
|
+
var(--diffs-decoration-bg)));
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
[data-line-annotation], [data-gutter-buffer="annotation"] {
|
|
393
|
+
--diffs-annotation-bg: var(--diffs-bg-context);
|
|
394
|
+
--diffs-computed-decoration-bg: var(--diffs-annotation-bg);
|
|
395
|
+
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
[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"] {
|
|
399
|
+
--diffs-computed-decoration-bg: var(--diffs-bg-context);
|
|
400
|
+
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
[data-gutter-buffer="merge-conflict-marker-start"], [data-merge-conflict="marker-start"] {
|
|
404
|
+
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
405
|
+
var(--diffs-bg) 78%,
|
|
406
|
+
var(--conflict-bg-current-header-override, var(--diffs-addition-base))), color-mix(in lab,
|
|
407
|
+
var(--diffs-bg) 68%,
|
|
408
|
+
var(--conflict-bg-current-header-override, var(--diffs-addition-base))));
|
|
409
|
+
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
[data-gutter-buffer="merge-conflict-marker-end"], [data-merge-conflict="marker-end"] {
|
|
413
|
+
--diffs-computed-decoration-bg: light-dark(color-mix(in lab,
|
|
414
|
+
var(--diffs-bg) 78%,
|
|
415
|
+
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))), color-mix(in lab,
|
|
416
|
+
var(--diffs-bg) 68%,
|
|
417
|
+
var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))));
|
|
418
|
+
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
[data-has-merge-conflict] [data-line-annotation], [data-has-merge-conflict] [data-gutter-buffer="annotation"] {
|
|
422
|
+
--diffs-computed-decoration-bg: var(--diffs-bg);
|
|
423
|
+
--diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
:where([data-background]) {
|
|
427
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
428
|
+
--mix-light: 91%;
|
|
429
|
+
--mix-dark: 85%;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
& [data-line], & [data-no-newline] {
|
|
433
|
+
--mix-light: 88%;
|
|
434
|
+
--mix-dark: 80%;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
& [data-gutter-buffer], & [data-column-number], & [data-line], & [data-no-newline] {
|
|
438
|
+
--diffs-diff-line-mix-target: var(--diffs-bg);
|
|
439
|
+
|
|
440
|
+
&[data-line-type="change-deletion"] {
|
|
441
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-override, var(--diffs-deletion-base));
|
|
442
|
+
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
443
|
+
|
|
444
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
445
|
+
color: var(--diffs-fg-number-deletion-override, var(--diffs-deletion-base));
|
|
446
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base));
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
450
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
451
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
452
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
453
|
+
var(--diffs-diff-line-mix-target)));
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
&[data-line-type="change-addition"] {
|
|
457
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-addition-override, var(--diffs-addition-base));
|
|
458
|
+
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
459
|
+
|
|
460
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
461
|
+
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
462
|
+
--diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base));
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
466
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
467
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
468
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
469
|
+
var(--diffs-diff-line-mix-target)));
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
&[data-merge-conflict="current"] {
|
|
473
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-current-override, var(--diffs-addition-base));
|
|
474
|
+
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
475
|
+
|
|
476
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
477
|
+
color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base));
|
|
478
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-current-number-override, var(--diffs-addition-base));
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
482
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
483
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
484
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
485
|
+
var(--diffs-diff-line-mix-target)));
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
&[data-merge-conflict="incoming"] {
|
|
489
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-override, var(--diffs-modified-base));
|
|
490
|
+
--diffs-hover-mix-target: var(--diffs-diff-line-mix-target);
|
|
491
|
+
|
|
492
|
+
&:where([data-gutter-buffer], [data-column-number]) {
|
|
493
|
+
color: var(--diffs-modified-base);
|
|
494
|
+
--diffs-diff-line-mix-target: var(--conflict-bg-incoming-number-override, var(--diffs-modified-base));
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
--diffs-computed-diff-line-bg: light-dark(color-mix(in lab,
|
|
498
|
+
var(--diffs-computed-decoration-bg) var(--mix-light),
|
|
499
|
+
var(--diffs-diff-line-mix-target)), color-mix(in lab,
|
|
500
|
+
var(--diffs-computed-decoration-bg) var(--mix-dark),
|
|
501
|
+
var(--diffs-diff-line-mix-target)));
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
[data-gutter-buffer], [data-column-number], [data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline], [data-editor-overlay] {
|
|
507
|
+
--diffs-selection-mix-target: var(--diffs-bg-selection-override, var(--diffs-selection-base));
|
|
508
|
+
--diffs-selection-emphasis-mix-target: var(--diffs-selection-mix-target);
|
|
509
|
+
|
|
510
|
+
&:where([data-editor-overlay]), &:where([data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline])[data-selected-line] {
|
|
511
|
+
--mix-selection-light: 82%;
|
|
512
|
+
--mix-selection-dark: 75%;
|
|
513
|
+
--diffs-hover-mix-target: var(--diffs-selection-mix-target);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
&:where([data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line])) {
|
|
517
|
+
--mix-selection-light: 75%;
|
|
518
|
+
--mix-selection-dark: 60%;
|
|
519
|
+
--diffs-selection-mix-target: var(--diffs-bg-selection-number-override, var(--diffs-selection-base));
|
|
520
|
+
--diffs-hover-mix-target: var(--diffs-selection-mix-target);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
&:where([data-line][data-selected-line]):is([data-line-type="change-addition"], [data-line-type="change-deletion"]) {
|
|
524
|
+
--diffs-selection-emphasis-mix-target: light-dark(color-mix(in lab,
|
|
525
|
+
var(--diffs-diff-line-mix-target, var(--diffs-selection-mix-target))
|
|
526
|
+
var(--mix-selection-light),
|
|
527
|
+
var(--diffs-selection-mix-target)), var(--diffs-selection-mix-target));
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
&:where([data-editor-overlay]), &[data-selected-line] {
|
|
531
|
+
--diffs-computed-selected-line-bg: light-dark(color-mix(in lab,
|
|
532
|
+
var(--diffs-computed-diff-line-bg) var(--mix-selection-light),
|
|
533
|
+
var(--diffs-selection-mix-target)), color-mix(in lab,
|
|
534
|
+
var(--diffs-computed-diff-line-bg) var(--mix-selection-dark),
|
|
535
|
+
var(--diffs-selection-mix-target)));
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
[data-line][data-editor-active-line], [data-column-number][data-editor-active-line] {
|
|
540
|
+
--diffs-computed-editor-active-line-bg: color-mix(in lab,
|
|
541
|
+
var(--diffs-computed-selected-line-bg)
|
|
542
|
+
var(--diffs-editor-active-line-source-mix, 100%),
|
|
543
|
+
var(--diffs-selection-emphasis-mix-target));
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
@media (pointer: fine) {
|
|
547
|
+
[data-line][data-hovered], [data-gutter-buffer][data-hovered], [data-column-number][data-hovered], [data-line-annotation][data-hovered], [data-no-newline][data-hovered], [data-merge-conflict][data-hovered], [data-merge-conflict-actions][data-hovered], [data-editor-overlay][data-hovered] {
|
|
548
|
+
--diffs-computed-hovered-line-bg: light-dark(color-mix(in lab,
|
|
549
|
+
var(--diffs-computed-editor-active-line-bg) 97%,
|
|
550
|
+
var(--diffs-hover-mix-target)), color-mix(in lab,
|
|
551
|
+
var(--diffs-computed-editor-active-line-bg) 91%,
|
|
552
|
+
var(--diffs-hover-mix-target)));
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
[data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line]) {
|
|
557
|
+
color: var(--diffs-selection-number-fg);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
[data-no-newline] {
|
|
561
|
+
user-select: none;
|
|
562
|
+
|
|
563
|
+
& span {
|
|
564
|
+
opacity: .6;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
[data-diff-type="split"][data-overflow="scroll"] {
|
|
569
|
+
grid-template-columns: 1fr 1fr;
|
|
570
|
+
display: grid;
|
|
571
|
+
|
|
572
|
+
& [data-additions] {
|
|
573
|
+
border-left: 1px solid var(--diffs-bg);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
& [data-deletions] {
|
|
577
|
+
border-right: 1px solid var(--diffs-bg);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
[data-code] {
|
|
582
|
+
grid-auto-flow: dense;
|
|
583
|
+
grid-template-columns: var(--diffs-code-grid);
|
|
584
|
+
overflow: var(--diffs-overflow-override, scroll) clip;
|
|
585
|
+
overscroll-behavior-x: none;
|
|
586
|
+
tab-size: var(--diffs-tab-size, 2);
|
|
587
|
+
padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
588
|
+
padding-bottom: max(0px,
|
|
589
|
+
calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) -
|
|
590
|
+
var(--diffs-scrollbar-gutter)));
|
|
591
|
+
scrollbar-gutter: stable;
|
|
592
|
+
align-self: flex-start;
|
|
593
|
+
display: grid;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
[data-diffs-scrollbar-measure] {
|
|
597
|
+
opacity: 0;
|
|
598
|
+
pointer-events: none;
|
|
599
|
+
scrollbar-gutter: auto;
|
|
600
|
+
grid-template-columns: none;
|
|
601
|
+
width: 100px;
|
|
602
|
+
height: 100px;
|
|
603
|
+
padding: 0;
|
|
604
|
+
position: absolute;
|
|
605
|
+
top: -200px;
|
|
606
|
+
left: -200px;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
[data-container-size] {
|
|
610
|
+
container-type: inline-size;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
[data-code]::-webkit-scrollbar {
|
|
614
|
+
width: 0;
|
|
615
|
+
height: var(--diffs-scrollbar-gutter);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
[data-code]::-webkit-scrollbar-track {
|
|
619
|
+
background: none;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
[data-code]::-webkit-scrollbar-thumb {
|
|
623
|
+
background-color: #0000;
|
|
624
|
+
background-clip: content-box;
|
|
625
|
+
border: 1px solid #0000;
|
|
626
|
+
border-radius: 3px;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
[data-code]::-webkit-scrollbar-corner {
|
|
630
|
+
background-color: #0000;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
@supports ((-moz-appearance: none)) {
|
|
634
|
+
[data-code] {
|
|
635
|
+
scrollbar-width: thin;
|
|
636
|
+
scrollbar-color: var(--diffs-bg-context) transparent;
|
|
637
|
+
padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
[data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] {
|
|
642
|
+
& [data-code], &[data-overflow="wrap"], &[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
|
|
643
|
+
padding-top: 0;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
[data-gutter] {
|
|
648
|
+
grid-template-rows: subgrid;
|
|
649
|
+
grid-template-columns: subgrid;
|
|
650
|
+
z-index: 3;
|
|
651
|
+
background-color: var(--diffs-bg);
|
|
652
|
+
grid-column: 1;
|
|
653
|
+
display: grid;
|
|
654
|
+
position: relative;
|
|
655
|
+
|
|
656
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
657
|
+
border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg));
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
[data-content] {
|
|
662
|
+
grid-template-rows: subgrid;
|
|
663
|
+
grid-template-columns: subgrid;
|
|
664
|
+
background-color: var(--diffs-bg);
|
|
665
|
+
grid-column: 2;
|
|
666
|
+
min-width: 0;
|
|
667
|
+
display: grid;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
[data-diff-type="split"][data-overflow="wrap"], [data-dehydrated][data-diff-type="split"][data-overflow="scroll"] {
|
|
671
|
+
grid-auto-flow: dense;
|
|
672
|
+
grid-template-columns: repeat(2, var(--diffs-code-grid));
|
|
673
|
+
padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
674
|
+
display: grid;
|
|
675
|
+
|
|
676
|
+
& [data-code] {
|
|
677
|
+
display: contents;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
& [data-deletions] {
|
|
681
|
+
& [data-gutter] {
|
|
682
|
+
grid-column: 1;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
& [data-content] {
|
|
686
|
+
border-right: 1px solid var(--diffs-bg);
|
|
687
|
+
grid-column: 2;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
& [data-additions] {
|
|
692
|
+
& [data-gutter] {
|
|
693
|
+
border-left: 1px solid var(--diffs-bg);
|
|
694
|
+
grid-column: 3;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
& [data-content] {
|
|
698
|
+
grid-column: 4;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] [data-content] {
|
|
704
|
+
overflow: clip;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
[data-overflow="scroll"] [data-gutter] {
|
|
708
|
+
position: sticky;
|
|
709
|
+
left: 0;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
[data-interactive-lines] [data-line] {
|
|
713
|
+
cursor: pointer;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
[data-interactive-line-numbers] [data-column-number] {
|
|
717
|
+
cursor: pointer;
|
|
718
|
+
touch-action: none;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
[data-content-buffer], [data-gutter-buffer] {
|
|
722
|
+
user-select: none;
|
|
723
|
+
min-height: 1lh;
|
|
724
|
+
position: relative;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
[data-gutter-buffer] {
|
|
728
|
+
padding-left: 2ch;
|
|
729
|
+
padding-right: 1ch;
|
|
730
|
+
|
|
731
|
+
&:before {
|
|
732
|
+
content: "";
|
|
733
|
+
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
734
|
+
display: block;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
[data-gutter-buffer="annotation"] {
|
|
739
|
+
--diffs-annotation-bg: var(--diffs-bg-context-gutter);
|
|
740
|
+
min-height: 0;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
[data-gutter-buffer="buffer"] {
|
|
744
|
+
--diffs-line-bg: var(--diffs-bg-context-gutter);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
[data-content-buffer] {
|
|
748
|
+
background-position: 5px 0;
|
|
749
|
+
background-size: 8px 8px;
|
|
750
|
+
background-origin: border-box;
|
|
751
|
+
background-image: repeating-linear-gradient(-45deg,
|
|
752
|
+
transparent,
|
|
753
|
+
transparent calc(3px * 1.414),
|
|
754
|
+
var(--diffs-bg-buffer) calc(3px * 1.414),
|
|
755
|
+
var(--diffs-bg-buffer) calc(4px * 1.414));
|
|
756
|
+
grid-column: 1;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
[data-separator] {
|
|
760
|
+
box-sizing: content-box;
|
|
761
|
+
background-color: var(--diffs-bg);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
[data-separator="simple"] {
|
|
765
|
+
min-height: 4px;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"], [data-separator="simple"] {
|
|
769
|
+
background-color: var(--diffs-bg-separator);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
[data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
773
|
+
height: 32px;
|
|
774
|
+
position: relative;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
[data-separator-wrapper] {
|
|
778
|
+
user-select: none;
|
|
779
|
+
fill: currentColor;
|
|
780
|
+
background-color: var(--diffs-bg);
|
|
781
|
+
align-items: center;
|
|
782
|
+
height: 100%;
|
|
783
|
+
display: flex;
|
|
784
|
+
position: absolute;
|
|
785
|
+
inset-inline: 0;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
[data-content] [data-separator-wrapper] {
|
|
789
|
+
display: none;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
[data-separator="metadata"] [data-separator-wrapper] {
|
|
793
|
+
background-color: var(--diffs-bg-separator);
|
|
794
|
+
height: 100%;
|
|
795
|
+
color: var(--diffs-fg-number);
|
|
796
|
+
white-space: nowrap;
|
|
797
|
+
text-overflow: ellipsis;
|
|
798
|
+
min-width: min-content;
|
|
799
|
+
padding-inline: 1ch;
|
|
800
|
+
inset-inline: 100% auto;
|
|
801
|
+
overflow: hidden;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
[data-separator="line-info"] {
|
|
805
|
+
margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback));
|
|
806
|
+
|
|
807
|
+
& [data-separator-wrapper] {
|
|
808
|
+
min-width: 16px;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
[data-separator="line-info-basic"], [data-separator="metadata"] {
|
|
813
|
+
margin-block: 0;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
[data-separator="line-info"][data-separator-first] {
|
|
817
|
+
margin-top: 0;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
[data-separator="line-info"][data-separator-last] {
|
|
821
|
+
margin-bottom: 0;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
[data-expand-index] [data-separator-wrapper] {
|
|
825
|
+
grid-template-columns: 32px auto;
|
|
826
|
+
display: grid;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
[data-expand-index] [data-separator-wrapper][data-separator-multi-button] {
|
|
830
|
+
grid-template-columns: 32px 32px auto;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
[data-expand-button], [data-separator-content] {
|
|
834
|
+
background-color: var(--diffs-bg-separator);
|
|
835
|
+
flex: none;
|
|
836
|
+
align-items: center;
|
|
837
|
+
display: flex;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
[data-expand-index] [data-separator-content]:hover {
|
|
841
|
+
cursor: pointer;
|
|
842
|
+
text-decoration: underline;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
[data-expand-button] {
|
|
846
|
+
cursor: pointer;
|
|
847
|
+
min-width: 32px;
|
|
848
|
+
color: var(--diffs-fg-number);
|
|
849
|
+
border-right: 2px solid var(--diffs-bg);
|
|
850
|
+
flex-shrink: 0;
|
|
851
|
+
justify-content: center;
|
|
852
|
+
align-self: stretch;
|
|
853
|
+
|
|
854
|
+
&:hover {
|
|
855
|
+
color: var(--diffs-fg);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
&[data-expand-all-button] {
|
|
859
|
+
display: none;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
[data-expand-down] [data-icon] {
|
|
864
|
+
transform: scaleY(-1);
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
[data-separator-content] {
|
|
868
|
+
height: 100%;
|
|
869
|
+
color: var(--diffs-fg-number);
|
|
870
|
+
flex: auto;
|
|
871
|
+
justify-content: flex-start;
|
|
872
|
+
padding: 0 1ch;
|
|
873
|
+
overflow: hidden;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
877
|
+
& [data-separator-content] {
|
|
878
|
+
user-select: none;
|
|
879
|
+
height: 100%;
|
|
880
|
+
overflow: clip;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
[data-unmodified-lines] {
|
|
885
|
+
text-overflow: ellipsis;
|
|
886
|
+
white-space: nowrap;
|
|
887
|
+
flex: 0 auto;
|
|
888
|
+
min-width: 0;
|
|
889
|
+
display: block;
|
|
890
|
+
overflow: hidden;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
@supports (width: 1cqi) {
|
|
894
|
+
[data-unified] {
|
|
895
|
+
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
896
|
+
padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
897
|
+
width: 100cqi;
|
|
898
|
+
|
|
899
|
+
& [data-separator-content] {
|
|
900
|
+
border-radius: 6px;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
& [data-separator="line-info"][data-expand-index] [data-separator-wrapper] [data-separator-content] {
|
|
905
|
+
border-top-left-radius: unset;
|
|
906
|
+
border-bottom-left-radius: unset;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
[data-gutter] {
|
|
911
|
+
& [data-separator="line-info"] [data-separator-wrapper] {
|
|
912
|
+
padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
& [data-separator="line-info"] [data-separator-content] {
|
|
916
|
+
border-top-left-radius: 6px;
|
|
917
|
+
border-bottom-left-radius: 6px;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
& [data-separator="line-info"][data-expand-index] [data-separator-content] {
|
|
921
|
+
border-top-left-radius: unset;
|
|
922
|
+
border-bottom-left-radius: unset;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
[data-additions] {
|
|
927
|
+
& [data-content] [data-separator="line-info"] {
|
|
928
|
+
background-color: var(--diffs-bg);
|
|
929
|
+
|
|
930
|
+
& [data-separator-wrapper] {
|
|
931
|
+
display: none;
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
& [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
936
|
+
background-color: var(--diffs-bg-separator);
|
|
937
|
+
border-top-right-radius: 6px;
|
|
938
|
+
border-bottom-right-radius: 6px;
|
|
939
|
+
height: 100%;
|
|
940
|
+
display: block;
|
|
941
|
+
|
|
942
|
+
& [data-separator-content], & [data-expand-button] {
|
|
943
|
+
display: none;
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
[data-overflow="scroll"] [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] {
|
|
949
|
+
width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback)));
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
[data-overflow="wrap"] [data-additions] [data-content] [data-separator="line-info"] [data-separator-wrapper] {
|
|
953
|
+
background-color: var(--diffs-bg-separator);
|
|
954
|
+
height: 100%;
|
|
955
|
+
margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
956
|
+
border-top-right-radius: 6px;
|
|
957
|
+
border-bottom-right-radius: 6px;
|
|
958
|
+
display: block;
|
|
959
|
+
|
|
960
|
+
& [data-separator-content], & [data-expand-button] {
|
|
961
|
+
display: none;
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
[data-separator="line-info"] [data-separator-wrapper] {
|
|
966
|
+
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
967
|
+
border-top-left-radius: 6px;
|
|
968
|
+
border-bottom-left-radius: 6px;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
@media (pointer: fine) {
|
|
973
|
+
[data-separator="line-info"] [data-separator-wrapper] {
|
|
974
|
+
&[data-separator-multi-button] {
|
|
975
|
+
& [data-expand-up] {
|
|
976
|
+
border-top-left-radius: 6px;
|
|
977
|
+
border-bottom-left-radius: unset;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
& [data-expand-down] {
|
|
981
|
+
border-bottom-left-radius: 6px;
|
|
982
|
+
border-top-left-radius: unset;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
@media (pointer: coarse) {
|
|
990
|
+
[data-separator="line-info-basic"] [data-separator-wrapper][data-separator-multi-button] {
|
|
991
|
+
grid-template-columns: 34px 34px auto;
|
|
992
|
+
|
|
993
|
+
& [data-separator-content] {
|
|
994
|
+
grid-column: unset;
|
|
995
|
+
grid-row: unset;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
@supports (width: 1cqi) {
|
|
1000
|
+
[data-separator="line-info"] [data-separator-wrapper] {
|
|
1001
|
+
& [data-expand-both], & [data-expand-down], & [data-expand-up] {
|
|
1002
|
+
border-top-left-radius: 6px;
|
|
1003
|
+
border-bottom-left-radius: 6px;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
&[data-separator-multi-button] {
|
|
1007
|
+
& [data-expand-up] {
|
|
1008
|
+
border-top-left-radius: 6px;
|
|
1009
|
+
border-bottom-left-radius: 6px;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
& [data-expand-down] {
|
|
1013
|
+
border-bottom-left-radius: unset;
|
|
1014
|
+
border-top-left-radius: unset;
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
@media (pointer: fine) {
|
|
1022
|
+
[data-separator-wrapper][data-separator-multi-button] {
|
|
1023
|
+
grid-template-rows: 50% 50%;
|
|
1024
|
+
display: grid;
|
|
1025
|
+
|
|
1026
|
+
& [data-separator-content] {
|
|
1027
|
+
grid-area: 1 / 2 / -1;
|
|
1028
|
+
min-width: min-content;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
& [data-expand-button] {
|
|
1032
|
+
grid-column: 1;
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
[data-separator="line-info"] [data-separator-wrapper], [data-separator="line-info"] [data-separator-wrapper][data-separator-multi-button] {
|
|
1037
|
+
grid-template-columns: 34px auto;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
[data-separator="line-info-basic"][data-expand-index] [data-separator-wrapper] {
|
|
1041
|
+
grid-template-columns: 100% auto;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
[data-separator="line-info"], [data-separator="line-info-basic"] {
|
|
1045
|
+
& [data-separator-multi-button] {
|
|
1046
|
+
& [data-expand-up] {
|
|
1047
|
+
border-bottom: 1px solid var(--diffs-bg);
|
|
1048
|
+
border-right: 2px solid var(--diffs-bg);
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
& [data-expand-down] {
|
|
1052
|
+
border-top: 1px solid var(--diffs-bg);
|
|
1053
|
+
border-right: 2px solid var(--diffs-bg);
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
[data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator="line-info-basic"] [data-separator-wrapper], [data-content] [data-separator-wrapper] {
|
|
1060
|
+
display: none;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
[data-line-annotation] {
|
|
1064
|
+
min-height: var(--diffs-annotation-min-height, 0);
|
|
1065
|
+
z-index: 2;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
[data-merge-conflict-actions] {
|
|
1069
|
+
z-index: 2;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
[data-separator="custom"] {
|
|
1073
|
+
grid-template-columns: subgrid;
|
|
1074
|
+
display: grid;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
[data-line], [data-column-number], [data-no-newline] {
|
|
1078
|
+
padding-inline: 1ch;
|
|
1079
|
+
position: relative;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
[data-indicators="classic"] [data-line] {
|
|
1083
|
+
padding-inline-start: 2ch;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
[data-indicators="classic"] {
|
|
1087
|
+
& [data-line-type="change-addition"], & [data-line-type="change-deletion"] {
|
|
1088
|
+
&[data-no-newline], &[data-line] {
|
|
1089
|
+
&:before {
|
|
1090
|
+
user-select: none;
|
|
1091
|
+
width: 1ch;
|
|
1092
|
+
height: 1lh;
|
|
1093
|
+
display: inline-block;
|
|
1094
|
+
position: absolute;
|
|
1095
|
+
top: 0;
|
|
1096
|
+
left: 0;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
& [data-line-type="change-addition"] {
|
|
1102
|
+
&[data-line], &[data-no-newline] {
|
|
1103
|
+
&:before {
|
|
1104
|
+
content: "+";
|
|
1105
|
+
color: var(--diffs-addition-base);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
& [data-line-type="change-deletion"] {
|
|
1111
|
+
&[data-line], &[data-no-newline] {
|
|
1112
|
+
&:before {
|
|
1113
|
+
content: "-";
|
|
1114
|
+
color: var(--diffs-deletion-base);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
[data-indicators="bars"] {
|
|
1121
|
+
& [data-line-type="change-deletion"], & [data-line-type="change-addition"] {
|
|
1122
|
+
&[data-column-number] {
|
|
1123
|
+
&:before {
|
|
1124
|
+
content: "";
|
|
1125
|
+
user-select: none;
|
|
1126
|
+
contain: strict;
|
|
1127
|
+
width: 4px;
|
|
1128
|
+
height: 100%;
|
|
1129
|
+
display: block;
|
|
1130
|
+
position: absolute;
|
|
1131
|
+
top: 0;
|
|
1132
|
+
left: 0;
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
& [data-line-type="change-deletion"] {
|
|
1138
|
+
&[data-column-number] {
|
|
1139
|
+
&:before {
|
|
1140
|
+
background-image: linear-gradient(0deg,
|
|
1141
|
+
var(--diffs-bg-deletion) 50%,
|
|
1142
|
+
var(--diffs-deletion-base) 50%);
|
|
1143
|
+
background-repeat: repeat;
|
|
1144
|
+
background-size: 2px 2px;
|
|
1145
|
+
background-size: calc(1lh / round(1lh / 2px))
|
|
1146
|
+
calc(1lh / round(1lh / 2px));
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
& [data-line-type="change-addition"] {
|
|
1152
|
+
&[data-column-number] {
|
|
1153
|
+
&:before {
|
|
1154
|
+
background-color: var(--diffs-addition-base);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
[data-overflow="wrap"] {
|
|
1161
|
+
& [data-line] {
|
|
1162
|
+
white-space: pre-wrap;
|
|
1163
|
+
word-break: break-word;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
& [data-annotation-content] {
|
|
1167
|
+
word-break: break-word;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
[data-overflow="scroll"] [data-line] {
|
|
1172
|
+
white-space: pre;
|
|
1173
|
+
min-height: 1lh;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
[data-column-number] {
|
|
1177
|
+
box-sizing: content-box;
|
|
1178
|
+
text-align: right;
|
|
1179
|
+
user-select: none;
|
|
1180
|
+
color: var(--diffs-fg-number);
|
|
1181
|
+
padding-left: 2ch;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
[data-line-number-content] {
|
|
1185
|
+
min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch));
|
|
1186
|
+
z-index: 1;
|
|
1187
|
+
display: inline-block;
|
|
1188
|
+
position: relative;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
[data-disable-line-numbers] {
|
|
1192
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
1193
|
+
min-width: 4px;
|
|
1194
|
+
padding: 0;
|
|
1195
|
+
|
|
1196
|
+
&:before {
|
|
1197
|
+
min-width: 0;
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
& [data-line-number-content] {
|
|
1202
|
+
display: none;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
& [data-gutter-utility-slot] {
|
|
1206
|
+
right: unset;
|
|
1207
|
+
justify-content: flex-start;
|
|
1208
|
+
left: 0;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
&[data-indicators="bars"] [data-gutter-utility-slot] {
|
|
1212
|
+
left: 6px;
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
[data-file][data-disable-line-numbers] {
|
|
1217
|
+
& [data-gutter-buffer], & [data-column-number] {
|
|
1218
|
+
border-right: 0;
|
|
1219
|
+
min-width: 0;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
[data-diff-span] {
|
|
1224
|
+
box-decoration-break: clone;
|
|
1225
|
+
border-radius: 3px;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
[data-line-type="change-addition"] [data-diff-span] {
|
|
1229
|
+
background-color: var(--diffs-bg-addition-emphasis);
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
[data-line-type="change-deletion"] [data-diff-span] {
|
|
1233
|
+
background-color: var(--diffs-bg-deletion-emphasis);
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"], [data-merge-conflict="marker-end"] {
|
|
1237
|
+
color: var(--diffs-fg);
|
|
1238
|
+
padding-left: 1ch;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
[data-merge-conflict="marker-start"], [data-merge-conflict="marker-end"] {
|
|
1242
|
+
align-items: center;
|
|
1243
|
+
display: flex;
|
|
1244
|
+
|
|
1245
|
+
&:after {
|
|
1246
|
+
color: var(--diffs-fg-conflict-marker);
|
|
1247
|
+
font-size: .75rem;
|
|
1248
|
+
font-style: normal;
|
|
1249
|
+
line-height: 1.25rem;
|
|
1250
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1251
|
+
padding-left: 1ch;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
[data-merge-conflict="marker-start"]:after {
|
|
1256
|
+
content: "(Current Change)";
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
[data-merge-conflict="marker-end"]:after {
|
|
1260
|
+
content: "(Incoming Change)";
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
[data-merge-conflict-actions-content] {
|
|
1264
|
+
min-height: 1.75rem;
|
|
1265
|
+
font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback));
|
|
1266
|
+
color: var(--diffs-fg);
|
|
1267
|
+
align-items: center;
|
|
1268
|
+
gap: .25rem;
|
|
1269
|
+
padding-inline: .5rem;
|
|
1270
|
+
font-size: .75rem;
|
|
1271
|
+
line-height: 1.2;
|
|
1272
|
+
display: flex;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
[data-merge-conflict-action] {
|
|
1276
|
+
appearance: none;
|
|
1277
|
+
color: var(--diffs-fg-number);
|
|
1278
|
+
font: inherit;
|
|
1279
|
+
cursor: pointer;
|
|
1280
|
+
background: none;
|
|
1281
|
+
border: 0;
|
|
1282
|
+
padding: 0;
|
|
1283
|
+
font-style: normal;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
[data-merge-conflict-action]:hover {
|
|
1287
|
+
color: var(--diffs-fg);
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
[data-merge-conflict-action="current"]:hover {
|
|
1291
|
+
color: var(--diffs-addition-base);
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
[data-merge-conflict-action="incoming"]:hover {
|
|
1295
|
+
color: var(--diffs-modified-base);
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
[data-merge-conflict-action-separator] {
|
|
1299
|
+
color: var(--diffs-fg-number);
|
|
1300
|
+
opacity: .6;
|
|
1301
|
+
user-select: none;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
[data-diffs-header="default"] {
|
|
1305
|
+
background-color: var(--diffs-bg);
|
|
1306
|
+
justify-content: space-between;
|
|
1307
|
+
align-items: center;
|
|
1308
|
+
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1309
|
+
min-height: calc(1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3));
|
|
1310
|
+
z-index: 2;
|
|
1311
|
+
flex-direction: row;
|
|
1312
|
+
padding-inline: 16px;
|
|
1313
|
+
display: flex;
|
|
1314
|
+
position: relative;
|
|
1315
|
+
top: 0;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
[data-header-content] {
|
|
1319
|
+
align-items: center;
|
|
1320
|
+
gap: var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1321
|
+
white-space: nowrap;
|
|
1322
|
+
flex-direction: row;
|
|
1323
|
+
min-width: 0;
|
|
1324
|
+
display: flex;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
[data-header-content] [data-prev-name], [data-header-content] [data-title] {
|
|
1328
|
+
text-overflow: ellipsis;
|
|
1329
|
+
white-space: nowrap;
|
|
1330
|
+
direction: rtl;
|
|
1331
|
+
min-width: 0;
|
|
1332
|
+
overflow: hidden;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
[data-prev-name] {
|
|
1336
|
+
opacity: .7;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
[data-rename-icon] {
|
|
1340
|
+
fill: currentColor;
|
|
1341
|
+
flex-grow: 0;
|
|
1342
|
+
flex-shrink: 0;
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
[data-diffs-header="default"] [data-metadata] {
|
|
1346
|
+
white-space: nowrap;
|
|
1347
|
+
align-items: center;
|
|
1348
|
+
gap: 1ch;
|
|
1349
|
+
display: flex;
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
[data-diffs-header="default"] [data-additions-count] {
|
|
1353
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1354
|
+
color: var(--diffs-addition-base);
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
[data-diffs-header="default"] [data-deletions-count] {
|
|
1358
|
+
font-family: var(--diffs-font-family, var(--diffs-font-fallback));
|
|
1359
|
+
color: var(--diffs-deletion-base);
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
[data-change-icon] {
|
|
1363
|
+
fill: currentColor;
|
|
1364
|
+
flex-shrink: 0;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
[data-change-icon="change"], [data-change-icon="rename-pure"], [data-change-icon="rename-changed"] {
|
|
1368
|
+
color: var(--diffs-modified-base);
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
[data-change-icon="new"] {
|
|
1372
|
+
color: var(--diffs-addition-base);
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
[data-change-icon="deleted"] {
|
|
1376
|
+
color: var(--diffs-deletion-base);
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
[data-change-icon="file"] {
|
|
1380
|
+
opacity: .6;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
[data-annotation-content] {
|
|
1384
|
+
z-index: 2;
|
|
1385
|
+
isolation: isolate;
|
|
1386
|
+
white-space: normal;
|
|
1387
|
+
align-self: flex-start;
|
|
1388
|
+
min-width: 0;
|
|
1389
|
+
display: flow-root;
|
|
1390
|
+
position: relative;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
[data-overflow="scroll"] [data-annotation-content], [data-overflow="scroll"] [data-merge-conflict-actions-content] {
|
|
1394
|
+
width: var(--diffs-column-content-width, auto);
|
|
1395
|
+
left: var(--diffs-column-number-width, 0);
|
|
1396
|
+
position: sticky;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
[data-annotation-slot] {
|
|
1400
|
+
text-wrap-mode: wrap;
|
|
1401
|
+
word-break: normal;
|
|
1402
|
+
white-space-collapse: collapse;
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
[data-gutter-utility-slot] {
|
|
1406
|
+
touch-action: none;
|
|
1407
|
+
justify-content: flex-end;
|
|
1408
|
+
display: flex;
|
|
1409
|
+
position: absolute;
|
|
1410
|
+
top: 0;
|
|
1411
|
+
bottom: 0;
|
|
1412
|
+
right: 0;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
[data-utility-button] {
|
|
1416
|
+
appearance: none;
|
|
1417
|
+
cursor: pointer;
|
|
1418
|
+
width: 1lh;
|
|
1419
|
+
height: 1lh;
|
|
1420
|
+
font-size: var(--diffs-font-size, 13px);
|
|
1421
|
+
line-height: var(--diffs-line-height, 20px);
|
|
1422
|
+
background-color: var(--diffs-modified-base);
|
|
1423
|
+
color: var(--diffs-bg);
|
|
1424
|
+
fill: currentColor;
|
|
1425
|
+
z-index: 4;
|
|
1426
|
+
touch-action: none;
|
|
1427
|
+
border: none;
|
|
1428
|
+
border-radius: 4px;
|
|
1429
|
+
justify-content: center;
|
|
1430
|
+
align-items: center;
|
|
1431
|
+
margin-right: calc(-1lh + 1ch);
|
|
1432
|
+
padding: 0;
|
|
1433
|
+
display: flex;
|
|
1434
|
+
position: relative;
|
|
1435
|
+
|
|
1436
|
+
&:before {
|
|
1437
|
+
content: "";
|
|
1438
|
+
display: block;
|
|
1439
|
+
position: absolute;
|
|
1440
|
+
inset: 0 0 0 -4px;
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
[data-decoration-bar-stack] {
|
|
1445
|
+
pointer-events: none;
|
|
1446
|
+
isolation: isolate;
|
|
1447
|
+
z-index: 1;
|
|
1448
|
+
background-color: var(--diffs-decoration-bar-color, transparent);
|
|
1449
|
+
box-sizing: content-box;
|
|
1450
|
+
border-left: 2px solid var(--diffs-bg);
|
|
1451
|
+
border-right: 2px solid var(--diffs-bg);
|
|
1452
|
+
width: 6px;
|
|
1453
|
+
position: absolute;
|
|
1454
|
+
top: 0;
|
|
1455
|
+
bottom: 0;
|
|
1456
|
+
right: -2px;
|
|
1457
|
+
|
|
1458
|
+
[data-decoration-bar-depth="1"] & {
|
|
1459
|
+
background-color: color-mix(in lab,
|
|
1460
|
+
var(--diffs-bg) 20%,
|
|
1461
|
+
var(--diffs-decoration-bar-color, transparent));
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
[data-decoration-bar-depth="2"] & {
|
|
1465
|
+
background-color: color-mix(in lab,
|
|
1466
|
+
var(--diffs-bg) 45%,
|
|
1467
|
+
var(--diffs-decoration-bar-color, transparent));
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
[data-decoration-bar-depth="3"] & {
|
|
1471
|
+
background-color: color-mix(in lab,
|
|
1472
|
+
var(--diffs-bg) 65%,
|
|
1473
|
+
var(--diffs-decoration-bar-color, transparent));
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
[data-decoration-bar-start] & {
|
|
1477
|
+
border-top-left-radius: 5px;
|
|
1478
|
+
border-top-right-radius: 5px;
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
[data-decoration-bar-end] & {
|
|
1482
|
+
z-index: 3;
|
|
1483
|
+
border-bottom-right-radius: 5px;
|
|
1484
|
+
border-bottom-left-radius: 5px;
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
[data-placeholder] {
|
|
1489
|
+
contain: strict;
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
[data-error-wrapper] {
|
|
1493
|
+
padding: var(--diffs-gap-block, var(--diffs-gap-fallback))
|
|
1494
|
+
var(--diffs-gap-inline, var(--diffs-gap-fallback));
|
|
1495
|
+
scrollbar-width: none;
|
|
1496
|
+
max-height: 400px;
|
|
1497
|
+
overflow: auto;
|
|
1498
|
+
|
|
1499
|
+
& [data-error-message] {
|
|
1500
|
+
color: var(--diffs-deletion-base);
|
|
1501
|
+
font-size: 18px;
|
|
1502
|
+
font-weight: bold;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
& [data-error-stack] {
|
|
1506
|
+
color: var(--diffs-fg-number);
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
@layer theme, rendered, unsafe;
|
|
1512
|
+
`,w_=`@layer base, theme, rendered, unsafe;`,T_=RegExp(`${k_(mt)}\\s*:\\s*[^;]+;`);function E_(e){return`${w_}
|
|
1513
|
+
@layer unsafe {
|
|
1514
|
+
${e}
|
|
1515
|
+
}`}function D_(e,t=`system`,n){return`${w_}
|
|
1516
|
+
@layer rendered {
|
|
1517
|
+
:host {${t===`system`?``:`
|
|
1518
|
+
color-scheme: ${t};`}
|
|
1519
|
+
${S_(n)}
|
|
1520
|
+
${e}
|
|
1521
|
+
}
|
|
1522
|
+
}`}function O_(e,t){let n=S_(t);return e.replace(T_,n)}function k_(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function A_(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function j_(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:A_(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function M_({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function N_(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function P_({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=F_(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function F_(){let e=document.createElement(`style`);return e.setAttribute(dt,``),e}var I_=void 0,L_=void 0;function R_(){return I_??=/macOS|MacIntel|iPhone|iPad|iPod/i.test(B_())}function z_(){return L_??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function B_(){let e=globalThis.navigator;return e?.platform??e?.userAgentData?.platform??`unknown`}function V_(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function H_(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}if(typeof HTMLElement<`u`&&customElements.get(`diffs-container`)==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(C_)),t.adoptedStyleSheets=[e]}connectedCallback(){x_(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(et,t)}var U_=[``],W_=-1,G_=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++W_}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;renderRange;enabled=!0;editor;constructor(e={theme:F},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new u_(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new Vg,this.interactionManager=new xg(`file`,Sg(e)),this.workerManager?.subscribeToThemeChanges(this)}handleHighlightRender=()=>{this.rerender()};rerender(){!this.enabled||this.file==null||this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}__getCurrentFile(){return this.file}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Sg(this.options))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!kt(this.appliedThemeCSS.theme,this.options.theme??F)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}getCodeScrollLeft(){return this.code?.scrollLeft??0}setCodeScrollLeft(e){this.code!=null&&(this.code.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions()}}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:e===`wrap`,columnVariables:this.shouldApplyColumnVariables(e)?`apply`:`measure`}),this.managersDirty=!1}shouldApplyColumnVariables(e){return e===`scroll`&&this.lineAnnotations.length>0}cleanUp(e=!1){this.emitPostRender(!0),this.editor?.cleanUp(e),this.editor=void 0,this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.pre=void 0,this.code=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;if(!this.enabled)throw Error(`File.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`File.hydrate: hydrate can only be called before the instance has rendered or hydrated`);this.hydrateElements(t,n),K_(this.pre,i,this.options.collapsed)||q_(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),V_(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(j_(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.file){return e==null?U_:this.fileRenderer.getOrCreateLineCache(e)}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.file,r=this.lineAnnotations,i=this.renderRange;e!=null&&t!=null&&n!=null&&this.fileRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.file!==n||e.__syncRenderView(a,t,n,r,i)})}attachEditor(e){this.editor?.cleanUp(),this.editor=e,this.fileRenderer.beginEditSession();let t=this.file==null?void 0:e.__prepareFile?.(this.file);return t!==void 0&&t!==this.file?this.renderPreparedFile({file:t,forceRender:!0,preventEmit:!0,renderRange:this.renderRange}):this.fileRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),()=>{this.editor=void 0,this.fileRenderer.endEditSession()}}applyDocumentChange(e,t){this.fileRenderer.applyDocumentChange(e),t!=null&&t!==this.lineAnnotations&&this.file!=null&&(this.setLineAnnotations(t),this.fileRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations())}updateRenderCache(e,t,n){this.fileRenderer.updateRenderCache(e,t,n?.lineCountChangeInFlight)}render(e){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);let t=this.editor?.__prepareFile?.(e.file)??e.file;return this.renderPreparedFile(t===e.file?e:{...e,file:t})}renderPreparedFile({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.lineAnnotations.length>0)&&o!==this.lineAnnotations,m=!At(this.file,e)||this.fileRenderer.hasUnkeyedFileContentsChanged(e);if(!c&&!n&&Yg(u,this.renderRange)&&!m&&!p&&!f)return this.applyCachedThemeState(l);this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.file=e,this.fileRenderer.setOptions(j_(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:h=!1,disableFileHeader:g=!1}=this.options;if(g&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let n=this.fileRenderer.renderFile(e,yt);n!=null&&this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n?.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.injectUnsafeCSS()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}try{let r=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f)||!this.applyPartialRender(d,u)){let n=this.fileRenderer.renderFile(e,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.applyFullRender(n,r)}this.applyBuffers(r,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,a||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.file){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||bf(e))return;let n=this.options.tokenizeMaxLength??1e5;this.fileRenderer.getOrCreateLineCache(e).length>n||await t.primeFileHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${bt(r)}`,a=this.annotationCache.get(i);if(a==null||!p_(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:__(bt(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=v_();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=y_(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=E_(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??F,s=typeof o==`string`?o:{...o},c=x_(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=P_({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:D_(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=O_(this.themeCSSStyle.textContent??``,x_(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&z_()}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e);let n=this.code=M_({code:this.code}),r=this.fileRenderer.renderCodeAST(e);this.editor?.__captureFocusForDOMReplacement();let i=()=>{if(n.childElementCount>=2)for(let e=0;e<2;e++){let t=n.children[e],i=r[e];t.innerHTML=as(i.children),t.style.cssText=i.properties.style}else n.innerHTML=as(r);t.contains(n)||t.replaceChildren(n)};this.shouldGuardRebuildScroll()?N_(t,i):i(),this.lastRowCount=e.rowCount}applyPartialRender(e,t){if(e==null||t==null)return!1;let{file:n,code:r}=this,i=r==null?void 0:this.getColumns(r);if(n==null||r==null||i==null)return!1;let a=e.startingLine,o=t.startingLine,s=e.totalLines===1/0?1/0:a+e.totalLines,c=t.totalLines===1/0?1/0:o+t.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l)return!1;if(!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))throw Error(`File.applyPartialRender: failed to trim to overlap`);let{length:d}=i.content.children,f=(e,t)=>{if(!(t<=0))return this.fileRenderer.renderFile(n,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,t){let{file:n}=this;if(n==null)return;this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??as(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderHeaderFilenameSuffix:a,renderCustomHeader:o,renderHeaderMetadata:s}=this.options;if(o!=null){let e=o(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,ut,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=a?.(n)??void 0,o=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,st,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,ct,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,lt,o),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:pg(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):pg(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=f_;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};m_(i,this.appliedPreAttributes)||(H_(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function K_(e,t,n=!1){return!n&&e==null&&t!=null}function q_(e,t,n=!1){return e==null&&t!=null&&!n}var J_=5e3,Y_=-1;function X_(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS}var Z_=class extends G_{virtualizer;metrics;__id=`virtualized-file:${++Y_}`;top;height=0;cache={heights:new Map,checkpoints:[],fileAnnotationHeight:0};isVisible=!1;isSetup=!1;layoutDirty=!0;forceRenderOverride;currentCollapsed;constructor(e,t,n=gt,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=n}setMetrics(e,t=!1){let n=Sp(e);!t&&Nm(this.metrics,n)||(this.metrics=n,this.resetLayoutCache())}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache()}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}hasLineAnnotations(){return this.lineAnnotations.some(e=>e.lineNumber>0)}getLineHeight(e,t=!1){let n=this.cache.heights.get(e);if(n!=null)return n;let r=t?2:1;return this.metrics.lineHeight*r}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!Pm(t,e),r=X_(t,e);super.setOptions(e),r&&this.resetLayoutCache(!0),n&&(this.forceRenderOverride=!0),n&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFile.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache(e=!1,t=!0){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heights.size>0&&this.cache.heights.clear(),this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.renderRange!=null&&t&&(this.renderRange=void 0),e&&this.isSimpleMode()&&this.computeApproximateSize()}reconcileHeights(){let e=!1;if(this.fileContainer==null||this.file==null)return this.height!==0&&(e=!0),this.height=0,e;let{overflow:t=`scroll`}=this.options;if(this.top=this.getVirtualizedTop(),t===`scroll`&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled()||this.code==null)return e;let n=this.code.children[1];if(!(n instanceof HTMLElement))return e;let r=hg(this.lineAnnotations);if(this.renderRange!=null&&r&&_g(this.renderRange)){let t=Q_(n)??0;t!==this.cache.fileAnnotationHeight&&(this.cache.fileAnnotationHeight=t,e=!0)}else!r&&this.cache.fileAnnotationHeight!==0&&(this.cache.fileAnnotationHeight=0,e=!0);for(let t of n.children){if(!(t instanceof HTMLElement))continue;let n=t.dataset.lineIndex;if(n==null)continue;let r=Number(n),i=t.getBoundingClientRect().height,a=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(a=!0),i+=t.nextElementSibling.getBoundingClientRect().height);let o=this.getLineHeight(r,a);i!==o&&(e=!0,i===this.metrics.lineHeight*(a?2:1)?this.cache.heights.delete(r):this.cache.heights.set(r,i))}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer==null||this.file==null?!1:(e&&(this.top=this.getVirtualizedTop()),this.render({file:this.file}));prepareCodeViewItem(e,t,n,r){let i=this.syncLineAnnotations(r),a=!At(this.file,e)||this.fileRenderer.hasUnkeyedFileContentsChanged(e),o=n?.resetFileLayoutCache===!0||a||i;n?.metrics!=null&&(this.metrics=n.metrics,o=!0);let{collapsed:s=!1}=this.options;return this.currentCollapsed!==s&&(this.currentCollapsed=s,o=!0),o&&this.resetLayoutCache(),this.file!==e&&(this.layoutDirty=!0),this.file=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e){if(this.file==null||e<1)return;let{disableFileHeader:t=!1,collapsed:n=!1}=this.options,r=this.fileRenderer.getLineCount(this.file)-1,i=Cp(this.metrics,t);if(n||r<0)return{top:i,height:0};let a=Math.min(Math.max(e-1,0),r),{overflow:o=`scroll`}=this.options,{lineHeight:s}=this.metrics;if(i+=this.cache.fileAnnotationHeight,o===`scroll`&&!this.hasLineAnnotations())return{top:i+a*s,height:s};let c=this.getLayoutCheckpointBeforeLineIndex(a);i=c?.top??i;for(let e=c?.lineIndex??0;e<a;e++)i+=this.getLineHeight(e,!1);return{top:i,height:this.getLineHeight(a,!1)}}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){if(this.file==null||this.renderRange==null)return;let{disableFileHeader:t=!1,collapsed:n=!1,overflow:r=`scroll`}=this.options;if(n||this.renderRange.totalLines<=0)return;let i=this.fileRenderer.getLineCount(this.file)-1;if(i<0)return;let a=Cp(this.metrics,t),o=Math.min(this.renderRange.startingLine,i),s=Math.min(o+this.renderRange.totalLines-1,i);if(s<o)return;let{fileAnnotationHeight:c}=this.cache;if(r===`scroll`&&!this.hasLineAnnotations()){let{lineHeight:t}=this.metrics,n=a+(o===0?c:this.renderRange.bufferBefore),r=o+Math.max(Math.ceil((e-n)/t),0);return r>s?void 0:{lineNumber:r+1,top:a+c+r*t}}let l=a+(o===0?c:this.renderRange.bufferBefore);for(let t=o;t<=s;t++){if(l>=e)return{lineNumber:t+1,top:l};l+=this.getLineHeight(t)}}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.file==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let t=e==null?this.renderRange:this.computeRenderRangeFromWindow(this.file,this.top,e);if(t==null)return;let{bufferBefore:n,bufferAfter:r,totalLines:i}=t,a=0;if(i===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(a=r)}return{topOffset:this.top+n+a,height:this.height-(n+r)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||this.resetLayoutCache(),this.isSetup=!1,super.cleanUp(e)}computeApproximateSize(e=!1,t=this.file){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],t==null){this.layoutDirty=!1;return}let{disableFileHeader:i=!1,collapsed:a=!1,overflow:o=`scroll`}=this.options,{lineHeight:s}=this.metrics,c=this.fileRenderer.getLineCount(t),l=Cp(this.metrics,i),u=Tp(this.metrics);if(this.height+=l,a){this.layoutDirty=!1;return}if(this.height+=this.cache.fileAnnotationHeight,o===`scroll`&&!this.hasLineAnnotations())this.height+=c*s;else for(let e=0;e<c;e++)this.addLayoutCheckpoint(e,this.height),this.height+=this.getLineHeight(e,!1);if(c>0&&(this.height+=u),this.fileContainer!=null&&n&&!r){let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFile.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFile.computeApproximateSize: computed height doesnt match`,{name:t.name,elementHeight:e.height,computedHeight:this.height})}this.layoutDirty=!1}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.file==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;if(this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(this.isSimpleMode(),!1),!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!==void 0&&this.file!==void 0){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(this.file,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}renderPreparedFile({fileContainer:e,file:t,forceRender:n=!1,lineAnnotations:r,...i}){let a=this.file==null||!At(this.file,t)||this.fileRenderer.hasUnkeyedFileContentsChanged(t),{forceRenderOverride:o,isSetup:s}=this;this.forceRenderOverride=void 0;let c=this.syncLineAnnotations(r);if(c&&this.resetLayoutCache(),e=this.getOrCreateFileContainerNode(e),t==null)return console.error(`VirtualizedFile.render: attempting to virtually render when we dont have file`),!1;if(s)this.top??=this.getVirtualizedTop(),a&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache(!1),this.computeApproximateSize(!1,t));else{this.computeApproximateSize(!1,t);let n=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(n==null)throw Error(`VirtualizedFile.render: simple virtualizer is not available`);n.connect(e,this),this.isVisible=n.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!a||!s))return this.file=t,a&&(this.cachedHeaderHTML=void 0),this.renderPlaceholder(this.height);let l=this.virtualizer.getWindowSpecs(),u=this.top??0,d=this.computeRenderRangeFromWindow(t,u,l),f=super.renderPreparedFile({file:t,fileContainer:e,renderRange:d,lineAnnotations:r,forceRender:(o??n)||c||a,...i});return this.isSimpleMode()&&f&&this.getSimpleVirtualizer()?.requestHeightReconcile(this),f}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}addLayoutCheckpoint(e,t){e%J_===0&&this.cache.checkpoints.push({lineIndex:e,top:t})}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFile: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFile: invalid checkpoint index`);if(n.lineIndex%t===0)return n}}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,overflow:a=`scroll`}=this.options,{hunkLineCount:o,lineHeight:s}=this.metrics,c=this.fileRenderer.getLineCount(e),l=this.height,u=Cp(this.metrics,i),d=c>0?Tp(this.metrics):0,{fileAnnotationHeight:f}=this.cache,p=u+f,m=Math.max(0,l-u-f-d),h=hg(this.lineAnnotations),g=t+u,_=f>0&&h&&g<r&&g+f>n;if(t<n-l||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:l-u-d};if(c<=o)return{startingLine:0,totalLines:o,bufferBefore:0,bufferAfter:0};let v=Math.ceil(Math.max(r-n,0)/s),y=Math.ceil(v/o)*o+o,b=y/o,x=(n+r)/2;if(a===`scroll`&&!this.hasLineAnnotations()){let e=t+p,i=e+m;if(!_&&!(e<r&&i>n))return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:l-u-d};let a=Math.floor(_&&x<t+p?0:(x-(t+p))/s),h=Math.floor(a/o)-Math.floor(b/2),g=Math.ceil(c/o),v=Math.max(0,Math.min(h,g))*o,S=h<0?y+h*o:y,C=v===0?0:f+v*s,w=Math.min(S,c-v);return{startingLine:v,totalLines:S,bufferBefore:C,bufferAfter:Math.max(0,(c-v-w)*s)}}let S=b,C=[],w=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-y*s*2),o),T=t+(w?.top??p),E=w?.lineIndex??0,D,O,k,ee=w?.lineIndex??0;for(let e=ee;e<c;e++){let i=E%o===0,a=Math.floor(E/o);if(i&&(C[a]=T-(t+p),k!=null)){if(k<=0)break;k--}let s=this.getLineHeight(e,!1);T>n-s&&T<r&&(D??=a),T+s>x&&(O??=a),k==null&&T>=r&&i&&(k=S),E++,T+=s}if(D==null){if(_)D=0,O=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:l-u-d}}O??=D;let A=Math.round(O-b/2),j=Math.max(0,Math.ceil(c/o)-b),te=Math.max(0,Math.min(A,j)),ne=te*o,re=A<0?y+A*o:y,ie=C[te]??0,ae=ne===0?0:f+ie,oe=te+re/o,se=oe<C.length?m-C[oe]:m-(T-t-p);return{startingLine:ne,totalLines:re,bufferBefore:ae,bufferAfter:Math.max(0,se)}}};function Q_(e){let t;for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===mg&&(t=Math.max(t??0,n.getBoundingClientRect().height));return t}async function $_(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function ev({fileDiff:e,metrics:t,disableFileHeader:n,hunkSeparators:r,expandUnchanged:i,expandedHunks:a,collapsedContextThreshold:o,canHydratePartialDiff:s}){let c=Cp(t,n),l=c,u=i?!0:a,d=e.hunks.length-1;for(let n=0;n<e.hunks.length;n++){let i=e.hunks[n];if(i==null)throw Error(`computeEstimatedDiffHeights: invalid hunk index`);let a=Op({isPartial:e.isPartial,rangeSize:i.collapsedBefore,expandedHunks:u,hunkIndex:n,collapsedContextThreshold:o}),f=(a.fromStart+a.fromEnd)*t.lineHeight;if(c+=f,l+=f,a.collapsedLines>0){let e=Rp({type:r,metrics:t,hunkIndex:n,hunkSpecs:i.hunkSpecs})?.totalHeight??0;c+=e,l+=e}c+=i.splitLineCount*t.lineHeight,l+=i.unifiedLineCount*t.lineHeight;let p=tv(i);c+=p.split*t.lineHeight,l+=p.unified*t.lineHeight;let m=n===d?jp({fileDiff:e,hunkIndex:n,expandedHunks:u,collapsedContextThreshold:o,errorPrefix:`computeEstimatedDiffHeights`}):void 0;if(m!=null){let e=(m.fromStart+m.fromEnd)*t.lineHeight;if(c+=e,l+=e,m.collapsedLines>0){let e=zp({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}else if(n===d&&e.isPartial&&s){let e=zp({type:r,metrics:t})?.totalHeight??0;c+=e,l+=e}}if(e.hunks.length>0){let e=Tp(t);c+=e,l+=e}return{splitHeight:c,unifiedHeight:l}}function tv(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};let t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type===`context`){let e=+(t.lines>0);return{split:e,unified:e}}return nv(e,t)}function nv(e,t){let n=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),r=t.deletions>0&&e.noEOFCRDeletions,i=t.additions>0&&e.noEOFCRAdditions;return{split:r||i?1:0,unified:n}}function rv({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function iv(e){return{...e,hunks:e.hunks.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))})),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function av(e){return e===``?[]:e.split(nt)}function ov(e,t,n){let r=e===`clone`?iv(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return sv(r,lv(r,n),uv(r,n));case`rename-pure`:{let e=uv(r,n);dv(r,n);let t=av(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,pv(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function sv(e,t,n){let r=av(t.contents),i=av(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=cv(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,pv(e,t,n),e}function cv(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent){if(e.type===`context`){p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines;continue}p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let m=Math.max(St(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=Ct(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=Ct(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function lv(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function uv(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function dv(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function fv(e,t,n){return e.cacheKey==null?mv(t,n):`${e.cacheKey}:hydrated`}function pv(e,t,n){let r=fv(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function mv(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?`${e.cacheKey}:${t.cacheKey}`:void 0:e?.cacheKey??t?.cacheKey}var hv=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;cleanUp(){this.enabled&&=(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));if(n==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener(`scroll`,this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener(`scroll`,this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==n&&(this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener(`scroll`,this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function gv(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function _v(e){return q({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function vv(e){return q({tagName:`div`,children:[q({tagName:`span`,children:[Of(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function yv(e){return q({tagName:`div`,children:[kf({name:e===`both`?`diffs-icon-expand-all`:`diffs-icon-expand`,properties:{"data-icon":``}})],properties:{role:`button`,"data-expand-button":``,"data-expand-both":e===`both`?``:void 0,"data-expand-up":e===`up`?``:void 0,"data-expand-down":e===`down`?``:void 0}})}function bv({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(q({tagName:`div`,children:[Of(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(yv(`up`)),s++),o||(e.push(yv(`down`)),s++)):(e.push(yv(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(q({tagName:`div`,children:[q({tagName:`span`,children:[Of(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(q({tagName:`div`,children:[Of(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(q({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(q({tagName:`slot`,properties:{name:i}})),q({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function xv(e,t){return`hunk-separator-${e}-${t}`}function Sv(e){let t=e.at(-1);return t==null?0:Math.max(Ct(t.additionStart,t.additionCount),Ct(t.deletionStart,t.deletionCount))}var Cv=-1,wv=class{options;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++Cv}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;editSessionActive=!1;constructor(e={theme:F},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Zg(e.theme??F)?ff():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(){this.editSessionActive=!0;let e=this.diffCache;e!=null&&!e.isPartial&&e.additionLines.length===0&&(Object.assign(e,Eh(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache())}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{renderCache:e}=this;if(e==null||bp(e.diff)||zv(e.diff,this.getTokenizeMaxLength()))return Promise.resolve();let{diff:t}=e,{workerManager:n}=this;return!this.editSessionActive&&n?.isWorkingPool()===!0&&t.cacheKey!=null?(n.evictDiffFromCache(t.cacheKey),n.primeDiffHighlightCache(t).then(()=>{this.applyRefreshedResult(t,n.getDiffResultCache(t))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(t).then(e=>this.applyRefreshedResult(t,e)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){if(t==null||this.renderCache==null||this.renderCache.diff!==e||this.editSessionActive)return;let{options:n}=this.getRenderOptions(e);yp(n,t.options)&&(this.renderCache={diff:e,options:t.options,highlighted:!0,result:t.result,renderRange:void 0},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.diff.cacheKey!=null&&this.workerManager?.evictDiffFromCache(e.diff.cacheKey)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??_t}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){if(this.renderCache==null)return!1;let{result:r,diff:i}=this.renderCache;if(r==null)return!1;if(i.isPartial)throw Error(`Could not update render cache for partial diff`);let a=r.code.additionLines,o=[],s=new Map;for(let[t,n]of e){let e=a[t]?.properties??{},r=n.map(e=>e[2]).join(``),c=t<i.additionLines.length,l=c?i.additionLines[t]??``:``,u=xp(l);c&&(i.additionLines[t]=Qg(l,r),u!==r&&(o.push(t),s.set(t,l))),a[t]={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})}}let c=!1;if(o.length>0){if(this.editSessionActive&&!i.isPartial){if(!n){if(i.additionLines.length<=1&&i.additionLines.join(``)===``)Object.assign(i,Eh(i,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else if(wh(i,i.additionLines))Object.assign(i,Th(i,i.additionLines,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else{let e=Wh(i,o,this.options.parseDiffOptions,s);this.applyExpansionRemap(e),c=e!=null}}}else Object.assign(i,Ah(i,o,this.options.parseDiffOptions))}return r.baseThemeType=t,this.renderCache.isDirty=!0,c}applyExpansionRemap(e){e!=null&&(this.expandedHunks=Jh(this.expandedHunks,e))}applyDocumentChange(e){if(this.renderCache==null)return;let{diff:t,result:n}=this.renderCache;if(n==null)return;if(t.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:r}=t;t.additionLines=Iv(e,r),n.code.additionLines=Pv(r,t.additionLines,n.code.additionLines,e),t.additionLines.length<=1&&t.additionLines.join(``)===``?(Object.assign(t,Eh(t,this.options.parseDiffOptions)),n.code.additionLines[0]=Fv(0,e.getLineText(0)),this.markEditSessionPass(t)):this.editSessionActive?this.applySessionDocumentChange(t):Object.assign(t,Dh(t,this.options.parseDiffOptions)),this.renderCache.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(wh(e,n)){Object.assign(e,Th(e,n,t)),this.markEditSessionPass(e);return}this.applyExpansionRemap(Uh(e,t))}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>$g(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=F,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=ht,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await df(s_(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=zv(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!yp(t,r.options)&&(r=void 0),this.renderCache??={diff:e,highlighted:!n&&!bp(e),options:t,result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLang=e.lang??yf(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??F}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!vp(e,n.diff)||!yp(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=vt){if(e==null)return;let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getMatchingWorkerResultCache(e,i);o!=null&&!this.hasHighlightedRenderCache(e,i)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...o},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||bp(e)||zv(e,this.getTokenizeMaxLength()),l=!vp(e,this.renderCache.diff),u=!Yg(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!l&&gv(t);o&&(this.renderCache.highlightPending=!0),!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,gv(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLang=e.lang??yf(e.name);let t=this.highlighter!=null&&Zg(i.theme),n=this.highlighter!=null&&Xg(this.computedLang),r=!c&&n;if(this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=vt){let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return a_({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=zv(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??yf(e.name);let n=this.highlighter!=null&&Zg(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&Xg(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=Om(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(Bp({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=Fv(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){if(this.renderCache==null)return;let i=this.renderCache.highlightPending===!0||!this.renderCache.highlighted||!yp(this.renderCache.options,n)||!vp(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!yp(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&vp(e,n.diff)&&yp(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1;this.diff=e;let f=a===`unified`,p=Bv(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:jf(),deletionsGutterAST:jf(),additionsGutterAST:jf(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=Ap({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(x.pushToGutter(`additions`,Nf(void 0,`buffer`,this.size)),h?.push(_v(this.size))):(x.pushToGutter(`deletions`,Nf(void 0,`buffer`,this.size)),g?.push(_v(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,Mf(t,n,r,i))};function T(e){C.flush(),a===`unified`?jv(`unified`,e,x):(jv(`deletions`,e,x),jv(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),Bp({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&T({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&Ov(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});w(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=Mv(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=Mv(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),Av({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&Ov(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&kv(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=Mv(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);w(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=Mv(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);w(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Av({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&kv(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),E=_?n.noEOFCRDeletions:!1,D=_?n.noEOFCRAdditions:!1,O=(s?.noEOFCR??!1)||E,k=(o?.noEOFCR??!1)||D;if(k||O){if(a===`split`&&C.flush(),O){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(vv(e)),x.pushToGutter(`unified`,Nf(e,`metadata`,1))):(x.deletionsContentAST.push(vv(e)),x.pushToGutter(`deletions`,Nf(e,`metadata`,1)),k||(x.pushToGutter(`additions`,Nf(void 0,`buffer`,1)),x.additionsContentAST.push(_v(1))))}if(k){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(vv(e)),x.pushToGutter(`unified`,Nf(e,`metadata`,1))):(x.additionsContentAST.push(vv(e)),x.pushToGutter(`additions`,Nf(e,`metadata`,1)),O||(x.pushToGutter(`deletions`,Nf(void 0,`buffer`,1)),x.deletionsContentAST.push(_v(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let E=Math.max(Sv(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),D=t.bufferBefore>0||t.bufferAfter>0,O=!f&&e.type!==`deleted`,k=!f&&e.type!==`new`,ee=x.rowCount>0||D;h=O&&ee?h:void 0,g=k&&ee?g:void 0,_=f&&ee?_:void 0;let A=this.createPreElement(g!=null&&h!=null,E);return{unifiedGutterAST:f&&ee?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:k&&ee?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:O&&ee?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:A,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:E,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=jf(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,e_(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(q({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(q({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(q({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return as(this.renderFullAST(e,t))}renderPartialHTML(e,t){return as(t==null?e:q({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!_g(n))return;let i=e.type===`new`?[]:Tv(gg(this.deletionAnnotations)),a=e.type===`deleted`?[]:Tv(gg(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){Av({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}Av({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(bt(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(bt(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return n_({fileOrDiff:e,mode:t,stickyHeader:n})}};function Tv(e){return e?.map(e=>bt(e))??[]}var Ev=new Intl.PluralRules(`en-US`);function Dv(e){return`${e} unmodified line${Ev.select(e)===`one`?``:`s`}`}function Ov(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function kv(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function Av({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,Nf(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,Nf(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,Nf(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function jv(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,bv({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(bv({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,bv({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(bv({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=xv(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?Dv(n):`More unchanged context may be available`;c.pushToGutter(e,bv({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(bv({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function Mv(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function Nv(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function Pv(e,t,n,r){let i=Nv(e),a=Nv(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let r=e.length;r<t.length;r++)l[r]??=n[r];for(let e=s;e<t.length;e++)l[e]??=Fv(e,r.getLineText(e));return l}function Fv(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function Iv(e,t){let n=[],r=Rv(t);for(let t=0;t<e.lineCount;t++){let i=e.getLineText(t,!0);n.push(t<e.lineCount-1&&!Lv(i)?i+r:i)}return n}function Lv(e){return e.endsWith(`
|
|
1523
|
+
`)||e.endsWith(`\r`)}function Rv(e){for(let t of e){if(t.endsWith(`\r
|
|
1524
|
+
`))return`\r
|
|
1525
|
+
`;if(t.endsWith(`
|
|
1526
|
+
`))return`
|
|
1527
|
+
`;if(t.endsWith(`\r`))return`\r`}return`
|
|
1528
|
+
`}function zv(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Bv(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Vv(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Hv(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function Uv(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:A_(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function Wv(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}var Gv=-1,Kv=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++Gv}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;pendingFiles;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:F},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Vg,this.scrollSyncManager=new hv,this.interactionManager=new xg(`diff`,Sg(e,typeof e.hunkSeparators==`function`||(e.hunkSeparators??`line-info`)===`line-info`||e.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}handleHighlightRender=()=>{this.rerender()};getHunksRendererOptions(e){return Uv(e)}createHunksRenderer(e){return new wv(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{let n=this.fileDiffCache;if(n==null)return;let r=n.hunks.at(-1),i,a;hunkIterator:for(let o of n.hunks){let n=t===`deletions`?o.deletionStart:o.additionStart,s=t===`deletions`?o.deletionCount:o.additionCount,c=St(n,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(e<c){let t=c-e;i=Math.max(u-t,0),a=Math.max(l-t,0);break hunkIterator}if(e>=c+s){if(o===r){let t=e-(c+s);i=u+o.unifiedLineCount+t,a=l+o.splitLineCount+t;break hunkIterator}continue}for(let n of o.hunkContent)if(n.type===`context`){if(e<c+n.lines){let t=e-c;a=l+t,i=u+t;break hunkIterator}c+=n.lines,l+=n.lines,u+=n.lines}else{let r=t===`deletions`?n.deletions:n.additions;if(e<c+r){let r=e-c;i=u+(t===`additions`?n.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(n.deletions,n.additions),u+=n.deletions+n.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(Sg(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!kt(this.appliedThemeCSS.theme,this.options.theme??F)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.lineAnnotations.length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){zm(this.handleEditSessionRender),this.emitPostRender(!0),this.editor?.cleanUp(e),this.editor=void 0,this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.pendingFiles=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=rv(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t),Xv(this.pre,Jv({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||Zv(this.headerElement,Yv({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),V_(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)!(e instanceof HTMLElement)||e.tagName.toLowerCase()!==`code`||(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?yh(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;e==null||t==null||!Wv(e)||this.pendingFiles?.fileDiff===e||(this.pendingFiles={fileDiff:e,promise:this.loadFilesForDiff(e,t)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}finally{this.pendingFiles?.fileDiff===e&&(this.pendingFiles=void 0)}}async handleFilesLoaded(e,t){this.fileDiff!==e||!e.isPartial||(ov(`merge`,e,t),this.setHydratedState(t),await $_(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender())}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){let l=rv(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);e!=null&&e.cacheKey===void 0&&(e.cacheKey=e.prevName==null?e.name:e.prevName+`:`+e.name),this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!qv(u,this.deletionFile)||!qv(d,this.additionFile)),y=e!=null&&e!==this.fileDiff,b=i!=null&&(i.length>0||this.lineAnnotations.length>0)&&i!==this.lineAnnotations;if(!f&&Yg(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&e===this.fileDiff||e==null&&!v))return this.applyCachedThemeState(p);let x;e==null&&_&&(v||this.fileDiff==null)&&(x=yh(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;if(this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e==null?x!=null&&(y=!0,this.fileDiff=x):this.fileDiff=e,y&&(this.cachedHeaderHTML=void 0),i!=null&&this.setLineAnnotations(i),this.fileDiff==null)return!1;this.fileDiff.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(Zh(this.fileDiff,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:C=!1,disableFileHeader:w=!1}=this.options;if(w&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,yt);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g)&&this.applyPartialRender({previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}get fileDiffCache(){return this.hunksRenderer.diffCache??this.fileDiff}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.fileDiffCache,r=this.lineAnnotations,i=this.computeEditorRenderRange(this.renderRange);e!=null&&t!=null&&n!=null&&!n.isPartial&&this.hunksRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.fileDiffCache!==n||e.__syncRenderView(a,t,n,r,i)})}computeEditorRenderRange(e){let t=this.fileDiffCache;if(e==null||t==null||gv(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return Bp({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.attachEditor: cannot attach an editor to a "${this.type}" diff`);return this.editor?.cleanUp(),this.editor=e,this.hunksRenderer.beginEditSession(),this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary(),this.hunksRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),e=>{this.editor=void 0,e!==!0&&this.finishEditSession()}}finishEditSession(){this.hunksRenderer.endEditSession(),this.completeEditSession()}completeEditSession(){let e=this.fileDiffCache;if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=Yh(e,this.hunksRenderer.getExpandedHunksMap(),t);return Zh(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(Xh(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){this.hunksRenderer.applyDocumentChange(e);let n=this.hunksRenderer.diffCache;if(n!=null){let e=this.fileDiff?.cacheKey;e!=null&&n.cacheKey==null&&(n.cacheKey=e),this.fileDiff=n}t!==void 0&&t!==this.lineAnnotations&&(this.setLineAnnotations(t),this.hunksRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations()),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let{shouldRefreshDiffsView:r,lineCountChangeInFlight:i}=n;if(this.hunksRenderer.updateRenderCache(e,t,i)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}r===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}isLineRenderable(e){let t=this.fileDiffCache;if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return Mp({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.fileDiffCache;if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return Np({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.fileDiffCache,{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=Dp(o);if(e<s){let c=Op({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=jp({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=Dp(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){Rm(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||bp(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!Hv(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${bt(r)}`,a=this.annotationCache.get(i);if(a==null||!Vv(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:__(bt(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=v_();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:pg(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):pg(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=f_;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,r=this.cachedHeaderHTML??as(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:a,renderHeaderFilenameSuffix:o,renderHeaderMetadata:s}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,ut,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let c=a?.(n)??void 0,l=o?.(n)??void 0,u=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,st,c),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,ct,l),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,lt,u),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=y_(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=E_(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??F,s=typeof o==`string`?o:{...o},c=x_(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=P_({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:D_(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=O_(this.themeCSSStyle.textContent??``,x_(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&z_()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?N_(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=Qv(t[0]),a=Qv(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=as(i),r.content.innerHTML=as(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=M_({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=M_({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=M_({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:a,options:{diffStyle:o=`split`}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let s=this.getCodeColumns(o,r,a,i);if(s==null)return!1;let c=e.startingLine,l=t.startingLine,u=c+e.totalLines,d=l+t.totalLines,f=Math.max(c,l),p=Math.min(u,d);if(p<=f)return!1;let m=Math.max(0,f-c),h=Math.max(0,u-p),g=this.trimColumns({columns:s,trimStart:m,trimEnd:h,previousStart:c,overlapStart:f,overlapEnd:p,diffStyle:o});if(g<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let _=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(l,Math.max(f-l,0));if(y==null&&l<f)return!1;let b=v(p,Math.max(d-p,0));if(b==null&&d>p)return!1;let x=(e,t)=>{if(e!=null){if(o===`unified`&&!Array.isArray(s))this.insertPartialHTML(o,s,e,t);else if(o===`split`&&Array.isArray(s))this.insertPartialHTML(o,s,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);_+=e.rowCount}};return this.cleanupErrorWrapper(),x(y,`afterbegin`),x(b,`beforeend`),this.lastRowCount!==_&&(this.applyRowSpan(o,s,_),this.lastRowCount=_),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){if(this.options.diffStyle!==`split`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(t))return;let n=(t,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(t,e),i=Qv(r?.[0]),a=Qv(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};n(`deletions`,t[0]),n(`additions`,t[1])}refreshUnifiedDiffView(){if(this.options.diffStyle!==`unified`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(t==null||Array.isArray(t))return;let n=this.hunksRenderer.renderCodeAST(`unified`,e),r=Qv(n?.[0]),i=Qv(n?.[1]),a=()=>{for(let[e,n]of[[t.gutter,r],[t.content,i]])n!=null&&(e.innerHTML=as(n));e.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,t,e.rowCount),this.lastRowCount=e.rowCount)};this.shouldGuardRebuildScroll()?N_(this.pre,a):a(),this.renderSeparators(e.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=Qv(t[0]),i=Qv(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};m_(u,this.appliedPreAttributes)||(H_(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function qv(e,t){return e==null||t==null?e==null&&t==null:At(e,t)}function Jv({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Yv({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function Xv(e,t,n=!1){return!n&&e==null&&t}function Zv(e,t,n=!1){return e==null&&t&&!n}function Qv(e){if(e!=null&&e.type===`element`)return e.children??[]}var $v=3e3,ey=-1,ty=class extends Kv{__id=`little-virtualized-file-diff:${++ey}`;top;height=0;metrics;cache={heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0};isVisible=!1;isSetup=!1;virtualizer;layoutDirty=!0;forceRenderOverride;currentCollapsed;currentExpandUnchanged;pendingHydratedDiff;pendingExpansions;constructor(e,t,n,r,i=!1){super(e,r,i),this.virtualizer=t,this.metrics=Sp(n)}setMetrics(e,t=!1){let n=Sp(e);!t&&Nm(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(e){this.syncLineAnnotations(e)&&this.resetLayoutCache({includeEstimatedHeights:!1})}syncLineAnnotations(e){return e==null||e===this.lineAnnotations||e.length===0&&this.lineAnnotations.length===0?!1:(super.setLineAnnotations(e),!0)}setFileAnnotationHeight(e){let t=this.cache.fileAnnotationHeight;return e!==t&&(this.cache.fileAnnotationHeight=e,this.cache.measuredHeightDeltaTotal+=e-t,!0)}hasFileAnnotations(e=this.fileDiff){return e==null||!hg(this.lineAnnotations)?!1:this.lineAnnotations.some(t=>t.lineNumber===0?e.type===`new`?t.side===`additions`:e.type!==`deleted`||t.side===`deletions`:!1)}getLineHeight(e,t=!1){return this.getEstimatedLineHeight(t)+(this.cache.heightDeltas.get(e)??0)}getEstimatedLineHeight(e=!1){let t=e?2:1;return this.metrics.lineHeight*t}setOptions(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.`);if(e==null)return;let{options:t}=this,n=!Pm(t,e),r=n&&ly(t,e);super.setOptions(e),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:uy(t,e)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(e){if(this.isAdvancedMode())throw Error(`VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.`);super.setThemeType(e)}resetLayoutCache({forceSimpleRecompute:e=!1,includeEstimatedHeights:t=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.size>0&&this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal!==0&&(this.cache.measuredHeightDeltaTotal=0),this.invalidateDerivedLayoutCache(t,n),e&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(e,t=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),e&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&t&&(this.renderRange=void 0)}reconcileHeights(){let e=!1,{overflow:t=`scroll`}=this.options;if(this.fileContainer==null||this.fileDiff==null)return this.height!==0&&(e=!0),this.height=0,e;if(this.top=this.getVirtualizedTop(),t===`scroll`&&this.lineAnnotations.length===0&&!this.isResizeDebuggingEnabled())return e;let n=this.getDiffStyle(),r=n===`split`?[this.codeDeletions,this.codeAdditions]:[this.codeUnified],i=this.hasFileAnnotations(this.fileDiff);if(this.renderRange!=null&&i&&_g(this.renderRange)){let t=ny(r)??0;this.setFileAnnotationHeight(t)&&(e=!0)}else!i&&this.setFileAnnotationHeight(0)&&(e=!0);for(let t of r){if(t==null)continue;let r=t.children[1];if(r instanceof HTMLElement)for(let t of r.children){if(!(t instanceof HTMLElement))continue;let r=t.dataset.lineIndex;if(r==null)continue;let i=my(r,n),a=t.getBoundingClientRect().height,o=!1;t.nextElementSibling instanceof HTMLElement&&(`lineAnnotation`in t.nextElementSibling.dataset||`noNewline`in t.nextElementSibling.dataset)&&(`noNewline`in t.nextElementSibling.dataset&&(o=!0),a+=t.nextElementSibling.getBoundingClientRect().height);let s=this.getEstimatedLineHeight(o),c=this.cache.heightDeltas.get(i)??0,l=a-s;l!==c&&(e=!0,this.cache.measuredHeightDeltaTotal+=l-c,l===0?this.cache.heightDeltas.delete(i):this.cache.heightDeltas.set(i,l))}}return(e||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),e}onRender=e=>this.fileContainer!=null&&(e&&(this.top=this.getVirtualizedTop()),this.render());flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}prepareCodeViewItem(e,t,n,r){let i=!vp(this.fileDiff,e),a=this.syncLineAnnotations(r),o=n?.resetDiffLayoutCache===!0||i||a,s=i||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights;n?.metrics!=null&&(this.metrics=Sp(n.metrics),o=!0,s=!0);let{collapsed:c=!1,expandUnchanged:l=!1}=this.options;return this.currentCollapsed!==c&&(this.currentCollapsed=c,o=!0),this.currentExpandUnchanged!==l&&(this.currentExpandUnchanged=l,o=!0,s=!0),o&&this.resetLayoutCache({includeEstimatedHeights:s}),this.fileDiff=e,this.top=t,this.computeApproximateSize(),this.height}getLinePosition(e,t=`additions`){if(this.fileDiff==null||e<1)return;let n=this.getLineIndex(e,t);if(n==null)return;let{disableFileHeader:r=!1,expandUnchanged:i=!1,collapsed:a=!1,collapsedContextThreshold:o=1}=this.options,s=this.getDiffStyle(),c=this.getHunkSeparatorType(),l=s===`split`?n[1]:n[0];this.approximateLayoutCheckpoints();let u=Cp(this.metrics,r),d=this.getLayoutCheckpointBeforeLineIndex(l),f=d?.top??u+this.cache.fileAnnotationHeight;if(a)return{top:u,height:0};let p;return Bp({diff:this.fileDiff,diffStyle:s,startingLine:d?.renderedLineIndex??0,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,hunk:t,collapsedBefore:n,collapsedAfter:r,deletionLine:i,additionLine:a})=>{let o=s===`split`?a?.splitLineIndex??i?.splitLineIndex:a?.unifiedLineIndex??i?.unifiedLineIndex;if(o==null)throw Error(`VirtualizedFileDiff.getLinePosition: missing line index data`);if(n>0){let r=Rp({type:c,metrics:this.metrics,hunkIndex:e,hunkSpecs:t?.hunkSpecs});if(r!=null){if(f+=r.gapBefore,l>=o-n&&l<o)return p={top:f,height:r.height},!0;f+=r.height+r.gapAfter}}let u=this.getLineHeight(o,(a?.noEOFCR??!1)||(i?.noEOFCR??!1));if(o===l)return p={top:f,height:u},!0;if(f+=u,r>0){let e=zp({type:c,metrics:this.metrics});if(e!=null){if(l>o&&l<=o+r)return p={top:f+e.gapBefore,height:e.height},!0;f+=e.totalHeight}}return!1}}),p}getEditorViewport(){return this.virtualizer.type===`simple`?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(e){if(this.fileDiff==null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:r=!1,collapsedContextThreshold:i=1}=this.options;if(r)return;let a=this.getDiffStyle(),o=this.getHunkSeparatorType();this.approximateLayoutCheckpoints();let s=this.getLayoutCheckpointBeforeTop(e),c=s?.top??Cp(this.metrics,t)+this.cache.fileAnnotationHeight,l;return Bp({diff:this.fileDiff,diffStyle:a,startingLine:s?.renderedLineIndex??0,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,deletionLine:s,additionLine:u})=>{let d=a===`split`?u?.splitLineIndex??s?.splitLineIndex:u?.unifiedLineIndex??s?.unifiedLineIndex;if(d==null)throw Error(`VirtualizedFileDiff.getNumericScrollAnchor: missing line index data`);if(r>0){let e=Rp({type:o,metrics:this.metrics,hunkIndex:t,hunkSpecs:n?.hunkSpecs});e!=null&&(c+=e.totalHeight)}if(c>=e&&(s==null?u!=null&&(l={lineNumber:u.lineNumber,side:`additions`,top:c}):l={lineNumber:s.lineNumber,side:`deletions`,top:c},l!=null))return!0;let f=this.getLineHeight(d,(u?.noEOFCR??!1)||(s?.noEOFCR??!1));if(c+=f,i>0){let e=zp({type:o,metrics:this.metrics});e!=null&&(c+=e.totalHeight)}return!1}}),l}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(e){if(this.top==null||this.fileDiff==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};let t=e==null?this.renderRange:this.computeRenderRangeFromWindow(this.fileDiff,this.top,e);if(t==null)return;let{bufferBefore:n,bufferAfter:r,totalLines:i}=t,a=0;if(i===0){let t=e??this.virtualizer.getWindowSpecs();this.top<t.top&&(a=r)}return{topOffset:this.top+n+a,height:this.height-(n+r)}}cleanUp(e=!1){this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),e||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.isSetup=!1,super.cleanUp(e)}expandHunk=(e,t,n)=>{this.fileDiff!=null&&(this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:e,direction:t,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(e,t,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.loadFilesIfNecessary(),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))};async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(this.isAdvancedMode()){let n=ov(`clone`,e,t);if(await $_(()=>this.primeHighlightCache(n)),!this.enabled||this.fileDiff!==e)return;this.pendingHydratedDiff={expectedDiff:e,nextDiff:n,files:t}}else{if(ov(`merge`,e,t),this.setHydratedState(t),await $_(()=>this.primeHighlightCache(e)),!this.enabled||this.fileDiff!==e)return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}consumeCodeViewLayoutChanges(e){let t=!1,n,{pendingExpansions:r,pendingHydratedDiff:i}=this;if(r!=null){this.pendingExpansions=void 0;for(let e of r)this.hunksRenderer.expandHunk(e.hunkIndex,e.direction,e.expansionLineCountOverride),t=!0}return i!=null&&(this.pendingHydratedDiff=void 0,i.expectedDiff===e&&(this.setHydratedState(i.files),n=i.nextDiff)),n==null?t&&(this.forceRenderOverride=!0,this.invalidateDerivedLayoutCache(!0)):(this.forceRenderOverride=!0,this.resetLayoutCache({includeEstimatedHeights:!0})),n}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(e){if(super.isLineRenderable(e))return!0;let{pendingExpansions:t}=this,n=this.fileDiffCache;if(t==null||t.length===0||n==null)return!1;let{expansionLineCount:r=100,collapsedContextThreshold:i=1}=this.options,a=new Map(this.hunksRenderer.getExpandedHunksMap());for(let e of t){let t={...a.get(e.hunkIndex)??{fromStart:0,fromEnd:0}},n=e.expansionLineCountOverride??r;(e.direction===`up`||e.direction===`both`)&&(t.fromStart+=n),(e.direction===`down`||e.direction===`both`)&&(t.fromEnd+=n),a.set(e.hunkIndex,t)}return Mp({fileDiff:n,lineNumber:e,expandedHunks:a,collapsedContextThreshold:i})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),!(!this.enabled||this.fileDiff==null)&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(e){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!1))}applyDocumentChange(e,t,n=!1){let{renderRange:r}=this;if(this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(e,t),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!==void 0&&this.fileDiff!==void 0){let e=this.virtualizer.getWindowSpecs(),t=this.computeRenderRangeFromWindow(this.fileDiff,this.top??0,e);t.bufferAfter!==r.bufferAfter&&this.updateBuffers(t)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(e=!1,t=this.fileDiff){let n=this.isResizeDebuggingEnabled();if(!e&&!this.layoutDirty&&!n)return;let r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,t==null){this.layoutDirty=!1;return}let{disableFileHeader:i=!1,collapsed:a=!1}=this.options,o=Cp(this.metrics,i);if(this.height+=o,a){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(t)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(t),this.layoutDirty=!1}getActiveEstimatedHeight(e=this.fileDiff){this.ensureEstimatedDiffHeights(e);let t=this.getDiffStyle()===`split`?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(t==null)throw Error(`VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height`);return t}ensureEstimatedDiffHeights(e=this.fileDiff){if(e==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:i,unifiedHeight:a}=ev({fileDiff:e,metrics:this.metrics,disableFileHeader:t,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:dy(e,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=i,this.cache.estimatedUnifiedHeight=a}validateComputedHeight(e=this.fileDiff){if(this.fileContainer==null||e==null)return;let t=this.fileContainer.getBoundingClientRect();t.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:e.name,elementHeight:t.height,computedHeight:this.height})}render({fileContainer:e,fileDiff:t,forceRender:n=!1,lineAnnotations:r,...i}={}){let a=rv(i,`VirtualizedFileDiff.render`),o=a!=null,s=a?.oldFile,c=a?.newFile,l=o&&(!py(s,this.deletionFile)||!py(c,this.additionFile)),u=t??this.fileDiff;t==null&&o&&(l||this.fileDiff==null)&&(u=yh(a.oldFile,a.newFile,this.options.parseDiffOptions));let{forceRenderOverride:d,isSetup:f}=this;this.forceRenderOverride=void 0;let p=this.syncLineAnnotations(r);p&&this.resetLayoutCache({includeEstimatedHeights:!1});let m=t!=null&&t!==this.fileDiff,h=u!=null&&!vp(this.fileDiff,u),g=m||l;if(h&&this.resetLayoutCache({includeEstimatedHeights:!0}),e=this.getOrCreateFileContainer(e),u==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;if(f)this.top??=this.getVirtualizedTop(),h&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,u));else{this.computeApproximateSize(!1,u);let t=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(t==null)throw Error(`VirtualizedFileDiff.render: simple virtualizer is not available`);t.connect(e,this),this.isVisible=t.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!g||!f))return this.fileDiff=u,a!=null&&(this.deletionFile=s,this.additionFile=c),h&&(this.cachedHeaderHTML=void 0),this.renderPlaceholder(this.height);let _=this.virtualizer.getWindowSpecs(),v=this.top??0,y=this.computeRenderRangeFromWindow(u,v,_),b=super.render({fileDiff:u,fileContainer:e,renderRange:y,lineAnnotations:r,forceRender:(d??n)||p||h,...a,...i});return this.isSimpleMode()&&b&&this.getSimpleVirtualizer()?.requestHeightReconcile(this),b}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type===`simple`}isAdvancedMode(){return this.virtualizer.type===`advanced`}getVirtualizedTop(){return this.virtualizer.type===`advanced`?this.virtualizer.getLocalTopForInstance(this):this.fileContainer==null?0:this.virtualizer.getOffsetInScrollContainer(this.fileContainer)}getSimpleVirtualizer(){return this.virtualizer.type===`simple`?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type===`advanced`?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??`split`}getHunkSeparatorType(){return fy(this.options.hunkSeparators)}approximateLayoutCheckpoints(e=this.fileDiff){if(!this.layoutDirty&&this.cache.checkpoints.length>0||e==null||e.hunks.length===0||this.options.collapsed===!0)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,i=e.hunks.length-1,a=dy(e,this.options.loadDiffFiles!=null),o=this.getDiffStyle(),s=this.getHunkSeparatorType(),c=n?!0:this.hunksRenderer.getExpandedHunksMap(),l=ry(this.cache.heightDeltas),u=Cp(this.metrics,t)+this.cache.fileAnnotationHeight,d=0,f=({rowCount:e,startLineIndex:t,preSeparatorHeight:n=0,postSeparatorHeight:r=0,metadataOffsets:i=[]})=>{if(e<=0)return;let a=d,o=d+e,s=oy(a);for(;s<o;){let e=s-a,r=u+(e>0?n:0)+e*this.metrics.lineHeight+sy(i,e)*this.metrics.lineHeight+iy(l,t,t+e);this.cache.checkpoints.push({renderedLineIndex:s,lineIndex:t+e,top:r}),s+=$v}u+=n+e*this.metrics.lineHeight+i.length*this.metrics.lineHeight+iy(l,t,t+e)+r,d=o};for(let t=0;t<e.hunks.length;t++){let n=e.hunks[t];if(n==null)throw Error(`VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index`);let l=Op({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:c,hunkIndex:t,collapsedContextThreshold:r}),u=l.collapsedLines>0?Rp({type:s,metrics:this.metrics,hunkIndex:t,hunkSpecs:n.hunkSpecs})?.totalHeight??0:0;f({rowCount:l.fromStart,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.rangeSize});let d=u;f({rowCount:l.fromEnd,startLineIndex:(o===`split`?n.splitLineStart:n.unifiedLineStart)-l.fromEnd,preSeparatorHeight:d}),l.fromEnd>0&&(d=0);let p=t===i?jp({fileDiff:e,hunkIndex:t,expandedHunks:c,collapsedContextThreshold:r,errorPrefix:`VirtualizedFileDiff`}):void 0,m=p!=null&&p.collapsedLines>0||t===i&&a?zp({type:s,metrics:this.metrics})?.totalHeight??0:0,h=p==null?0:p.fromStart+p.fromEnd,g=o===`split`?n.splitLineCount:n.unifiedLineCount,_=o===`split`?n.splitLineStart:n.unifiedLineStart;f({rowCount:g,startLineIndex:_,preSeparatorHeight:d,postSeparatorHeight:h===0?m:0,metadataOffsets:cy({diffStyle:o,hunk:n,rowCount:g})}),p!=null&&h>0&&f({rowCount:h,startLineIndex:_+g,postSeparatorHeight:m})}this.cache.totalLines=d}getLayoutCheckpointBeforeLineIndex(e){if(e<=0||this.cache.checkpoints.length===0)return;let t=0,n=this.cache.checkpoints.length-1,r;for(;t<=n;){let i=t+n>>1,a=this.cache.checkpoints[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.lineIndex<=e?(r=a,t=i+1):n=i-1}return r}getLayoutCheckpointBeforeTop(e,t){let n=0,r=this.cache.checkpoints.length-1,i=-1;for(;n<=r;){let t=n+r>>1,a=this.cache.checkpoints[t];if(a==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);a.top<=e?(i=t,n=t+1):r=t-1}if(t==null)return i>=0?this.cache.checkpoints[i]:void 0;for(let e=i;e>=0;e--){let n=this.cache.checkpoints[e];if(n==null)throw Error(`VirtualizedFileDiff: invalid checkpoint index`);if(n.renderedLineIndex%t===0)return n}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a=r?!0:this.hunksRenderer.getExpandedHunksMap();for(let[r,o]of e.hunks.entries()){let s=t===`split`?o.splitLineCount:o.unifiedLineCount;n+=s;let c=Math.max(o.collapsedBefore,0),{fromStart:l,fromEnd:u,renderAll:d}=Op({isPartial:e.isPartial,rangeSize:c,expandedHunks:a,hunkIndex:r,collapsedContextThreshold:i});c>0&&(n+=d?c:l+u)}let o=jp({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:a,collapsedContextThreshold:i,errorPrefix:`VirtualizedFileDiff`});return o!=null&&(n+=o.fromStart+o.fromEnd),n}getLayoutLineCount(e,t){let n=this.getExpandedLineCount(e,t),r=t===`split`?e.splitLineCount:e.unifiedLineCount;return Math.max(n,r,e.additionLines.length,e.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1}=this.options,{hunkLineCount:s,lineHeight:c}=this.metrics,l=this.getDiffStyle(),u=this.getHunkSeparatorType(),d=dy(e,this.options.loadDiffFiles!=null),f=this.height,p=this.getLayoutLineCount(e,l),m=Cp(this.metrics,i),h=e.hunks.length>0?Tp(this.metrics):0,{fileAnnotationHeight:g}=this.cache,_=m+g,v=Math.max(0,f-m-g-h),y=this.hasFileAnnotations(e),b=t+m,x=g>0&&y&&b<r&&b+g>n;if(t<n-f||t>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h};if(p<=s||e.hunks.length===0)return{startingLine:0,totalLines:s,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(e),p=this.getLayoutLineCount(e,l);let S=Math.ceil(Math.max(r-n,0)/c),C=Math.ceil(S/s)*s+s,w=C/s,T=w,E=[],D=(n+r)/2,O=this.getLayoutCheckpointBeforeTop(Math.max(0,n-t-C*c*2),s),k=t+(O?.top??_),ee=O?.renderedLineIndex??0,A,j,te;if(Bp({diff:e,diffStyle:l,startingLine:O?.renderedLineIndex??0,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:i,hunk:a,collapsedBefore:o,collapsedAfter:c,deletionLine:f,additionLine:p})=>{let m=p==null?f.splitLineIndex:p.splitLineIndex,h=p==null?f.unifiedLineIndex:p.unifiedLineIndex,g=(p?.noEOFCR??!1)||(f?.noEOFCR??!1),v=i===e.hunks.length-1&&a!=null&&(l===`split`?m===a.splitLineStart+a.splitLineCount-1:h===a.unifiedLineStart+a.unifiedLineCount-1),y=(o>0?Rp({type:u,metrics:this.metrics,hunkIndex:i,hunkSpecs:a?.hunkSpecs}):void 0)?.totalHeight??0;k+=y;let b=ee%s===0,x=Math.floor(ee/s);if(b&&(E[x]=k-(t+_+y),te!=null)){if(te<=0)return!0;te--}let S=this.getLineHeight(l===`split`?m:h,g);if(k>n-S&&k<r&&(A??=x),j==null&&k+S>D&&(j=x),te==null&&k>=r&&b&&(te=T),ee++,k+=S,c>0||v&&d){let e=zp({type:u,metrics:this.metrics});e!=null&&(k<r&&k+e.totalHeight>n&&(A??=x),j==null&&k+e.totalHeight>D&&(j=x),k+=e.totalHeight)}return!1}}),A==null){if(x)A=0,j=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:f-m-h}}j??=A;let ne=Math.round(j-w/2),re=Math.max(0,Math.ceil(p/s)-w),ie=Math.max(0,Math.min(ne,re)),ae=ie*s,oe=ne<0?C+ne*s:C,se=E[ie]??0,ce=ae===0?0:g+se,le=ie+oe/s,ue=le<E.length?v-E[le]:v-(k-t-_);return{startingLine:ae,totalLines:oe,bufferBefore:ce,bufferAfter:Math.max(0,ue)}}};function ny(e){let t;for(let n of e){if(n==null)continue;let e=n.children[1];if(e instanceof HTMLElement)for(let n of e.children)n instanceof HTMLElement&&n.dataset.lineAnnotation===mg&&(t=Math.max(t??0,n.getBoundingClientRect().height))}return t}function ry(e){let t=Array.from(e).sort((e,t)=>e[0]-t[0]),n=[],r=[0],i=0;for(let[e,a]of t)n.push(e),i+=a,r.push(i);return{lineIndexes:n,prefixTotals:r}}function iy({lineIndexes:e,prefixTotals:t},n,r){if(n>=r||e.length===0)return 0;let i=ay(e,n);return(t[ay(e,r)]??0)-(t[i]??0)}function ay(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1,a=e[i];if(a==null)throw Error(`VirtualizedFileDiff: invalid prefix index`);a<t?n=i+1:r=i}return n}function oy(e){return Math.ceil(e/$v)*$v}function sy(e,t){let n=0;for(let r of e)r<t&&n++;return n}function cy({diffStyle:e,hunk:t,rowCount:n}){if(n<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];let r=t.hunkContent.at(-1);if(r==null)return[];if(r.type===`context`)return[n-1];let i=Math.max(r.deletions,r.additions),a=r.deletions+r.additions;if(e===`split`)return i>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[n-1]:[];let o=[],s=n-a;return r.deletions>0&&t.noEOFCRDeletions&&o.push(s+r.deletions-1),r.additions>0&&t.noEOFCRAdditions&&o.push(n-1),o}function ly(e,t){return(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function uy(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function dy(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function fy(e){return typeof e==`function`?`custom`:e??`line-info`}function py(e,t){return e==null||t==null?e==null&&t==null:At(e,t)}function my(e,t){let[n,r]=e.split(`,`).map(Number);return t===`split`?r:n}function hy(e,t){return typeof window>`u`&&t!=null?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,P.jsx)(P.Fragment,{children:e})}var gy=(0,N.createContext)(void 0);function _y(){return(0,N.useContext)(gy)}var vy=typeof window>`u`?N.useEffect:N.useLayoutEffect;function yy({file:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=_y(),f=i!==void 0,p=(0,N.useContext)(Mm),m=Xe(),h=(0,N.useRef)(null),g=qe(n=>{if(n!=null){if(h.current!=null)throw Error(`File: An instance should not already exist when a node is created`);d==null?h.current=new G_(by({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new Z_(by({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({file:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`File: A File instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return vy(()=>{if(h.current==null)return;let n=by({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),a=n!==void 0&&!Pm(h.current.options,n);h.current.setOptions(n),h.current.render({file:e,lineAnnotations:r,forceRender:a}),i!==void 0&&h.current.setSelectedLines(i)}),vy(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`File: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`File: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,N.useCallback)(()=>h.current?.getHoveredLine(),[])}}function by({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?$e:e?.renderCustomHeader,renderGutterUtility:r?$e:e?.renderGutterUtility}:e}function xy({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,metrics:a,className:o,style:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,prerenderedHTML:p,renderGutterUtility:m,disableWorkerPool:h=!1,edit:g=!1}){let{ref:_,getHoveredLine:v}=yy({file:e,options:r,editorOptions:i,metrics:a,lineAnnotations:t,selectedLines:n,prerenderedHTML:p,hasGutterRenderUtility:m!=null,hasCustomHeader:l!=null,disableWorkerPool:h,edit:g});return(0,P.jsx)(et,{ref:_,className:o,style:s,children:hy(Ot({file:e,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,renderGutterUtility:m,lineAnnotations:t,getHoveredLine:v}),p)})}var Sy=typeof window>`u`?N.useEffect:N.useLayoutEffect;function Cy({fileDiff:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=_y(),f=i!==void 0,p=(0,N.useContext)(Mm),m=Xe(),h=(0,N.useRef)(null),g=qe(n=>{if(n!=null){if(h.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);d==null?h.current=new Kv(wy({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new ty(wy({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({fileDiff:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return Sy(()=>{let{current:n}=h;if(n==null)return;let a=wy({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),o=a!==void 0&&!Pm(n.options,a);n.setOptions(a),n.render({forceRender:o,fileDiff:e,lineAnnotations:r}),i!==void 0&&n.setSelectedLines(i)}),Sy(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`FileDiff: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`FileDiff: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,N.useCallback)(()=>h.current?.getHoveredLine(),[])}}function wy({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?$e:e?.renderCustomHeader,renderGutterUtility:r?$e:e?.renderGutterUtility}:e}function Ty({oldFile:e,newFile:t,options:n,editorOptions:r,metrics:i,lineAnnotations:a,selectedLines:o,className:s,style:c,prerenderedHTML:l,renderAnnotation:u,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1}){let v=(0,N.useMemo)(()=>yh(e,t,n?.parseDiffOptions),[e,t,n?.parseDiffOptions]),{ref:y,getHoveredLine:b}=Cy({fileDiff:v,options:n,editorOptions:r,metrics:i,lineAnnotations:a,selectedLines:o,prerenderedHTML:l,hasGutterRenderUtility:h!=null,hasCustomHeader:d!=null,disableWorkerPool:g,edit:_});return(0,P.jsx)(et,{ref:y,className:s,style:c,children:hy(Et({fileDiff:v,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderAnnotation:u,lineAnnotations:a,renderGutterUtility:h,getHoveredLine:b}),l)})}var Ey=100,Dy=1,Oy=2,ky=3,Ay=class{#e=[];#t=[];#n;#r=!1;constructor(e){this.#n=Math.max(1,e?.maxEntries??Ey)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}clear(){this.#e.length=0,this.#t.length=0,this.#r=!1}clearRedo(){this.#t.length=0}push(e){this.#e.push(e),this.clearRedo(),this.#r=!0,this.#e.length>this.#n&&this.#e.shift()}setLastUndoSelectionsAfter(e){let t=this.#e[this.#e.length-1];t!==void 0&&(t.selectionsAfter=e.map(e=>({...e})))}setLastUndoLineAnnotations(e,t){let n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=e.slice(),n.lineAnnotationsAfter=t.slice())}peekUndo(){return this.#e[this.#e.length-1]}peekUndoForCoalescing(){return this.#r?this.peekUndo():void 0}replaceLastUndo(e){if(this.#e.length===0){this.push(e);return}this.#e[this.#e.length-1]=e,this.clearRedo(),this.#r=!0}popUndoToRedo(){let e=this.#e.pop();if(e!==void 0)return this.#t.push(e),this.#r=!1,e}popRedoToUndo(){let e=this.#t.pop();if(e!==void 0)return this.#e.push(e),this.#r=!1,e}};function jy(e,t,n,r,i,a,o,s){let c=[...t].sort((e,t)=>e.start-t.start),l=[],u;if(i?.length===c.length){let t=[];for(let n of i){if(n.start.line!==n.end.line||n.start.character!==n.end.character)break;t.push(e.offsetAt(n.start))}if(t.length===c.length){t.sort((e,t)=>e-t);let e=!0,n=!0;for(let r=0;r<c.length;r++){let i=c[r];if(i.text.length>0||i.start===i.end){e=!1,n=!1;break}e&&=t[r]===i.end,n&&=t[r]===i.start}u=e?Oy:n?ky:void 0}}for(let t=0,n=0;t<c.length;t++){let r=c[t],i=e.getTextSlice(r.start,r.end),a=r.start+n;l.push({start:a,end:a+r.text.length,text:i}),n+=r.text.length-(r.end-r.start)}return{forwardEdits:c.map(e=>({...e})),inverseEdits:l,versionBefore:n,versionAfter:r,selectionsBefore:i?.map(e=>({...e})),selectionsAfter:a?.map(e=>({...e})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:s?.slice(),coalescingMode:u}}function My(e,t){if(e===void 0||e.undoBoundary===!0||t.undoBoundary===!0||e.forwardEdits.length===0||e.forwardEdits.length!==e.inverseEdits.length||e.forwardEdits.length!==t.forwardEdits.length||t.forwardEdits.length!==t.inverseEdits.length)return!1;let n;for(let r=0;r<e.forwardEdits.length;r++){let i=e.forwardEdits[r],a=e.inverseEdits[r],o=t.forwardEdits[r],s=t.inverseEdits[r],c=Fy(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
|
|
1529
|
+
`)&&!a.text.includes(`
|
|
1530
|
+
`),u=o.start===o.end&&o.text.length>0&&!o.text.includes(`
|
|
1531
|
+
`)&&s.text.length===0;if(l&&u){if(o.start!==a.end||(n??=Dy,n!==Dy||e.coalescingMode!==void 0&&e.coalescingMode!==Dy||t.coalescingMode!==void 0&&t.coalescingMode!==Dy))return!1;continue}let d=i.text.length===0&&i.end>i.start&&a.text.length>0,f=o.text.length===0&&o.end>o.start&&s.text.length>0;if(d&&f){let r;if(c===i.end)r=ky;else if(c+(o.end-o.start)!==i.start)return!1;else r=Oy;if(n??=r,n!==r||e.coalescingMode!==void 0&&e.coalescingMode!==r||t.coalescingMode!==void 0&&t.coalescingMode!==r)return!1;continue}return!1}return n!==void 0}function Ny(e,t){let n=[],r=[],i;for(let a=0;a<e.forwardEdits.length;a++){let o=e.forwardEdits[a],s=e.inverseEdits[a],c=t.forwardEdits[a],l=t.inverseEdits[a],u=Fy(c.start,e.forwardEdits);if(o.text.length>0){i??=Dy,n.push({start:o.start,end:o.end,text:o.text+c.text}),r.push(s.text);continue}if(u===o.end){i??=ky,n.push({start:o.start,end:u+(c.end-c.start),text:``}),r.push(s.text+l.text);continue}i??=Oy,n.push({start:Math.min(o.start,u),end:o.end,text:``}),r.push(l.text+s.text)}return{forwardEdits:n,inverseEdits:Py(n,r),versionBefore:e.versionBefore,versionAfter:t.versionAfter,selectionsBefore:e.selectionsBefore?.slice(),selectionsAfter:t.selectionsAfter?.slice(),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:t.lineAnnotationsAfter?.slice(),coalescingMode:i}}function Py(e,t){let n=[];for(let r=0,i=0;r<e.length;r++){let a=e[r],o=a.start+i;n.push({start:o,end:o+a.text.length,text:t[r]}),i+=a.text.length-(a.end-a.start)}return n}function Fy(e,t){let n=e;for(let e of t){let t=e.end-e.start,r=e.text.length,i=r-t;if(!(n<e.start)){if(n>=e.start+r){n-=i;continue}n=e.start+Math.min(n-e.start,t)}}return n}var Iy=1e5,Ly=10,Ry=13,zy=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,By=class{source;offset;length;lineOffsetStart;lineOffsetEnd;hasVirtualTrailingCRBreak;firstCharCode;lastCharCode;static Original=0;static Added=1;constructor(e,t,n,r,i,a,o,s){this.source=e,this.offset=t,this.length=n,this.lineOffsetStart=r,this.lineOffsetEnd=i,this.hasVirtualTrailingCRBreak=a,this.firstCharCode=o,this.lastCharCode=s}get lineBreakCount(){return this.lineOffsetEnd-this.lineOffsetStart+ +!!this.hasVirtualTrailingCRBreak}},Vy=class{text;lineOffsets;constructor(e){this.text=e,this.lineOffsets=Tf(e)}append(e){let t=this.text.length;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);(r===Ly||r===Ry)&&(r===Ry&&e.charCodeAt(n+1)===Ly&&n++,this.lineOffsets.push(t+n+1))}return this.text+=e,t}},Hy=class{piece;subtreeLength;subtreeLineBreakCount;subtreeFirstCharCode;subtreeLastCharCode;left=null;right=null;parent=null;priority=0;constructor(e,t=e.length,n=e.lineBreakCount,r=e.firstCharCode,i=e.lastCharCode){this.piece=e,this.subtreeLength=t,this.subtreeLineBreakCount=n,this.subtreeFirstCharCode=r,this.subtreeLastCharCode=i}updateSubtreeLength(){this.subtreeLength=(this.left?.subtreeLength??0)+this.piece.length+(this.right?.subtreeLength??0),this.subtreeLineBreakCount=(this.left?.subtreeLineBreakCount??0)+this.piece.lineBreakCount+(this.right?.subtreeLineBreakCount??0)-+!!Zy(this.left?.subtreeLastCharCode,this.piece.firstCharCode)-!!Zy(this.piece.lastCharCode,this.right?.subtreeFirstCharCode),this.subtreeFirstCharCode=this.left?.subtreeFirstCharCode??this.piece.firstCharCode,this.subtreeLastCharCode=this.right?.subtreeLastCharCode??this.piece.lastCharCode}},Uy=class{#e;#t=new Vy(``);#n=null;#r=0;#i=0;#a=null;#o=null;#s=null;#c=2654435769;constructor(e){this.#e=new Vy(e);let t=this.#y(By.Original,0,e.length);this.#n=t.length>0?this.#C(t):null,this.#r=this.#n?.subtreeLength??0,this.#i=(this.#n?.subtreeLineBreakCount??0)+1}get lineCount(){return this.#i}getText(e){if(e===void 0)return this.#g();let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this.getTextSlice(t,n)}getLineText(e,t=!1){if(this.#a!==null&&this.#a[0]===e&&this.#a[1]===t)return this.#a[2];let n=this.#f(e);if(n===void 0)throw Error(`Line index out of range: ${e}`);let r=this.getTextSlice(n[0],n[1],!t);return this.#a=[e,t,r],this.#o=[e,t,r.length],r}getLineLength(e,t=!1){let n=this.#o,r=this.#a;if(n!==null&&n[0]===e&&n[1]===t)return n[2];if(r!==null&&r[0]===e&&r[1]===t){let n=r[2].length;return this.#o=[e,t,n],n}let i=this.#f(e);if(i===void 0)throw Error(`Line index out of range: ${e}`);let[a,o]=i,s=o-a;if(!t)for(;s>0&&Wy(this.charAt(a+s-1).charCodeAt(0));)s--;return this.#o=[e,t,s],s}getTextSlice(e,t,n=!1){if(e>=t)return``;let r=Gy(e,0,this.#r),i=Gy(t,r,this.#r);if(r>=i)return``;let a=this.#u(r);if(a===void 0)return``;let o=[],[s,c]=a,l=i-r;for(;s!==null&&l>0;){let e=Math.min(s.piece.length-c,l),t=this.#v(s.piece.source),r=s.piece.offset+c,i=r+e;if(n)for(;i>r&&Wy(t.text.charCodeAt(i-1));)i--;o.push(t.text.slice(r,i)),l-=e,c=0,s=this.#d(s)}return o.join(``)}charAt(e){let t=this.#u(e);if(t===void 0)return``;let[n,r]=t;return this.#v(n.piece.source).text.charAt(n.piece.offset+r)}includes(e){if(e.length===0)return!0;let t=Ky(e),n=0,r=!1;return this.#_(i=>{for(let a=i.start;a<i.end;a++){let o=i.text.charCodeAt(a);for(;n>0&&o!==e.charCodeAt(n);)n=t[n-1];if(o===e.charCodeAt(n)&&n++,n===e.length)return r=!0,!1}return!0}),r}findNextNonOverlappingSubstring(e,t){if(e.length===0||e.length>this.#r)return;let n=qy(t,this.#r),r=n.reduce((e,[,t])=>Math.max(e,t),0),i=Ky(e),a=0,o=0,s,c;return this.#_(t=>{for(let l=t.start;l<t.end;l++){let u=t.text.charCodeAt(l);for(;a>0&&u!==e.charCodeAt(a);)a=i[a-1];if(u===e.charCodeAt(a)&&a++,a===e.length){let t=o-e.length+1;if(!Jy(n,t,t+e.length)){if(t>=r)return c=t,!1;s??=t}a=i[a-1]}o++}return!0}),c??s}search(e){if(e.text.length===0||this.#r===0||e.text.includes(`
|
|
1532
|
+
`)||e.text.includes(`\r`)||e.regex&&(e.text.includes(`\\n`)||e.text.includes(`\\r`)))return[];let t;try{t=nb(e.text,e.regex,e.caseSensitive)}catch{return[]}return this.#l(t,e.wholeWord,Iy)}#l(e,t,n){let r=[],i=this.#g(),a=i.length,o=Tf(i);for(let s=0;s<o.length;s++){let c=o[s],l=o[s+1]??a;for(;l>c&&Wy(i.charCodeAt(l-1));)l--;let u=i.slice(c,l);e.lastIndex=0;let d;for(;(d=e.exec(u))!==null;){let a=d.index,o=d[0];if(o.length===0){e.lastIndex=ab(u,a);continue}let s=c+a;if((!t||tb(i,s,o.length))&&(r.push([s,s+o.length]),r.length>=n))return r;a===e.lastIndex&&(e.lastIndex=ab(u,a))}}return r}insert(e,t){if(e.length===0)return;let n=Gy(t,0,this.#r);this.#b(n,n,e),this.#x()}delete(e,t){if(t<=0||this.#r===0)return;let n=Gy(e,0,this.#r),r=Gy(n+t,n,this.#r);n!==r&&(this.#b(n,r,``),this.#x())}applyEdits(e){if(e.length!==0){for(let t=e.length-1;t>=0;t--){let n=e[t],r=Gy(n.start,0,this.#r),i=Gy(n.end,r,this.#r);this.#b(r,i,n.text)}this.#x()}}positionAt(e){let t=Gy(e,0,this.#r);if(this.#r===0)return{line:0,character:0};let n=this.#p(t),r=t-(n===0?0:this.#m(n-1));return this.#s=[n,r,t],{line:n,character:r}}positionsAt(e){let t=Array.from({length:e.length});if(e.length===0)return t;if(this.#r===0)return t.fill({line:0,character:0});for(let n=0;n<e.length;n++)t[n]=this.positionAt(e[n]);return t}offsetAt(e){if(e.line<0||this.#r===0)return 0;if(e.line>=this.#i)throw Error(`Line index out of range: ${e.line}`);let t=this.#s;if(t!==null&&t[0]===e.line&&t[1]===e.character)return t[2];let n=this.#f(e.line);if(n===void 0)throw Error(`Line index out of range: ${e.line}`);let r=Gy(e.character,0,n[1]-n[0]);return n[0]+r}#u(e){if(e<0||e>=this.#r)return;let t=this.#n,n=e;for(;t!==null;){let e=t.left?.subtreeLength??0;if(n<e){t=t.left;continue}if(n-=e,n<t.piece.length)return[t,n];n-=t.piece.length,t=t.right}}#d(e){if(e.right!==null){let t=e.right;for(;t.left!==null;)t=t.left;return t}let t=e;for(;t.parent!==null&&t===t.parent.right;)t=t.parent;return t.parent}#f(e){if(e<0)throw Error(`Line index out of range: ${e}`);if(this.#r===0){if(e===0)return[0,0];throw Error(`Line index out of range: ${e}`)}if(e>=this.#i)throw Error(`Line index out of range: ${e}`);return[e===0?0:this.#m(e-1),e<this.#i-1?this.#m(e):this.#r]}#p(e){let t=this.#n,n=Gy(e,0,this.#r),r=0;for(;t!==null;){let e=t.left?.subtreeLength??0;if(n<e){t=t.left;continue}if(r+=(t.left?.subtreeLineBreakCount??0)-+!!Zy(t.left?.subtreeLastCharCode,t.piece.firstCharCode),n-=e,n<=t.piece.length){let e=this.#v(t.piece.source),i=Math.min(Qy(e.lineOffsets,t.piece.offset+n),t.piece.lineOffsetEnd);return r+=i-t.piece.lineOffsetStart,n===t.piece.length&&t.piece.hasVirtualTrailingCRBreak&&r++,n===t.piece.length&&Zy(t.piece.lastCharCode,this.#d(t)?.piece.firstCharCode)&&r--,r}r+=t.piece.lineBreakCount-+!!Zy(t.piece.lastCharCode,t.right?.subtreeFirstCharCode),n-=t.piece.length,t=t.right}return this.#i-1}#m(e){let t=this.#n,n=e,r=0,i;for(;t!==null;){let e=(t.left?.subtreeLineBreakCount??0)-+!!Zy(t.left?.subtreeLastCharCode,t.piece.firstCharCode);if(n<e){i=t.piece.firstCharCode,t=t.left;continue}let a=t.left?.subtreeLength??0;r+=a,n-=e;let o=t.right?.subtreeFirstCharCode??i,s=t.piece.lineBreakCount-+!!Zy(t.piece.lastCharCode,o);if(n<s)return r+this.#h(t.piece,n);r+=t.piece.length,n-=s,t=t.right}return this.#r}#h(e,t){return t<e.lineOffsetEnd-e.lineOffsetStart?this.#v(e.source).lineOffsets[e.lineOffsetStart+t]-e.offset:e.length}#g(){let e=[];return this.#_(t=>{e.push(t.text.slice(t.start,t.end))}),e.join(``)}#_(e){this.#j(this.#n,t=>{let n=this.#v(t.piece.source);return e({text:n.text,lineOffsets:n.lineOffsets,lineOffsetStart:t.piece.lineOffsetStart,lineOffsetEnd:t.piece.lineOffsetEnd,start:t.piece.offset,end:t.piece.offset+t.piece.length})})}#v(e){return e===By.Original?this.#e:this.#t}#y(e,t,n){let r=this.#v(e),i=t+n,a=Qy(r.lineOffsets,t),o=Qy(r.lineOffsets,i),s=r.text.charCodeAt(i-1);return new By(e,t,n,a,o,s===Ry&&r.lineOffsets[o-1]!==i,r.text.charCodeAt(t),s)}#b(e,t,n){if(e===t&&n.length===0)return;let[r,i]=this.#E(this.#n,e),a=this.#D(i,t-e),o;if(n.length>0){let e=this.#y(By.Added,this.#t.append(n),n.length);o=this.#O(this.#k(r,e),a)}else{let[e,t]=this.#A(a);o=e===void 0?r:this.#O(this.#k(r,e),t)}o!==null&&(o.parent=null),this.#n=o,this.#r=o?.subtreeLength??0,this.#i=(o?.subtreeLineBreakCount??0)+1}#x(){this.#a=null,this.#o=null,this.#s=null}#S(){return this.#c=Math.imul(this.#c,1664525)+1013904223>>>0,this.#c}#C(e){let t=new Hy(e);return t.priority=this.#S(),t}#w(e,t){e.left=t,t!==null&&(t.parent=e)}#T(e,t){e.right=t,t!==null&&(t.parent=e)}#E(e,t){if(e===null)return[null,null];if(t<=0)return[null,e];if(t>=e.subtreeLength)return[e,null];let n=e.left?.subtreeLength??0;if(t<=n){let[n,r]=this.#E(e.left,t);return this.#w(e,r),e.updateSubtreeLength(),[n,e]}let r=e.piece.length;if(t>=n+r){let[i,a]=this.#E(e.right,t-n-r);return this.#T(e,i),e.updateSubtreeLength(),[e,a]}let i=t-n,a=new Hy(this.#y(e.piece.source,e.piece.offset,i)),o=new Hy(this.#y(e.piece.source,e.piece.offset+i,r-i));return a.priority=e.priority,o.priority=e.priority,this.#w(a,e.left),this.#T(o,e.right),a.updateSubtreeLength(),o.updateSubtreeLength(),[a,o]}#D(e,t){if(e===null||t>=e.subtreeLength)return null;if(t<=0)return e;let n=e.left?.subtreeLength??0;if(t<=n)return this.#w(e,this.#D(e.left,t)),e.updateSubtreeLength(),e;let r=n+e.piece.length;if(t>=r)return this.#D(e.right,t-r);let i=t-n,a=new Hy(this.#y(e.piece.source,e.piece.offset+i,e.piece.length-i));return a.priority=e.priority,this.#T(a,e.right),a.updateSubtreeLength(),a}#O(e,t){return e===null?t:t===null?e:e.priority>=t.priority?(this.#T(e,this.#O(e.right,t)),e.updateSubtreeLength(),e):(this.#w(t,this.#O(e,t.left)),t.updateSubtreeLength(),t)}#k(e,t){if(e===null)return this.#C(t);let n=e;for(;n.right!==null;)n=n.right;if(Yy(n.piece,t)){n.piece=Xy(n.piece,t);for(let t=n;t!==null&&(t.updateSubtreeLength(),t!==e);)t=t.parent;return e}return this.#O(e,this.#C(t))}#A(e){if(e===null)return[void 0,null];if(e.left===null)return[e.piece,e.right];let[t,n]=this.#A(e.left);return this.#w(e,n),e.updateSubtreeLength(),[t,e]}#j(e,t){return e===null?!0:!this.#j(e.left,t)||t(e)===!1?!1:this.#j(e.right,t)}};function Wy(e){return e===10||e===13}function Gy(e,t,n){return Math.min(Math.max(e,t),n)}function Ky(e){let t=Array.from({length:e.length}).fill(0),n=0;for(let r=1;r<e.length;r++){let i=e.charCodeAt(r);for(;n>0&&i!==e.charCodeAt(n);)n=t[n-1];i===e.charCodeAt(n)&&n++,t[r]=n}return t}function qy(e,t){let n=[];for(let[r,i]of e){let e=Gy(r,0,t),a=Gy(i,e,t);e<a&&n.push([e,a])}n.sort((e,t)=>e[0]-t[0]);let r=[];for(let e of n){let t=r[r.length-1];if(t!==void 0&&e[0]<=t[1]){t[1]=Math.max(t[1],e[1]);continue}r.push(e)}return r}function Jy(e,t,n){let r=0,i=e.length;for(;r<i;){let n=r+Math.floor((i-r)/2);e[n][1]<=t?r=n+1:i=n}let a=e[r];return a!==void 0&&a[0]<n}function Yy(e,t){return e.source===t.source&&e.offset+e.length===t.offset&&!Zy(e.lastCharCode,t.firstCharCode)}function Xy(e,t){return new By(e.source,e.offset,e.length+t.length,e.lineOffsetStart,t.lineOffsetEnd,t.hasVirtualTrailingCRBreak,e.firstCharCode,t.lastCharCode)}function Zy(e,t){return e===Ry&&t===Ly}function Qy(e,t){let n=0,r=e.length;for(;n<r;){let i=n+Math.floor((r-n)/2);e[i]<=t?n=i+1:r=i}return n}function $y(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function eb(e){if(e<=32||e===127)return!0;let t=String.fromCharCode(e);return zy.includes(t)}function tb(e,t,n){let r=t<=0||eb(e.charCodeAt(t-1)),i=t+n>=e.length||eb(e.charCodeAt(t+n));return r&&i}function nb(e,t,n){let r=t?e:$y(e);return new RegExp(r,`g${n?``:`i`}${t?`m`:``}`)}function rb(e,t){return e.replace(/\$([$&]|\d+)/g,(e,n)=>n===`$`?`$`:n===`&`?t[0]??``:t[Number(n)]??``)}function ib(e,t,n,r,i,a){if(!r.regex)return r.replaceText;let o=e(i),s=n(o.line),c=i-t({line:o.line,character:0}),l;try{l=nb(r.text,!0,r.caseSensitive)}catch{return r.replaceText}l.lastIndex=c;let u=l.exec(s);return u===null||u.index!==c||u[0].length!==a-i?r.replaceText:rb(r.replaceText,u)}function ab(e,t){if(t+1<e.length){let n=e.charCodeAt(t),r=e.charCodeAt(t+1);if(n>=55296&&n<=56319&&r>=56320&&r<=57343)return t+2}return t+1}var ob=class e{#e;#t;#n;#r;#i;#a;constructor(e,t,n=`text`,r=0,i=new Ay){this.#e=new URL(e,`file://`).toString(),this.#t=n,this.#n=r,this.#r=new Uy(t),this.#i=i;let a=this.#r.getLineText(0,!0);this.#a=a.endsWith(`\r
|
|
1533
|
+
`)?`\r
|
|
1534
|
+
`:a.endsWith(`\r`)?`\r`:`
|
|
1535
|
+
`}get uri(){return this.#e}get languageId(){return this.#t}get version(){return this.#n}get lineCount(){return this.#r.lineCount}get eol(){return this.#a}get canUndo(){return this.#i.canUndo}get canRedo(){return this.#i.canRedo}positionAt(e){return this.normalizePosition(this.#r.positionAt(e))}positionsAt(e){let t=this.#r.positionsAt(e);for(let e=0;e<t.length;e++)t[e]=this.normalizePosition(t[e]);return t}offsetAt(e){return this.#r.offsetAt(this.normalizePosition(e))}getText(e){return e===void 0?this.#r.getText():this.#r.getText({start:this.normalizePosition(e.start),end:this.normalizePosition(e.end)})}getLineText(e,t){return this.#r.getLineText(e,t)}normalizeEol(e){return e.replace(/\r\n|\r|\n/g,this.eol)}getLineLength(e,t){return this.#r.getLineLength(e,t)}charAt(e){return typeof e==`number`?this.#r.charAt(e):this.#r.charAt(this.offsetAt(e))}getTextSlice(e,t){return this.#r.getTextSlice(e,t)}findNextNonOverlappingSubstring(e,t){return this.#r.findNextNonOverlappingSubstring(e,t)}search(e){return this.#r.search(e)}applyEdits(e,t=!0,n,r,i=!1){if(e.length!==0)return this.#o(this.#d(this.resolveEdits(e)),t,n,r,i)}resolveEdits(e){return e.map(e=>this.#c(e))}applyResolvedEdits(e,t=!0,n,r,i=!1){if(e.length!==0)return this.#o(this.#d(e.map(e=>this.#l(e))),t,n,r,i)}#o(e,t,n,r,i){let a=jy(this,e,this.#n,this.#n+1,t?n:void 0,t?r:void 0);t&&i&&(a.undoBoundary=!0);let o=this.#i.peekUndoForCoalescing(),s=this.#f(e);return this.#n++,s.lineDelta===0&&My(o,a)?this.#i.replaceLastUndo(Ny(o,a)):this.#i.push(a),s}setLastUndoSelectionsAfter(e){this.#i.setLastUndoSelectionsAfter(e)}setLastUndoLineAnnotations(e,t){this.#i.setLastUndoLineAnnotations(e,t)}undo(){let e=this.#i.popUndoToRedo();if(e===void 0)return;let t=this.#f(e.inverseEdits);if(t===void 0)return;this.#n=e.versionBefore;let n=e.selectionsBefore?.slice();return[t,n,e.lineAnnotationsBefore?.slice(),n===void 0?e.inverseEdits.map(e=>({...e})):void 0]}redo(){let e=this.#i.popRedoToUndo();if(e===void 0)return;let t=this.#f(e.forwardEdits);if(t===void 0)return;this.#n=e.versionAfter;let n=e.selectionsAfter?.slice();return[t,n,e.lineAnnotationsAfter?.slice(),n===void 0?e.forwardEdits.map(e=>({...e})):void 0]}normalizePosition(t){let n=e.#s(t.line,this.lineCount-1);return{line:n,character:e.#s(t.character,this.getLineLength(n))}}static#s(e,t){return Number.isNaN(e)?0:Math.max(0,Math.min(Math.floor(e),t))}#c(e){let t=this.offsetAt(e.range.start),n=this.offsetAt(e.range.end);if(t>n){let e=t;t=n,n=e}return this.#l({start:t,end:n,text:e.newText})}#l(e){let{start:t,end:n}=e,r=t===n;return this.#u(t)&&t--,r?n=t:this.#u(n)&&n++,{start:t,end:n,text:e.text}}#u(e){let t=this.#r.charAt(e-1).charCodeAt(0),n=this.#r.charAt(e).charCodeAt(0);return t>=55296&&t<=56319&&n>=56320&&n<=57343}#d(e){let t=[...e].sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});for(let e=0;e<t.length-1;e++)if(t[e].end>t[e+1].start)throw Error(`Overlapping text edits are not supported`);return t}#f(e){let t=this.#r.lineCount,n=this.positionsAt(e.flatMap(e=>[e.start,e.end])),r=this.#p(e,n),i=n[0],a=n[n.length-1],o=a.line===t-1&&a.character===this.#r.getLineLength(a.line);this.#r.applyEdits(e);let s=this.#r.lineCount;return{changes:e.map((e,t)=>({...e,range:{start:n[t*2],end:n[t*2+1]}})),startLine:r.startLine,startCharacter:i.character,endCharacter:a.character,endLine:Math.min(r.endLine,Math.max(0,s-1)),endedAtDocumentEnd:o,previousLineCount:t,lineCount:s,lineDelta:s-t,changedLineRanges:r.ranges,changedLineChanges:r.changes}}#p(e,t){let n=1/0,r=0,i=0,a=[],o=[],s=this.#r.lineCount-1,c=this.#r.getLineLength(s);for(let l=0;l<e.length;l++){let u=e[l],d=t[l*2],f=t[l*2+1],p=d.line,m=f.line,h=Ef(u.text),g=p+i,_=g+h,v=h-(m-p);n=Math.min(n,p),r=Math.max(r,_);let y=a[a.length-1];y!==void 0&&g<=y[1]+1?a[a.length-1]=[y[0],Math.max(y[1],_)]:a.push([g,_]),o.push([g,_,v,d.character,f.character,m===s&&f.character===c]),i+=v}return n===1/0?{startLine:0,endLine:0,ranges:[[0,0]],changes:[[0,0,0,0,0,!1]]}:{startLine:n,endLine:r,ranges:a,changes:o}}};function sb({metaKey:e,ctrlKey:t},n=R_()){return n?e&&!t:t&&!e}function cb(e){if(R_()&&e.ctrlKey&&!e.altKey&&!e.metaKey)switch(e.key){case`a`:return`start`;case`e`:return`end`;case`p`:return`up`;case`n`:return`down`;case`f`:return`right`;case`b`:return`left`}if(!e.altKey&&!e.ctrlKey&&!e.metaKey){if(e.key===`ArrowUp`)return`up`;if(e.key===`ArrowDown`)return`down`;if(e.key===`ArrowLeft`)return`left`;if(e.key===`ArrowRight`)return`right`;if(e.key===`Home`)return`start`;if(e.key===`End`)return`end`}if(sb(e)){if(e.key===`ArrowLeft`)return`textStart`;if(e.key===`ArrowRight`)return`end`}}var lb=new WeakMap,ub=fb([{bindings:{Tab:`indent`,"shift+Tab":`outdent`,"cmdOrCtrl+[":`indentLess`,"cmdOrCtrl+]":`indentMore`,"cmdOrCtrl+z":`undo`,"cmdOrCtrl+shift+z":`redo`,"cmdOrCtrl+a":`selectAll`,"cmdOrCtrl+d":`findNextMatch`,"cmdOrCtrl+f":`openSearchPanel`,"cmdOrCtrl+alt+f":`openSearchReplacePanel`,"alt+ArrowUp":`moveLineUp`,"alt+ArrowDown":`moveLineDown`,"shift+alt+ArrowUp":`copyLineUp`,"shift+alt+ArrowDown":`copyLineDown`,Escape:`simplifySelection`,"cmdOrCtrl+Enter":`insertBlankLine`,"cmdOrCtrl+/":`toggleComment`,"shift+alt+a":`toggleBlockComment`,"cmdOrCtrl+Home":`moveCursorToDocStart`,"cmdOrCtrl+End":`moveCursorToDocEnd`,"cmdOrCtrl+shift+Home":`expandSelectionDocStart`,"cmdOrCtrl+shift+End":`expandSelectionDocEnd`}},{platform:`mac`,bindings:{"ctrl+k":`deleteHardLineForward`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`,"cmd+ArrowUp":`moveCursorToDocStart`,"cmd+ArrowDown":`moveCursorToDocEnd`,"cmd+shift+ArrowUp":`expandSelectionDocStart`,"cmd+shift+ArrowDown":`expandSelectionDocEnd`}},{platform:`windows`,bindings:{"ctrl+y":`redo`}},{platform:`linux`,bindings:{"ctrl+y":`redo`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`}}]),db={Backquote:"`",Minus:`-`,Equal:`=`,Comma:`,`,Period:`.`,Slash:`/`,Semicolon:`;`,Quote:`'`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Space:`Space`};function fb(e){let t=lb.get(e);if(t===void 0){t={mac:new Map,windows:new Map,linux:new Map};for(let n of e)for(let e of Object.keys(n.bindings)){let r=n.bindings[e];if(r===void 0)continue;let i=e.split(`+`),a=i.pop();for(let e of[`mac`,`windows`,`linux`]){if(n.platform!==void 0&&n.platform!==e)continue;let o=0;for(let t of i)t===`alt`?o|=1:t===`ctrl`?o|=2:t===`cmd`?o|=4:t===`shift`?o|=8:t===`cmdOrCtrl`&&(o|=e===`mac`?4:2);let s=t[e].get(o);s===void 0&&(s=new Map,t[e].set(o,s)),s.set(a,r)}}lb.set(e,t)}return t}function pb(e,t,n=R_()){let r=e.key===` `?`Space`:e.key.length===1?e.key.toLowerCase():e.key,i=e.code??``,a=i.startsWith(`Key`)&&i.length===4?i.slice(3).toLowerCase():i.startsWith(`Digit`)&&i.length===6?i.slice(5):db[i],o=n?`mac`:globalThis.navigator?.platform.includes(`Linux`)===!0?`linux`:`windows`,s=+!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0);if(t!==void 0){let e=fb(t)[o].get(s),n=e?.get(r)??(a===void 0?void 0:e?.get(a));if(n!==void 0)return n}let c=ub[o].get(s);return c?.get(r)??(a===void 0?void 0:c?.get(a))}function mb(e,t=R_()){if(!e.altKey&&sb(e,t)&&((e.key.length===1?e.key.toLowerCase():e.key)===`g`||e.code===`KeyG`))return e.shiftKey?`previous`:`next`}var hb=`::selection {
|
|
1536
|
+
background-color: #0000;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
[data-deleted-text-selection] [data-deletions] ::selection, [data-deleted-text-selection] [data-line-type="change-deletion"] ::selection {
|
|
1540
|
+
background-color: var(--diffs-editor-selection-bg);
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
@keyframes blinking {
|
|
1544
|
+
0% {
|
|
1545
|
+
opacity: 1;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
50% {
|
|
1549
|
+
opacity: 0;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
100% {
|
|
1553
|
+
opacity: 1;
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
:host, [data-code], [data-content], [data-diff-type="split"][data-overflow="wrap"] {
|
|
1558
|
+
position: relative;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
[data-code] {
|
|
1562
|
+
container-type: inline-size;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
[data-content] {
|
|
1566
|
+
cursor: text;
|
|
1567
|
+
caret-color: var(--diffs-bg-caret);
|
|
1568
|
+
background-color: #0000;
|
|
1569
|
+
outline: none;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
[data-line] {
|
|
1573
|
+
cursor: text;
|
|
1574
|
+
background-color: #0000;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
[data-line]:after {
|
|
1578
|
+
content: "";
|
|
1579
|
+
z-index: -20;
|
|
1580
|
+
background-color: var(--diffs-line-bg);
|
|
1581
|
+
pointer-events: none;
|
|
1582
|
+
position: absolute;
|
|
1583
|
+
inset: 0;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
[data-line][data-editor-active-line]:after {
|
|
1587
|
+
box-shadow: inset 0 0 0 1px var(--diffs-editor-line-highlight-border);
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
[data-editor-overlay] {
|
|
1591
|
+
display: contents;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
[data-caret], [data-selection-range], [data-match-range], [data-bracket-match-range], [data-marker-range] {
|
|
1595
|
+
height: 1lh;
|
|
1596
|
+
line-height: var(--diffs-line-height);
|
|
1597
|
+
pointer-events: none;
|
|
1598
|
+
position: absolute;
|
|
1599
|
+
top: 0;
|
|
1600
|
+
left: 0;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
[data-caret] {
|
|
1604
|
+
background-color: var(--diffs-bg-caret-override, var(--diffs-editor-cursor-fg, light-dark(color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 75%, var(--diffs-bg)))));
|
|
1605
|
+
visibility: hidden;
|
|
1606
|
+
width: 2px;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
1610
|
+
[data-caret] {
|
|
1611
|
+
animation: 1.2s .8s infinite blinking;
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
[data-selection-range] {
|
|
1616
|
+
z-index: -10;
|
|
1617
|
+
background-color: var(--diffs-editor-selection-bg);
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
[data-selection-corner] {
|
|
1621
|
+
background-color: var(--diffs-selection-corner-bg, var(--diffs-bg));
|
|
1622
|
+
width: 100%;
|
|
1623
|
+
height: 100%;
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
[data-match-range] {
|
|
1627
|
+
z-index: -10;
|
|
1628
|
+
background-color: var(--diffs-editor-match-bg, var(--diffs-editor-selection-bg));
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
[data-match-range]:not([data-focus]) {
|
|
1632
|
+
background-color: var(--diffs-editor-match-highlight-bg, light-dark(#ff963288, #ff963266));
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
[data-bracket-match-range] {
|
|
1636
|
+
z-index: -9;
|
|
1637
|
+
box-sizing: border-box;
|
|
1638
|
+
border-bottom: 1px solid
|
|
1639
|
+
var(--diffs-editor-bracket-match-border, color-mix(in lab, var(--diffs-fg) 60%, transparent));
|
|
1640
|
+
background-color: var(--diffs-editor-bracket-match-bg, color-mix(in lab, var(--diffs-fg) 5%, transparent));
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
[data-rtl] {
|
|
1644
|
+
border-top-left-radius: 3px;
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
[data-rtr] {
|
|
1648
|
+
border-top-right-radius: 3px;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
[data-rbl] {
|
|
1652
|
+
border-bottom-left-radius: 3px;
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
[data-rbr] {
|
|
1656
|
+
border-bottom-right-radius: 3px;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
[data-marker-range] {
|
|
1660
|
+
z-index: 1;
|
|
1661
|
+
background-color: var(--diffs-marker-bg);
|
|
1662
|
+
mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+");
|
|
1663
|
+
mask-position: 0 100%;
|
|
1664
|
+
mask-size: 6px 3px;
|
|
1665
|
+
mask-repeat: repeat-x;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
[data-marker-error] {
|
|
1669
|
+
--diffs-marker-contrast: light-dark(#fff, #000);
|
|
1670
|
+
--diffs-marker-bg: var(--diffs-editor-error-fg, var(--diffs-deletion-base));
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
[data-marker-warning] {
|
|
1674
|
+
--diffs-marker-contrast: #000;
|
|
1675
|
+
--diffs-marker-bg: var(--diffs-editor-warning-fg, light-dark(var(--diffs-warning-light), var(--diffs-warning-dark)));
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
[data-marker-info] {
|
|
1679
|
+
--diffs-marker-contrast: #000;
|
|
1680
|
+
--diffs-marker-bg: var(--diffs-editor-info-fg, var(--diffs-modified-base));
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
[data-marker-hint] {
|
|
1684
|
+
--diffs-marker-contrast: light-dark(#fff, #000);
|
|
1685
|
+
--diffs-marker-bg: var(--diffs-editor-hint-fg, var(--diffs-fg-number));
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
@media (width >= 480px) {
|
|
1689
|
+
[data-content] {
|
|
1690
|
+
caret-color: #0000;
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
[data-content]:focus ~ [data-editor-overlay] [data-caret] {
|
|
1694
|
+
visibility: visible;
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
[data-editor-widget] {
|
|
1699
|
+
--diffs-widget-fg: var(--diffs-fg);
|
|
1700
|
+
--diffs-widget-bg: color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));
|
|
1701
|
+
--diffs-widget-border: color-mix(in lab, var(--diffs-fg) 20%, transparent);
|
|
1702
|
+
--diffs-widget-shadow: inset 0 0 0 1px var(--diffs-bg), 0 4px 8px #00000013,
|
|
1703
|
+
0 6px 18px #00000013;
|
|
1704
|
+
z-index: 100;
|
|
1705
|
+
width: fit-content;
|
|
1706
|
+
max-width: calc(100% - 24px);
|
|
1707
|
+
font: 14px/20px var(--diffs-header-font-fallback);
|
|
1708
|
+
border: 1px solid var(--diffs-widget-border);
|
|
1709
|
+
background-color: var(--diffs-widget-bg);
|
|
1710
|
+
box-shadow: var(--diffs-widget-shadow);
|
|
1711
|
+
background-clip: padding-box;
|
|
1712
|
+
border-radius: 9px;
|
|
1713
|
+
position: absolute;
|
|
1714
|
+
top: 0;
|
|
1715
|
+
left: 0;
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
[data-marker-popover], [data-selection-action-popover] {
|
|
1719
|
+
--popover-gap: var(--diffs-popover-gap, var(--diffs-gap-fallback, 8px));
|
|
1720
|
+
--popover-viewport-left: 0px;
|
|
1721
|
+
--popover-viewport-right: 100cqw;
|
|
1722
|
+
--popover-viewport-top: -99999px;
|
|
1723
|
+
--popover-viewport-bottom: 99999px;
|
|
1724
|
+
--popover-min-left: calc(var(--popover-viewport-left) + var(--gutter-width, 0px) + var(--popover-gap));
|
|
1725
|
+
--popover-available-width: max(0px,
|
|
1726
|
+
calc(var(--popover-viewport-right) - var(--popover-min-left) -
|
|
1727
|
+
var(--popover-gap)));
|
|
1728
|
+
max-width: min(640px, var(--popover-available-width));
|
|
1729
|
+
translate: clamp(var(--popover-min-left),
|
|
1730
|
+
var(--popover-x, var(--popover-min-left)),
|
|
1731
|
+
calc(var(--popover-viewport-right) - var(--popover-gap) - 100%))
|
|
1732
|
+
/* Clamp into the scrollport so a popover with no fitting side stays in view. */
|
|
1733
|
+
clamp(var(--popover-viewport-top),
|
|
1734
|
+
calc(var(--popover-y, 0px) + var(--popover-y-shift, 0px)),
|
|
1735
|
+
calc(var(--popover-viewport-bottom) - var(--popover-gap) - 100%));
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
[data-marker-popover] {
|
|
1739
|
+
--diffs-widget-bg: var(--diffs-marker-bg);
|
|
1740
|
+
--diffs-widget-shadow: 0 4px 8px #00000026, 0 6px 18px #00000026;
|
|
1741
|
+
min-width: min(180px, var(--popover-available-width));
|
|
1742
|
+
overflow-wrap: anywhere;
|
|
1743
|
+
color: var(--diffs-marker-contrast);
|
|
1744
|
+
white-space: normal;
|
|
1745
|
+
pointer-events: auto;
|
|
1746
|
+
border: 0;
|
|
1747
|
+
padding: 8px 12px;
|
|
1748
|
+
|
|
1749
|
+
@supports (color: contrast-color(red)) {
|
|
1750
|
+
color: contrast-color(var(--diffs-marker-bg, var(--diffs-bg)));
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
& [data-marker-message] {
|
|
1754
|
+
white-space: normal;
|
|
1755
|
+
overflow-wrap: anywhere;
|
|
1756
|
+
|
|
1757
|
+
& code {
|
|
1758
|
+
white-space: normal;
|
|
1759
|
+
color: inherit;
|
|
1760
|
+
background-color: #0000;
|
|
1761
|
+
display: inline;
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
[data-selection-action-popover] {
|
|
1767
|
+
pointer-events: auto;
|
|
1768
|
+
flex-wrap: wrap;
|
|
1769
|
+
align-items: center;
|
|
1770
|
+
gap: 4px;
|
|
1771
|
+
width: max-content;
|
|
1772
|
+
padding: 4px;
|
|
1773
|
+
display: flex;
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
[data-search-panel] {
|
|
1777
|
+
z-index: 100;
|
|
1778
|
+
flex-direction: column;
|
|
1779
|
+
justify-content: right;
|
|
1780
|
+
width: 100%;
|
|
1781
|
+
height: 0;
|
|
1782
|
+
display: flex;
|
|
1783
|
+
position: sticky;
|
|
1784
|
+
top: 16px;
|
|
1785
|
+
right: 16px;
|
|
1786
|
+
container: search-panel / inline-size;
|
|
1787
|
+
|
|
1788
|
+
& [data-editor-widget] {
|
|
1789
|
+
z-index: 100;
|
|
1790
|
+
flex-shrink: 0;
|
|
1791
|
+
align-items: stretch;
|
|
1792
|
+
gap: 8px;
|
|
1793
|
+
min-width: 260px;
|
|
1794
|
+
max-width: 100%;
|
|
1795
|
+
margin-inline: auto 16px;
|
|
1796
|
+
padding: 4px;
|
|
1797
|
+
display: flex;
|
|
1798
|
+
position: relative;
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
& svg {
|
|
1802
|
+
fill: currentColor;
|
|
1803
|
+
width: 12px;
|
|
1804
|
+
height: 12px;
|
|
1805
|
+
display: block;
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
[data-search-grid] {
|
|
1810
|
+
grid-template-columns: auto auto auto;
|
|
1811
|
+
grid-template-areas: "find matches nav"
|
|
1812
|
+
"replace actions .";
|
|
1813
|
+
align-items: center;
|
|
1814
|
+
gap: 4px 6px;
|
|
1815
|
+
width: 100%;
|
|
1816
|
+
display: grid;
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
[data-input-box][data-find] {
|
|
1820
|
+
grid-area: find;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
[data-search-nav] {
|
|
1824
|
+
grid-area: nav;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
[data-input-box][data-replace] {
|
|
1828
|
+
grid-area: replace;
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
[data-replace-actions] {
|
|
1832
|
+
grid-area: actions;
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
[data-search-grid][data-mode="find"] {
|
|
1836
|
+
grid-template-areas: "find matches nav";
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
[data-search-grid][data-mode="find"] [data-replace-cell] {
|
|
1840
|
+
display: none;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
@container search-panel (width < 400px) {
|
|
1844
|
+
[data-search-panel] [data-editor-widget] {
|
|
1845
|
+
padding: 10px;
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
[data-search-grid][data-mode="replace"] {
|
|
1849
|
+
grid-template-columns: auto 1fr auto;
|
|
1850
|
+
grid-template-areas: "find find find"
|
|
1851
|
+
"replace replace replace"
|
|
1852
|
+
"nav matches actions";
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
[data-search-grid][data-mode="find"] {
|
|
1856
|
+
grid-template-columns: auto 1fr auto;
|
|
1857
|
+
grid-template-areas: "find find find"
|
|
1858
|
+
"nav matches matches";
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
[data-replace-actions] {
|
|
1862
|
+
justify-self: end;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
[data-search-grid] [data-input-box] {
|
|
1866
|
+
width: auto;
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
[data-input-box] {
|
|
1871
|
+
align-items: center;
|
|
1872
|
+
width: 200px;
|
|
1873
|
+
display: flex;
|
|
1874
|
+
position: relative;
|
|
1875
|
+
|
|
1876
|
+
& input {
|
|
1877
|
+
width: 100%;
|
|
1878
|
+
min-width: 0;
|
|
1879
|
+
color: var(--diffs-fg);
|
|
1880
|
+
background-color: var(--diffs-bg);
|
|
1881
|
+
border: 1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));
|
|
1882
|
+
border-radius: 6px;
|
|
1883
|
+
outline: none;
|
|
1884
|
+
flex-grow: 1;
|
|
1885
|
+
padding-inline: 6px;
|
|
1886
|
+
font-size: 13px;
|
|
1887
|
+
line-height: 24px;
|
|
1888
|
+
|
|
1889
|
+
&::selection {
|
|
1890
|
+
background-color: color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg));
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
&:focus-visible {
|
|
1894
|
+
outline: 1px solid var(--diffs-modified-base);
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
&[data-find] input {
|
|
1899
|
+
padding-inline-end: 72px;
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
& [data-search-icon] {
|
|
1903
|
+
--diffs-search-icon-size: 20px;
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
[data-search-toggles] {
|
|
1908
|
+
align-items: center;
|
|
1909
|
+
gap: 1px;
|
|
1910
|
+
display: flex;
|
|
1911
|
+
position: absolute;
|
|
1912
|
+
top: 50%;
|
|
1913
|
+
right: 4px;
|
|
1914
|
+
transform: translateY(-50%);
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
[data-matches] {
|
|
1918
|
+
white-space: nowrap;
|
|
1919
|
+
min-width: 50px;
|
|
1920
|
+
color: color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));
|
|
1921
|
+
flex-shrink: 0;
|
|
1922
|
+
grid-area: matches;
|
|
1923
|
+
font-size: 12px;
|
|
1924
|
+
font-weight: 500;
|
|
1925
|
+
line-height: 20px;
|
|
1926
|
+
|
|
1927
|
+
&[data-no-matches] {
|
|
1928
|
+
color: color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg));
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
[data-replace-actions], [data-search-nav] {
|
|
1933
|
+
align-items: center;
|
|
1934
|
+
display: flex;
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
[data-search-icon] {
|
|
1938
|
+
appearance: none;
|
|
1939
|
+
width: var(--diffs-search-icon-size, 24px);
|
|
1940
|
+
height: var(--diffs-search-icon-size, 24px);
|
|
1941
|
+
color: color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));
|
|
1942
|
+
border-radius: var(--diffs-search-icon-radius, 4px);
|
|
1943
|
+
cursor: pointer;
|
|
1944
|
+
background: none;
|
|
1945
|
+
border: 0;
|
|
1946
|
+
flex-shrink: 0;
|
|
1947
|
+
justify-content: center;
|
|
1948
|
+
align-items: center;
|
|
1949
|
+
margin: 0;
|
|
1950
|
+
padding: 0;
|
|
1951
|
+
transition: background-color .1s ease-in-out, color .1s ease-in-out;
|
|
1952
|
+
display: flex;
|
|
1953
|
+
|
|
1954
|
+
&:disabled {
|
|
1955
|
+
opacity: .25;
|
|
1956
|
+
cursor: default;
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
&:not(:disabled):hover {
|
|
1960
|
+
color: var(--diffs-fg);
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
&:focus-visible {
|
|
1964
|
+
outline: 1px solid var(--diffs-modified-base);
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
&[aria-pressed="true"] {
|
|
1968
|
+
color: var(--diffs-modified-base);
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
[data-search-close] {
|
|
1973
|
+
--diffs-search-icon-size: 20px;
|
|
1974
|
+
--diffs-search-icon-radius: 50%;
|
|
1975
|
+
color: var(--diffs-widget-bg);
|
|
1976
|
+
background-color: color-mix(in lab,
|
|
1977
|
+
var(--diffs-widget-fg) 50%,
|
|
1978
|
+
var(--diffs-bg));
|
|
1979
|
+
position: absolute;
|
|
1980
|
+
top: 0;
|
|
1981
|
+
right: 0;
|
|
1982
|
+
transform: translate(50%, -50%);
|
|
1983
|
+
|
|
1984
|
+
&:not(:disabled):hover {
|
|
1985
|
+
opacity: 1;
|
|
1986
|
+
color: var(--diffs-widget-bg);
|
|
1987
|
+
background-color: var(--diffs-widget-fg);
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
`,gb=`//`,_b=[`/*`,`*/`],vb={sql:{lineComment:`--`},ruby:{lineComment:`#`,blockComment:[`=begin`,`=end`]},rst:{lineComment:`..`},coffeescript:{lineComment:`#`,blockComment:[`###`,`###`]},cmd:{lineComment:`@REM`},julia:{lineComment:`#`,blockComment:[`#=`,`=#`]},yaml:{lineComment:`#`},yml:{lineComment:`#`},markdown:{lineComment:null,blockComment:[`<!--`,`-->`]},zsh:{lineComment:`#`},makefile:{lineComment:`#`},handlebars:{lineComment:null,blockComment:[`{{!--`,`--}}`]},ini:{lineComment:`;`,blockComment:[`;`,` `]},powershell:{lineComment:`#`,blockComment:[`<#`,`#>`]},vb:{lineComment:`'`},xml:{lineComment:null,blockComment:[`<!--`,`-->`]},lua:{lineComment:`--`,blockComment:[`--[[`,`]]`]},html:{lineComment:null,blockComment:[`<!--`,`-->`]},diff:{lineComment:`#`,blockComment:[`#`,` `]},r:{lineComment:`#`},fsharp:{blockComment:[`(*`,`*)`]},pug:{lineComment:`//-`},perl:{lineComment:`#`},tex:{lineComment:`%`},clojure:{lineComment:`;;`},css:{lineComment:null},python:{lineComment:`#`,blockComment:[`"""`,`"""`]},dotenv:{lineComment:`#`},dockerfile:{lineComment:`#`},razor:{lineComment:null,blockComment:[`<!--`,`-->`]},prompt:{lineComment:null,blockComment:[`<!--`,`-->`]}};function yb(e,t){let n={...vb[e],...t?.[e]};return{lineComment:n.lineComment===void 0?gb:n.lineComment,blockComment:n.blockComment??_b}}function bb(e,t,n){let r=[],i=new Set;for(let a of t){let t=a.end.line;a.start.line<t&&a.end.character===0&&t--;let o=r.length,s=1/0;for(let o=a.start.line;o<=t;o++){if(i.has(o))continue;i.add(o);let t=e.getLineText(o),a=t.length-t.trimStart().length,c=a===t.length;c||(s=Math.min(s,a)),r.push({line:o,comment:t.slice(a,a+n.length)===n?a:-1,empty:c,indent:a,single:!1})}if(s!==1/0)for(let e=o;e<r.length;e++)r[e].empty||(r[e].indent=s);r.length===o+1&&(r[o].single=!0)}let a=r.some(e=>e.comment<0&&(!e.empty||e.single)),o=[];if(a){for(let e of r){if(e.empty&&!e.single)continue;let t={line:e.line,character:e.indent};o.push({range:{start:t,end:t},newText:n+` `})}return o}for(let t of r){if(t.comment<0)continue;let r=e.getLineText(t.line),i=t.comment,a=i+n.length+ +(r[i+n.length]===` `);o.push({range:{start:{line:t.line,character:i},end:{line:t.line,character:a}},newText:``})}return o}var xb=50;function Sb(e,t,n,r,i){let a=Math.max(0,r-xb),o=e.getTextSlice(a,r),s=e.getTextSlice(i,i+xb),c=o.length-o.trimEnd().length,l=s.length-s.trimStart().length,u=o.length-c;if(o.slice(u-t.length,u)===t&&s.slice(l,l+n.length)===n)return{open:{start:r-c-t.length,end:r-c+ +(c>0),text:``},close:{start:i+l-+(l>0),end:i+l+n.length,text:``},contentStart:r,contentEnd:i};let d=i-r<=100?e.getTextSlice(r,i):void 0,f=d??e.getTextSlice(r,r+xb),p=d??e.getTextSlice(i-xb,i),m=f.length-f.trimStart().length,h=i-(p.length-p.trimEnd().length)-n.length;if(f.slice(m,m+t.length)!==t||e.getTextSlice(h,h+n.length)!==n)return;let g=r+m,_=g+t.length+ +!!/\s/.test(f[t.length+m]??``),v=h-+!!/\s/.test(e.getTextSlice(h-1,h));return{open:{start:g,end:_,text:``},close:{start:v,end:h+n.length,text:``},contentStart:_,contentEnd:v}}function Cb(e,t,n,r){let i=0,a=t.length;for(;i<a;){let n=i+a>>>1;t[n].end<e?i=n+1:a=n}let o=n[i];for(let n=i;n<t.length;n++){let i=t[n];if(e<i.start)break;if(i.start===i.end&&e===i.start){if(r<0)break;o+=i.text.length;continue}if(e>i.end){o+=i.text.length-(i.end-i.start);continue}return e===i.end?i.start+o+i.text.length:i.start+o+(r>0?i.text.length:0)}return e+o}function wb(e,t,[n,r],i=!1){let a=t.map(t=>{let{start:n,end:r}=t;if(i){let t=r.line;n.line<t&&r.character===0&&t--;let i=e.getLineText(n.line),a=i.length-i.trimStart().length;n={line:n.line,character:a},r={line:t,character:e.getLineLength(t)}}return{from:e.offsetAt(n),to:e.offsetAt(r),direction:t.direction,comment:void 0}});if(i&&a.length>1){a.sort((e,t)=>{let n=e.from-t.from;return n===0?e.to-t.to:n});let e=0;for(let t=1;t<a.length;t++){let n=a[e],r=a[t];r.from<=n.to?n.to=Math.max(n.to,r.to):a[++e]=r}a.length=e+1}for(let t of a)t.comment=Sb(e,n,r,t.from,t.to);let o=a.every(e=>e.comment!==void 0),s=[];for(let e of a){let t=e.comment;if(o&&t!==void 0){s.push(t.open,t.close);continue}if(t===void 0){if(e.from===e.to){s.push({start:e.from,end:e.to,text:n+` `+r});continue}s.push({start:e.from,end:e.from,text:n+` `},{start:e.to,end:e.to,text:` `+r})}}if(s.length===0)return;s.sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});let c=s.map(t=>({range:{start:e.positionAt(t.start),end:e.positionAt(t.end)},newText:t.text}));if(i)return{edits:c,nextSelectionOffsets:[]};let l=a.map(e=>{let t=e.comment;return o&&t!==void 0?{start:t.contentStart,end:t.contentEnd,startAssociation:1,endAssociation:-1}:t===void 0?e.from===e.to?{start:e.from,end:e.to,startAssociation:-1,endAssociation:-1,collapsedInset:n.length+1}:{start:e.from,end:e.to,startAssociation:1,endAssociation:-1}:{start:e.from,end:e.to,startAssociation:1,endAssociation:1}}),u=Array(s.length+1);u[0]=0;for(let e=0;e<s.length;e++){let t=s[e];u[e+1]=u[e]+t.text.length-(t.end-t.start)}return{edits:c,nextSelectionOffsets:l.map((e,t)=>{let n=Cb(e.start,s,u,e.startAssociation)+(e.collapsedInset??0);return[n,e.collapsedInset===void 0?Cb(e.end,s,u,e.endAssociation):n,a[t].direction]})}}function J(e,t,n){let{style:r,dataset:i,children:a,...o}=t??{},s=document.createElement(e);return Object.assign(s,o),r!==void 0&&(typeof r==`string`?s.style.cssText=r:Object.assign(s.style,r)),i!==void 0&&(typeof i==`string`?s.dataset[i]=``:Array.isArray(i)?i.forEach(e=>{s.dataset[e]=``}):Object.assign(s.dataset,i)),a!==void 0&&s.replaceChildren(...a),n!==void 0&&n.appendChild(s),s}function Y(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function Tb(e,t=`line`){let n=e.dataset[t];if(n===void 0)return;let r=parseInt(n,10);if(!Number.isNaN(r))return r}function Eb(e,t){if(e.nodeType===3){let n=e.textContent?.length??0;return Math.max(0,Math.min(t,n))}return e.nodeType===1?Math.max(0,Math.min(t,e.childNodes.length)):0}function Db(e,t){return Object.assign(e,t)}function Ob(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}function kb(e,t=1e3){return Math.round(e*t)/t}function Ab(e){return e.endsWith(`
|
|
1991
|
+
`)||e.endsWith(`\r`)}function jb(e){if(!(typeof Intl>`u`||typeof Intl.Segmenter!=`function`))return new Intl.Segmenter(void 0,e)}var Mb,Nb=!1;function Pb(){return Nb||=(Mb=jb({granularity:`grapheme`}),!0),Mb}function Fb(e){let t=e.ownerDocument,n=e.parentElement;for(;n!=null&&n!==t.body&&n!==t.documentElement;){let e=n.ownerDocument.defaultView?.getComputedStyle(n).overflowY;if(e===`auto`||e===`scroll`||e===`overlay`)return n;n=n.parentElement}return t}function Ib(e,t){let n=Lb(e);if(n.length===0)return;let r=[],i=!1;for(let a of t){if(a.side===`deletions`||a.lineNumber<=0){r.push(a);continue}let t=a.lineNumber-1,o=e.previousLineCount,s=!1;for(let e of n){let n=Math.max(1,o+e.lineDelta),r=Rb(t,e,n);if(r===void 0){s=!0,t=void 0;break}(r!==t||Bb(t,e))&&(s=!0),t=r,o=n}if(t===void 0){i=!0;continue}let c=t+1;if(s){r.push(c===a.lineNumber?a:{...a,lineNumber:c}),i=!0;continue}r.push(a)}return i?r:void 0}function Lb(e){if(e.changedLineChanges!==void 0)return e.changedLineChanges.flatMap(([e,t,n,r=0,i=0,a=!1])=>{if(n===0)return[];let o=Math.max(0,t-e);return[{startLine:e,startCharacter:r,endLine:e+Math.max(0,o-n),deletesEndLine:n<0&&a,insertedLineBreaks:o,lineDelta:n}]});if(e.lineDelta===0)return e.changedLineRanges.flatMap(([e,t])=>{let n=t-e;return n<=0?[]:[{startLine:e,startCharacter:0,endLine:e,deletesEndLine:!1,insertedLineBreaks:n,lineDelta:n}]});let t=Math.max(0,-e.lineDelta),n=e.endedAtDocumentEnd&&e.startLine+t===e.previousLineCount-1;return[{startLine:e.startLine,startCharacter:e.startCharacter,endLine:e.startLine+t,deletesEndLine:n,insertedLineBreaks:Math.max(0,e.lineDelta),lineDelta:e.lineDelta}]}function Rb(e,t,n){if(e<t.startLine)return e;if(e>t.endLine||t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)return e+t.lineDelta;if(t.startLine===t.endLine)return t.startCharacter===0?e+t.insertedLineBreaks:e;if(zb(e,t))return;let r=Math.min(Math.max(0,e-t.startLine),t.insertedLineBreaks);return Vb(t.startLine+r,n)}function zb(e,t){return!(t.lineDelta>=0||e<t.startLine||e>t.endLine||e===t.startLine&&t.startCharacter>0||e===t.endLine&&!t.deletesEndLine)}function Bb(e,t){return t.lineDelta===0||e<t.startLine||e>t.endLine?!1:!(t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)}function Vb(e,t){return Math.max(0,Math.min(e,Math.max(0,t-1)))}function Hb(e,t,n){let r=new Map,i=new Map;for(let t of e){let e=t.lineNumber;r.has(e)||r.set(e,[]),i.has(e)||i.set(e,[]),(t.side===`deletions`?i:r).get(e).push(bt(t))}let a=t.parentElement?.previousElementSibling,o,s;if(a!=null&&a instanceof HTMLElement&&a.dataset.deletions!==void 0)for(let e of a.children){let t=e,{gutter:n,content:r}=t.dataset;n===void 0?r!==void 0&&(s=t):o=t}Ub(t,n),s!==void 0&&Ub(s,o);let c=Wb(r,t,n);if(s===void 0)return;let l=Wb(i,s,o);requestAnimationFrame(()=>{Gb(r,i,c,l)})}function Ub(e,t){let n=[];for(let r=1;r<e.childElementCount;r++){let i=e.children[r];i.dataset.lineAnnotation!==void 0&&(n.push(i),t!==void 0&&n.push(t.children[r]))}for(let e of n)e.remove()}function Wb(e,t,n){let r=new Map;for(let n of t.children){let t=Tb(n);if(t!==void 0){let i=e.get(t);if(i!==void 0){let e=J(`div`,{dataset:{lineAnnotation:`0,`+(t-1)},children:[J(`div`,{dataset:`annotationContent`,children:i.map(e=>J(`slot`,{name:e}))})]});n.after(e),r.set(t,e)}}}if(n!==void 0)for(let t of n.children){let n=Tb(t,`columnNumber`);if(n!==void 0&&e.has(n)){let e=J(`div`,{dataset:{gutterBuffer:`annotation`,bufferSize:`1`},style:{gridRow:`span 1`}});t.after(e)}}return r}function Gb(e,t,n,r){let i=new Map;for(let[t,n]of e.entries()){let e=r.get(t);if(n.length===0&&e!==void 0){let n=Kb(e);n>0&&i.set(t,n)}}for(let[e,r]of t.entries()){let t=n.get(e);if(r.length===0&&t!==void 0){let n=Kb(t);n>0&&i.set(e,n)}}qb(e,n,i),qb(t,r,i)}function Kb(e){let t=e.firstElementChild;return t instanceof HTMLElement?t.getBoundingClientRect().height:0}function qb(e,t,n){for(let[r,i]of t.entries()){let t=e.get(r),a=n.get(r);t?.length===0&&a!==void 0&&i.style.setProperty(`--diffs-annotation-min-height`,`${a}px`)}}var Jb=class{#e;#t;#n;#r;#i;#a;#o=0;#s=0;#c=0;#l=!0;#u;#d=new Map;#f;#p;constructor(e){this.#f=e.hasActivePopover,this.#p=e.updateActivePopover}setViewportElements(e,t){let n=this.#e!==e||this.#t!==t;this.#e=e,n&&(this.#t=t,this.#l=!0,this.#u?.forEach(e=>e()),this.#u=void 0)}cleanUp(){this.#t=void 0,this.#e=void 0,this.#n=void 0,this.#r=void 0,this.#i=void 0,this.#a=void 0,this.#o=0,this.#s=0,this.#c=0,this.#l=!0,this.#u?.forEach(e=>e()),this.#u=void 0,this.#d.clear()}resetPlacement(e=`default`){this.#d.delete(e)}setPlacement(e,t=`default`){this.#d.set(t,e)}choosePlacement(e){let{preferred:t,fallback:n,viewport:r,popoverHeight:i,atDocumentEdge:a,placementKey:o=`default`}=e,s=this.#d.get(o),c;if(r!==void 0&&i>0){let e=(e,t=0)=>e.top>=r.top+t&&e.bottom<=r.bottom-t;c=s===`fallback`&&e(n)&&!e(t,4)||!e(t)&&e(n)?`fallback`:`preferred`}else c=a?`fallback`:`preferred`;return this.#d.set(o,c),c}getPlacementBounds(){let e=this.#g();if(e===void 0)return;let t=this.#_(),n,r;if(t===void 0?(n=0,r=window.innerHeight):(n=t.top,r=t.bottom),n=Math.max(n,e.top),r=Math.min(r,e.bottom),r<=n)return;let i=this.#o,a=this.#s,o=this.#c>0?this.#c:e.width,s=t===void 0?0:t.left,c=t===void 0?window.innerWidth:t.right,l=i,u=i+o,d=Math.max(l,s-e.left+i),f=Math.min(u,c-e.left+i);return{top:n-e.top+a,bottom:r-e.top+a,left:d,right:Math.max(d,f)}}#m(){let e=this.#e;if(e===void 0)return;if(this.#r===e&&(this.#n===void 0||this.#n.isConnected))return this.#n;let t=e.parentElement;for(;t!==null;){let n=getComputedStyle(t).overflowY;if(n===`auto`||n===`scroll`||n===`overlay`)return this.#n=t,this.#r=e,t;t=t.parentElement}this.#n=void 0,this.#r=e}#h(){if(!this.#l)return;this.#v();let e=this.#t;this.#i=e?.getBoundingClientRect(),this.#o=e?.scrollLeft??0,this.#s=e?.scrollTop??0,this.#c=e?.clientWidth??0,this.#a=this.#m()?.getBoundingClientRect(),this.#l=!1}#g(){return this.#h(),this.#i}#_(){return this.#h(),this.#a}#v(){if(this.#u!==void 0)return;let e,t=()=>{this.#l=!0,!(!this.#f()||e!==void 0)&&(e=requestAnimationFrame(()=>{e=void 0,this.#p()}))},n=this.#m(),r=this.#t;this.#u=[Y(n===void 0?window:n,`scroll`,t,{passive:!0}),...r===void 0?[]:[Y(r,`scroll`,t,{passive:!0})],Y(window,`resize`,t,{passive:!0}),()=>{e!==void 0&&(cancelAnimationFrame(e),e=void 0)}]}};function Yb(e,{gutterWidth:t,placeAbove:n,viewport:r,x:i,y:a}){if(e.style.setProperty(`--gutter-width`,t+`px`),e.style.setProperty(`--popover-x`,i+`px`),e.style.setProperty(`--popover-y`,a+`px`),e.style.setProperty(`--popover-y-shift`,n?`-100%`:`0px`),r===void 0){e.style.removeProperty(`--popover-viewport-left`),e.style.removeProperty(`--popover-viewport-right`),e.style.removeProperty(`--popover-viewport-top`),e.style.removeProperty(`--popover-viewport-bottom`);return}e.style.setProperty(`--popover-viewport-left`,r.left+`px`),e.style.setProperty(`--popover-viewport-right`,r.right+`px`),e.style.setProperty(`--popover-viewport-top`,r.top+`px`),e.style.setProperty(`--popover-viewport-bottom`,r.bottom+`px`)}var Xb=new Map([[`'`,`'`],[`"`,`"`],["`","`"],[`{`,`}`],[`[`,`]`],[`<`,`>`],[`(`,`)`]]),Zb=new Set([`'`,`"`,"`"]),Qb=new Set([`{`,`[`,`(`,`<`]);function $b(e,t=0){let n=nS(e.startContainer,e.startOffset),r=nS(e.endContainer,e.endOffset);if(n!==null&&r!==null)return{start:n,end:r,direction:t}}function ex(e,t,n,r){if(e===void 0)return[[],t];let{start:i,end:a}=t,o=[],s={...t},c=i.line!==a.line,l=a.line;i.line<a.line&&a.character===0&&l--;for(let t=i.line;t<=l;t++){let l=e.getLineText(t);if(l===void 0||c&&l.trim().length===0)continue;let u=l.startsWith(` `)?` `:` `.repeat(n),d=0,f=u;if(r){if(l.startsWith(` `))d=1;else if(l.startsWith(` `)){let e=l.length-l.trimStart().length;d=Math.min(u.length,e)}if(d===0)continue;f=``}o.push({range:{start:{line:t,character:0},end:{line:t,character:d}},newText:f});let p=f.length-d;t===i.line&&(s={...s,start:{...i,character:Math.max(0,i.character+p)}}),t===a.line&&(s={...s,end:{...a,character:Math.max(0,a.character+p)}})}return[o,s]}function tx(e,t,n,r={}){let i=e.lineCount;return t.map(t=>{let{line:a,character:o}=n===`up`||n===`left`?t.start:t.end;if(n===`textStart`||n===`start`||n===`end`){let i=Z(t);a=i.line,o=i.character;let s=ix(e,a,o,r);if(n===`textStart`){let t=e.getLineText(a).slice(s.start,s.end),n=s.start+$x(t);o=o===n?s.start:n}else o=n===`start`?s.start:s.end}else if(n===`up`){let t=nx(e,a,o,-1,r);t===void 0?a>0&&(a=r.resolveRenderableLine==null?a-1:r.resolveRenderableLine(a-1,`up`)??a):(a=t.line,o=t.character)}else if(n===`down`){let t=nx(e,a,o,1,r);if(t!==void 0)a=t.line,o=t.character;else{let e=Math.max(i-1,0);a<e&&(a=r.resolveRenderableLine==null?a+1:Math.min(r.resolveRenderableLine(a+1,`down`)??a,e))}}else if(X(t)){let t=e.getLineLength(a);if(o=Math.min(o,t),n===`left`){if(o>0)o=Yx(e,a,o,!1);else if(a>0){let t=r.resolveRenderableLine==null?a-1:r.resolveRenderableLine(a-1,`up`);t!==void 0&&(a=t,o=e.getLineLength(a))}}else if(o<t)o=Yx(e,a,o,!0);else if(a<i-1){let e=r.resolveRenderableLine==null?a+1:r.resolveRenderableLine(a+1,`down`);e!==void 0&&(a=Math.min(e,i-1),o=0)}}let s={line:a,character:o};return{start:s,end:s,direction:0}})}function nx(e,t,n,r,i){if(i.getSoftLineOffsets===void 0)return;let a=ix(e,t,n,i),o=a.index+r,s=t,c;if(o>=0&&o<a.count)c=ox(e,s,o,i);else{let a=t+r;if(a<0||a>=e.lineCount)return{line:t,character:n};let o=i.resolveRenderableLine==null?a:i.resolveRenderableLine(a,r<0?`up`:`down`);if(o===void 0)return{line:t,character:n};s=Math.min(o,e.lineCount-1);let l=ax(e,s,i);c=ox(e,s,r<0?l-1:0,i)}let l=Math.max(0,n-a.start),u=c.start+l,d=c.index===c.count-1?u:Math.min(u,c.end),f=e.getLineText(s);return{line:s,character:d>f.length?d:rx(f,d)}}function rx(e,t){if(t<=0||t>=e.length)return t;let n=Pb();if(n!==void 0){for(let r of n.segment(e)){if(t<=r.index)return t;let e=r.index+r.segment.length;if(t<e)return e}return t}let r=0;for(let n of e){if(t<=r)return t;let e=r+n.length;if(t<e)return e;r=e}return t}function ix(e,t,n,r){let i=e.getLineLength(t),a=r.getSoftLineOffsets?.(t);if(a===void 0||a.length<2)return{start:0,end:i,index:0,count:1};for(let i=0;i+1<a.length;i++){let a=ox(e,t,i,r);if(n>=a.start&&n<=a.end)return a}return ox(e,t,n<(a[0]??0)?0:a.length-2,r)}function ax(e,t,n){let r=n.getSoftLineOffsets?.(t);return r===void 0||r.length<2?1:r.length-1}function ox(e,t,n,r){let i=e.getLineLength(t),a=r.getSoftLineOffsets?.(t);if(a===void 0||a.length<2)return{start:0,end:i,index:0,count:1};let o=a.length-1,s=Math.max(0,Math.min(n,o-1)),c=Math.max(0,Math.min(i,a[s]??0));return{start:c,end:Math.max(c,Math.min(i,a[s+1]??i)),index:s,count:o}}function sx(e,t,n,r={}){return t.map(t=>{let i=t.direction===-1?t.start:t.end,[a]=tx(e,[{start:i,end:i,direction:0}],n,r);return Tx(t,a)})}function cx(e,t,n,r,i=2,a=!1){if(t[t.length-1]===void 0)return{nextSelections:[]};let o=[];for(let e of t)o.push(e.start,e.end);let s=o.map(t=>e.offsetAt(t)),c=s[(t.length-1)*2],l=s[(t.length-1)*2+1],u=[],d=!0;for(let e=0;e<t.length;e++){let t={index:e,start:s[e*2],end:s[e*2+1]},n=u[u.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(d=!1),u.push(t)}d||u.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let f=tS(e,n,i),p=[],m=Array.from({length:t.length}),h=0,g,_=()=>{if(g===void 0)return;let t=tS(e,{start:g.start,end:g.end,text:f.text},i),n=Qx(e,t.text,t.start);p.push({start:t.start,end:t.end,text:n});let r=[g.start+h+n.length,g.start+h+n.length];for(let e of g.indices)m[e]=r;h+=n.length-(t.end-t.start),g=void 0};for(let e of u){let t=Math.max(0,e.start+(f.start-c)),n=Math.max(t,e.end+(f.end-l));if(g!==void 0&&t<g.end){g.end=Math.max(g.end,n),g.indices.push(e.index);continue}_(),g={start:t,end:n,indices:[e.index]}}_();let v=e.applyResolvedEdits(p,!0,t,void 0,a),y=eS(e,m.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(y),v!==void 0&&r!==void 0){let t=Ib(v,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:y,change:v}}function lx(e,t){if(t.length!==e.length+2)return;let n=Xb.get(t[0]);if(n!==void 0&&t[t.length-1]===n&&t.slice(1,-1)===e)return 1}function ux(e,t,n,r){let i=t.start+n,a=i+r.length;if(t.end-t.start>0){let n=e.getTextSlice(t.start,t.end),a=lx(n,r)??r.indexOf(n);if(a!==-1&&a+n.length<=r.length){let e=i+a;return[e,e+n.length]}}return[a,a]}function dx(e,t,n,r,i=!1,a=`selection`){if(t.length!==n.length)throw Error(`Selection text replacements must match the selection count`);let o=[];for(let e of t)o.push(e.start,e.end);let s=o.map(t=>e.offsetAt(t)),c=[],l=!0;for(let e=0;e<t.length;e++){let t={index:e,start:s[e*2],end:s[e*2+1]},n=c[c.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(l=!1),c.push(t)}l||c.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let u=n.every(e=>e===``),d,f=Array.from({length:t.length});if(u){d=[];let e=!1;for(let t of c){if(f[t.index]=[t.end,t.end],t.start>=t.end)continue;e=!0;let n=d[d.length-1];n!==void 0&&t.start<n.end?d[d.length-1]={start:n.start,end:Math.max(n.end,t.end),text:``}:d.push({start:t.start,end:t.end,text:``})}if(!e)return{nextSelections:t};for(let e of c){let t=e.end,n=0,r=t;for(let e of d){if(t<=e.start)break;if(t>=e.end){n-=e.end-e.start;continue}r=e.start+n;break}r===t&&(r+=n),f[e.index]=[r,r]}}else{d=[];let t=0,r=-1;for(let i=0;i<c.length;i++){let o=c[i];if(o.start<r)throw Error(`Overlapping multi-selection edits are not supported`);r=o.end;let s=Qx(e,n[a===`document`?i:o.index],o.start);d.push({start:o.start,end:o.end,text:s}),f[o.index]=ux(e,o,t,s),t+=s.length-(o.end-o.start)}}let p=e.applyResolvedEdits(d,!0,t,void 0,i),m=eS(e,f.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(m),p!==void 0&&r!==void 0){let t=Ib(p,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:m,change:p}}function fx(e,t){return e===`never`?!1:e===`brackets`?Qb.has(t):e!==`quotes`||Zb.has(t)}function px(e,t,n,r){if(n.length!==1||t.length===0)return;let i=Xb.get(n);if(i===void 0||!fx(r,n))return;let a=[];for(let r of t){if(X(r))return;a.push(n+e.getText(r)+i)}return a}function mx(e,t,n){let r=[],i=[];for(let n of t){let[t,a]=Xx(e,n);if(!X(n)){i.push([t,a]);continue}let{line:o,character:s}=n.start,c=t,l=e.getLineText(o),u=l.length,d=c-s,f=Jx(l),p;if(s>0&&s<u){let e=qx(l,s,!1,f),t=qx(l,s,!0,f);p={start:d+e,end:d+t,text:l.slice(s,t)+l.slice(e,s)},i.push([d+t,d+t])}else if(s===u&&f.length>=2){let e=f[f.length-1],t=f[f.length-2];p={start:d+t,end:c,text:l.slice(e,u)+l.slice(t,e)},i.push([c,c])}else if(s===0&&o>0&&u>0){let t=o-1,n=e.getLineText(t),r=n.length,a=e.offsetAt({line:t,character:r}),s=r>0?qx(n,r,!1,Jx(n)):r,u=qx(l,0,!0,f),d=a-(r-s),m=l.slice(0,u)+e.getTextSlice(a,c)+n.slice(s,r);p={start:d,end:c+u,text:m};let h=d+m.length;i.push([h,h])}else{i.push([t,a]);continue}r.push(p)}if(r.length===0)return{nextSelections:t};r.sort((e,t)=>e.start-t.start);for(let e=1;e<r.length;e++)if(r[e].start<r[e-1].end)throw Error(`Overlapping multi-selection edits are not supported`);let a=e.applyResolvedEdits(r,!0,t),o=eS(e,i);if(e.setLastUndoSelectionsAfter(o),a!==void 0&&n!==void 0){let t=Ib(a,n);t!==void 0&&e.setLastUndoLineAnnotations(n,t)}return{nextSelections:o,change:a}}function hx(e,t,n){let r=t.map(t=>{let n=Zx(e,t);return{start:n.start,end:n.end,direction:0}});return dx(e,r,r.map(()=>``),n)}function gx(e,t,n,r){let i=t.map(t=>{if(!X(t))return{start:t.start,end:t.end,direction:0};let r=Z(t),{line:i,character:a}=r,o=n?.(i,a)??0;if(a>o)return{start:{line:i,character:o},end:{line:i,character:a},direction:0};if(i===0)return{start:r,end:r,direction:0};let s=e.getLineLength(i-1);return{start:{line:i-1,character:s},end:{line:i,character:0},direction:0}});return dx(e,i,i.map(()=>``),r)}function _x(e,t,n){let r=t.map(t=>{let[n,r]=Kx(e,t);return{start:n,end:r,direction:0}});return dx(e,r,r.map(()=>``),n)}function vx(e,t,n){if(!X(t))return[t.start,t.end];let r=Z(t),{line:i,character:a}=r,o=e.getLineLength(i),s=e.lineCount;if(a=Math.min(a,o),n)return a<o?[{line:i,character:a},{line:i,character:Yx(e,i,a,!0)}]:i<s-1?[{line:i,character:o},{line:i+1,character:0}]:[r,r];if(a>0)return[{line:i,character:Yx(e,i,a,!1)},{line:i,character:a}];if(i>0){let t=e.getLineLength(i-1);return[{line:i-1,character:t},{line:i,character:0}]}return[r,r]}function yx(e,t,n,r,i=2){let a=t.map(t=>{let[r,a]=vx(e,t,n);if(!n&&X(t)){let t=tS(e,{start:e.offsetAt(r),end:e.offsetAt(a),text:``},i);r=e.positionAt(t.start),a=e.positionAt(t.end)}return{start:r,end:a,direction:0}});return dx(e,a,a.map(()=>``),r)}function X(e){return e.start.line===e.end.line&&e.start.character===e.end.character}function Z(e){let{start:t,end:n,direction:r}=e;return r===-1?t:n}function bx(e){return e===`context`||e===`context-expanded`||e===`change-addition`}function xx(e,t){let n=X(e),r=X(t);return n&&r?Q(e.start,t.start)===0:n?Q(t.start,e.start)<=0&&Q(e.start,t.end)<=0:r?Q(e.start,t.start)<=0&&Q(t.start,e.end)<=0:Q(e.start,t.end)<0&&Q(t.start,e.end)<0}function Q(e,t){return e.line===t.line?e.character-t.character:e.line-t.line}function Sx(e,t,n){let r=t===n?0:t<n?1:-1,i=Math.min(t,n),a=Math.max(t,n);return{start:e.positionAt(i),end:e.positionAt(a),direction:r}}function Cx(e,t){let n=0;for(let r of t){if(e<r.start)break;if(e>=r.end)n+=r.text.length-(r.end-r.start);else return r.start+n+r.text.length}return e+n}function wx(e,t,n,r){return t.map((t,i)=>{let[a,o]=n[i],s=Cx(a,r),c=Cx(o,r);return Sx(e,t.direction===-1?c:s,t.direction===-1?s:c)})}function Tx(e,t){let n=e.direction===-1?e.end:e.start,r=Q(n,t.start),i=Q(n,t.end),a=t.end;a=r<=0?t.end:i>=0?t.start:r===0?t.end:t.start;let o=Q(n,a);return{start:o<=0?n:a,end:o<=0?a:n,direction:o===0?0:o<0?1:-1}}function Ex(e,t){let n=Q(t.start,e.start)<0,r=Q(t.end,e.end)>0;return n&&!r?{start:t.start,end:e.end,direction:-1}:r&&!n?{start:e.start,end:t.end,direction:1}:e.direction===-1?{start:t.start,end:e.end,direction:Q(t.start,e.end)===0?0:-1}:{start:e.start,end:t.end,direction:Q(e.start,t.end)===0?0:1}}function Dx(e,t){return Ox(e.map(e=>Ex(e,t)))}function Ox(e){if(e.length<=1)return e;let t=e.map((e,t)=>({index:t,selection:e})).sort((e,t)=>{let n=Q(e.selection.start,t.selection.start);if(n!==0)return n;let r=Q(e.selection.end,t.selection.end);return r===0?e.index-t.index:r}),n=[],r=t[0];for(let e of t.slice(1)){if(xx(r.selection,e.selection)){let t=e.index>r.index?e:r,n=Q(e.selection.start,r.selection.start)<0?e.selection.start:r.selection.start,i=Q(e.selection.end,r.selection.end)>0?e.selection.end:r.selection.end,a=t.selection.direction;a===0&&Q(n,i)!==0&&(a=Q(t.selection.start,n)===0?-1:1),r={index:t.index,selection:{direction:a,end:i,start:n}};continue}n.push(r),r=e}return n.push(r),n.sort((e,t)=>e.index-t.index).map(({selection:e})=>e)}function kx(e){let t=e.map(e=>{let t=e.end.line;return e.end.character===0&&Q(e.start,e.end)!==0&&t--,{startLine:e.start.line,endLine:Math.max(e.start.line,t)}}).sort((e,t)=>{let n=e.startLine-t.startLine;return n===0?e.endLine-t.endLine:n}),n=[];for(let e of t){let t=n.at(-1);t!==void 0&&e.startLine<=t.endLine+1?t.endLine=Math.max(t.endLine,e.endLine):n.push({...e})}return n}function Ax(e,t,n,r){let i=e=>{let i=e.line+t;if(i>=n){let e=Math.max(0,n-1);return{line:e,character:r(e)}}return i<0?{line:0,character:0}:{line:i,character:e.character}};return{start:i(e.start),end:i(e.end),direction:e.direction}}function jx(e,t){if(t.length===0)return;let n=t.map(t=>X(t)?Wx(e,t):t),r=n.map(t=>e.getText(t)),i=r[0];if(i.length===0||r.some(e=>e!==i))return;let a=n.map(t=>[e.offsetAt(t.start),e.offsetAt(t.end)]),o=e.findNextNonOverlappingSubstring(i,a);if(o===void 0)return n.some((e,n)=>{let r=t[n];return Q(e.start,r.start)!==0||Q(e.end,r.end)!==0||e.direction!==r.direction})?n:void 0;let s=Sx(e,o,o+i.length);return[...n,s]}function Mx(e){let t=e.lineCount-1;return{start:{line:0,character:0},end:{line:t,character:e.getLineLength(t)},direction:1}}function Nx(e,t,n){let r=0;if(t){let t=e.lineCount-1;r=n===!0&&t>0&&e.getLineLength(t)===0?t-1:t}let i=t?e.getLineLength(r):0,a={line:r,character:i};return{start:a,end:a,direction:1}}function Px(e,t){if(X(t)){let n=t.start.line;return{start:e.offsetAt({line:n,character:0}),end:n<e.lineCount-1?e.offsetAt({line:n+1,character:0}):e.offsetAt({line:n,character:e.getLineLength(n)})}}let n=e.offsetAt(t.start),r=e.offsetAt(t.end);return n<=r?{start:n,end:r}:{start:r,end:n}}function Fx(e,t){return t.map(t=>Px(e,t)).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n})}function Ix(e,t){return Fx(e,t).map(({start:t,end:n})=>e.getTextSlice(t,n))}function Lx(e,t){let n=Fx(e,t),r=e.eol,i=``,a=-1;for(let t of n)if(!(t.end<=t.start)){if(t.start<=a){t.end>a&&(i+=e.getTextSlice(a,t.end),a=t.end);continue}i.length>0&&!Ab(i)&&(i+=r),i+=e.getTextSlice(t.start,t.end),a=t.end}return i}function Rx(e,t){if(X(t))return zx(e,t);let[n,r]=Q(t.start,t.end)<=0?[t.start,t.end]:[t.end,t.start];return{start:e.offsetAt(n),end:e.offsetAt(r),text:``}}function zx(e,t){let n=t.start.line,r=e.offsetAt({line:n,character:0}),i=e.offsetAt({line:n,character:e.getLineLength(n)});return n<e.lineCount-1?{start:r,end:e.offsetAt({line:n+1,character:0}),text:``}:n>0?{start:e.offsetAt({line:n-1,character:e.getLineLength(n-1)}),end:i,text:``}:{start:r,end:i,text:``}}function Bx(e){let t=[];for(let{edit:n}of e){if(n.start>=n.end)continue;let e=t.at(-1);e!==void 0&&n.start<=e.end?t[t.length-1]={start:e.start,end:Math.max(e.end,n.end),text:``}:t.push(n)}return t}function Vx(e,t){let n=Array.from({length:e.length}),r=0,i=0;for(let a of e){for(;r<t.length&&a.edit.start>t[r].end;){let e=t[r];i-=e.end-e.start,r++}let e=t[r];e!==void 0&&a.edit.start>=e.start&&a.edit.start<=e.end?n[a.index]=e.start+i:n[a.index]=a.edit.start+i}return n}function Hx(e,t){let n=[...t.map((t,n)=>({index:n,edit:Rx(e,t)}))].sort((e,t)=>{let n=e.edit.start-t.edit.start;if(n!==0)return n;let r=e.edit.end-t.edit.end;return r===0?e.index-t.index:r}),r=Bx(n);return{text:Lx(e,t),edits:r,nextSelectionOffsets:Vx(n,r)}}function Ux(e,t){let n=Math.max(0,t),r=rS(e),i=null;for(let e of r){i=e;let t=dS(e);if(n<=t+(e.textContent?.length??0)){let r=iS(e,n<t?0:n-t);if(r!==null)return r}}if(i!==null){let e=iS(i,i.textContent?.length??0);return e===null?[i,0]:e}let a=0,o=null;for(let t of e.childNodes){if(t.nodeType===1&&t.tagName===`BR`)return[t,0];if(t.nodeType!==3)continue;o=t;let e=fS(o.textContent,o.textContent?.length??0);if(n<=a+e)return[o,fS(o.textContent,n-a)];a+=e}return o===null?[e,0]:[o,fS(o.textContent,o.textContent?.length??0)]}function Wx(e,t){let{line:n,character:r}=t.start,i=e.getLineText(n),a=Gx(i,Math.max(0,Math.min(r,i.length)));return a===void 0?t:{start:{line:n,character:a.start},end:{line:n,character:a.end},direction:1}}function Gx(e,t){let n=jb({granularity:`word`});if(n!==void 0){for(let r of n.segment(e)){if(r.isWordLike!==!0)continue;let e=r.index,n=e+r.segment.length;if(t>=e&&t<=n)return{start:e,end:n}}return}let r=/[\p{Alphabetic}\p{Number}_]+/gu,i;for(;(i=r.exec(e))!==null;){let e=i.index,n=e+i[0].length;if(t>=e&&t<=n)return{start:e,end:n}}}function Kx(e,t){if(!X(t))return[t.start,t.end];let n=Z(t),{line:r,character:i}=n;if(i===0){if(r===0)return[n,n];let t=e.getLineLength(r-1);return[{line:r-1,character:t},{line:r,character:0}]}let a=e.getLineText(r),o=Jx(a),s=i,c;for(;s>0;){let e=qx(a,s,!1,o),t=a.slice(e,s),n=/\S/.test(t)?/\p{Alphabetic}|\p{Number}|_/u.test(t)?1:2:0;if(c!==void 0&&n!==c)break;(n!==0||s!==i)&&(c=n),s=e}return[{line:r,character:s},{line:r,character:i}]}function qx(e,t,n,r){if(n){for(let e of r)if(e>t)return e;return e.length}for(let e=r.length-1;e>=0;e--){let n=r[e];if(n<t)return n}return 0}function Jx(e){let t=[0],n=Pb();if(n!==void 0){for(let r of n.segment(e))r.index>0&&t.push(r.index);return t}let r=0;for(let n of e)r>0&&t.push(r),r+=n.length;return t}function Yx(e,t,n,r){let i=e.getLineLength(t);if(r){if(n>=i)return i;let r=e.offsetAt({line:t,character:0}),a=e.getTextSlice(r+n,r+i),o=Pb();if(o!==void 0){for(let e of o.segment(a))return n+e.segment.length;return i}for(let e of a)return n+e.length;return i}if(n<=0)return 0;let a=e.offsetAt({line:t,character:0}),o=e.getTextSlice(a,a+n),s=0,c=Pb();if(c!==void 0){for(let e of c.segment(o))s=e.index;return s}let l=0;for(let e of o)s=l,l+=e.length;return s}function Xx(e,t){let n=t.direction===-1;return[e.offsetAt(n?t.end:t.start),e.offsetAt(Z(t))]}function Zx(e,t){if(!X(t))return{start:t.start,end:t.end};let{line:n,character:r}=t.start,i=e.getLineText(n).length;return r<i?{start:{line:n,character:r},end:{line:n,character:i}}:n<e.lineCount-1?{start:{line:n,character:r},end:{line:n+1,character:0}}:{start:{line:n,character:r},end:{line:n,character:r}}}function Qx(e,t,n){if(t!==`
|
|
1992
|
+
`&&t!==`\r`&&t!==`\r
|
|
1993
|
+
`)return t;let r=e.positionAt(n).line,i=e.getLineText(r),a=$x(i);return a===0?t:t+i.slice(0,a)}function $x(e){let t=0;for(;t<e.length;t++){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}return t}function eS(e,t){let n=[];for(let[e,r]of t)n.push(Math.min(e,r),Math.max(e,r));let r=e.positionsAt(n);return t.map(([e,t],n)=>{let i=e===t?0:e<t?1:-1;return{start:r[n*2],end:r[n*2+1],direction:i}})}function tS(e,t,n){if(t.text!==``||t.start!==t.end-1)return t;let r=e.positionAt(t.end);if(r.character===0)return t;let i=e.getLineText(r.line),a=i.slice(0,r.character);if(/[^ \t]/.test(a)||i[r.character-1]===` `)return t;let o=Math.max(0,r.character-n),s=i.slice(o,r.character);return s.length===n&&/^ +$/.test(s)?{...t,start:t.end-s.length}:t}function nS(e,t){let n=e.nodeType===1?e:e.parentElement;for(;n!==null&&uS(n)===void 0;)n=n.parentElement;if(n===null)return null;let r=uS(n);if(r===void 0)return null;if(e.nodeType===3)return e.parentElement===null?null:cS(e.parentElement)===null?{line:r,character:sS(n,e)+fS(e.textContent,t)}:{line:r,character:lS(e,t)};if(e.nodeType===1){let i=e;if(i.tagName===`DIV`){let e=0;for(let n=0;n<t;n++)e=lS(i.childNodes[n]);return{line:r,character:e}}if(i.tagName===`BR`)return{line:r,character:0};if(i.tagName===`SPAN`){if(t<i.childNodes.length){let e=i.childNodes[t];if(e?.nodeType===1){let t=dS(e);if(t!==void 0)return{line:r,character:t};let n=cS(e),i=n===null?void 0:dS(n);if(i!==void 0)return{line:r,character:i}}}return{line:r,character:t>0?lS(i.childNodes[t-1]):sS(n,i)}}return{line:r,character:sS(n,i)}}return null}function rS(e){let t=[];for(let n of e.childNodes){if(n.nodeType!==1)continue;let e=n;if(e.tagName===`SPAN`){if(dS(e)!==void 0){t.push(e);continue}for(let n of e.childNodes)n.nodeType===1&&dS(n)!==void 0&&t.push(n)}}return t}function iS(e,t){let n=Math.max(0,t),r=[{container:e,index:0}];for(;r.length>0;){let e=r[r.length-1];if(e.index>=e.container.childNodes.length){r.pop();continue}let t=e.container.childNodes[e.index];if(e.index++,t.nodeType===3){let e=fS(t.textContent,t.textContent?.length??0);if(n<=e)return[t,n];n-=e}else t.nodeType===1&&r.push({container:t,index:0})}return null}function aS(e,t){let n=0,r=[{container:e,index:0}];for(;r.length>0;){let e=r[r.length-1];if(e.index>=e.container.childNodes.length){r.pop();continue}let i=e.container.childNodes[e.index];if(i===t)return n;e.index++,i.nodeType===3?n+=fS(i.textContent,i.textContent?.length??0):i.nodeType===1&&r.push({container:i,index:0})}return n}function oS(e,t){let n=t;for(;n!==null;){if(n===e)return!0;n=n.parentElement}return!1}function sS(e,t){if(t.parentElement===e){let n=0,r=Array.prototype.indexOf.call(e.childNodes,t);for(let t=0;t<r;t++)n=lS(e.childNodes[t]);return n}for(let n of rS(e))if(oS(n,t))return dS(n)+(t.nodeType===3?aS(n,t):0);let n=0,r=t.nodeType===1?t:t.parentElement;for(;r!==null&&r.parentElement!==null&&uS(r.parentElement)===void 0;){let e=r.parentElement,t=Array.prototype.indexOf.call(e.childNodes,r);for(let r=0;r<t;r++)n=lS(e.childNodes[r]);r=e}return n}function cS(e){let t=e;for(;t!==null;){if(uS(t)!==void 0)return null;if(dS(t)!==void 0)return t;t=t.parentElement}return null}function lS(e,t){if(e===void 0)return 0;if(e.nodeType===3){let n=e.parentElement;if(n===null)return 0;let r=cS(n);if(r===null)return 0;let i=dS(r);if(i===void 0)return 0;let a=t===void 0?fS(e.textContent,e.textContent?.length??0):fS(e.textContent,t);return i+aS(r,e)+a}if(e.nodeType!==1)return 0;let n=e;if(n.tagName!==`SPAN`&&n.tagName!==`BR`)return 0;let r=dS(n);if(r!==void 0)return r+(n.textContent?.length??0);let i=0;for(let e of n.childNodes)i=Math.max(i,lS(e));return i}function uS(e){let{line:t,lineType:n}=e.dataset;if(t!==void 0&&n!==`change-deletion`){let e=parseInt(t,10);if(!Number.isNaN(e))return e-1}}function dS(e){let{char:t}=e.dataset;if(t!==void 0){let e=parseInt(t,10);if(!Number.isNaN(e))return e}}function fS(e,t){let n=e??``,r=n.search(/[\r\n]/);return Math.min(t,r===-1?n.length:r)}var pS=300,mS=100,hS=`marker-popover`,gS=class{#e;#t=[];#n=0;#r;#i;#a;#o;#s;#c;#l;#u=!1;constructor(e){this.#e=e}get markers(){return this.#t}isPopoverVisible(){return this.#l!==void 0}updatePopoverPosition(){let e=this.#l,t=this.#r;if(e===void 0||t===void 0)return;let n=this.#t[e];if(n===void 0){this.removePopover();return}this.#_(t,n.start.line,n.start.character)}setMarkers(e,t){this.#n=t.lineCount,this.#t=e.map(e=>({...e,start:t.normalizePosition(e.start),end:t.normalizePosition(e.end)})),this.removePopover()}listenHover(e){this.#a?.forEach(e=>e()),this.#a=void 0,this.#t.length!==0&&(this.#a=[Y(e,`mouseover`,e=>{if(this.#e.isMouseDown())return;let t=e.composedPath()[0];if(t===void 0)return;let n=this.#d(t);n===void 0?(this.#f(),this.#h()):this.#m(n)}),Y(e,`mouseleave`,()=>{this.#f(),this.#h()})])}removePopover(){this.#f(),this.#p(),this.#v()}cleanup(){this.#a?.forEach(e=>e()),this.#a=void 0,this.removePopover(),this.#t=[]}#d(e){let t=e.closest(`[data-line]`);if(t==null)return;let n=Tb(t);if(n===void 0)return;let r;if(e.tagName===`SPAN`){let t=e.dataset.char;if(t===void 0||(r=parseInt(t,10),Number.isNaN(r)))return}else if(e.tagName===`BR`)r=0;else return;let i={line:n-1,character:r};for(let e=this.#t.length-1;e>=0;e--)if(xx({start:i,end:i},this.#t[e]))return e}#f(){this.#o!==void 0&&(clearTimeout(this.#o),this.#o=void 0),this.#c=void 0}#p(){this.#s!==void 0&&(clearTimeout(this.#s),this.#s=void 0)}#m(e){if(e===this.#l||e===this.#c){this.#p();return}if(this.#f(),this.#p(),this.#r!==void 0){this.#y(e);return}this.#c=e,this.#o=setTimeout(()=>{this.#o=void 0,this.#c=void 0,this.#y(e)},pS)}#h(){this.#u||(this.#p(),this.#s=setTimeout(()=>{this.#s=void 0,this.#u||this.removePopover()},mS))}#g(e,t,n,r,i=this.#e.popoverManager.getPlacementBounds()){Yb(e,{gutterWidth:this.#e.getGutterWidth(),placeAbove:r,viewport:i,x:t,y:n})}#_(e,t,n){let{getCharX:r,getLineY:i,getLineHeight:a,popoverManager:o}=this.#e,[s,c]=r(t,n),l=a(),u=i(t)+c*l,d=e.offsetHeight,f={top:u+l,bottom:u+l+d},p={top:u-d,bottom:u},m=t>=this.#n-3,h=o.getPlacementBounds(),g=o.choosePlacement({preferred:f,fallback:p,viewport:h,popoverHeight:d,atDocumentEdge:m,placementKey:hS})===`fallback`;this.#g(e,s,g?u:u+l,g,h)}#v(){this.#i?.forEach(e=>e()),this.#i=void 0,this.#r?.remove(),this.#r=void 0,this.#l=void 0,this.#u=!1,this.#e.popoverManager.resetPlacement(hS)}#y(e){if(e===this.#l)return;let t=this.#e.getOverlayElement();if(e>=this.#t.length||t==null)return;let{start:n,message:r,severity:i}=this.#t[e],{line:a,character:o}=n,s=this.#r;if(this.#e.popoverManager.resetPlacement(hS),s!==void 0){vS(s,i);let t=s.firstElementChild;t?.dataset.markerMessage!==void 0&&(typeof r==`string`?t.textContent=r:r instanceof HTMLElement?t.replaceChildren(r):t.innerHTML=r.html),this.#_(s,a,o),this.#l=e;return}this.#r=J(`div`,{dataset:{editorWidget:``,markerPopover:``,[yS(i)]:``},children:[J(`div`,{dataset:`markerMessage`,...typeof r==`string`?{textContent:r}:r instanceof HTMLElement?{children:[r]}:{innerHTML:r.html}})]},t),this.#_(this.#r,a,o),this.#l=e,this.#i=[Y(this.#r,`mouseenter`,()=>{this.#u=!0,this.#p()}),Y(this.#r,`mouseleave`,()=>{this.#u=!1,this.#h()})]}},_S=[`error`,`warning`,`info`,`hint`];function vS(e,t){for(let t of _S)delete e.dataset[yS(t)];e.dataset[yS(t)]=``}function yS(e){switch(e){case`error`:return`markerError`;case`warning`:return`markerWarning`;case`info`:return`markerInfo`;case`hint`:return`markerHint`}}var bS=new Map([[`(`,`)`],[`[`,`]`],[`{`,`}`]]),xS=new Map([...bS].map(([e,t])=>[t,e])),SS=1e3,CS=5e4;function wS(e,t,n){let r=TS(e,t,e.normalizePosition(n));if(r===void 0)return;let i=bS.get(r.char),a=xS.get(r.char);if(i!==void 0)return PS(r,OS(e,t,r,i));if(a!==void 0)return PS(kS(e,t,r,a),r)}function TS(e,t,n){let r=ES(n);if(r!==void 0){let n=DS(e,t,r);if(n!==void 0)return n}return DS(e,t,n)}function ES(e){if(e.character>0)return{line:e.line,character:e.character-1}}function DS(e,t,n){let r=e.getLineText(n.line)[n.character];if(!(r===void 0||!bS.has(r)&&!xS.has(r)||AS(t,n)))return{...n,char:r}}function OS(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s<e.lineCount;s++){if(a>=SS)return;a++;let c=e.getLineText(s),l=t.getStringCommentRegexpRangesInLine(s),u={index:0},d=s===n.line?n.character:0;for(let e=d;e<c.length;e++){if(o>=CS)return;if(o++,MS(l,e,u))continue;let t=c[e];if(t===n.char)i++;else if(t===r&&(i--,i===0))return{line:s,character:e,char:t}}}}function kS(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s>=0;s--){if(a>=SS)return;a++;let c=e.getLineText(s),l=t.getStringCommentRegexpRangesInLine(s),u={index:l===null?-1:l.length-1},d=s===n.line?n.character:c.length-1;for(let e=d;e>=0;e--){if(o>=CS)return;if(o++,NS(l,e,u))continue;let t=c[e];if(t===n.char)i++;else if(t===r&&(i--,i===0))return{line:s,character:e,char:t}}}}function AS(e,t){return jS(e.getStringCommentRegexpRangesInLine(t.line),t.character)}function jS(e,t){if(e===null)return!1;for(let[n,r]of e){if(t<n)return!1;if(t<r)return!0}return!1}function MS(e,t,n){if(e===null)return!1;for(;n.index<e.length&&t>=e[n.index][1];)n.index++;let r=e[n.index];return r!==void 0&&t>=r[0]}function NS(e,t,n){if(e===null)return!1;for(;n.index>=0&&t<e[n.index][0];)n.index--;let r=e[n.index];return r!==void 0&&t<r[1]}function PS(e,t){if(e!==void 0&&t!==void 0)return[FS(e),FS(t)]}function FS(e){return{start:{line:e.line,character:e.character},end:{line:e.line,character:e.character+1}}}var IS=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
1994
|
+
<symbol id="diffs-editor-icon-close" viewBox="0 0 16 16">
|
|
1995
|
+
<path fill="currentColor" d="M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z"></path>
|
|
1996
|
+
</symbol>
|
|
1997
|
+
<symbol id="diffs-editor-icon-arrow-up" viewBox="0 0 16 16">
|
|
1998
|
+
<path fill="currentColor" transform="rotate(-90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
|
|
1999
|
+
</symbol>
|
|
2000
|
+
<symbol id="diffs-editor-icon-arrow-down" viewBox="0 0 16 16">
|
|
2001
|
+
<path fill="currentColor" transform="rotate(90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
|
|
2002
|
+
</symbol>
|
|
2003
|
+
<symbol id="diffs-editor-icon-case" viewBox="0 0 16 16">
|
|
2004
|
+
<path fill="currentColor" d="M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z"></path>
|
|
2005
|
+
<path fill="currentColor" d="M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z"></path>
|
|
2006
|
+
</symbol>
|
|
2007
|
+
<symbol id="diffs-editor-icon-whole-word" viewBox="0 0 16 16">
|
|
2008
|
+
<path fill="currentColor" d="M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z"></path>
|
|
2009
|
+
<path fill="currentColor" d="M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z"></path>
|
|
2010
|
+
<path fill="currentColor" d="M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z"></path>
|
|
2011
|
+
</symbol>
|
|
2012
|
+
<symbol id="diffs-editor-icon-regex" viewBox="0 0 16 16">
|
|
2013
|
+
<path fill="currentColor" d="M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z"></path>
|
|
2014
|
+
<path fill="currentColor" d="M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z"></path>
|
|
2015
|
+
</symbol>
|
|
2016
|
+
<symbol id="diffs-editor-icon-replace" viewBox="0 0 16 16">
|
|
2017
|
+
<path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M5.28033 5.71967C5.57322 6.01256 5.57322 6.48744 5.28033 6.78033L3.56066 8.5H11.75C12.7165 8.5 13.5 7.7165 13.5 6.75V2.75C13.5 2.33579 13.8358 2 14.25 2C14.6642 2 15 2.33579 15 2.75V6.75C15 8.54493 13.5449 10 11.75 10H3.56066L5.28033 11.7197C5.57322 12.0126 5.57322 12.4874 5.28033 12.7803C4.98744 13.0732 4.51256 13.0732 4.21967 12.7803L1.21967 9.78033C0.926777 9.48744 0.926777 9.01256 1.21967 8.71967L4.21967 5.71967C4.51256 5.42678 4.98744 5.42678 5.28033 5.71967Z"></path>
|
|
2018
|
+
</symbol>
|
|
2019
|
+
<symbol id="diffs-editor-icon-replace-all" viewBox="0 0 16 16">
|
|
2020
|
+
<path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967L14.7803 3.21967C15.0732 3.51256 15.0732 3.98744 14.7803 4.28033L11.7803 7.28033C11.4874 7.57322 11.0126 7.57322 10.7197 7.28033C10.4268 6.98744 10.4268 6.51256 10.7197 6.21967L12.4393 4.5H4.25C3.2835 4.5 2.5 5.2835 2.5 6.25V6.875C2.5 7.28921 2.16421 7.625 1.75 7.625C1.33579 7.625 1 7.28921 1 6.875V6.25C1 4.45507 2.45508 3 4.25 3H12.4393L10.7197 1.28033C10.4268 0.987437 10.4268 0.512563 10.7197 0.21967ZM5.28033 8.71967C5.57322 9.01256 5.57322 9.48744 5.28033 9.78033L3.56066 11.5H11.75C12.7165 11.5 13.5 10.7165 13.5 9.75V9.125C13.5 8.71079 13.8358 8.375 14.25 8.375C14.6642 8.375 15 8.71079 15 9.125V9.75C15 11.5449 13.5449 13 11.75 13H3.56066L5.28033 14.7197C5.57322 15.0126 5.57322 15.4874 5.28033 15.7803C4.98744 16.0732 4.51256 16.0732 4.21967 15.7803L1.21967 12.7803C0.926777 12.4874 0.926777 12.0126 1.21967 11.7197L4.21967 8.71967C4.51256 8.42678 4.98744 8.42678 5.28033 8.71967Z"></path>
|
|
2021
|
+
</symbol>
|
|
2022
|
+
</svg>`,LS=()=>{let e=document.createElement(`div`);e.innerHTML=IS;let t=e.firstElementChild;if(t===null||!(t instanceof SVGSVGElement))throw Error(`Failed to create sprite element`);return t},RS=(e,t=16)=>`<svg width="${t}" height="${t}" aria-hidden="true" focusable="false">
|
|
2023
|
+
<use href="#diffs-editor-icon-${e}"></use>
|
|
2024
|
+
</svg>`,zS=class{#e;#t;#n;#r;#i;#a;constructor(e){let{textDocument:t,containerElement:n,defaultQuery:r,mode:i=`find`,initialMatch:a,scrollToMatch:o,applyReplace:s,onUpdate:c,onClose:l}=e,u={text:r,replaceText:``,caseSensitive:!1,wholeWord:!1,regex:!1},d={all:[],current:void 0},f=J(`div`,{dataset:{matches:``,noMatches:``},textContent:`No results`}),p=e=>{d.all=u.text===``?[]:t.search(u);let n=d.all.length===0;if(A.disabled=n,j.disabled=n,n){f.textContent=`No results`,f.dataset.noMatches=``,d.current=void 0,c([]);return}if(delete f.dataset.noMatches,e?.syncSelection===!1){m(c(d.all,{syncSelection:!1}));return}m(c(d.all))};this.#n=p;let m=e=>{if(e===void 0)f.textContent=`${d.all.length} results`;else{let[t,n]=e;f.textContent=`${d.all.findIndex(e=>e[0]===t&&e[1]===n)+1} of ${d.all.length}`}d.current=e},h=(e,t)=>{u[e]=t,p()},g=(e=!1,t=!1)=>{let n=d.all,r=n[0];if(n.length>0){if(e){let e=d.current?.[0]??0;r=n.at(-1);for(let t of n)if(t[1]<=e)r=t;else break}else{let e=d.current?.[1]??0;for(let t of n)if(t[0]>=e){r=t;break}}}r!==void 0&&(m(r),o(r,t)),d.current=r};this.#i=e=>g(e,!0);let _=(e,n)=>({start:e,end:n,text:ib(e=>t.positionAt(e),e=>t.offsetAt(e),e=>t.getLineText(e),u,e,n)}),v=()=>{if(u.text===``||d.all.length===0)return;let e=d.current;if(e===void 0&&(g(!1,!0),e=d.current,e===void 0))return;let[t,n]=e,r=_(t,n);s([r]),o([t+r.text.length,t+r.text.length],!0),d.current=void 0,p()},y=()=>{u.text!==``&&d.all.length!==0&&(s(d.all.map(([e,t])=>_(e,t))),d.current=void 0,p())},b=()=>{this.cleanup(),l()};this.#a=b;let x=e=>J(`button`,{type:`button`,title:e.label,ariaLabel:e.label,dataset:{searchIcon:``,...e.dataset},innerHTML:RS(e.icon,e.size??16),onclick:e.onClick}),S=(e,t,n)=>{let r=x({icon:e,label:t,size:14,onClick:()=>{let e=!u[n];r.ariaPressed=String(e),h(n,e)}});return r.ariaPressed=String(u[n]),r},C=S(`case`,`Match Case`,`caseSensitive`),w=S(`whole-word`,`Whole Word`,`wholeWord`),T=S(`regex`,`Regexp`,`regex`),E=J(`input`,{type:`text`,placeholder:`Replace`,dataset:`replace`,value:``,oninput:e=>{u.replaceText=e.target.value},onkeydown:e=>{if(e.isComposing||e.keyCode===229)return;let t=mb(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),v()):t!==void 0&&(e.preventDefault(),g(t===`previous`,!0))}});this.#t=J(`input`,{type:`text`,placeholder:`Search`,dataset:`search`,value:r,oninput:e=>{u.text=e.target.value,d.current=void 0,p()},onkeydown:e=>{if(e.isComposing||e.keyCode===229)return;let t=mb(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),g(e.shiftKey,!0)):t===void 0?sb(e)&&(e.key===`f`||e.code===`KeyF`)&&(e.preventDefault(),ie(e.altKey?`replace`:`find`)):(e.preventDefault(),g(t===`previous`,!0))}});let D=J(`div`,{dataset:`searchToggles`,children:[C,w,T]}),O=J(`div`,{dataset:{inputBox:``,find:``},children:[this.#t,D]}),k=J(`div`,{dataset:{inputBox:``,replace:``,replaceCell:``},children:[E]}),ee=J(`div`,{dataset:{replaceActions:``,replaceCell:``},children:[x({icon:`replace`,label:`Replace`,onClick:v}),x({icon:`replace-all`,label:`Replace All`,onClick:y})]}),A=x({icon:`arrow-up`,label:`Previous`,onClick:()=>{g(!0)}}),j=x({icon:`arrow-down`,label:`Next`,onClick:()=>{g()}});A.disabled=!0,j.disabled=!0;let te=J(`div`,{dataset:`searchNav`,children:[A,j]}),ne=x({icon:`close`,label:`Close`,onClick:b,dataset:{searchClose:``}}),re=J(`div`,{dataset:{searchGrid:``,mode:i},children:[O,k,ee,f,te,ne]}),ie=e=>{re.dataset.mode=e,this.#t.focus(),this.#t.select()};this.#r=ie,this.#e=J(`div`,{dataset:`searchPanel`,children:[J(`div`,{dataset:`editorWidget`,children:[re]})]}),d.current=a,n.before(this.#e),requestAnimationFrame(()=>{a===void 0?c([]):p(),this.#t.select()})}focus(){this.#t.focus()}navigate(e){this.#i?.(e)}updateMatches(e){this.#n?.(e)}setMode(e){this.#r?.(e)}close(){this.#a?.()}cleanup(){this.#e.remove()}},BS=class{#e;#t;#n;constructor(e,t,n){this.#e=J(`div`,{dataset:{editorWidget:``,selectionActionPopover:``},contentEditable:`false`,children:[e]},t),this.#t=this.#e.offsetHeight,this.#n=new ResizeObserver(()=>{let e=this.#e.offsetHeight;e!==this.#t&&(this.#t=e,n())}),this.#n.observe(this.#e)}reposition(e,t,n,r,i,a){this.#e.style.visibility=i?``:`hidden`,Yb(this.#e,{gutterWidth:n,placeAbove:r,viewport:a,x:e,y:t})}get height(){return this.#t}cleanup(){this.#n.disconnect(),this.#e.remove()}};function VS(e){return{selections:e.selections?.map(e=>({start:{...e.start},end:{...e.end},direction:e.direction})),view:e.view===void 0?void 0:{...e.view}}}function HS(e){return typeof e==`object`?e:e===`indexedDB`?new qS:new US}var US=class{#e=new Map;get(e){let t=this.#e.get(e);return t===void 0?void 0:VS(t)}set(e,t){this.#e.set(e,VS(t))}},WS=`pierre-diffs-editor-state`,GS=1,KS=`states`,qS=class{#e=JS();async get(e){let t=await this.#e;if(t===void 0)return;let n=await YS(t.transaction(KS,`readonly`).objectStore(KS).get(e));return n===void 0?void 0:VS(n)}async set(e,t){let n=await this.#e;n!==void 0&&await YS(n.transaction(KS,`readwrite`).objectStore(KS).put(VS(t),e))}};function JS(){try{let e=globalThis.indexedDB;if(e===void 0)return Promise.resolve(void 0);let t=e.open(WS,GS);return t.onupgradeneeded=()=>{let e=t.result;e.objectStoreNames.contains(KS)||e.createObjectStore(KS)},YS(t)}catch{return Promise.resolve(void 0)}}function YS(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}var XS=4096,ZS=/\p{Mark}/u,QS=class{#e;#t;#n;#r=new Map;ch=-1;tabSize=2;lineHeight=20;paddingTop=0;init(e){if(this.#e===e&&this.#t!==void 0&&this.ch!==-1)return;if(this.#e=e,this.#t??=document.createElement(`canvas`).getContext(`2d`)??void 0,this.#t===void 0)throw Error(`Could not get canvas context`);let t=e.parentElement;if(t!==null){let{paddingTop:e}=getComputedStyle(t);e.endsWith(`px`)&&(this.paddingTop=parseFloat(e.slice(0,-2)))}let{fontSize:n,fontFamily:r,tabSize:i,lineHeight:a}=getComputedStyle(e);a.endsWith(`px`)?this.lineHeight=parseFloat(a.slice(0,-2)):n.endsWith(`px`)&&(this.lineHeight=kb(parseFloat(n.slice(0,-2))*parseFloat(a)));let o=n+` `+r;(this.#n!==o||this.ch===-1)&&(this.#n=o,this.#t.font=o,this.ch=this.canvasMeasureTextWidth(`0`),this.clearTextWidthCache());let s=parseInt(i,10);Number.isNaN(s)||(this.tabSize=s)}remeasureCharacterWidth(){if(this.#t===void 0||this.#n===void 0)return!1;this.#t.font=this.#n;let e=this.canvasMeasureTextWidth(`0`),t=e!==this.ch;t&&(this.ch=e);let n=this.#a();return t||n}measureTextWidth(e){if(!e.includes(` `))return this.#i(e);if(this.#t===void 0)throw Error(`Metrics not initialized`);let t=nC(e,this.tabSize);if(t!==-1)return t*this.ch;let n=0,r=0,i=this.tabSize*this.ch;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)===9){if(t>r&&(n+=this.#i(e.slice(r,t))),i>0){let e=n%i;n+=e===0?i:i-e}r=t+1}return r<e.length&&(n+=this.#i(e.slice(r))),kb(n)}#i(e){return $S(e)?this.domMeasureTextWidth(e):this.canvasMeasureTextWidth(e)}canvasMeasureTextWidth(e){if(this.#t===void 0)throw Error(`Metrics not initialized`);return kb(this.#t.measureText(e).width)}domMeasureTextWidth(e){if(this.#e===void 0)throw Error(`Metrics not initialized`);let t=e+`|`+this.#n,n=this.#r.get(t);if(n!==void 0)return n;let r=J(`span`,{style:{position:`absolute`,top:`0`,left:`0`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre`,font:`inherit`},textContent:e},this.#e),i;try{i=kb(r.getBoundingClientRect().width)}finally{r.remove()}if(this.#r.size>=XS){let e=this.#r.keys().next().value;e!==void 0&&this.#r.delete(e)}return this.#r.set(t,i),i}clearTextWidthCache(){this.#a()}#a(){let e=this.#r.size>0;return this.#r.clear(),e}};function $S(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=57343||n===8205||n===65038||n===65039||n>127&&ZS.test(e.charAt(t)))return!0}return!1}function eC(e,t){let n=Math.max(0,Math.min(t,e.length));if(n===0||n===e.length||!$S(e))return n;let r=Pb();if(r!==void 0){for(let t of r.segment(e)){let e=t.index,r=e+t.segment.length;if(n>e&&n<r)return r;if(n<=e)break}return n}let i=0;for(let t of e){let e=i+t.length;if(n>i&&n<e)return e;if(n<=i)break;i=e}return n}function tC(e){if(!$S(e))return;let t=[0],n=Pb();if(n!==void 0){for(let r of n.segment(e))t.push(r.index+r.segment.length);return t}let r=0;for(let n of e)r+=n.length,t.push(r);return t}function nC(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i>127)return-1;n+=i===9?t-n%t:1}return n}var rC=500,iC=0,aC=class{#e;#t;#n;#r=`dark`;#i=``;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=!1;#h=[_i];#g=[];#_=0;#v=[];#y=-1;#b=!0;#x=!1;#S=0;#C=++iC;#w=-1;#T=-1;#E;#D=0;#O=[];#k=!1;#A=Ob(async e=>{if(this.#m)return;let{startingLine:t=0,totalLines:n=1/0}=e??{},r=Math.min(n===1/0?1/0:t+n,this.#o.lineCount);if(this.#t===void 0&&!cC(this.#o.languageId)){if(await this.#e.loadLanguage(this.#o.languageId),this.#m)return;this.#t=this.#e.getLanguage(this.#o.languageId)}this.#F(),this.#V(r)},500);#j=({data:e})=>{if(typeof e!=`object`||!e)return;let{type:t,tokenizerId:n,jobId:r}=e;t===`tokenize`&&n===this.#C&&typeof r==`number`&&r===this.#S&&(this.#w>=0?this.#q(r):this.#J(r))};get themeType(){return this.#r}getStringCommentRegexpRangesInLine(e){if(!this.#d||e<0||e>=this.#o.lineCount||(this.#I(),this.#t===void 0))return null;if(this.#O[e]===void 0){this.#K(e);let t=this.#h[e]??_i,n=this.#H(e,t);this.#h[e+1]=n.state}return this.#O[e]??null}constructor({codeOptions:e,highlighter:t,textDocument:n,matchBrackets:r,setStyle:i,onDeferTokenize:a,onThemeChange:o,__debug:s}){let{themeType:c=`system`,theme:l=F,tokenizeMaxLineLength:u=1e3}=e;this.#n=window.matchMedia(`(prefers-color-scheme: dark)`);let d;if(d=c===`system`?this.#N():c,typeof l!=`string`&&c===`system`){let e=new MutationObserver(e=>{for(let{type:t,attributeName:n}of e)if(t===`attributes`&&n!==null&&(n===`class`||n.startsWith(`data-`))){let e=this.#N();this.#M(l[e],e);break}});e.observe(document.documentElement,{attributes:!0}),e.observe(document.body,{attributes:!0}),this.#p=[Y(this.#n,`change`,()=>{let e=this.#N();this.#M(l[e],e)}),()=>e.disconnect()]}this.#e=t,this.#o=n,this.#s=u,this.#c=i,this.#l=a,this.#u=o,this.#d=r!==!1,this.#f=s??!1,this.#I(),this.#a=[],this.#P(typeof l==`string`?l:l[d],typeof l==`string`?void 0:d)}#M(e,t){(e!==this.#i||t!==this.#r)&&(this.#P(e,t),this.stopBackgroundTokenize(),this.#h=[_i],this.#g=[],this.#_=0,this.#v=[],this.#t!==void 0&&this.#o.lineCount>0&&this.#B(0),this.#u?.())}#N(){try{if(typeof document<`u`&&typeof getComputedStyle==`function`&&document.body!=null){let e=getComputedStyle(document.body).colorScheme.split(/\s+/),t=e.includes(`dark`);if(t!==e.includes(`light`))return t?`dark`:`light`}}catch{}return this.#n.matches?`dark`:`light`}syncTheme(e){let{themeType:t=`system`,theme:n=F}=e;if(typeof n==`string`){let e=this.#e.getTheme(n).type;if(n===this.#i&&e===this.#r)return;this.#M(n,e);return}let r=t===`system`?this.#N():t,i=n[r];(r!==this.#r||i!==this.#i)&&this.#M(i,r)}#P(e,t){let{theme:n,colorMap:r}=this.#e.setTheme(e),{colors:i={}}=this.#e.getTheme(e),a=i[`editor.selectionBackground`],o=i[`editor.lineHighlightBackground`],s=o!=null&&o.trim()!==``&&!dp.isFullyTransparent(o)?o:void 0,c=i[`editor.lineHighlightBorder`]??(s==null?`color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-fg))`:`transparent`),l=s==null?`100%`:`85%`,u=i[`editorCursor.foreground`],d=i[`editor.findMatchBackground`],f=i[`editor.findMatchHighlightBackground`],p=i[`editorBracketMatch.background`],m=i[`editorBracketMatch.border`],h=i[`editorHint.foreground`],g=i[`editorInfo.foreground`],_=i[`editorWarning.foreground`],v=i[`editorError.foreground`];this.#c(`:host {
|
|
2025
|
+
--diffs-editor-selection-bg: ${a??`var(--diffs-line-bg)`};
|
|
2026
|
+
--diffs-editor-line-highlight-border: ${c};
|
|
2027
|
+
--diffs-editor-active-line-source-mix: ${l};
|
|
2028
|
+
--diffs-editor-match-bg: ${d??`initial`};
|
|
2029
|
+
--diffs-editor-match-highlight-bg: ${f??`initial`};
|
|
2030
|
+
--diffs-editor-bracket-match-bg: ${p??`initial`};
|
|
2031
|
+
--diffs-editor-bracket-match-border: ${m??`initial`};
|
|
2032
|
+
--diffs-editor-cursor-fg: ${u??`initial`};
|
|
2033
|
+
--diffs-editor-hint-fg: ${h??`initial`};
|
|
2034
|
+
--diffs-editor-info-fg: ${g??`initial`};
|
|
2035
|
+
--diffs-editor-warning-fg: ${_??`initial`};
|
|
2036
|
+
--diffs-editor-error-fg: ${v??`initial`};
|
|
2037
|
+
}`),this.#i=e,this.#r=t??n.type,this.#a=r}#F(){if(this.#i===``)return;let{colorMap:e}=this.#e.setTheme(this.#i);this.#a=e}cleanUp(){this.#m=!0,this.stopBackgroundTokenize(),this.#R(),this.#p?.forEach(e=>e()),this.#p=void 0}tokenize(e,t,n=!1){if(this.#I(),this.#F(),this.#t===void 0&&!cC(this.#o.languageId))throw Error(`Grammar for language "${this.#o.languageId}" not loaded`);let{lineCount:r}=this.#o,{startingLine:i=0,totalLines:a=1/0}=t??{},o=a===1/0?r:Math.min(i+a,r),s=e.startLine,c=Math.max(i,s),l=t!==void 0&&a!==1/0&&e.lineDelta>0&&s<o&&e.endLine>=o,u=e.lineDelta===0&&(e.changedLineChanges?.every(([,,e])=>e===0)??!0);this.#d&&!u&&(this.#O.length=Math.min(this.#O.length,e.startLine));let d=n&&e.lineDelta!==0&&s>=i,f=u||t===void 0||s>=c,p=e.changedLineRanges??[[s,e.endLine]];this.#g=[],this.#_=0,this.#v=[];let m=-1;if(s<c)for(let[e,t]of p)e<c&&(m=Math.max(m,Math.min(t,c-1)));let h=m>=s&&(u||e.lineDelta<0);u?this.#K(s):(this.#W(e),(t===void 0||s>=c)&&this.#K(c));let g=0,_=p[g][1],v,y=0,b=u?p[g][0]:c,x=!1,S=new Map,C=h?new Map:void 0;if(C!==void 0&&!u){let e=Math.min(m+1,c,o);if(e>s){this.#K(e);let t=s,n=this.#h[t]??_i;for(;t<e;t++){let e=this.#H(t,n);n=e.state,C.set(t,e.resolvedTokens)}this.#h[e]=n}}let w=this.#h[b]??_i;for(;b<o;){let e=u?this.#h[b+1]:d?this.#G(b+1):void 0;f&&(this.#h[b]=w);let{resolvedTokens:t,state:n}=this.#H(b,w);if(w=n,b>=c?S.set(b,t):C?.set(b,t),f&&(this.#h[b+1]=w),x=b>=_&&(u||d)&&e!==void 0&&w.equals(e),x){g++;let e=p[g];if(e===void 0)break;if(e[0]>=o){v=e[0],y=g;break}let t=this.#h[e[0]];if(d)for(let n=b+2;n<=e[0]&&(t=this.#G(n),t!==void 0);n++)this.#h[n]=t;t===void 0?(_=e[1],b++):(b=e[0],w=t,_=e[1]),x=!1;continue}b++}if(f&&(b<o?this.#h[b+1]=w:this.#h[b]=w),x&&d&&v===void 0){for(let e=b+2;e<=r;e++){let t=this.#G(e);if(t===void 0)break;this.#h[e]=t}this.#g=[],this.#_=0,this.#v=[]}if(C!==void 0&&C.size>0&&this.#l(C,this.#r),v!==void 0)this.#d&&u&&(this.#O.length=Math.min(this.#O.length,v)),this.#B(v,p,y);else if(!x&&b<r){let e=l&&s>=c?o:s<c&&!u?s:b;this.#d&&u&&(this.#O.length=Math.min(this.#O.length,e)),this.#B(e,p,g)}return S}prebuildStateStack(e){this.#I(),this.#A(e)}stopBackgroundTokenize(){this.#T=-1,!this.#b&&(this.#b=!0,this.#x=!1,this.#y=-1,this.#w=-1,this.#E=void 0,this.#D=0,this.#g=[],this.#_=0,this.#v=[],this.#R())}pauseBackgroundTokenize(){this.#b||this.#x||(this.#f&&console.log(`[diffs/editor] background tokenization paused`,{jobId:this.#S}),this.#x=!0)}resumeBackgroundTokenize(){this.#b||!this.#x||this.#t===void 0||this.#y<0||(this.#f&&console.log(`[diffs/editor] background tokenization resumed`,{jobId:this.#S}),this.#x=!1,this.#z(this.#S))}#I(){this.#t===void 0&&!cC(this.#o.languageId)&&this.#e.getLoadedLanguages().includes(this.#o.languageId)&&(this.#t=this.#e.getLanguage(this.#o.languageId))}#L(){this.#k||=(globalThis.addEventListener(`message`,this.#j),!0)}#R(){this.#k&&=(globalThis.removeEventListener(`message`,this.#j),!1)}#z(e){globalThis.postMessage({type:`tokenize`,tokenizerId:this.#C,jobId:e})}#B(e,t,n=0){if(cC(this.#o.languageId))return;let r=++this.#S;this.#f&&console.log(`[diffs/editor] background tokenization scheduled`,{jobId:r,startLine:e,changedLineRanges:t,changedRangeIndex:n}),this.#b=!1,this.#x=!1,this.#y=e,this.#w>=0&&(this.#T=Math.max(this.#T,this.#w)),this.#w=-1,this.#E=t,this.#D=n,this.#L(),this.#z(r)}#V(e){if(this.#t===void 0||this.#h.length>e)return;if(!this.#b){this.#w>=0?this.#w=Math.max(this.#w,e):this.#T=Math.max(this.#T,e);return}let t=++this.#S;this.#b=!1,this.#x=!1,this.#y=this.#h.length-1,this.#w=e,this.#T=-1,this.#E=void 0,this.#D=0,this.#L(),this.#z(t)}#H(e,t){let n=this.#o.getLineText(e);if(n.length>this.#s)return console.warn(`[diffs] Line(${e}) too long to tokenize: ${n.length}`),this.#U(e,null),{resolvedTokens:[[0,``,n]],state:t};if(this.#t===void 0||n===``||n.trim()===``)return this.#U(e,null),{resolvedTokens:[[0,``,n]],state:t};let r=oC(this.#t,this.#a,n,t,rC,this.#d);return this.#U(e,r.bracketIgnoredRanges),{resolvedTokens:r.resolvedTokens,state:r.ruleStack}}#U(e,t){this.#d&&(this.#O[e]=t)}#W(e){let t=e.changedLineChanges??[[e.startLine,e.endLine,e.lineDelta]],n=e.startLine+1;n<=this.#h.length-n?(this.#g=this.#h,this.#_=0,this.#h=this.#h.slice(0,n)):(this.#_=n,this.#g=this.#h.slice(n),this.#h.length=Math.min(this.#h.length,n)),this.#v=t}#G(e){let t=e;for(let n=this.#v.length-1;n>=0;n--){let[r,i,a]=this.#v[n];if(a!==0){if(t>i)t-=a;else if(t>r)return this.#h[e]}}return this.#g[t-this.#_]??this.#h[e]}#K(e,t){let n=Math.min(Math.max(0,e),this.#o.lineCount);if(this.#h.length>n||this.#t===void 0)return!0;let r=t===void 0?0:performance.now(),i=this.#h.length-1,a=this.#h[i]??_i;for(;i<n;){this.#h[i]=a;let e=this.#o.getLineText(i);if(e.length<=this.#s&&e!==``&&e.trim()!==``){let t=oC(this.#t,this.#a,e,a,rC,this.#d,!1);this.#U(i,t.bracketIgnoredRanges),a=t.ruleStack}else this.#U(i,null);if(i++,this.#h[i]=a,t!==void 0&&performance.now()-r>t)break}return i>=n}#q(e){if(this.#b||this.#x||this.#t===void 0||e!==this.#S)return;this.#F();let t=this.#K(this.#w,1);if(!(this.#b||this.#x||e!==this.#S)){if(t){this.stopBackgroundTokenize();return}this.#y=this.#h.length-1,this.#z(e)}}#J(e){if(this.#b||this.#x||this.#t===void 0||e!==this.#S)return;this.#F();let t=performance.now(),n=new Map,r=this.#o.lineCount,i=this.#E,a=this.#y,o=this.#h[a]??_i,s=!1,c=this.#D,l=i?.[c]?.[1];for(;a<r;){this.#h[a]=o;let e=l===void 0?void 0:this.#G(a+1),r=this.#o.getLineText(a);if(r.length>this.#s)console.warn(`[diffs] Line(${a}) too long to tokenize: ${r.length}`),n.set(a,[[0,``,r]]),this.#U(a,null);else if(r===``||r.trim()===``)n.set(a,[[0,``,r]]),this.#U(a,null);else{let e=oC(this.#t,this.#a,r,o,rC,this.#d);n.set(a,e.resolvedTokens),this.#U(a,e.bracketIgnoredRanges),o=e.ruleStack}if(this.#h[a+1]=o,s=l!==void 0&&a>=l&&e!==void 0&&o.equals(e),a++,s){c++;let e=i?.[c];if(e===void 0)break;if(l=e[1],this.#h[e[0]]===void 0)s=!1;else{a=e[0],o=this.#h[a]??o,s=!1;continue}}if(performance.now()-t>1)break}if(this.#l(n,this.#r),!(this.#b||this.#x||e!==this.#S)){if(s||a>=r){let e=this.#T;this.stopBackgroundTokenize(),e>=0&&this.#V(e);return}this.#y=a,this.#D=c,this.#z(e)}}};function oC(e,t,n,r,i,a=!0,o=!0){let s=e.tokenizeLine2(n,r,i);s.stoppedEarly&&console.warn(`[diffs] Time limit reached when tokenizing line: ${n.substring(0,100)}`);let c=s.tokens,l=c.length/2,u=[],d=[];if(!o&&!a)return{ruleStack:s.ruleStack,resolvedTokens:u,bracketIgnoredRanges:d};for(let e=0;e<l;e++){let r=c[2*e],i=e+1<l?c[2*e+2]:n.length;if(r===i)continue;let s=c[2*e+1];if(o){let e=lr.getForeground(s);u.push([r,t[e],n.slice(r,i)])}a&&lr.getTokenType(s)>0&&d.push([r,i])}return{ruleStack:s.ruleStack,resolvedTokens:u,bracketIgnoredRanges:d}}function sC(e){return e.map(([e,t,n])=>e===0&&t===``?n===``?J(`br`):n:J(`span`,{dataset:{char:e.toString()},style:`color:${t};`,textContent:n}))}function cC(e){return e===`text`||e===`ansi`}function lC(e){let t=e.getSelection?.();if(t==null||t.rangeCount===0)return;let n=t.getRangeAt(0);return{collapsed:n.collapsed,startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset}}function uC(e){if(typeof e.cacheKey!=`string`||e.cacheKey.length===0)throw Error(`Editor persistState requires a non-empty file.cacheKey for "${e.name}". Provide a unique, stable cacheKey for every editable file.`);return e.cacheKey}function dC(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}var fC=2,pC=1e4,mC=`selection-action`,hC=`application/vnd.pierre.diffs-selections+json`,gC=class{#e;#t=new QS;#n;#r;#i=new Map;#a;#o;#s=new Map;#c;#l=0;#u=!1;#d;#f;#p;#m;#h={generation:0,callback:void 0,delivered:!1};#g;#_;#v;#y=new Map;#b=new Map;#x=new Map;#S;#C;#w;#T;#E;#D;#O;#k;#A;#j;#M;#N;#P;#F;#I;#L;#R;#z;#B;#V;#H;#U=!0;#W=!1;#G=!1;#K=!1;#q;#J=!1;#Y=!1;#X=!1;#Z;#Q=!1;#$;#ee=``;#te;#ne;#re;#ie;#ae;#oe;#se=!1;#ce=!1;#le=!1;#ue=!1;#de;#fe=(e,t)=>{if(this.#P?.updateRenderCache(e,t),this.#R!==void 0&&this.#R.totalLines!==1/0){let{startingLine:t,totalLines:n}=this.#R,r=Math.min(t+n,this.#L?.lineCount??0);for(let[n,i]of e)if(n>=t&&n<r){let e=this.#Ht(n);e!==void 0&&e.replaceChildren(...sC(i))}}};constructor(e={}){this.#e=e}setOptions(e){let t=this.#e.persistStateStorage??`inMemory`,n={...this.#e,...e};if(n.persistState===!0&&this.#P?.type===`file`){let e=this.#P.__getCurrentFile?.()??this.#F;e!==void 0&&uC(e)}this.#e=n,this.#e.persistState!==!0&&(this.#i.clear(),this.#l++,this.#u=!1),(this.#e.persistStateStorage??`inMemory`)!==t&&(this.#l++,this.#a=void 0,this.#o=void 0,this.#s.clear())}edit(e){if(this.#e.persistState===!0&&e.type===`file`){let t=e.__getCurrentFile?.();t!==void 0&&uC(t)}return this.#ke(),this.#P=e,this.#Pe(),this.#m=e.attachEditor(this),()=>this.cleanUp()}applyEdits(e,t=!0){let n=this.#L;if(n==null)throw Error(`Editor is not attached`);let r=this.#K,i=this.#re,a=i?.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]),o=i===void 0?void 0:n.resolveEdits(e).sort((e,t)=>e.start-t.start),s=n.applyEdits(e,t,i);if(s===void 0)return;let c;i!==void 0&&a!==void 0&&o!==void 0&&(c=wx(n,i,a,o),t&&n.setLastUndoSelectionsAfter(c)),this.#zt(s,c,this.#Bt(s),{skipFocus:!r})}get canUndo(){return this.#L?.canUndo??!1}get canRedo(){return this.#L?.canRedo??!1}undo(){this.#Ue(`undo`)}redo(){this.#Ue(`redo`)}getFile(){let e=this.#F,t=this.#L;if(e===void 0||t===void 0)return;let n={...e};return Object.defineProperty(n,"contents",{enumerable:!0,get:()=>t.getText()}),n}getText(){return this.#L?.getText()??``}getState(){let e=this.#P;return{selections:this.#re,view:e==null?void 0:{scrollLeft:e.getCodeScrollLeft(),scrollTop:this.#Me()}}}setState({selections:e,view:t}){if(this.#P===void 0||this.#L===void 0)throw Error(`Editor is not attached`);if(this.#U=!1,this.#yt(e??[]),t!=null){this.#P.setCodeScrollLeft(t.scrollLeft),t.scrollTop!==void 0&&this.#Ne(t.scrollTop);return}this.#at()}setSelections(e){let t=this.#L;if(t===void 0)throw Error(`Text document is not initialized`);let n=e.map(e=>{let n=t.normalizePosition(e.start),r=t.normalizePosition(e.end),i=e.direction===`none`?0:e.direction===`backward`?-1:1;return Q(n,r)>0&&([n,r]=[r,n],i!==0&&(i=i===1?-1:1)),{direction:i,start:n,end:r}});this.#U=!1,this.#yt(n);let r=n.at(-1);r!==void 0&&this.#Se(Z(r).line),this.#at()}setMarkers(e){let t=this.#L;if(t===void 0)throw Error(`Text document is not initialized`);if(e.length===0){this.#B?.cleanup(),this.#B=void 0,this.#yt(this.#re??[]);return}this.#B??=new gS({popoverManager:this.#Ee(),getLineHeight:()=>this.#t.lineHeight,getOverlayElement:()=>this.#A,getGutterWidth:()=>this.#Ut(),getCharX:(e,t)=>this.#Kt(e,t),getLineY:e=>this.#Gt(e),isMouseDown:()=>this.#X||this.#Y}),this.#B.setMarkers(e,t),this.#k!==void 0&&this.#B.listenHover(this.#k),this.#yt(this.#re??[])}focus(e){let t=e?.preventScroll??!1,n=e?.lineNumber;if(n===`first-visible`||typeof n==`number`){let r=this.#L;if(r==null||this.#P==null)return;let i=n===`first-visible`?this.#nt(e?.offset):n;if(i==null)return;let a=r.normalizePosition({line:i-1,character:n===`first-visible`?0:e?.character??0});this.#rt(a,t);return}let r=this.#re?.at(-1);if(r!==void 0){let e=r.direction===-1?r.end:r.start;this.#$e(e,t)}else this.#$e(void 0,t)}blur(){this.#q=void 0,this.#K=!1,this.#W=!1,this.#k?.blur()}cleanUp(e=!1){this.#ke(),e||(this.#h.delivered=!1);let t=this.#P!=null,n=this.#e.persistState===!0;this.#l++,this.#he(),t&&(this.#u=n),zm(this.#Be),this.#n?.cleanUp(),this.#n=void 0,e||(this.#L=void 0,this.#F=void 0),this.#f?.forEach(e=>e()),this.#f=void 0,this.#d?.forEach(e=>e()),this.#d=void 0,this.#m?.(e),this.#m=void 0,this.#_=void 0,this.#v=void 0,this.#y.clear(),this.#b.clear(),this.#x.clear(),this.#S=void 0,this.#C?.remove(),this.#C=void 0,this.#w?.remove(),this.#w=void 0,this.#T?.remove(),this.#T=void 0,this.#E?.remove(),this.#E=void 0,this.#D=void 0,this.#r?.cleanUp(),this.#r=void 0,this.#O=void 0,this.#k?.removeAttribute(`contentEditable`),this.#k=void 0,this.#q=void 0,this.#K=!1,this.#A?.remove(),this.#A=void 0,this.#N?.disconnect(),this.#N=void 0,this.#ue=!1,this.#de!==void 0&&(cancelAnimationFrame(this.#de),this.#de=void 0),this.#Oe(),this.#P=void 0}__prepareFile(e){if(this.#e.persistState!==!0)return e;let t=uC(e),n=this.#F,r=e.lang??yf(e.name);n!==void 0&&(uC(n)!==t||n.name!==e.name||this.#L?.languageId!==r)&&(this.#l++,this.#he());let i=this.#pe(e,t);return i===void 0||i.getText()===e.contents?e:{...e,contents:i.getText()}}__postponeBgTokenizeToNextFrame(){let e=this.#n;e!==void 0&&(e.pauseBackgroundTokenize(),requestAnimationFrame(()=>{e.resumeBackgroundTokenize()}))}__captureFocusForDOMReplacement(){let e=this.#k,t=this.#D?.shadowRoot?.activeElement;e!=null&&(this.#K||t===e||t!=null&&e.contains(t))&&(this.#q={})}__syncRenderView=(e,t,n,r,i)=>{let a=this.#P;if(a==null)return;let o=t.shadowRoot;if(o==null){console.error(`[editor] Could not find the shadow root.`);return}let s,c,l;for(let e of o.querySelectorAll(`[data-code]`))if(e.dataset.deletions===void 0){s=e;for(let t of e.children){let e=t,{gutter:n,content:r}=e.dataset;n===void 0?r!==void 0&&(l=e):c=e}break}if(s===void 0||l===void 0){this.#q=void 0;return}this.#Ee().setViewportElements(t,s),this.#D!==t&&(this.#D=t,this.#C!==void 0&&t.appendChild(this.#C),this.#w!==void 0&&o.appendChild(this.#w),this.#T!==void 0&&o.appendChild(this.#T),this.#E!==void 0&&o.prepend(this.#E));let u=this.#L===void 0||this.#F===void 0||this.#F.name!==n.name||this.#F.lang!==n.lang||this.#F.cacheKey!==n.cacheKey,d=this.#e.persistState===!0?uC(n):void 0,f;if(u){this.#ke();let e=``;e=`contents`in n?n.contents:n.additionLines.join(``);let t=new Ay({maxEntries:this.#e.historyMaxEntries}),{name:r,lang:i,cacheKey:o}=n,s=i??yf(n.name),c=d===void 0?void 0:this.#pe(n,d),l=a.type===`file`||c?.getText()===e?c:void 0,u=l??new ob(n.name,e,s,0,t);this.#F={name:r,lang:i,cacheKey:o},this.#L=u,d!==void 0&&(this.#i.set(d,u),f={cacheKey:d,textDocument:u}),this.#n?.cleanUp(),this.#n=void 0,this.#Oe(),this.#b.clear(),this.#re=this.#ne,this.#e.__debug===!0&&console.log(l===void 0?`[diffs/editor] text document rebuilt from`:`[diffs/editor] cached text document reused for`,n.name)}f===void 0&&this.#u&&d!==void 0&&this.#L!==void 0&&(f={cacheKey:d,textDocument:this.#L});let p=this.#L;if(this.#n==null&&p!=null&&(this.#n=new aC({highlighter:e,textDocument:p,codeOptions:this.#P?.__getEffectiveCodeOptions()??{},matchBrackets:this.#e.matchBrackets,onDeferTokenize:this.#fe,onThemeChange:()=>this.#_t(),setStyle:e=>{this.#T.textContent=e},__debug:this.#e.__debug})),this.#k!==l&&(this.#O=c,this.#k=Db(l,{contentEditable:`true`,role:`textbox`,ariaMultiLine:`true`,autocapitalize:`off`,writingSuggestions:`off`,autocorrect:!1,spellcheck:!1,translate:!1}),this.#A!==void 0&&l.after(this.#A),this.#t.init(l),this.#Xe(),this.#ze(l,c),this.#k!==void 0&&this.#e.__debug===!0&&console.log(`[diffs/editor] full re-render triggered !!!`)),this.#q!=null&&(this.#q.target=l),l.ariaLabel!==n.name&&(l.ariaLabel=n.name),r!==void 0&&r.length>0||this.#we)for(let e of this.#k.children){let t=e,{lineAnnotation:n,lineType:r,separator:i}=t.dataset;(n!==void 0||i!==void 0||r===`change-deletion`)&&t.setAttribute(`contenteditable`,`false`)}if(this.#De(),this.#n?.syncTheme(this.#P?.__getEffectiveCodeOptions()??{}),this.#I=r,this.#R=i,this.#z=i?.totalLines,this.#n?.prebuildStateStack(i),this.#B?.removePopover(),(this.#re!==void 0||this.#ie!==void 0||this.#B!==void 0)&&this.#yt(this.#re??[]),this.#ne!==void 0&&this.#M!==void 0?(this.#ne=void 0,this.#at(!1,`center`)):this.#ae===void 0?this.#q===void 0?this.#re!==void 0&&this.#re.length>0&&this.#K&&!this.#le&&this.focus({preventScroll:!0}):this.#et():this.#st(this.#ae,this.#oe,this.#ce),this.#le&&this.#V?.focus(),this.#e.__debug===!0&&i!==void 0){let{startingLine:e,totalLines:t}=i;console.log(`[diffs/editor] render file:`,n.name,`RenderRange:`,e+`-`+(e+t),`of`,this.#L?.lineCount,`lines`)}f!==void 0&&(this.#u=!1,this.#ve(f.cacheKey,f.textDocument)),this.#Ae(a)};#pe(e,t){let n=this.#i.get(t),r=e.lang??yf(e.name);return n?.languageId===r?n:void 0}#me(){let e=this.#e.persistStateStorage??`inMemory`;return(this.#a===void 0||this.#o!==e)&&(this.#a=HS(e),this.#o=e),this.#a}#he(){let e=this.#F,t=this.#L;if(this.#e.persistState!==!0||this.#P===void 0||e===void 0||t===void 0)return;let n=uC(e);this.#i.set(n,t);let r;try{r=this.#me()}catch{return}let i=VS(this.getState()),a=this.#c;if(a?.cacheKey===n&&a.textDocument===t){if(this.#c=void 0,t.version===a.documentVersion&&this.#re===a.selections&&i.view?.scrollLeft===a.view?.scrollLeft&&i.view?.scrollTop===a.view?.scrollTop)return;this.#ge(r,n,i,a.completion);return}this.#ge(r,n,i)}#ge(e,t,n,r){let i=this.#s.get(t);if(r!==void 0||i!==void 0){let a=r??Promise.resolve();i!==void 0&&(a=a.then(()=>i)),this.#_e(t,a.then(()=>e.set(t,n)));return}let a;try{a=e.set(t,n)}catch{return}dC(a)&&this.#_e(t,a)}#_e(e,t){let n=t.catch(()=>{});this.#s.set(e,n),n.finally(()=>{this.#s.get(e)===n&&this.#s.delete(e)})}#ve(e,t){let n=++this.#l,r=t.version,i=this.#re,a=this.getState().view,o,s=s=>{let c=this.getState().view;if(n!==this.#l||this.#L!==t||t.version!==r||this.#re!==i||c?.scrollLeft!==a?.scrollLeft||this.#F===void 0||uC(this.#F)!==e)return;let l=o?.userScrolled()===!0;if(s===void 0){this.#P?.setCodeScrollLeft(0),l||this.#Ne(0);return}let u=VS(s);l&&u.view!==void 0&&(u.view={scrollLeft:u.view.scrollLeft}),this.setState(u)},c=()=>{let t;try{t=this.#me().get(e)}catch{return}if(dC(t))return t.then(s).catch(()=>{});try{s(t)}catch{}},l=this.#s.get(e),u=l===void 0?c():l.then(c);if(dC(u)){o=this.#ye();let n={cacheKey:e,textDocument:t,documentVersion:r,selections:i,view:a,completion:u.catch(()=>{})};this.#c=n,n.completion.finally(()=>{o?.dispose(),this.#c===n&&(this.#c=void 0)})}}#ye(){let e=this.#je();if(!(e instanceof HTMLElement))return;let t=!1,n=[`wheel`,`touchstart`,`mousedown`],r=()=>{for(let t of n)e.removeEventListener(t,i,{capture:!0})},i=()=>{t=!0,r()};for(let t of n)e.addEventListener(t,i,{capture:!0,passive:!0});return{userScrolled:()=>t,dispose:r}}#be(e){return this.#P?.isLineRenderable?.(e+1)??!0}get#xe(){let e=this.#P;if(e?.getNearestRenderableLine!=null)return(t,n)=>{let r=e.getNearestRenderableLine(t+1,n);return r==null?void 0:r-1}}#Se(e){this.#be(e)||this.#P?.revealLine?.(e+1)}get#Ce(){return this.#P?.options.diffStyle??`split`}get#we(){return this.#P?.type===`file-diff`}get#Te(){return this.#P?.options.overflow===`wrap`}#Ee(){return this.#r??=new Jb({hasActivePopover:()=>this.#H!==void 0||this.#B?.isPopoverVisible()===!0,updateActivePopover:()=>{this.#Tt(),this.#B?.updatePopoverPosition()}})}#De(){this.#y.clear(),this.#x.clear(),this.#S=void 0}#Oe(){this.#gt(null),this.#_=void 0,this.#v=void 0,this.#Fe(),this.#G=!1,this.#j?.forEach(e=>e.remove()),this.#j=void 0,this.#re=void 0,this.#ae=void 0,this.#B?.cleanup(),this.#B=void 0,this.#V?.cleanup(),this.#V=void 0,this.#H?.cleanup(),this.#H=void 0,this.#U=!0}#ke(){let e=this.#h;e.generation++,e.callback!=null&&(zm(e.callback),e.callback=void 0)}#Ae(e){let t=this.#h,n=this.#L;if(t.delivered||t.callback!=null||n==null)return;let{generation:r}=t,i=()=>{if(t.callback!==i||(t.callback=void 0,r!==t.generation||this.#P!==e||this.#L!==n))return;let a=this.#k,o=this.#D?.shadowRoot;a==null||o==null||!o.contains(a)||(t.delivered=!0,this.#e.onAttach?.(this,e))};t.callback=i,Rm(i)}#je(){let e=this.#P?.getEditorViewport?.();if(e!==void 0)return e;let t=this.#D;if(this.#P!=null&&t!=null)return Fb(t)}#Me(){let e=this.#je();return e instanceof HTMLElement?e.scrollTop:e?.defaultView?.scrollY??0}#Ne(e){let t=this.#je();t instanceof HTMLElement?t.scrollTop=e:t instanceof Document&&t.defaultView?.scrollTo({top:e})}#Pe(){this.#C=J(`style`,{dataset:`editorGlobalCss`,textContent:`
|
|
2038
|
+
[data-annotation-slot] {
|
|
2039
|
+
user-select: none;
|
|
2040
|
+
-webkit-user-select: none;
|
|
2041
|
+
}
|
|
2042
|
+
`}),this.#w=J(`style`,{dataset:`editorCss`,textContent:hb}),this.#T=J(`style`,{dataset:`editorThemeCss`}),this.#E=LS(),this.#A=J(`div`,{dataset:`editorOverlay`});let e=e=>{let t=e.composedPath()[0];return t instanceof Node&&this.#k?.contains(t)===!0},t=()=>{this.#q!=null&&(this.#q=void 0,this.#K=!1,this.#W=!1)},n=e=>{if(e.pointerType!==`mouse`)return;let t=this.#Y;this.#Fe(),t&&this.#$e(),this.#e.enabledSelectionAction===!0&&this.#re!==void 0&&this.#re.length>0&&!X(this.#re.at(-1))&&this.#yt(this.#re)};this.#f=[Y(document,`focusin`,n=>{e(n)||t()},{passive:!0}),Y(document,`pointerdown`,n=>{e(n)||queueMicrotask(t)},{capture:!0,passive:!0}),Y(document,`selectionchange`,()=>{let e=this.#D?.shadowRoot;if(this.#W||this.#G||e==null||!this.#K||this.#re!==void 0&&this.#re.length>1&&!this.#X)return;let t=document.getSelection();if(t==null)return;let n=typeof t.getComposedRanges==`function`?t.getComposedRanges({shadowRoots:[e]})?.[0]:lC(e);if(n===void 0||!this.#Yt(n))return;let r=$b(n,0);if(r!==void 0){if(this.#X&&this.#Q&&this.#re!==void 0&&this.#re.length>0){let e=this.#re.at(-1);this.#yt([Ex(e,r)]);return}if(this.#X)this.#$===void 0?this.#$=r:r=Tx(this.#$,r);else if(this.#$!==void 0)r.direction=Tx(this.#$,r).direction;else if(this.#re!==void 0&&this.#re.length===1){let e=this.#re[0];Q(e.start,r.start)===0&&Q(e.end,r.end)===0&&(r.direction=e.direction)}this.#Z!==void 0&&(this.#Z.focusLine=Z(r).line,this.#vt())||(this.#te===void 0?this.#yt([r]):this.#yt([...this.#te.filter(e=>!xx(e,r)),r]))}},{passive:!0}),Y(document,`pointerup`,n,{passive:!0}),Y(document,`pointercancel`,n,{passive:!0}),Y(document,`keydown`,e=>{e.key===`Shift`&&(this.#$=this.#re?.at(-1))},{passive:!0}),Y(document,`keyup`,e=>{e.key===`Shift`&&(this.#$=void 0)},{passive:!0})]}#Fe(){this.#p?.forEach(e=>e()),this.#p=void 0,this.#W=!1,this.#Y=!1,this.#X=!1,this.#Z=void 0,this.#Q=!1,this.#$=void 0,this.#te=void 0}#Ie(e){this.#p?.forEach(e=>e()),this.#p=e}#Le(){return this.#P?.options.enableLineSelection===!0}#Re(){this.#G=this.#re!==void 0}#ze(e,t){let{onFocus:n,onBlur:r}=this.#e,i=t=>{let n=t.composedPath()[0];return n!==void 0&&(n===e||e.contains(n))};this.#d?.forEach(e=>e()),this.#d=[Y(e,`focus`,()=>{this.#K=!0,n?.(),!this.#X&&!this.#W&&this.#re!==void 0&&this.#re.length>0&&this.#it(this.#re.at(-1))},{passive:!0}),Y(e,`blur`,()=>{this.#q?.target===e&&(this.#q=void 0,this.#W=!1),this.#K=!1,r?.()},{passive:!0}),Y(e,`pointerdown`,t=>{if(this.#U=!0,this.#G=!1,t.pointerType!==`mouse`)return;if(this.#Z=void 0,this.#lt(t)){this.#ht(!0),this.#re!==void 0&&this.#yt([]);return}this.#ht(!1),this.#B?.removePopover();let n=[];if(z_()&&this.#I!==void 0&&this.#I.length>0){let t=[...e.querySelectorAll(`[data-line-annotation]`)].map(e=>[Y(e,`mouseenter`,()=>{this.#W=!0}),Y(e,`mouseleave`,()=>{this.#W=!1})]).flat();n.push(...t)}this.#X=!0;let r=t.button===0&&t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey;if(this.#$=void 0,r?(this.#Z={pointerId:t.pointerId,startClientX:t.clientX,clientX:t.clientX,startScrollLeft:e.parentElement?.scrollLeft??0},this.#te=void 0,this.#re=void 0,this.#yt([]),n.push(Y(document,`pointermove`,e=>{let t=this.#Z;t!==void 0&&e.pointerType===`mouse`&&e.pointerId===t.pointerId&&(t.clientX=e.clientX,this.#vt())},{capture:!0,passive:!0}))):t.button===0&&sb(t)&&(this.#te=this.#re?.map(e=>({...e}))),this.#Ie(n),t.shiftKey){let e=this.#re?.at(-1);if(e!==void 0){let t=e.direction===-1?e.end:e.start;this.#it({start:t,end:t,direction:0})}this.#Q=!0}},{passive:!0}),Y(e,`keydown`,e=>{if(!i(e)||(this.#U=!0,this.#G=!1,e.isComposing||e.keyCode===229))return;let t=pb(e,this.#e.keymap);if(t!==void 0){e.preventDefault(),t===`simplifySelection`&&(this.#V?.close(),this.#V=void 0,this.#le=!1,this.#H?.cleanup(),this.#H=void 0),this.#Ue(t);return}let n=cb(e),r=this.#L;if(this.#re!==void 0&&this.#re.length>0&&n!==void 0&&r!==void 0){let t={getSoftLineOffsets:this.#Te?e=>this.#Jt(e):void 0,resolveRenderableLine:this.#xe};e.shiftKey?this.#yt(sx(r,this.#re,n,t)):this.#yt(tx(r,this.#re,n,t)),this.#at(),e.preventDefault();return}if((e.key.length===1?e.key.toLowerCase():e.key)===`v`&&sb(e)){if(e.repeat&&this.#we){e.preventDefault();return}if(this.#e.clipboard!==void 0){e.preventDefault(),Rm(this.#Be);return}}if(this.#V!==void 0){let t=mb(e);if(t!==void 0){e.preventDefault(),this.#V.navigate(t===`previous`);return}}}),Y(e,`copy`,e=>{i(e)&&(e.preventDefault(),this.#pt()?e.clipboardData?.setData(`text`,this.#mt()):this.#At(e.clipboardData,this.#Ot(),this.#kt()))}),Y(e,`cut`,e=>{if(i(e)){if(e.preventDefault(),this.#pt())e.clipboardData?.setData(`text`,this.#mt());else{let t=this.#kt();this.#At(e.clipboardData,this.#jt(),t)}}}),Y(e,`paste`,e=>{if(!i(e))return;e.preventDefault();let t=e.clipboardData,n=this.#L;if(t===null||n===void 0)return;let r=t.getData(`text`),a=this.#re?.length??0;if(a>1){let e=t.getData(hC);if(e!==void 0)try{let t=JSON.parse(e);Array.isArray(t)&&t.length===a&&(r=t)}catch{}}this.#Nt(Array.isArray(r)?r.map(e=>n.normalizeEol(e)):n.normalizeEol(r),void 0,!0,`document`)}),Y(e,`beforeinput`,e=>{i(e)&&e.inputType!==`insertCompositionText`&&(e.preventDefault(),this.#Qe(e.inputType,e.data))}),Y(e,`drop`,e=>{i(e)&&e.preventDefault()}),Y(e,`compositionstart`,e=>{i(e)&&(this.#J=!0,this.#W=!0)},{passive:!0}),Y(e,`compositionend`,e=>{if(!i(e))return;this.#W=!1;let t=this.#J;this.#J=!1,(e.data!==``||!t)&&this.#Qe(`insertText`,e.data)},{passive:!0})];let a=this.#D?.shadowRoot?.querySelector(`[data-deletions]`);if(a!=null&&this.#d.push(Y(a,`pointerdown`,e=>{let t=e.composedPath();if(bg(t)){this.#Re();return}let n=t[0],r=n instanceof HTMLElement?n.closest(`[data-column-number]`):null;if(r instanceof HTMLElement){if(this.#Le()){this.#Re();return}if(this.#ft(r,a,e.pointerType===`mouse`))return}this.#ht(!0),this.#re!==void 0&&this.#yt([])},{passive:!0})),t!==void 0){let e=(e,t=!1)=>{let n=e;return n?.dataset.lineNumberContent===void 0?t&&n?.tagName===`SPAN`&&(n=n.closest(`[data-line]`)):n=n.parentElement??void 0,n},n=e=>{if(e===void 0)return;let t=e.dataset.lineType,n=Tb(e)??Tb(e,`columnNumber`);if(!(n===void 0||t===void 0||!bx(t)))return n-1};this.#d.push(Y(t,`pointerdown`,t=>{let r=t.composedPath();if(bg(r)){this.#Re();return}let i=e(r[0]);if(i!==void 0&&this.#Le()){this.#Re();return}if(i?.dataset.lineType===`change-deletion`){let e=i.closest(`[data-code]`);e!=null&&this.#ft(i,e,t.pointerType===`mouse`);return}if(t.pointerType!==`mouse`)return;let a=this.#L,o=n(i);if(o===void 0||a===void 0)return;this.#U=!0,this.#B?.removePopover();let s=this.#ct(o,o,a);this.#Y=!0,this.#$=s,this.#yt([s]),this.#it(s),this.#$e(),this.#Ie([Y(document,`mousemove`,t=>{if(!this.#Y)return;let r=this.#L,i=n(e(t.composedPath()[0],!0));if(i===void 0||r===void 0)return;let a=this.#$?.start.line??i,o=this.#ct(a,i,r);this.#$??=o,this.#yt([o]),this.#$e(o.direction===-1?o.start:o.end)},{passive:!0})])},{passive:!0}))}this.#B?.listenHover(e),this.#N?.disconnect(),this.#N=new ResizeObserver(this.#Ye),this.#N.observe(e),this.#N.observe(e.parentElement),this.#Ve(e)}#Be=async()=>{let e=this.#e.clipboard;if(e!==void 0){let t=await e.readText(),n=this.#re?.length??0;if(n>1){let r=await e.readText(hC);try{let e=JSON.parse(r);Array.isArray(e)&&e.length===n&&(t=e)}catch{}}let r=this.#L;r!==void 0&&this.#Nt(Array.isArray(t)?t.map(e=>r.normalizeEol(e)):r.normalizeEol(t),void 0,!0,`document`)}};#Ve(e){this.#we&&this.#Ce===`split`&&this.#Te&&(this.#g={top:e.offsetTop,left:e.offsetLeft-this.#Ut()},this.#e.__debug===!0&&console.log(`[diffs/editor] content offset:`,this.#g))}get#He(){if(this.#we&&this.#Ce===`split`&&this.#Te)return this.#g}#Ue(e){let t=this.#L;if(t!==void 0)switch(e){case`openSearchPanel`:this.#Et(`find`);break;case`openSearchReplacePanel`:this.#Et(`replace`);break;case`findNextMatch`:{let e=this.#re;if(e===void 0)break;if(e.some(X)){let n=e.map(e=>X(e)?Wx(t,e):e);this.#yt(n),this.focus()}else{let n=jx(t,e);if(n!==void 0){this.#yt(n);let e=n.at(-1);e!==void 0&&this.#Se(Z(e).line),this.#at()}}break}case`moveLineUp`:case`moveLineDown`:this.#Je(e===`moveLineUp`?-1:1);break;case`copyLineUp`:case`copyLineDown`:this.#Ke(e===`copyLineUp`?-1:1);break;case`simplifySelection`:{let e=this.#re,t=e?.at(-1);if(e===void 0||t===void 0)break;if(e.length>1)this.#yt([t]),this.#$e(Z(t));else if(!X(t)){let e=Z(t);this.#yt([{start:e,end:e,direction:0}]),this.#$e(e)}break}case`insertBlankLine`:this.#qe();break;case`deleteHardLineForward`:this.#Lt();break;case`toggleComment`:case`toggleBlockComment`:{let n=this.#re;if(n===void 0)break;let{lineComment:r,blockComment:i}=yb(t.languageId,this.#e.languageCommentConfig);if(e===`toggleComment`&&r!==null){this.#Ge(bb(t,n,r));break}let a=e===`toggleComment`,o=wb(t,n,i,a);o!==void 0&&this.#Ge(o.edits,a?void 0:e=>o.nextSelectionOffsets.map(([t,n,r])=>({start:e.positionAt(t),end:e.positionAt(n),direction:r})));break}case`indent`:case`outdent`:case`indentLess`:case`indentMore`:if(this.#re!==void 0){let n=[],r=[],i=new Set,a=[];for(let o of this.#re){let s=o.start.line,c=e===`outdent`||e===`indentLess`,l=e===`indentLess`||e===`indentMore`;if(s!==o.end.line||c||l){let e=ex(t,o,this.#t.tabSize,c);for(let t of e[0]){let e=t.range.start.line;i.has(e)||(i.add(e),n.push(t))}r.push(e[1])}else{let e=t.charAt({line:s,character:0})===` `?` `:` `.repeat(this.#t.tabSize);n.push({range:o,newText:e}),a.push({line:s,startCharacter:o.start.character,addedLength:e.length-(o.end.character-o.start.character),selectionIndex:r.length});let i={line:o.start.line,character:o.start.character+e.length};r.push({start:i,end:i,direction:0})}}for(let e of a){let t=0;for(let n of a)n.line===e.line&&n.startCharacter<e.startCharacter&&(t+=n.addedLength);if(t!==0){let n=r[e.selectionIndex],i={line:e.line,character:n.start.character+t};r[e.selectionIndex]={start:i,end:i,direction:0}}}let o=t.applyEdits(n,!0,this.#re,r);o!==void 0&&this.#zt(o,r)}break;case`selectAll`:{let e=Mx(t);this.#yt([e]),this.focus();let n=this.#Vt(),r=n[0]?.[0],i=n.at(-1)?.[1];r!==void 0&&i!==void 0&&(this.#G=!0,this.#it({start:{line:r,character:0},end:{line:i,character:t.getLineLength(i)},direction:1}));break}case`moveCursorToDocStart`:case`moveCursorToDocEnd`:{let n=Nx(t,e===`moveCursorToDocEnd`,this.#we);this.#yt([n]),this.#Se(Z(n).line),this.#at()}break;case`expandSelectionDocStart`:case`expandSelectionDocEnd`:{let n=e===`expandSelectionDocEnd`,r=this.#re;if(r!==void 0){let e=Nx(t,n,this.#we);this.#yt(Dx(r,e)),this.#Se(Z(e).line),this.#at()}}break;case`undo`:case`redo`:this.#We(e)}}#We(e){let t=this.#L;if(t===void 0||e===`undo`&&!t.canUndo||e===`redo`&&!t.canRedo)return;let n=this.#re,r=n?.map(e=>[t.offsetAt(e.start),t.offsetAt(e.end)]),i=e===`undo`?t.undo():t.redo();if(i===void 0)return;let[a,o,s,c]=i,l=o??(n!==void 0&&r!==void 0&&c!==void 0?wx(t,n,r,c):void 0);this.#zt(a,l,s)}#Ge(e,t){let n=this.#L,r=this.#re;if(n===void 0||r===void 0)return;let i=t===void 0,a=i?r.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]):void 0,o=i?e.map(e=>{let t=n.offsetAt(e.range.start),r=n.offsetAt(e.range.end);return{start:Math.min(t,r),end:Math.max(t,r),text:e.newText}}).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n}):void 0,s=n.applyEdits(e,!0,r,void 0,!0);if(s===void 0)return;let c=i?wx(n,r,a,o):t(n);n.setLastUndoSelectionsAfter(c),this.#zt(s,c,this.#Bt(s))}#Ke(e){let t=this.#L,n=this.#re;if(t===void 0||n===void 0)return;let r=kx(n);if(r.length===0)return;let i=[],a=0,o=[];for(let n of r){i.push(a);let r=n.endLine-n.startLine+1;a+=r;let s=t.getText({start:{line:n.startLine,character:0},end:{line:n.endLine,character:t.getLineLength(n.endLine)}});if(e>0){let e={line:n.startLine,character:0};o.push({range:{start:e,end:e},newText:s+t.eol})}else if(n.endLine<t.lineCount-1){let e={line:n.endLine+1,character:0};o.push({range:{start:e,end:e},newText:s+t.eol})}else{let e={line:n.endLine,character:t.getLineLength(n.endLine)};o.push({range:{start:e,end:e},newText:t.eol+s})}}let s=n.map(t=>{let n=t.start.line,a=0,o=r.length-1;for(;a<=o;){let e=a+o>>>1,t=r[e];if(n<t.startLine)o=e-1;else if(n>t.endLine)a=e+1;else{a=e;break}}let s=Math.max(0,a<=o?a:o),c=r[s],l=i[s]+(e>0?c.endLine-c.startLine+1:0);return{start:{...t.start,line:t.start.line+l},end:{...t.end,line:t.end.line+l},direction:t.direction}});this.#Ge(o,()=>s)}#qe(){let e=this.#L,t=this.#re;if(e===void 0||t===void 0)return;let n=t.map(e=>Z(e).line),r=Array.from(new Set(n)).sort((e,t)=>e-t),i=new Map,a=new Map,o=[];for(let t=0;t<r.length;t++){let n=r[t],s=e.getLineText(n),c=/^\s*/.exec(s)?.[0]??``;i.set(n,t),a.set(n,c);let l={line:n,character:e.getLineLength(n)};o.push({range:{start:l,end:l},newText:e.eol+c})}let s=t.map((e,t)=>{let r=n[t],o={line:r+1+i.get(r),character:a.get(r).length};return{start:o,end:o,direction:0}});this.#Ge(o,()=>s)}#Je(e){let t=this.#L,n=this.#re;if(t===void 0||n===void 0)return;let r=kx(n);if(r.length===0||e<0&&r[0].startLine===0||e>0&&r.at(-1).endLine>=t.lineCount-1)return;let i=t.lineCount,a=e=>e<i-1?{line:e+1,character:0}:{line:e,character:t.getLineLength(e)},o=(e,n)=>{let r=e.map(e=>t.getLineText(e)).join(t.eol);return n?r+t.eol:r},s=[];if(e<0)for(let e of r){let t=e.startLine-1,n=[];for(let t=e.startLine;t<=e.endLine;t++)n.push(t);s.push({range:{start:{line:t,character:0},end:a(e.endLine)},newText:o([...n,t],e.endLine<i-1)})}else for(let e=r.length-1;e>=0;e--){let t=r[e],n=t.endLine+1,c=[];for(let e=t.startLine;e<=t.endLine;e++)c.push(e);s.push({range:{start:{line:t.startLine,character:0},end:a(n)},newText:o([n,...c],n<i-1)})}let c=r.at(-1),l=e>0&&c.endLine===i-2?t.getLineLength(c.endLine):t.getLineLength(i-1),u=n.map(n=>Ax(n,e,i,e=>e===i-1?l:t.getLineLength(e))),d=t.applyEdits(s,!0,n,u,!0);d!==void 0&&this.#zt(d,u)}#Ye=()=>{let e=this.#I?.length??0,t=this.#_,n=this.#v;this.#_=void 0,this.#v=void 0;let r=this.#Ut()!==t,i=this.#Wt()!==n;!r&&!i||(this.#x.clear(),this.#S=void 0,this.#t.clearTextWidthCache(),i&&(this.#b.clear(),(this.#Te||e>0)&&this.#y.clear()),(this.#re!==void 0||this.#ie!==void 0||this.#B!==void 0)&&(this.#yt(this.#re??[]),this.#re!==void 0&&this.#K&&this.focus()),this.#B?.removePopover(),this.#Ve(this.#k))};#Xe(){if(this.#ue)return;let e=document.fonts;e!==void 0&&(this.#ue=!0,e.ready.then(()=>{this.#k===void 0||!this.#t.remeasureCharacterWidth()||(this.#_=void 0,this.#v=void 0,this.#De(),this.#b.clear(),(this.#re!==void 0||this.#ie!==void 0||this.#B!==void 0)&&this.#yt(this.#re??[]),this.#B?.removePopover())}))}#Ze(e,t,n=this.#R,r){let i=this.#n,a=this.#P,o=this.#L,s=this.#O,c=this.#k;if(i===void 0||a===void 0||o===void 0||c===void 0)return;i.stopBackgroundTokenize();let l=performance.now(),u=i.tokenize(e,n,!this.#we&&a.getLinePosition!==void 0),d=performance.now();if(u.size>0){let e=c.children,t=new Set;for(let e of u.keys())this.#be(e)&&t.add(e);for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0){let e=Tb(r),n=r.dataset.lineType;if(e===void 0||n===`change-deletion`)continue;let i=e-1;if(t.has(i)){let e=u.get(i);if(r.replaceChildren(...sC(e)),t.delete(i),t.size===0)break}}}if(t.size>0){let n=0;for(let t=e.length-1;t>=0;t--){let r=e[t],i=Tb(r);if(i!==void 0&&r.dataset.lineType!==`change-deletion`){n=i;break}}for(let e of t){if(e<n)continue;let t=u.get(e),r=String(e+1);J(`div`,{dataset:{line:r,lineType:`context`,lineIndex:e.toString()},children:sC(t)},c),s!==void 0&&J(`div`,{dataset:{lineType:`context`,columnNumber:r,lineIndex:e.toString()},children:[J(`span`,{dataset:{lineNumberContent:``},textContent:r})]},s)}}}if(e.lineDelta<0)for(let t of[c.children,s?.children??[]])for(let n=t.length-1;n>=0;n--){let r=t[n],i=Tb(r)??Tb(r,`columnNumber`),a=r.dataset.lineType;if(i!==void 0&&a!==`change-deletion`){if(i-1<e.lineCount)break;r.remove()}}let f=e.lineDelta!==0;if(f){let e=c.children.length;for(let t of c.children){let{bufferSize:n}=t.dataset;n!==void 0&&(e+=parseInt(n)-1)}c.style.gridRow=`span `+e,s!==void 0&&(s.style.gridRow=`span `+e)}a.updateRenderCache(u,i.themeType,{shouldRefreshDiffsView:this.#we&&!f,lineCountChangeInFlight:f}),f&&a.applyDocumentChange(o,t,r),(f||this.#we&&this.#Ce===`unified`)&&this.#De(),t!==void 0&&(this.#I=t,Hb(t,c,s)),this.#e.__debug===!0&&console.log(`[diffs/editor] re-render in: ${kb(performance.now()-d)}ms,`,`tokenize in: ${kb(d-l)}ms (${u.size} dirty lines)`)}#Qe(e,t){switch(e){case`insertText`:{let e=t??``,n=this.#L,r=this.#re,i=n!==void 0&&r!==void 0?px(n,r,e,this.#e.autoSurround):void 0;this.#Nt(i??e);break}case`insertCompositionText`:break;case`insertLineBreak`:case`insertParagraph`:this.#Nt(this.#L?.eol??`
|
|
2043
|
+
`);break;case`deleteContentBackward`:this.#Pt();break;case`deleteContentForward`:this.#Pt(!0);break;case`deleteSoftLineBackward`:case`deleteHardLineBackward`:this.#Ft();break;case`deleteWordBackward`:this.#It();break;case`insertTranspose`:this.#Rt();break;default:console.warn(`[diffs] Unknown input type: ${e}`,t)}}#$e(e,t=!0,n){this.#K=!0,e===void 0?n?.()===!1?this.#K=!1:this.#k?.focus({preventScroll:t}):(this.#W=!0,this.#it({start:e,end:e,direction:0}),Rm(()=>{if(n?.()===!1||!this.#K){this.#W=!1;return}this.#k?.focus({preventScroll:t}),Rm(()=>{this.#W=!1})}))}#et(e){let t=this.#q;if(t==null)return;if(this.#le){this.#q=void 0,this.#K=!1,this.#W=!1;return}let n=this.#k;if(n==null||!this.#tt(n)){this.#q=void 0,this.#K=!1;return}let r=()=>{if(this.#q!==t)return!1;let e=this.#tt(n);return this.#q=void 0,e};if(e!=null){this.#$e(e,!0,r);return}let i=this.#re?.at(-1);if(i==null){this.#$e(void 0,!0,r);return}let a=i.direction===-1?i.end:i.start;this.#$e(a,!0,r)}#tt(e){let t=this.#D,n=t?.shadowRoot;if(t==null||n==null||this.#k!==e||!n.contains(e))return!1;let{activeElement:r}=n;if(r===e||r!=null&&e.contains(r))return!0;if(r!=null)return!1;let{ownerDocument:i}=t,{activeElement:a}=i;return a==null||a===i.body||a===i.documentElement||a===t}#nt(e=0){let t=this.#k,n=this.#D;if(this.#L==null||t==null||n==null)return;let r=this.#je();if(r===void 0)return;let i,a;if(r instanceof HTMLElement){let e=r.getBoundingClientRect();i=e.top,a=e.bottom}else i=0,a=r.defaultView?.innerHeight??0;let o=n.shadowRoot?.querySelector(`[data-diffs-header][data-sticky]`);if(o!=null&&(i=Math.max(i,o.getBoundingClientRect().bottom)),Number.isFinite(e)&&(i+=Math.max(0,e)),!(a<=i))for(let e of t.children){let t=e,n=Tb(t),r=t.dataset.lineType;if(n==null||r==null||!bx(r))continue;let o=t.getBoundingClientRect();if(!(o.bottom<=o.top)&&o.top>=i&&o.top<a)return n}}#rt(e,t){let n={start:e,end:e,direction:0};this.#U=!1,this.#yt([n]),this.#Se(e.line),t?this.#$e(e,!0):this.#at()}#it(e){let t=window.getSelection();if(t===null)return;let{start:n,end:r,direction:i}=e;Q(n,r)>0&&([n,r]=[r,n]);let a=this.#Ht(n.line),o=this.#Ht(r.line);if(a===void 0||o===void 0)return;let[s,c]=Ux(a,n.character),[l,u]=Ux(o,r.character);i===-1&&([s,c,l,u]=[l,u,s,c]);try{t.setBaseAndExtent(s,Eb(s,c),l,Eb(l,u))}catch(e){console.error(`[diffs/editor] failed to update window selection:`,e)}}#at(e=!1,t=`nearest`){let n=this.#re?.at(-1);if(n===void 0)return;let r=this.#M;if(r!==void 0){if(r.scrollIntoView({block:t,inline:`nearest`}),!e){let e=n.direction===-1?n.end:n.start;this.#q===void 0?this.#$e(e):this.#et(e)}}else{let t=Z(n);this.#st(t.line,t.character,e)}}#ot(){let e=this.#V===void 0?0:48,t=this.#Ut()+this.#t.ch;return`${e}px ${this.#t.ch}px 0 ${t}px`}#st(e,t=0,n=!1){this.__postponeBgTokenizeToNextFrame();let r=J(`div`,{style:{position:`absolute`,left:`0`,width:`2px`,height:this.#t.lineHeight+`px`,scrollMargin:this.#ot()}});if(this.#Ht(e)!==void 0){let[i,a]=this.#Kt(e,t),o=this.#Gt(e)+a*this.#t.lineHeight;if(r.style.top=o+`px`,r.style.left=i+`px`,this.#A?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),!n){let n={line:e,character:t};this.#q===void 0?this.#$e(n):this.#et(n)}this.#ae=void 0,this.#oe=void 0,this.#se=!1,this.#ce=!1}else{let i=this.#P?.getLinePosition?.(e+1);if(i!==void 0)r.style.top=i.top+`px`,this.#D?.shadowRoot?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),i.height>0&&this.#be(e)?(this.#ae=e,this.#oe=t,this.#ce=n):(this.#ae=void 0,this.#oe=void 0,this.#ce=!1);else{let i=0;if(this.#ae===e&&this.#k!==void 0)for(let t=this.#k.childElementCount-1;t>=0;t--){let n=this.#k.children[t],r=n.dataset.lineType,a=Tb(n);if(r!==void 0&&bx(r)&&a!==void 0){i=(e-(a-1))*this.#t.lineHeight;break}}let a=((this.#I??[]).filter(t=>t.lineNumber<e).length+e)*this.#t.lineHeight+i;r.style.top=a+`px`,this.#D?.shadowRoot?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),this.#ae===e&&(i===0||this.#se)||!this.#be(e)?(this.#ae=void 0,this.#oe=void 0,this.#se=!1,this.#ce=!1):(this.#ae=e,this.#oe=t,this.#se=i!==0,this.#ce=n)}}r.remove()}#ct(e,t,n){let r=e=>({line:e,character:0}),i=e=>({line:e,character:n.getLineText(e).length});return t<e?{start:r(t),end:i(e),direction:-1}:{start:r(e),end:i(t),direction:1}}#lt(e){let t=e.composedPath()[0];return t instanceof HTMLElement&&t.closest(`[data-line]`)?.getAttribute(`data-line-type`)===`change-deletion`}#ut(e,t,n){let r=[...n.querySelectorAll(`[data-content] > [data-line]`)],i=r.indexOf(e),a=r.indexOf(t),[o,s]=a<i?[t,e]:[e,t],c=window.getSelection();if(c!==null){let e=document.createRange();e.setStart(o,0),e.setEnd(s,s.childNodes.length),c.removeAllRanges(),c.addRange(e)}this.#ht(!0),this.#yt([]),this.#gt(Tb(t)??null,!0,`deletions`);let l=Math.min(i,a),u=Math.max(i,a);this.#ee=l<0?``:r.slice(l,u+1).filter(e=>e.getAttribute(`data-line-type`)===`change-deletion`).map(e=>e.textContent??``).join(`
|
|
2044
|
+
`)}#dt(e,t){let n=e.parentElement;if(n==null||t==null)return;let r=[...n.children].indexOf(e),i=t.children[r];return i instanceof HTMLElement?i:void 0}#ft(e,t,n){let r=t.querySelector(`[data-content]`),i=this.#dt(e,r);return i!==void 0&&(this.#ut(i,i,t),n&&this.#Ie([Y(document,`mousemove`,e=>{let n=e.composedPath()[0],a=n instanceof HTMLElement?n.closest(`[data-column-number]`):null;if(a instanceof HTMLElement&&t.contains(a)){let e=this.#dt(a,r);e!==void 0&&this.#ut(i,e,t)}},{passive:!0})]),!0)}#pt(){return this.#D?.shadowRoot?.querySelector(`pre`)?.hasAttribute(`data-deleted-text-selection`)??!1}#mt(){return this.#ee===``?window.getSelection()?.toString()??``:this.#ee}#ht(e){let t=this.#D?.shadowRoot?.querySelector(`pre`);t!=null&&(e?(t.setAttribute(`data-deleted-text-selection`,``),this.#gt(null),this.#ee=``):(t.removeAttribute(`data-deleted-text-selection`),this.#ee=``))}#gt(e,t=!1,n=`additions`){try{this.#P?.setEditorActiveLine(e,{lineNumberOnly:t,side:n})}catch{}}#_t(){this.#de===void 0&&(this.#de=requestAnimationFrame(()=>{this.#de=void 0,(this.#re!==void 0||this.#ie!==void 0||this.#B!==void 0)&&this.#yt(this.#re??[])}))}#vt(){let e=this.#Z,t=this.#$,n=this.#L;if(e===void 0||e.focusLine===void 0||t===void 0||n===void 0)return!1;let r=t.direction===-1?t.end:t.start,i=this.#k?.parentElement?.scrollLeft??0,a=(e.clientX-e.startClientX+i-e.startScrollLeft)/this.#t.ch,o=a<0?-Math.round(-a):Math.round(a),s=Math.max(0,r.character+o),c={line:e.focusLine,character:s};if(e.renderedGoal!==void 0&&Q(e.renderedGoal,c)===0)return!0;e.renderedGoal=c;let l=[],u=c.line<r.line?-1:1;for(let e=r.line;;e+=u){if(this.#be(e)){let t=n.getLineText(e),i=Math.min(r.character,t.length),a=Math.min(s,t.length),o=rx(t,i),c=a===i?o:rx(t,a);l.push({start:{line:e,character:Math.min(o,c)},end:{line:e,character:Math.max(o,c)},direction:o===c?0:o<c?1:-1})}if(e===c.line)break}return this.#yt(l),!0}#yt(e){if(this.__postponeBgTokenizeToNextFrame(),this.#M=void 0,this.#gt(null),e.length===0&&this.#ie===void 0&&this.#B===void 0){this.#re=void 0,this.#j?.forEach(e=>e.remove()),this.#j?.clear(),this.#H?.cleanup(),this.#H=void 0;return}let t=document.createDocumentFragment(),n={fragment:t,elements:new Map};if(e.length>0){let t=Ox(e),r=t.at(-1);this.#re=t;let i=t.some(e=>!X(e)),a=Z(r).line+1;this.#gt(a,i);for(let e of t)X(e)||this.#bt(n,`selection`,e),this.#wt(n,e,e===r);let o=this.#e.matchBrackets!==!1&&this.#L!==void 0&&this.#n!==void 0&&X(r)?wS(this.#L,this.#n,r.start):void 0;if(o!==void 0)for(let e of o)this.#bt(n,`bracketMatch`,e)}let r=this.#L;if(this.#ie!==void 0&&r!==void 0){let e=this.#ie,t=this.#R,i=t!==void 0&&Number.isFinite(t.totalLines)||this.#we&&this.#P?.options.expandUnchanged!==!0?this.#Vt():void 0,a=this.#re?.at(-1),o=a===void 0?-1:r.offsetAt(a.start),s=a===void 0?-1:r.offsetAt(a.end),c=0,l=i?.length??1;for(let t=0;t<l;t++){let a=1/0,l=i?.[t];if(l!==void 0){let[t,n]=l,i=r.offsetAt({line:t,character:0}),o=n+1;a=o<r.lineCount?r.offsetAt({line:o,character:0}):r.offsetAt({line:o-1,character:r.getLineLength(o-1)});let s=c,u=e.length;for(;s<u;){let t=s+Math.floor((u-s)/2);e[t][1]<=i?s=t+1:u=t}c=s}for(;c<e.length;c++){let[t,i]=e[c];if(t>=a)break;let l={start:r.positionAt(t),end:r.positionAt(i)},u=o===t&&s===i;this.#bt(n,`match`,l,u?`focus`:void 0)}}}if(this.#B!==void 0&&r!==void 0)for(let e of this.#B.markers)this.#bt(n,`marker`,e,yS(e.severity));this.#A?.appendChild(t),this.#j?.forEach(e=>e.remove()),this.#j?.clear(),this.#j=n.elements,this.#Tt()}#bt(e,t,n,r){if(this.#L===void 0)return;let{start:i,end:a}=n,o=i.line,s=a.line+1;if(this.#R!==void 0){let{startingLine:e,totalLines:t}=this.#R;o=Math.max(o,e),s=Math.min(s,e+t)}for(let n=o;n<s;n++){if(!this.#Xt(n))continue;let o=n===a.line,s=n===i.line?i.character:0,c=o?a.character:this.#L.getLineLength(n);if(this.#Te){let i=this.#Wt(),a=this.#L.getLineText(n);if(2*this.#t.ch+this.#t.measureTextWidth(a)>i){this.#xt(e,n,a,s,c,o,t,r);continue}}let l=0,u=0,d=0;l=s===0?this.#Ut()+this.#t.ch+(this.#He?.left??0):this.#Kt(n,s)[0],!o&&t===`selection`&&(d=this.#t.ch),u=s===c?d:this.#Kt(n,c)[0]-l+d,this.#Ct(e,t,n,0,l,u,r)}}#xt(e,t,n,r,i,a,o,s){let c=this.#Jt(t),l=c.length-1,u=this.#Ut()+this.#t.ch+(this.#He?.left??0);for(let d=0;d<l;d++){let f=c[d],p=c[d+1],m=Math.max(r,f),h=Math.min(i,p);if(m>h)continue;let g=this.#St(n,f,m),_=u+g,v=0;!a&&d===l-1&&o===`selection`&&(v=this.#t.ch);let y=m===h?v:this.#St(n,f,h)-g+v;this.#Ct(e,o,t,d,_,y,s)}}#St(e,t,n){if(n<=t)return 0;let r=e.slice(t,n),i=nC(r,this.#t.tabSize);return i===-1?this.#t.measureTextWidth(r):i*this.#t.ch}#Ct(e,t,n,r,i,a,o){if(a===0)return;let{ch:s,lineHeight:c}=this.#t,l=this.#Gt(n)+r*c,u=`${t}-${n}/${r}-${i}-${a} ${o??``}`,d=this.#j,f=(this.#e.roundedSelection??!0)&&t===`selection`,p=(n,r,i,a)=>{let o=this.#Gt(n)+r*c,l=this.#Ht(n),u=`initial`;l!==void 0&&(l.dataset.lineType===`change-addition`||l.dataset.selectedLine!==void 0)&&(u=getComputedStyle(l).getPropertyValue(`--diffs-line-bg`));let f=`width:${s}px;transform:translateX(${i}px) translateY(${o}px);--diffs-selection-corner-bg:${u}`,p={selectionCorner:``,[a]:``},m=`${t}-block-${n}/${r}-${i}-1ch`,h=m+`-`+a;if(a===`rbl`){let t=m+`-rtl`,n=e.elements.get(t);n!==void 0&&(n.remove(),e.elements.delete(t),h+=`-rtl`,p.rtl=``)}let g=e.elements.get(h);g===void 0&&(d?.has(h)===!0?(g=d.get(h),g.style.cssText=f,d.delete(h)):g=J(`div`,{dataset:`selectionRange`,style:{cssText:f},children:[J(`div`,{dataset:p})]},e.fragment),e.elements.set(h,g))},m=t=>{let o=i+a,c=t.dataset,l=e.previousSelectionRange;if((l===void 0||l.line!==n||l.wrapLine!==r)&&(e.previousSelectionRange={element:t,line:n,wrapLine:r,left:i,width:a}),l===void 0||o<=l.left)[`rtl`,`rtr`,`rbl`,`rbr`].forEach(e=>{c[e]=``});else{let e=l.line,t=l.wrapLine,a=l.left,u=l.element.dataset,d=a+l.width;a>i&&p(e,t,a-s,`rbr`),delete u.rbl,delete c.rtl,delete c.rtr,o>=d&&delete u.rbr,o>d&&(p(e,t,d,`rbl`),c.rtr=``),o<d&&p(n,r,o,`rtl`),i<a&&(c.rtl=``),c.rbl=``,c.rbr=``}},h=e.elements.get(u);if(h!==void 0){f&&m(h);return}d?.has(u)===!0?(h=d.get(u),d.delete(u)):h=J(`div`,{dataset:o?[t+`Range`,o]:t+`Range`},e.fragment),h.style.width=`${a}px`,h.style.transform=`translateX(${i}px) translateY(${l}px)`,f&&m(h),e.elements.set(u,h)}#wt(e,t,n){let{line:r,character:i}=Z(t);if(!this.#Xt(r))return;let[a,o]=this.#Kt(r,i),s=`caret-`+r+`/`+o+`:`+i;if(e.elements.has(s))return;let c=J(`div`,{dataset:`caret`,style:{transform:`translateX(${a-1}px) translateY(${this.#Gt(r)+o*this.#t.lineHeight}px)`}},e.fragment);e.elements.set(s,c),n&&(c.style.scrollMargin=this.#ot(),this.#M=c)}#Tt(){let e=this.#re?.at(-1),t=this.#A,n=this.#L,r=this.#e.renderSelectionAction,i=()=>{this.#H?.cleanup(),this.#H=void 0};if(this.#e.enabledSelectionAction!==!0||r===void 0||e===void 0||X(e)||this.#X||t===void 0||n===void 0){i();return}let a=Z(e);if(!this.#Xt(a.line)){i();return}if(this.#H===void 0){if(!this.#U)return;let a=()=>this.#re?.at(-1)??e,o=r({textDocument:n,get selection(){return a()},applyEdits:e=>this.applyEdits(e),getSelectionText:()=>this.#L?.getText(a())??``,replaceSelectionText:e=>{this.#Nt(e,[a()])},close:()=>{i(),this.#at()}});this.#H=new BS(o,t,()=>this.#Tt()),this.#Ee().resetPlacement(mC)}let o=this.#t.lineHeight,s=e.direction===-1,c={placeAbove:s,anchor:a},l=s?{placeAbove:!1,anchor:e.end}:{placeAbove:!0,anchor:e.start},u=this.#H.height,d=e=>{let[t,n]=this.#Kt(e.anchor.line,e.anchor.character),r=this.#Gt(e.anchor.line)+n*o,i=e.placeAbove?r:r+o,a=e.placeAbove?i-u:i;return{top:a,bottom:a+u,left:t,anchorTop:i,rowTop:r}},f=d(c),p=n.lineCount,m=s?a.line<3:a.line>=p-3,h=this.#Xt(l.anchor.line)?d(l):void 0,g=this.#Ee(),_=g.getPlacementBounds(),v=h!==void 0&&g.choosePlacement({preferred:f,fallback:h,viewport:_,popoverHeight:u,atDocumentEdge:m,placementKey:mC})===`fallback`;h===void 0&&g.setPlacement(`preferred`,mC);let{placeAbove:y}=v?l:c,{left:b,anchorTop:x}=v&&h!==void 0?h:f,S=s?f.rowTop:h?.rowTop??-1/0,C=(s?h?.rowTop??1/0:f.rowTop)+(e.end.line>e.start.line&&e.end.character===0?0:o),w=_===void 0||C>_.top&&S<_.bottom;this.#H.reposition(b,x,this.#Ut(),y,w,_)}#Et(e){if(this.#V!==void 0){this.#V.setMode(e);return}this.#Dt(e)}#Dt(e){this.#V?.cleanup();let t=this.#L,n=this.#D?.shadowRoot?.querySelector(`pre`),r=this.#re;if(t===void 0||n==null)return;let i=``,a;if(r!==void 0&&r.length>0){let e=r.at(-1);if(X(e)){e=Wx(t,e),this.#yt([...r.slice(0,-1),e]);let n=t.getText(e);n!==``&&!n.includes(`
|
|
2045
|
+
`)&&(i=n,a=[t.offsetAt(e.start),t.offsetAt(e.end)])}}let o=([e,n],r)=>{let i=Sx(t,e,n);this.#yt([i]),this.#Se(Z(i).line),this.#at(!0),this.#le=r},s=new zS({textDocument:t,containerElement:n,defaultQuery:i,mode:e,initialMatch:a,scrollToMatch:o,applyReplace:e=>{if(e.length===0)return;let n=t.applyEdits(e.map(e=>({range:{start:t.positionAt(e.start),end:t.positionAt(e.end)},newText:e.text})),!0,this.#re);n!==void 0&&this.#zt(n,void 0,this.#Bt(n),{skipSearchRefresh:!0})},onUpdate:(e,n)=>{if(e.length===0){this.#ie=void 0,this.#yt(this.#re??[]);return}if(this.#ie=e,n?.syncSelection===!1){this.#yt(this.#re??[]);let n=this.#re?.at(-1);if(n!==void 0){let r=t.offsetAt(n.start),i=t.offsetAt(n.end);for(let t of e)if(t[0]===r&&t[1]===i)return t}return}let r=this.#re?.at(-1),i=0,a;r!==void 0&&(i=t.offsetAt(r.start));for(let t of e)if(t[0]>=i){a=t;break}return a===void 0?this.#yt(this.#re??[]):o(a,!0),a},onClose:()=>{this.#V=void 0,this.#le=!1,this.#ie=void 0,this.#yt(this.#re??[])}});this.#V=s,this.#le=!1}#Ot(){let e=this.#L,t=this.#re;return e===void 0||t===void 0?``:Lx(e,t)}#kt(){let e=this.#L,t=this.#re;return e===void 0||t===void 0?[]:Ix(e,t)}#At(e,t,n){e!==null&&(e.setData(`text`,t),n.length>1&&e.setData(hC,JSON.stringify(n)))}#jt(){let e=this.#L,t=this.#re;if(e===void 0||t===void 0||t.length===0)return``;if(t.some(e=>X(e))){let n=Hx(e,t);return this.#Mt(n.edits,n.nextSelectionOffsets),n.text}let n=Lx(e,t);return this.#Nt(``,void 0,!0),n}#Mt(e,t){let n=this.#L,r=this.#re;if(n===void 0||r===void 0||e.length===0)return;let i=n.applyResolvedEdits(e,!0,r,void 0,!0);if(i===void 0)return;let a=t.map(e=>{let t=n.positionAt(e);return{start:t,end:t,direction:0}});n.setLastUndoSelectionsAfter(a),this.#zt(i,a,this.#Bt(i))}#Nt(e,t=this.#re,n=!1,r=`selection`){if(t===void 0)return;let i=this.#L,a=t.at(-1);if(i===void 0||a===void 0)return;let{nextSelections:o,change:s}=Array.isArray(e)&&e.length===t.length?dx(i,t,e,this.#I,n,r):cx(i,t,{start:i.offsetAt(a.start),end:i.offsetAt(a.end),text:Array.isArray(e)?e.join(i.eol):e},this.#I,void 0,n);s!==void 0&&this.#zt(s,o,this.#Bt(s))}#Pt(e=!1){let t=this.#re,n=this.#L;if(t===void 0||n===void 0)return;let{nextSelections:r,change:i}=yx(n,t,e,this.#I,this.#t.tabSize);i!==void 0&&this.#zt(i,r,this.#Bt(i))}#Ft(){let e=this.#re,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=gx(t,e,this.#Te?(e,t)=>{let n=this.#Jt(e);for(let e=0;e+1<n.length;e++){let r=n[e],i=n[e+1];if(t>=r&&t<=i)return r}return 0}:void 0,this.#I);r!==void 0&&this.#zt(r,n,this.#Bt(r))}#It(){let e=this.#re,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=_x(t,e,this.#I);r!==void 0&&this.#zt(r,n,this.#Bt(r))}#Lt(){let e=this.#re,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=hx(t,e,this.#I);r!==void 0&&this.#zt(r,n,this.#Bt(r))}#Rt(){let e=this.#re,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=mx(t,e,this.#I);r!==void 0&&this.#zt(r,n,this.#Bt(r))}#zt(e,t,n,r){let i=this.getFile(),a=this.#e.onChange;if(i!==void 0&&a!==void 0){let t=n??this.#I;a(i,t,{changes:e.changes,file:i,lineAnnotations:t})}if(e.lineDelta!==0||this.#Te)for(let t of this.#y.keys())t>=e.startLine&&this.#y.delete(t);if(this.#b.size>0){if(e.lineDelta===0&&(e.changedLineRanges.length===1||e.changedLineChanges?.every(([,,e])=>e===0)===!0))for(let[t,n]of e.changedLineRanges)for(let e=t;e<=n;e++)this.#b.delete(e);else for(let t of this.#b.keys())t>=e.startLine&&this.#b.delete(t)}this.#S=void 0;let o=this.#R,s;if(o!==void 0&&t!==void 0&&t.length>0){let n=t.at(-1),r=o.startingLine+o.totalLines;if(n.end.line>=r){let t=n.end.line-o.startingLine+1,i=this.#z===void 0||this.#z===1/0?1/0:this.#z*fC;e.startLine<=r&&t<=i&&this.#be(n.end.line)?(n.end.line>r&&(s=!0),o={...o,totalLines:t},this.#R=o):s=!0}}if(this.#Ze(e,n,o,s),r?.skipSearchRefresh!==!0&&this.#V!==void 0&&this.#ie!==void 0&&this.#V.updateMatches({syncSelection:!1}),t!==void 0&&(this.#yt(t),r?.skipFocus!==!0)){let e=t.at(-1);if(e!==void 0&&this.#Se(Z(e).line),this.#M!==void 0)requestAnimationFrame(()=>{this.#M?.scrollIntoView({block:`nearest`,inline:`nearest`})});else if(t.length>0){let e=Z(t.at(-1));this.#st(e.line,e.character)}this.focus({preventScroll:!0})}}#Bt(e){if(this.#I!==void 0){let t=Ib(e,this.#I);if(t!==void 0)return this.#L?.setLastUndoLineAnnotations(this.#I,t),t}}#Vt(){let e=this.#k;if(e===void 0)return[];let t=[];for(let n of e.children){let e=n,r=e.dataset.lineType,i=Tb(e);if(i===void 0||r===void 0||!bx(r))continue;let a=i-1,o=t.at(-1);o!==void 0&&a<=o[1]+1?o[1]=Math.max(o[1],a):t.push([a,a])}return t}#Ht(e){let t=this.#x.get(e);if(t!==void 0)return t??void 0;let n=this.#R;if(n!==void 0&&(e<n.startingLine||e>=n.startingLine+n.totalLines))return;let r=this.#k;if(r!==void 0){if(n!==void 0){let{startingLine:i}=n,{children:a}=r;for(let n=e-i;n<=a.length;n++){let r=a[n];if(r===void 0)break;let i=Tb(r),o=r.dataset.lineType;if(i!==void 0&&i===e+1&&o!==void 0&&bx(o)){t=r;break}}}return t??=r.querySelector(`[data-line="${e+1}"]`+(this.#Ce===`unified`?`:not([data-line-type="change-deletion"])`:``)),t!==void 0&&this.#x.set(e,t),t??void 0}}#Ut(){if(this.#O===void 0)return 0;if(this.#_===void 0){let e=this.#k?.parentElement?.style.getPropertyValue(`--diffs-column-number-width`);this.#_=e!==void 0&&e.length>2&&e.endsWith(`px`)?parseInt(e.slice(0,-2),10):this.#O.offsetWidth}return this.#_}#Wt(){if(this.#k===void 0)return 0;if(this.#v===void 0){let e=this.#k.parentElement?.style.getPropertyValue(`--diffs-column-content-width`);this.#v=e!==void 0&&e.length>2&&e.endsWith(`px`)?parseFloat(e.slice(0,-2)):this.#k.offsetWidth}return this.#v}#Gt(e){let t=this.#y.get(e);if(t!==void 0)return t;let n=this.#Ht(e);if(n===void 0)return-1;let r=n.offsetTop+this.#t.paddingTop;return r+=this.#He?.top??0,this.#y.set(e,r),r}#Kt(e,t){if(this.#S!==void 0&&this.#S[0]===e&&this.#S[1]===t)return[this.#S[2],this.#S[3]];let n=this.#L?.getLineText(e),r=this.#Ut()+this.#t.ch;if(n===void 0||n.length===0||t<=0)return[r+(this.#He?.left??0),0];let i=eC(n,Math.min(t,n.length)),a=n.slice(0,i),o=nC(a,this.#t.tabSize),s=0,c=0;if(s=o===-1?r+this.#t.measureTextWidth(a):r+o*this.#t.ch,this.#Te){let t=this.#Wt();if(2*this.#t.ch+this.#t.measureTextWidth(n)>t){let t=this.#qt(e);if(t==null)return[s+(this.#He?.left??0),0];for(let e=0;e+1<t.length;e++){let a=t[e];if(i<=t[e+1]){c=e;let t=n.slice(a,i),o=nC(t,this.#t.tabSize);s=o===-1?r+this.#t.measureTextWidth(t):r+o*this.#t.ch;break}}}s+=this.#He?.left??0}return this.#S===void 0?this.#S=[e,t,s,c]:(this.#S[0]=e,this.#S[1]=t,this.#S[2]=s,this.#S[3]=c),[s,c]}#qt(e){let t=this.#b.get(e);if(t!==void 0)return t;this.#b.size>=pC&&this.#b.clear();let n=this.#L?.getLineText(e);if(n===void 0||n.length===0){let t=new Uint32Array([0]);return this.#b.set(e,t),t}let r=this.#k;if(r==null||!r.isConnected)return;let i=J(`div`,{style:{position:`absolute`,top:`0`,left:`0`,width:`100%`,boxSizing:`border-box`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,font:`inherit`,paddingInline:`1ch`,tabSize:this.#t.tabSize.toString()},textContent:n},r),a=i.firstChild,o=document.createRange(),s=[];try{let t=i.getBoundingClientRect();if(t.width===0)return;let r=tC(n),c=t.left+this.#t.ch,l=r===void 0?n.length:r.length-1,u=e=>r===void 0?e:r[e],d=e=>(o.setStart(a,u(e)),o.setEnd(a,u(e+1)),o.getBoundingClientRect());s.push(0);let f=d(0).top,p=1;for(;p<l;){let e=p,t=l;for(;e<t;){let n=e+t>>1;d(n).top>f?t=n:e=n+1}if(e>=l)break;let{left:n,top:r}=d(e),i=z_()&&n-c>this.#t.ch/2;s.push(u(i?e-1:e)),f=r,p=e+1}let m=new Uint32Array(s.length+1);for(let e=0;e<s.length;e++)m[e]=s[e];return m[s.length]=n.length,this.#b.set(e,m),m}finally{i.remove()}}#Jt(e){let t=this.#qt(e);if(t!==void 0)return t;let n=this.#L?.getLineText(e)?.length??0;return Uint32Array.of(0,n)}#Yt({startContainer:e,endContainer:t}){let n=this.#k;return n!==void 0&&n.contains(e)&&n.contains(t)}#Xt(e){let t=this.#L?.lineCount??0;return e<0||e>=t?!1:this.#Ht(e)!==void 0}},_C=N.createContext(void 0);function vC(e){let t=N.useContext(_C);if(t===void 0&&!e)throw Error(b(72));return t}var yC={...ye,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,appliedTriggerProps:(e,t)=>t?e.activeTriggerProps:void 0,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},bC=class extends Ce{constructor(e,t,n){let r=new a;super(xC(e,r,t,n),SC(r),yC)}setOpen=(e,t)=>{s(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,w(Se,e))}};function xC(e,t,n,r=!1){return{...A(t,n,r),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function SC(e){return{popupRef:N.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var CC=te(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:i,disableHoverablePopup:a=!1,trackCursorAxis:o=`none`,actionsRef:s,onOpenChange:c,onOpenChangeComplete:l,handle:u,triggerId:d,defaultTriggerId:f=null,children:p}=e,m=y((e,t)=>new bC({open:n,openProp:i,activeTriggerId:f,triggerIdProp:d},e,t));m.useControlledProp(`openProp`,i),m.useControlledProp(`triggerIdProp`,d),m.useContextCallback(`onOpenChange`,c),m.useContextCallback(`onOpenChangeComplete`,l);let h=m.useState(`open`),g=!t&&h,_=m.useState(`activeTriggerId`),v=m.useState(`mounted`),b=m.useState(`payload`);m.useSyncedValues({trackCursorAxis:o,disableHoverablePopup:a,disabled:t}),r(m,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:x,transitionStatus:S}=oe(g,m),C=m.useState(`isInstantPhase`),D=m.useState(`instantType`),O=m.useState(`lastOpenChangeReason`),k=N.useRef(null);E(()=>{h&&t&&m.setOpen(!1,w(ie))},[h,t,m]),E(()=>{S===`ending`&&O===`none`||S!==`ending`&&C?(D!==`delay`&&(k.current=D),m.set(`instantType`,`delay`)):k.current!==null&&(m.set(`instantType`,k.current),k.current=null)},[S,C,O,D,m]),E(()=>{g&&(_??m.set(`payload`,void 0))},[m,_,g]),N.useImperativeHandle(s,()=>({unmount:x,close:()=>m.setOpen(!1,w(be))}),[x,m]);let ee=g||v||!t&&o!==`none`;return(0,P.jsxs)(_C.Provider,{value:m,children:[u&&(0,P.jsx)(T,{handle:u,store:m}),ee&&(0,P.jsx)(wC,{store:m,disabled:t,trackCursorAxis:o}),typeof p==`function`?p({payload:b}):p]})});function wC({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=x(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=Ke(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=N.useMemo(()=>ee(a.reference,i.reference),[a.reference,i.reference]);return _(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??k}),null}var TC=N.createContext(void 0);function EC(){let e=N.useContext(TC);if(e===void 0)throw Error(b(70));return e}var DC=t(i(),1),OC=N.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=fe({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,P.jsxs)(N.Fragment,{children:[l,c&&DC.createPortal(n,c)]})}),kC=N.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return vC().useState(`mounted`)||n?(0,P.jsx)(TC.Provider,{value:n,children:(0,P.jsx)(OC,{ref:t,...r})}):null}),AC=N.createContext(void 0);function jC(){let e=N.useContext(AC);if(e===void 0)throw Error(b(71));return e}var MC=N.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=O,style:g,..._}=e,v=vC(),y=EC(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=v.useState(`adaptiveOrigin`),k=Oe({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:D}),ee=N.useMemo(()=>({open:b,side:k.side,align:k.align,anchorHidden:k.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,k.side,k.align,k.anchorHidden,S,T]),A=Ae(e,ee,{styles:k.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,P.jsx)(AC.Provider,{value:k,children:A})}),NC=N.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=vC(),{side:s,align:c}=jC(),l=o.useState(`open`),u=o.useState(`instantType`),p=o.useState(`transitionStatus`),h=o.useState(`popupProps`),g=o.useState(`floatingRootContext`),_=o.useState(`disabled`),v=o.useState(`closeDelay`);f({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),Te(g,{enabled:!_,closeDelay:v});let y=o.useStateSetter(`popupElement`);return m(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:p},ref:[t,o.context.popupRef,y],props:[xe,h,ke(p),a],stateAttributesMapping:d})}),PC={open:0,warm:!1,cooling:void 0},FC=600,IC=(0,N.createContext)(null);function LC(){let e=(0,N.useContext)(IC);if(!e)throw Error(`Tooltip parts must be used inside <Tooltip>`);return e}var RC=(0,N.forwardRef)(function({children:e,className:t,defaultOpen:n=!1,delayDuration:r=300,onOpenChange:i,open:a,side:o=`top`,...s},c){let l=(0,N.useRef)(null),[u,d]=(0,N.useState)(n),[f,p]=(0,N.useState)(!1),m=a??u;(0,N.useEffect)(()=>{if(m)return PC.open+=1,PC.warm=!0,clearTimeout(PC.cooling),()=>{--PC.open,!(PC.open>0)&&(PC.cooling=setTimeout(()=>{PC.warm=!1},FC))}},[m]);let h=`${(0,N.useId)()}-content`,g=(0,N.useRef)(null),_=()=>{g.current!==null&&(clearTimeout(g.current),g.current=null)},v=e=>{_(),a===void 0&&d(e),i?.(e)};return ce(()=>{v(!1)}),(0,N.useEffect)(()=>_,[]),(0,P.jsx)(IC.Provider,{value:{arrivedWarm:f,cancelClose:_,contentId:h,open:m,scheduleClose:()=>{_(),m&&(g.current=setTimeout(()=>{v(!1)},0))},scheduleOpen:()=>{if(_(),m)return;let e=PC.warm;g.current=setTimeout(()=>{p(e),v(!0)},e?0:Math.max(0,r))},side:o,trigger:l},children:(0,P.jsx)(CC,{open:m,onOpenChange:v,children:(0,P.jsx)(`span`,{...s,className:we(`relative inline-flex`,t),ref:c,children:e})})})}),zC=(0,N.forwardRef)(function({asChild:e=!1,children:t,className:n,onBlur:r,onFocus:i,onPointerEnter:a,onPointerLeave:o,...s},c){let u=LC(),d=(0,N.useCallback)(e=>{u.trigger.current=e},[u.trigger]);(0,N.useImperativeHandle)(c,()=>u.trigger.current);let{"aria-describedby":f,...p}=s,m={...p,"aria-describedby":[f,u.open?u.contentId:void 0].filter(Boolean).join(` `)||void 0,"data-state":u.open?`open`:`closed`,onBlur:e=>{r?.(e),e.defaultPrevented||u.scheduleClose()},onFocus:e=>{i?.(e),e.defaultPrevented||u.scheduleOpen()},onPointerEnter:e=>{a?.(e),e.defaultPrevented||u.scheduleOpen()},onPointerLeave:e=>{o?.(e),e.defaultPrevented||u.scheduleClose()}};return e?(0,P.jsx)(l,{...m,className:we(n),ref:d,children:t}):(0,P.jsx)(`button`,{...m,className:we(`btn`,n),ref:d,type:s.type??`button`,children:t})}),BC=(0,N.forwardRef)(function({children:e,className:t,onPointerEnter:n,onPointerLeave:r,...i},a){let s=LC(),c=ve(`tooltip`),[l,u]=(0,N.useState)(null);return(0,N.useImperativeHandle)(a,()=>l,[l]),(0,N.useLayoutEffect)(()=>{let e=l;if(!s.open||!e||!o(e))return;let t=v(e),n=s.arrivedWarm?0:t.distance,r={bottom:`0 ${String(-n)}px`,left:`${String(n)}px 0`,right:`${String(-n)}px 0`,top:`0 ${String(n)}px`}[s.side],i=e.animate([{opacity:0,translate:r},{opacity:1,translate:`0 0`}],{duration:s.arrivedWarm?t.fast:t.normal,easing:se(t,t.ease),composite:`add`});return()=>{i.cancel()}},[l,s.open,s.arrivedWarm,s.side]),!s.open||!c?null:(0,P.jsx)(kC,{container:c,children:(0,P.jsx)(MC,{anchor:s.trigger,side:s.side,sideOffset:8,collisionPadding:8,collisionBoundary:c===document.body?void 0:c,className:`pointer-events-auto z-(--stipe-layer-tooltip)`,children:(0,P.jsx)(NC,{...i,"aria-live":`polite`,className:we(`pointer-events-auto max-w-(--container-xs) rounded-box bg-base-content px-md py-sm text-xs text-base-100 shadow-lg`,t),id:s.contentId,onPointerEnter:e=>{n?.(e),e.defaultPrevented||s.cancelClose()},onPointerLeave:e=>{r?.(e),e.defaultPrevented||s.scheduleClose()},ref:u,role:`tooltip`,children:e})})})});function VC(e){return e.replace(/^\uFEFF/,``).replace(/\r\n?/g,`
|
|
2046
|
+
`)}function HC(e){return/^\s*$/.test(e)}function UC(e,t){let n=0;for(;n<e.length&&n<t&&e[n]===` `;)n++;return e.slice(n)}function WC(e){let t=``;for(let n of e)n.type===`text`||n.type===`inlineCode`?t+=n.value:`children`in n?t+=WC(n.children):n.type===`image`&&(t+=n.alt);return t}function GC(){let e=new Map;return t=>{let n=t.toLowerCase().normalize(`NFKD`).replace(/[\u0300-\u036f]/g,``).replace(/&[a-z0-9#]+;/gi,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`section`,r=e.get(n)??0;return e.set(n,r+1),r===0?n:`${n}-${r+1}`}}function KC(e){let t=e.trim().replace(/[\u0000-\u001F\u007F\s]+/g,``);return t?/^(#|\/|\.\/|\.\.\/)/.test(t)||/^(https?:|mailto:|tel:)/i.test(t)?t:/^[a-z][a-z0-9+.-]*:/i.test(t)?``:t:``}function qC(e){return e.trim().toLowerCase()}function JC(e){return qC(e).replace(/[^a-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``)}function YC(e,t={}){let n=hw(QC(e,t));for(let e of t.extensions??[])n=e.transformInline?.(n,{options:t})??n;return n}var XC=32,ZC=16;function QC(e,t,n={scans:Math.max(e.length*ZC,1024),depth:0}){if(n.depth>=XC)return e?[{type:`text`,value:e}]:[];n.depth++;let r=[],i=0,a=``,o=()=>{a&&=(r.push({type:`text`,value:a}),``)};for(;i<e.length;){let s=e[i],c=e[i+1];if(s===`\\`){if(c===`
|
|
2047
|
+
`){o(),r.push({type:`break`}),i+=2;continue}if(c&&/[\\`*_[\]{}()#+\-.!|~<>]/.test(c)){a+=c,i+=2;continue}}if(s==="`"){let t=iw(e,i,"`"),s=aw(e,i+t,"`",t,n);if(s!==-1){o(),r.push({type:`inlineCode`,value:e.slice(i+t,s).replace(/\s+/g,` `).trim()}),i=s+t;continue}a+=e.slice(i,i+t),i+=t;continue}if(s===`!`&&c===`[`){let a=ew(e,i+1,t,n);if(a){o(),r.push({type:`image`,src:KC(a.href),alt:mw(a.label,n),...a.title?{title:a.title}:{}}),i=a.end;continue}}if(s===`[`){let a=$C(e,i,t,n);if(a){o(),r.push(a.node),i=a.end;continue}let s=ew(e,i,t,n);if(s){let e=KC(s.href);o(),e?r.push({type:`link`,href:e,...s.title?{title:s.title}:{},children:QC(s.label,t,n)}):r.push(...QC(s.label,t,n)),i=s.end;continue}}if(s===`*`&&c===`*`&&e[i+2]===`*`){let a=ow(e,i+3,`***`,n);if(a!==-1){o(),r.push({type:`emphasis`,children:QC(e.slice(i+1,a+2),t,n)}),i=a+3;continue}}if(s===`*`&&c===`*`||s===`_`&&c===`_`){let l=s===`_`&&!uw(e,i,2,!0)?-1:ow(e,i+2,s+s,n);if(l!==-1){o(),r.push({type:`strong`,children:QC(e.slice(i+2,l),t,n)}),i=l+2;continue}a+=s+c,i+=2;continue}if(s===`~`&&c===`~`&&e[i+2]===`~`){let t=iw(e,i,`~`);a+=e.slice(i,i+t),i+=t;continue}if(s===`~`&&c===`~`){let s=ow(e,i+2,`~~`,n);if(s!==-1){o(),r.push({type:`strike`,children:QC(e.slice(i+2,s),t,n)}),i=s+2;continue}a+=`~~`,i+=2;continue}if(s===`~`){let a=sw(e,i+1,n);if(a!==-1){o(),r.push({type:`strike`,children:QC(e.slice(i+1,a),t,n)}),i=a+1;continue}}if(s===`*`||s===`_`){let a=s===`_`&&!uw(e,i,1,!0)?-1:ow(e,i+1,s,n);if(a!==-1){o(),r.push({type:`emphasis`,children:QC(e.slice(i+1,a),t,n)}),i=a+1;continue}}if(s===`<`&&t.allowHtml){let t=cw(e,i+1,`>`,n);if(t!==-1&&tw(e.slice(i,t+1))){o(),r.push({type:`inlineHtml`,value:e.slice(i,t+1)}),i=t+1;continue}}a+=s,i++}return o(),n.depth--,r}function $C(e,t,n,r){if(e[t+1]!==`^`)return;let i=cw(e,t+2,`]`,r);if(i===-1)return;let a=qC(e.slice(t+2,i)),o=n.footnotes?.[a];if(!o||!n.footnoteOrder)return;let s=n.footnoteOrder.indexOf(a);s===-1&&(n.footnoteOrder.push(a),s=n.footnoteOrder.length-1);let c=(n.footnoteCounts?.[a]??0)+1;return n.footnoteCounts&&(n.footnoteCounts[a]=c),{node:{type:`footnoteReference`,id:o.id??(JC(o.label)||`footnote`),number:s+1,...c>1?{referenceIndex:c}:{}},end:i+1}}function ew(e,t,n,r){let i=rw(e,t,`[`,`]`,r);if(i===-1)return;let a=e.slice(t+1,i);if(e[i+1]===`(`){let t=rw(e,i+1,`(`,`)`,r);if(t===-1)return;let n=nw(e.slice(i+2,t).trim());return n?{label:a,href:n.href,...n.title?{title:n.title}:{},end:t+1}:void 0}if(e[i+1]===`[`){let t=rw(e,i+1,`[`,`]`,r);if(t===-1)return;let o=e.slice(i+2,t),s=n.references?.[qC(o||a)];return s?{label:a,href:s.href,...s.title?{title:s.title}:{},end:t+1}:void 0}let o=n.references?.[qC(a)];if(o)return{label:a,href:o.href,...o.title?{title:o.title}:{},end:i+1}}function tw(e){return/^<!--(?:[\s\S]*--|-?)>$/.test(e)||/^<\?[\s\S]*\?>$/.test(e)||/^<![A-Z][\s\S]*>$/.test(e)||/^<!\[CDATA\[[\s\S]*\]\]>$/.test(e)||/^<\/[A-Za-z][\w:-]*\s*>$/.test(e)?!0:/^<[A-Za-z][\w:-]*(?:\s+[A-Za-z_:][\w:.-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?)*\s*\/?>$/.test(e)}function nw(e){let t=e.match(/^(\S+)(?:\s+["']([^"']*)["'])?$/);return t?{href:t[1].replace(/^<|>$/g,``),...t[2]?{title:t[2]}:{}}:{href:e}}function rw(e,t,n,r,i){let a=0;for(let o=t;o<e.length;o++){if(!lw(i))return-1;if(e[o-1]!==`\\`&&(e[o]===n&&a++,e[o]===r&&(a--,a===0)))return o}return-1}function iw(e,t,n,r){let i=0;for(;e[t+i]===n&&!(r&&!lw(r));)i++;return i}function aw(e,t,n,r,i){for(let a=t;a<e.length;a++){if(!lw(i))return-1;if(e[a]===n&&iw(e,a,n,i)>=r)return a}return-1}function ow(e,t,n,r){for(let i=t;i<e.length;i++){if(!lw(r))return-1;if(e[i-1]!==`\\`&&(n!==`~~`||e[i-1]!==`~`&&e[i+2]!==`~`)&&!(n[0]===`_`&&!uw(e,i,n.length,!1))&&e.startsWith(n,i))return i}return-1}function sw(e,t,n){if(pw(e[t]??``)||/\d/.test(e[t]??``))return-1;for(let r=t;r<e.length;r++){if(!lw(n))return-1;if(e[r-1]!==`\\`&&e[r]===`~`&&e[r-1]!==`~`&&e[r+1]!==`~`)return pw(e[r-1]??``)?-1:r}return-1}function cw(e,t,n,r){for(let i=t;i<e.length;i++){if(!lw(r))return-1;if(e[i]===n)return i}return-1}function lw(e){return e.scans<=0?!1:(e.scans--,!0)}function uw(e,t,n,r){let i=e[t-1],a=e[t+n],o=!dw(a)&&(!fw(a)||dw(i)||fw(i)),s=!dw(i)&&(!fw(i)||dw(a)||fw(a));return r?o&&(!s||fw(i)):s&&(!o||fw(a))}function dw(e){return e===void 0||/\s/.test(e)}function fw(e){return e!==void 0&&/[^\p{L}\p{N}\s]/u.test(e)}function pw(e){return/\s/.test(e)}function mw(e,t){return QC(e,{},t).map(e=>e.type===`text`||e.type===`inlineCode`?e.value:``).join(``)}function hw(e){let t=[];for(let n of e){let e=t.at(-1);e?.type===`text`&&n.type===`text`?e.value+=n.value:t.push(n)}return t}var gw=64;function _w(e,t={}){let n=VC(e),r=t.frontmatter!==!1,i=n.split(`
|
|
2048
|
+
`),a;if(r&&i[0]===`---`){let e=i.findIndex((e,t)=>t>0&&e===`---`);e>0&&(a=i.slice(1,e).join(`
|
|
2049
|
+
`),i=i.slice(e+1))}let o=bw(i);i=o.lines;let s=[],c=Object.create(null),l=Object.keys(o.references).length>0,u=Object.keys(o.footnotes).length>0,d=l||u?{...t,...l?{references:o.references}:{},...u?{footnotes:o.footnotes,footnoteOrder:s,footnoteCounts:c}:{}}:t,f=new vw(i,d,GC()).parse();u&&s.length>0&&f.push(xw(o.footnotes,s,d));let p=a===void 0?{type:`root`,children:f}:{type:`root`,frontmatter:a,children:f};for(let e of d.extensions??[])p=e.transformDocument?.(p,{options:d})??p;return p}var vw=class e{lines;options;slugger;budget;index=0;constructor(e,t,n,r={depth:0}){this.lines=e,this.options=t,this.slugger=n,this.budget=r}parse(){if(this.budget.depth>=gw){let e=this.lines.slice(this.index).join(`
|
|
2050
|
+
`);return this.index=this.lines.length,e?[{type:`paragraph`,children:YC(e,this.options)}]:[]}this.budget.depth++;let e=[];for(;this.index<this.lines.length;){if(HC(this.current())){this.index++;continue}let t=this.parseExtensionBlock();if(t){e.push(t);continue}let n=this.parseFence()??this.parseHeading()??this.parseThematicBreak()??this.parseBlockquote()??this.parseList()??this.parseTable()??this.parseHtmlBlock()??this.parseParagraph();e.push(n)}return this.budget.depth--,e}parseExtensionBlock(){for(let t of this.options.extensions??[]){let n=0,r=t.parseBlock?.({lines:this.lines,index:this.index,options:this.options,parseInline:e=>YC(e,this.options),parseBlocks:t=>new e(VC(t).split(`
|
|
2051
|
+
`),this.options,this.slugger,this.budget).parse(),consume:e=>{n=e}});if(r)return this.index+=Math.max(n,1),r}}parseFence(){let e=this.current().match(/^ {0,3}(`{3,}|~{3,})(.*)$/);if(!e)return;let t=e[1],n=t[0],r=t.length,i=e[2].trim(),a=[];for(this.index++;this.index<this.lines.length;){let e=this.current(),t=e.match(/^ {0,3}(`{3,}|~{3,})\s*$/);if(t&&t[1][0]===n&&t[1].length>=r){this.index++;break}a.push(e),this.index++}return{type:`code`,value:a.join(`
|
|
2052
|
+
`),...yw(i)}}parseHeading(){let e=this.current().match(/^ {0,3}(#{1,6})(?:[ \t]+(.*)|[ \t]*)$/);if(!e)return;let t=e[1].length,n=e[2]??``,r=YC((/^#+[ \t]*$/.test(n)?``:n.replace(/[ \t]+#+[ \t]*$/,``)).trim(),this.options),i=this.createHeadingId(r);return this.index++,i?{type:`heading`,depth:t,id:i,children:r}:{type:`heading`,depth:t,children:r}}parseThematicBreak(){if(/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(this.current()))return this.index++,{type:`thematicBreak`}}parseBlockquote(){if(!/^ {0,3}>\s?/.test(this.current()))return;let t=[];for(;this.index<this.lines.length;){let e=this.current();if(HC(e)){t.push(``),this.index++;continue}let n=e.match(/^ {0,3}>\s?(.*)$/);if(!n)break;t.push(n[1]),this.index++}return{type:`blockquote`,children:new e(t,this.options,this.slugger,this.budget).parse()}}parseList(){let t=Cw(this.current());if(!t)return;let n=[],r=t.ordered,i=t.indent,a=r?t.number:void 0,o=!1;for(;this.index<this.lines.length;){let r=Cw(this.current());if(!r||!ww(r,t)||r.indent!==i)break;let a=r.content,s=a.match(/^\[([ xX])\]\s+(.*)$/),c=s?s[1].toLowerCase()===`x`:void 0;s&&(a=s[2]);let l=[a];for(this.index++;this.index<this.lines.length;){let e=this.current(),n=Cw(e);if(n&&n.indent===i)break;if(HC(e)){let e=this.index;for(;e<this.lines.length&&HC(this.lines[e]);)e++;let n=this.lines[e];if(n===void 0)break;let a=Cw(n);if(a?.indent===i){if(!ww(a,t))break;o=!0,this.index=e;break}if(Tw(n)<r.contentIndent)break;o=!0,l.push(``),this.index=e;continue}if(Tw(e)>=r.contentIndent){l.push(UC(e,r.contentIndent)),this.index++;continue}if(Ew(e,this.next()))break;l.push(e.trimStart()),this.index++}let u={type:`listItem`,children:new e(l,this.options,this.slugger,this.budget).parse()};c!==void 0&&(u.checked=c),n.push(u)}return{type:`list`,ordered:r,...r&&a!==void 0?{start:a}:{},...o&&{loose:!0},items:n}}parseTable(){let e=this.current(),t=this.next();if(!t||!Dw(e,t))return;let n=Ow(e),r=Ow(t).map(kw),i=n.length,a=[];for(this.index+=2;this.index<this.lines.length;){let e=this.current();if(HC(e)||Ew(e,this.next()))break;let t=Ow(e);a.push(Array.from({length:i},(e,n)=>Aw(t[n]??``,this.options))),this.index++}return{type:`table`,align:r,header:n.map(e=>Aw(e,this.options)),rows:a}}parseHtmlBlock(){if(!this.options.allowHtml||!/^ {0,3}<([A-Za-z][\w:-]*|!--|\/[A-Za-z])/.test(this.current()))return;let e=[];if(/^ {0,3}<!--/.test(this.current())){for(;this.index<this.lines.length;){let t=this.current();if(e.push(t),this.index++,t.includes(`-->`))break}return{type:`html`,value:e.join(`
|
|
2053
|
+
`)}}for(;this.index<this.lines.length&&!HC(this.current());)e.push(this.current()),this.index++;return{type:`html`,value:e.join(`
|
|
2054
|
+
`)}}parseParagraph(){let e=[];for(;this.index<this.lines.length;){let t=this.current();if(HC(t)||e.length>0&&Ew(t,this.next()))break;e.push(t.trim()),this.index++}return{type:`paragraph`,children:YC(e.join(`
|
|
2055
|
+
`),this.options)}}createHeadingId(e){if(this.options.headingIds===!1)return;let t=WC(e);return typeof this.options.headingIds==`function`?this.options.headingIds(t,this.index):this.slugger(t)}current(){return this.lines[this.index]??``}next(){return this.lines[this.index+1]}};function yw(e){if(!e)return{};let t=e.match(/^([A-Za-z0-9_+.#-]+)/)?.[1],n=t?e.slice(t.length).trim():e,r=n.match(/(?:^|\s)(?:title|file)=(?:"([^"]+)"|'([^']+)'|([^\s}]+))/),i=n.match(/(?:^|\s)framework=(?:"([^"]+)"|'([^']+)'|([^\s}]+))/),a=n.match(/\{([^}]+)\}|(?:^|\s)lines=([^\s]+)/),o=Sw(a?.[1]??a?.[2]??``),s=r?r[1]??r[2]??r[3]:void 0,c=i?i[1]??i[2]??i[3]:void 0;return{...t?{lang:t}:{},...n?{meta:n}:{},...s?{title:s,file:s}:{},...c?{framework:c.toLowerCase()}:{},...o.length?{highlightLines:o}:{}}}function bw(e){let t=Object.create(null),n=Object.create(null),r=new Map,i=[],a,o=0,s=0;for(;s<e.length;){let c=e[s],l=c.match(/^ {0,3}(`{3,}|~{3,})/);if(l){let e=l[1][0];a?e===a&&l[1].length>=o&&(a=void 0,o=0):(a=e,o=l[1].length),i.push(c),s++;continue}if(!a){let i=c.match(/^ {0,3}\[\^([^\]\n]+)\]:[ \t]*(.*)$/);if(i){let t=i[1],a=[i[2]??``];for(s++;s<e.length;){let t=e[s];if(!/^(?: {4,}|\t)/.test(t))break;a.push(t.replace(/^(?: {4}|\t)/,``)),s++}let o=qC(t);if(!n[o]){let e=JC(t)||`footnote`,i=(r.get(e)??0)+1;r.set(e,i),n[o]={label:t,content:a.join(`
|
|
2056
|
+
`),id:i===1?e:`${e}-${i}`}}continue}let a=c.match(/^ {0,3}\[([^\]\n]+)\]:[ \t]*(\S+)(?:[ \t]+(?:"([^"]*)"|'([^']*)'|\(([^)]*)\)))?[ \t]*$/);if(a){let e=a[3]??a[4]??a[5];t[qC(a[1])]={href:a[2].replace(/^<|>$/g,``),...e===void 0?{}:{title:e}},s++;continue}}i.push(c),s++}return{lines:i,references:t,footnotes:n}}function xw(e,t,n){let r=[];for(let i=0;i<t.length;i++){let a=e[t[i]];a&&r.push({id:a.id??(JC(a.label)||`footnote`),number:i+1,children:new vw(VC(a.content).split(`
|
|
2057
|
+
`),n,GC()).parse()})}for(let e of r){let r=n.footnoteCounts?.[t[e.number-1]]??1;r>1&&(e.referenceCount=r)}return{type:`footnotes`,items:r}}function Sw(e){let t=new Set;for(let n of e.split(`,`)){let e=n.trim().match(/^(\d+)(?:-(\d+))?$/);if(!e)continue;let r=Number(e[1]),i=Number(e[2]??e[1]);for(let e=r;e<=i&&e<r+1e3;e++)t.add(e)}return[...t].sort((e,t)=>e-t)}function Cw(e){let t=e.match(/^(\s{0,8})([-+*]|\d{1,9}[.)])(?:([ \t]+)(.*))?$/);if(!t)return;let n=t[2],r=/\d/.test(n[0]);return{ordered:r,...r?{number:Number.parseInt(n,10)}:{},indent:t[1].length,marker:r?n.at(-1):n,contentIndent:t[1].length+n.length+(t[3]?.length??1),content:t[4]??``}}function ww(e,t){return e.ordered===t.ordered&&e.marker===t.marker}function Tw(e){return e.match(/^ */)?.[0].length??0}function Ew(e,t){let n=Cw(e);return/^ {0,3}(`{3,}|~{3,})/.test(e)||/^ {0,3}#{1,6}(?:\s+|$)/.test(e)||/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(e)||/^ {0,3}>\s?/.test(e)||n!==void 0&&(!n.ordered||n.number===1)||!!t&&Dw(e,t)}function Dw(e,t){if(!e.includes(`|`))return!1;let n=Ow(t);return n.length===Ow(e).length&&n.every(e=>/^:?-+:?$/.test(e.trim()))}function Ow(e){let t=e.trim();t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&(t=t.slice(0,-1));let n=[],r=``;for(let e=0;e<t.length;e++){let i=t[e];if(i===`\\`&&t[e+1]===`|`){r+=`|`,e++;continue}if(i===`|`){n.push(r.trim()),r=``;continue}r+=i}return n.push(r.trim()),n}function kw(e){let t=e.trim();if(t.startsWith(`:`)&&t.endsWith(`:`))return`center`;if(t.endsWith(`:`))return`right`;if(t.startsWith(`:`))return`left`}function Aw(e,t){return{type:`tableCell`,children:YC(e,t)}}function jw({children:e,...t}){return(0,N.createElement)(N.Fragment,null,Mw(e,t))}function Mw(e,t={}){return(typeof e==`string`?_w(e,t):e).children.map((e,n)=>Nw(e,t,`b:${n}`))}function Nw(e,t={},n){switch(e.type){case`heading`:return $(t,`h${e.depth}`,{key:n,...e.id?{id:e.id}:{},...e.framework?{"data-framework":e.framework}:{}},Fw(e.children,t),Gw(e.id,t));case`paragraph`:return $(t,`p`,{key:n},Fw(e.children,t));case`code`:return Iw(e,t,n);case`list`:return $(t,e.ordered?`ol`:`ul`,{key:n,...e.ordered&&e.start&&e.start!==1?{start:e.start}:{}},e.items.map((n,r)=>$(t,`li`,{key:r},Lw(n.children,n.checked,e.loose,t,`${r}`))));case`blockquote`:return $(t,`blockquote`,{key:n},e.children.map((e,r)=>Nw(e,t,`${n}:${r}`)));case`table`:return $(t,`table`,{key:n},$(t,`thead`,null,$(t,`tr`,null,e.header.map((n,r)=>zw(`th`,n,e.align[r],t,r)))),e.rows.length?$(t,`tbody`,null,e.rows.map((n,r)=>$(t,`tr`,{key:r},n.map((n,r)=>zw(`td`,n,e.align[r],t,r))))):null);case`footnotes`:return Bw(e.items,t,n);case`thematicBreak`:return $(t,`hr`,{key:n});case`html`:return t.allowHtml?$(t,`div`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):$(t,`p`,{key:n},e.value);case`callout`:return $(t,`div`,{key:n,className:`markdown-alert markdown-alert-${e.kind.toLowerCase()}`},$(t,`p`,{className:`markdown-alert-title`},e.title),$(t,`div`,{className:`markdown-alert-content`},e.children.map((e,r)=>Nw(e,t,`${n}:${r}`))));case`component`:return Ww(e,t,n)}}function Pw(e,t={},n){switch(e.type){case`text`:return e.value;case`inlineCode`:return $(t,`code`,{key:n},e.value);case`strong`:return $(t,`strong`,{key:n},Fw(e.children,t));case`emphasis`:return $(t,`em`,{key:n},Fw(e.children,t));case`strike`:return $(t,`del`,{key:n},Fw(e.children,t));case`footnoteReference`:return $(t,`sup`,{key:n},$(t,`a`,{id:`user-content-fnref-${Uw(e)}`,"data-footnote-ref":``,"aria-describedby":`footnote-label`,href:`#user-content-fn-${e.id}`},e.number));case`link`:return $(t,`a`,{key:n,href:e.href,...e.title?{title:e.title}:{}},Fw(e.children,t));case`image`:return $(t,`img`,{key:n,src:e.src,alt:e.alt,...e.title?{title:e.title}:{}});case`break`:return $(t,`br`,{key:n});case`inlineHtml`:return t.allowHtml?$(t,`span`,{key:n,dangerouslySetInnerHTML:{__html:e.value}}):e.value}}function Fw(e,t){return e.map((e,n)=>Pw(e,t,`i:${n}`))}function Iw(e,t,n){let r=e.lang??`plaintext`,i=t.highlighter,a={className:`language-${r}`},o=i?void 0:e.value,s=i?{dangerouslySetInnerHTML:{__html:i(e.value,r,{...e.highlightLines&&{highlightLines:e.highlightLines},...t.codeLineNumbers!==void 0&&{lineNumbers:t.codeLineNumbers}})}}:void 0,c=$(t,`pre`,{className:`tm-code${t.codeLineNumbers?` tm-code--line-numbers`:``}`,"data-lang":r,...e.title?{"data-code-title":e.title}:{},...e.file?{"data-filename":e.file}:{},...e.framework?{"data-framework":e.framework}:{}},$(t,`code`,{...a,...s},o));return e.title?$(t,`figure`,{key:n,className:`tm-code-frame`,"data-lang":r},$(t,`figcaption`,null,e.title),c):$(t,N.Fragment,{key:n},c)}function Lw(e,t,n,r,i){let[a,...o]=e,s=t===void 0?[]:[$(r,`input`,{key:`${i}:checkbox`,type:`checkbox`,disabled:!0,checked:t,readOnly:!0}),` `];if(a?.type===`paragraph`){let e=[...s,...Fw(a.children,r)];return[...n?[$(r,`p`,{key:`${i}:paragraph`},e)]:e,...o.flatMap((e,t)=>Rw(e,n,r,`${i}:${t+1}`))]}return[...s,...e.flatMap((e,t)=>Rw(e,n,r,`${i}:${t}`))]}function Rw(e,t,n,r){return!t&&e.type===`paragraph`?Fw(e.children,n):[Nw(e,n,r)]}function zw(e,t,n,r,i){return $(r,e,{key:i,...n?{style:{textAlign:n}}:{}},Fw(t.children,r))}function Bw(e,t,n){return $(t,`section`,{key:n,"data-footnotes":``,className:`footnotes`},$(t,`h2`,{id:`footnote-label`,className:`sr-only`},`Footnotes`,Gw(`footnote-label`,t)),$(t,`ol`,null,e.map(e=>$(t,`li`,{key:e.id,id:`user-content-fn-${e.id}`},Vw(e,t)))))}function Vw(e,t){let n=e.children.length-1,r=Hw(e,t);return n<0?[$(t,`p`,{key:`backref-wrapper`},r.slice(1))]:e.children.map((e,i)=>i===n&&e.type===`paragraph`?$(t,`p`,{key:i},Fw(e.children,t),r):Nw(e,t,`${i}`))}function Hw(e,t){let n=[];for(let r=1;r<=(e.referenceCount??1);r++){let i=r===1?e.id:`${e.id}-${r}`,a=r===1?`${e.number}`:`${e.number}-${r}`;n.push(` `,$(t,`a`,{key:r,"data-footnote-backref":``,"aria-label":`Back to reference ${a}`,className:`data-footnote-backref`,href:`#user-content-fnref-${i}`},`↩`))}return n}function Uw(e){return e.referenceIndex&&e.referenceIndex>1?`${e.id}-${e.referenceIndex}`:e.id}function $(e,t,n,...r){let i=typeof t==`string`?e.components?.[t]??t:t;return(0,N.createElement)(i,n,...r)}function Ww(e,t,n){let r=e.tagName??`md-comment-component`,i={...e.properties??{}};return e.tagName||(i[`data-component`]=e.name,i[`data-attributes`]||=JSON.stringify(e.attributes)),$(t,r,{key:n,...i},e.children.map((e,r)=>Nw(e,t,`${n}:${r}`)))}function Gw(e,t){if(!e||!t.headingAnchors)return null;let n=typeof t.headingAnchors==`object`?t.headingAnchors:{};return $(t,`a`,{href:`#${e}`,"aria-hidden":n.ariaHidden??!0,className:n.className??`anchor-heading anchor-heading-link`,tabIndex:n.tabIndex??-1},n.content??`#`)}function Kw(e){return e}function qw({fallbackLanguage:e=`plaintext`,languages:t}){let n=new Map,r=new Map;for(let e of t){let t=Zw(e.name);n.set(t,e),r.set(t,t);for(let n of e.aliases||[])r.set(Zw(n),t)}let i=Zw(e);function a(e){return r.get(Zw(e||i))||i}function o(e,t,i=0){let s=n.get(a(t));return!s||i>24?[]:Qw(e.length,s.tokenize(e,{hasLanguage(e){let t=r.get(Zw(e));return!!(t&&n.has(t))},tokenize(e,t){return o(e,t,i+1)}}))}function s(e,t={}){let n=a(t.lang),r=o(e,n);return{code:e,lang:n,tokens:r.length?$w(e,r):[{value:e}]}}function c(e,t={}){let n=s(e,t),r=Yw(Jw(n.tokens,t));return{...n,html:`<pre class="th-code th-code--${uT(n.lang)}${t.lineNumbers?` th-code--line-numbers`:``}" data-language="${uT(n.lang)}"><code>${r}</code></pre>`}}function l({code:e,decorations:t,lang:n,lineNumbers:r,title:i}){let a=e.trimEnd(),o=c(a,{decorations:t,lang:n,lineNumbers:r});return{copyText:a,htmlMarkup:o.html,lang:o.lang,title:i,tokens:o.tokens}}return{highlight:c,highlightToHtml(e,t={}){return c(e,t).html},listLanguages(){return[...n.keys()]},normalizeLanguage:a,renderCodeBlockData:l,tokenize:s}}function Jw(e,t={}){let n=e.map(e=>e.value).join(``),r=t.decorations||[],i=r.filter(tT),a=r.filter(nT);if(!(t.lineNumbers||a.length))return eT(e,0,n.length,i);let o=[],s=rT(n);for(let t=0;t<s.length;t++){let r=t+1,c=s[t],l=s[t+1]??n.length,u=l>c&&n[l-1]===`
|
|
2058
|
+
`,d=u?l-1:l,f=a.filter(e=>iT(e.lines,r));o.push({type:`element`,classNames:[`th-line`,...f.flatMap(e=>cT(e.className))],data:{...aT(f),line:String(r)},children:eT(e,c,d,i)}),u&&o.push({type:`text`,value:`
|
|
2059
|
+
`})}return o}function Yw(e){let t=``;for(let n of e){if(n.type===`text`){t+=Xw(n.value);continue}let e=n.classNames.map(uT).join(` `),r=Object.entries(n.data||{}).map(([e,t])=>` data-${uT(lT(e))}="${uT(t)}"`).join(``);t+=`<span${e?` class="${e}"`:``}${r}>${Yw(n.children)}</span>`}return t}function Xw(e){return e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`)}function Zw(e){return e.trim().toLowerCase()}function Qw(e,t){let n=[],r=t.map(t=>({...t,start:Math.max(0,Math.min(e,t.start)),end:Math.max(0,Math.min(e,t.end))})).sort((e,t)=>e.start-t.start),i=0;for(let e of r)e.start>=e.end||e.start<i||(n.push(e),i=e.end);return n}function $w(e,t){let n=[],r=0;for(let i of t)i.start>r&&n.push({value:e.slice(r,i.start)}),n.push({className:i.className,value:e.slice(i.start,i.end)}),r=i.end;return r<e.length&&n.push({value:e.slice(r)}),n}function eT(e,t,n,r){let i=[],a=0;for(let o of e){let e=a+o.value.length,s=Math.max(t,a),c=Math.min(n,e);if(s<c){let e=new Set([s,c]);for(let t of r){let[n,r]=t.range;r<=s||n>=c||(e.add(Math.max(s,n)),e.add(Math.min(c,r)))}let t=[...e].sort((e,t)=>e-t);for(let e=0;e<t.length-1;e++){let n=t[e],s=t[e+1],c={type:`text`,value:o.value.slice(n-a,s-a)};o.className&&(c={type:`element`,classNames:[`th-token`,`th-${o.className}`],children:[c]});let l=r.filter(e=>e.range[0]<=n&&e.range[1]>=s);for(let e of l)c={type:`element`,classNames:[`th-decoration`,...cT(e.className)],data:oT(e.data),children:[c]};i.push(c)}}if(a=e,a>=n)break}return i}function tT(e){return`range`in e}function nT(e){return`lines`in e}function rT(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
|
|
2060
|
+
`&&n+1<e.length&&t.push(n+1);return t}function iT(e,t){return typeof e==`number`?e===t:t>=e[0]&&t<=e[1]}function aT(e){let t={};for(let n of e)Object.assign(t,oT(n.data));return t}function oT(e){if(e)return Object.fromEntries(Object.entries(e).map(([e,t])=>[sT(e),String(t)]))}function sT(e){return lT(e).replace(/[^a-z0-9_.:-]/gi,`-`)}function cT(e){return e?.trim().split(/\s+/).filter(Boolean)||[]}function lT(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function uT(e){return Xw(e)}function dT(e){return t=>fT(t,e)}function fT(e,t,n=[]){let r=[...n],i=new Uint8Array(e.length);for(let e of n)i.fill(1,e.start,e.end);for(let n of t){if(`collect`in n){for(let t of n.collect(e))mT(r,i,t);continue}let t=hT(n.regex),a;for(;a=t.exec(e);){let e=n.group?a[n.group]:a[0];if(!e){a[0].length||t.lastIndex++;continue}let o=n.group?a[0].indexOf(e):0,s=a.index+o;mT(r,i,{start:s,end:s+e.length,className:typeof n.className==`function`?n.className(a):n.className})}}return r}function pT(e,t){return e.map(e=>({...e,start:e.start+t,end:e.end+t}))}function mT(e,t,n){return n.start>=n.end||n.start<0||n.end>t.length||gT(t,n.start,n.end)?!1:(e.push(n),t.fill(1,n.start,n.end),!0)}function hT(e){return new RegExp(e.source,e.flags.includes(`g`)?e.flags:`${e.flags}g`)}function gT(e,t,n){for(let r=t;r<n;r++)if(e[r])return!0;return!1}var _T=Kw({name:`css`,tokenize:dT([{className:e=>e[0].startsWith(`/*`)?`comment`:`string`,regex:/\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'/g},{className:`variable`,regex:/--[A-Za-z0-9_-]+/g},{className:`selector`,regex:/(^|[}\n])\s*([^@{}\n][^{}\n]*)(?=\s*\{)/g,group:2},{className:`property`,regex:/(?:^|[;{]\s*)([A-Za-z-]+)(?=\s*:)/gm,group:1},{className:`function`,regex:/\b[A-Za-z-]+(?=\()/g},{className:`number`,regex:/\b\d+(?:\.\d+)?(?:px|rem|em|%|s|ms|vh|vw|deg)?\b/g}])}),vT=Kw({name:`dockerfile`,aliases:[`docker`],tokenize:dT([{className:`comment`,regex:/^\s*#.*$/gm},{className:`keyword`,regex:/^\s*(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)\b/gim},{className:`string`,regex:/\b[A-Za-z0-9._/-]+:[A-Za-z0-9._-]+\b/g},{className:`variable`,regex:/\$\{?[A-Za-z_][A-Za-z0-9_]*\}?/g},{className:`command`,regex:/\b(?:bun|npm|npx|pnpm|yarn|node|apt|apt-get|apk)\b/g}])});function yT(e,t,n=`html`){let r=[],i=[],a=0;for(;a<e.length;){if(e.startsWith(`<!--`,a)){let t=e.indexOf(`-->`,a+4),n=t<0?e.length:t+3;r.push({start:a,end:n,className:`comment`}),a=n;continue}if(n===`ejs`&&e.startsWith(`<%`,a)){let t=e.indexOf(`%>`,a+2),n=t<0?e.length:t;i.push({start:a+2,end:n,lang:`js`}),a=t<0?e.length:t+2;continue}if(e[a]!==`<`){a++;continue}let t=e[a+1]===`/`,o=a+(t?2:1),s=/^[A-Za-z][\w:.-]*/.exec(e.slice(o));if(!s){a++;continue}let c=wT(e,o+s[0].length);if(c<0){a++;continue}let l=s[0].toLowerCase();if(r.push({start:o,end:o+s[0].length,className:`tag`}),t||bT(e,o+s[0].length,c,r),!t&&(l===`script`||l===`style`)){let t=`</${l}`,n=e.toLowerCase().indexOf(t,c+1);if(n>=0){let t=xT(l,e.slice(a,c+1));i.push({start:c+1,end:n,lang:t})}}a=c+1}n===`vue`&&ST(e,`{{`,`}}`,`js`,i),n===`svelte`&&CT(e,i);for(let n of i)n.start>=n.end||!t.hasLanguage(n.lang)||r.push(...pT(t.tokenize(e.slice(n.start,n.end),n.lang),n.start));return r}function bT(e,t,n,r){let i=e.slice(t,n),a=/\s([:@A-Za-z_][\w:.-]*)(?=\s*(?:=|\/?>))/g,o;for(;o=a.exec(i);){let e=o[0].indexOf(o[1]),n=t+o.index+e;r.push({start:n,end:n+o[1].length,className:`attr`})}let s=t;for(;s<n;){let t=e[s];if(t!==`"`&&t!==`'`){s++;continue}let i=TT(e,s,t,n);r.push({start:s,end:i,className:`string`}),s=i}}function xT(e,t){if(e===`style`)return`css`;let n=/\blang\s*=\s*["']?([\w-]+)/i.exec(t)?.[1];return n===`ts`||n===`typescript`?`ts`:`js`}function ST(e,t,n,r,i){let a=0;for(;(a=e.indexOf(t,a))>=0;){let o=e.indexOf(n,a+t.length);if(o<0)return;i.push({start:a+t.length,end:o,lang:r}),a=o+n.length}}function CT(e,t){let n=0;for(;n<e.length;){if(e[n]!==`{`||e[n+1]===`#`){n++;continue}let r=e.indexOf(`}`,n+1);if(r<0)return;t.push({start:n+1,end:r,lang:`js`}),n=r+1}}function wT(e,t){let n=t;for(;n<e.length;)if(e[n]===`"`||e[n]===`'`)n=TT(e,n,e[n],e.length);else if(e[n]===`>`)return n;else n++;return-1}function TT(e,t,n,r){let i=t+1;for(;i<r;)if(e[i]===`\\`)i+=2;else if(e[i]===n)return i+1;else i++;return r}var ET=Kw({name:`html`,aliases:[`htm`,`xml`,`angular-html`],tokenize:(e,t)=>yT(e,t)}),DT=[{className:`function`,regex:/@[A-Za-z_$][\w$]*/g},{className:`keyword`,regex:RegExp(`\\b(?:abstract|as|asserts|async|await|break|case|catch|class|const|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|infer|instanceof|interface|is|keyof|let|module|namespace|new|of|override|package|private|protected|public|readonly|return|satisfies|set|static|super|switch|this|throw|try|type|typeof|using|var|while|with|yield)\\b`,`g`)},{className:`literal`,regex:/\b(?:false|null|true|undefined|NaN|Infinity)\b/g},{className:`number`,regex:/\b(?:0x[\da-f](?:_?[\da-f])*n?|0b[01](?:_?[01])*n?|0o[0-7](?:_?[0-7])*n?|\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:e[+-]?\d(?:_?\d)*)?n?)\b/gi},{className:`function`,regex:/\bfunction\s*\*?\s*([A-Za-z_$][\w$]*)/g,group:1},{className:`function`,regex:/(^|[^.A-Za-z0-9_$])([A-Za-z_$][\w$]*)\s*(?=\()/g,group:2},{className:`type`,regex:/\b(?:Array|Record|Promise|Readonly|Set|Map|WeakMap|WeakSet|string|number|boolean|bigint|symbol|object|unknown|never|void|any|[A-Z][A-Za-z0-9_$]*)\b/g},{className:`property`,regex:/(?:\.|\?\.)([A-Za-z_$][\w$]*)/g,group:1}];function OT(e,t=!1,n=!1){let r=kT(e,t,n),i=t?NT(e,n):[];return fT(e,DT,[...r,...i])}function kT(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i],o=e[i+1];if(a===`/`&&o===`/`){let t=VT(e,i+2);r.push({start:i,end:t,className:`comment`}),i=t;continue}if(a===`/`&&o===`*`){let t=e.indexOf(`*/`,i+2),n=t<0?e.length:t+2;r.push({start:i,end:n,className:`comment`}),i=n;continue}if(a===`'`||a===`"`){let t=BT(e,i,a);r.push({start:i,end:t,className:`string`}),i=t;continue}if(a==="`"){i=AT(e,i,r,t,n);continue}if(a===`/`&&!(t&&e[i-1]===`<`)&<(e,i)){let t=RT(e,i);if(t>i+1){r.push({start:i,end:t,className:`literal`}),i=t;continue}}i++}return r}function AT(e,t,n,r,i){let a=t,o=t+1;for(;o<e.length;){if(e[o]===`\\`){o+=2;continue}if(e[o]==="`")return n.push({start:a,end:o+1,className:`string`}),o+1;if(e[o]===`$`&&e[o+1]===`{`){a<o&&n.push({start:a,end:o,className:`string`}),n.push({start:o,end:o+2,className:`operator`});let t=jT(e,o+2),s=t<0?e.length:t,c=e.slice(o+2,s);if(n.push(...pT(OT(c,r,i),o+2)),t<0)return e.length;n.push({start:t,end:t+1,className:`operator`}),o=t+1,a=o;continue}o++}return a<e.length&&n.push({start:a,end:e.length,className:`string`}),e.length}function jT(e,t){let n=1,r=t;for(;r<e.length;){let t=e[r],i=e[r+1];if(t===`'`||t===`"`){r=BT(e,r,t);continue}if(t==="`"){r=MT(e,r);continue}if(t===`/`&&i===`/`){r=VT(e,r+2);continue}if(t===`/`&&i===`*`){let t=e.indexOf(`*/`,r+2);r=t<0?e.length:t+2;continue}if(t===`{`&&n++,t===`}`&&--n===0)return r;r++}return-1}function MT(e,t){let n=t+1;for(;n<e.length;)if(e[n]===`\\`)n+=2;else if(e[n]==="`")return n+1;else if(e[n]===`$`&&e[n+1]===`{`){let t=jT(e,n+2);n=t<0?e.length:t+1}else n++;return e.length}function NT(e,t){let n=[],r=0,i=0,a=0;for(;r<e.length;){if(i&&(e[r]===`"`||e[r]===`'`||e[r]==="`")){r=e[r]==="`"?MT(e,r):BT(e,r,e[r]);continue}if(i&&e[r]===`{`){a++,r++;continue}if(i&&e[r]===`}`){a=Math.max(0,a-1),r++;continue}if(e[r]!==`<`){r++;continue}if(e.startsWith(`</>`,r)){i=Math.max(0,i-1),r+=3;continue}if(e.startsWith(`<>`,r)&&(i>0||FT(e,r,t))){i++,r+=2;continue}let o=e[r+1]===`/`,s=r+(o?2:1),c=/^[A-Za-z][\w:.-]*/.exec(e.slice(s));if(!c||!o&&!(i>0&&a===0)&&!FT(e,r,t)){r++;continue}let l=zT(e,s+c[0].length);if(l<0||IT(e,r,l,o)){r++;continue}n.push({start:s,end:s+c[0].length,className:`tag`}),o||PT(e,s+c[0].length,l,n);let u=/\/\s*$/.test(e.slice(s,l));o?i=Math.max(0,i-1):u||i++,r=l+1}return n}function PT(e,t,n,r){let i=e.slice(t,n),a=/\s([:@A-Za-z_$][\w$:.-]*)(?=\s*(?:=|\/?>))/g,o;for(;o=a.exec(i);){let e=o[0].indexOf(o[1]),n=t+o.index+e;r.push({start:n,end:n+o[1].length,className:`attr`})}}function FT(e,t,n){if(n&&/^\s*$/.test(e.slice(e.lastIndexOf(`
|
|
2061
|
+
`,t-1)+1,t)))return!0;let r=e.slice(0,t).trimEnd();return!r||/\b(?:return|case|yield)$/.test(r)?!0:/(?:[=([{,:;!&|?]|>)$/.test(r)}function IT(e,t,n,r){if(r)return!1;let i=e.slice(t+1,n),a=e.slice(n+1).trimStart();return/\s+extends\s+/.test(i)||a[0]===`(`&&!i.trimEnd().endsWith(`/`)}function LT(e,t){let n=e.slice(0,t).trimEnd();return!n||/\b(?:case|delete|in|instanceof|of|return|throw|typeof|void|yield)$/.test(n)?!0:/[=([{,:;!&|?~+*%^<>-]$/.test(n)}function RT(e,t){let n=!1,r=t+1;for(;r<e.length&&e[r]!==`
|
|
2062
|
+
`;)if(e[r]===`\\`)r+=2;else if(e[r]===`[`)n=!0,r++;else if(e[r]===`]`)n=!1,r++;else if(e[r]===`/`&&!n){for(r++;/[a-z]/i.test(e[r]||``);)r++;return r}else r++;return t+1}function zT(e,t){let n=0,r=t;for(;r<e.length;){let t=e[r];if(t===`'`||t===`"`){r=BT(e,r,t);continue}if(t===`{`)n++;else if(t===`}`)n=Math.max(0,n-1);else if(t===`>`&&n===0)return r;else if(t===`
|
|
2063
|
+
`&&n===0)return-1;r++}return-1}function BT(e,t,n){let r=t+1;for(;r<e.length;)if(e[r]===`\\`)r+=2;else if(e[r]===n)return r+1;else if(e[r]===`
|
|
2064
|
+
`&&n!=="`")return r;else r++;return e.length}function VT(e,t){let n=e.indexOf(`
|
|
2065
|
+
`,t);return n<0?e.length:n}var HT=Kw({name:`js`,aliases:[`javascript`,`mjs`,`cjs`,`js-vue`],tokenize:e=>OT(e)}),UT=Kw({name:`json`,aliases:[`jsonc`,`json5`],tokenize:dT([{className:e=>e[0].startsWith(`//`)||e[0].startsWith(`/*`)?`comment`:e[1]?`property`:`string`,regex:/\/\/[^\n]*|\/\*[\s\S]*?\*\/|("(?:\\.|[^"\\])*")(?=\s*:)|"(?:\\.|[^"\\])*"/g},{className:`literal`,regex:/\b(?:false|null|true)\b/g},{className:`number`,regex:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/gi}])}),WT=Kw({name:`jsx`,tokenize:e=>OT(e,!0)}),GT=Kw({name:`markdown`,aliases:[`md`],tokenize(e,t){return fT(e,[{className:`heading`,regex:/^#{1,6}\s.*$/gm},{className:`heading`,regex:/^.+\n(?:=+|-+)\s*$/gm},{className:`code-inline`,regex:/`[^`\n]+`/g},{className:`link`,regex:/!?\[[^\]]+\]\([^)]+\)/g},{className:`meta`,regex:/^\s{0,3}(?:>|[-*+] |\d+\. )/gm}],KT(e,t))}});function KT(e,t){let n=[],r=/^( {0,3})(`{3,}|~{3,})\s*([^\n]*)$/gm,i;for(;i=r.exec(e);){let a=i[2],o=e.indexOf(`
|
|
2066
|
+
`,i.index+i[0].length);if(o<0)break;let s=RegExp(`^ {0,3}${a[0]}{${a.length},}\\s*$`,`gm`);s.lastIndex=o+1;let c=s.exec(e),l=c?.index??e.length,u=i[3].trim().split(/\s+/)[0],d=u&&t.hasLanguage(u)?pT(t.tokenize(e.slice(o+1,l),u),o+1):[];n.push({start:i.index,end:o,className:`meta`}),n.push(...qT(o+1,l,d)),c&&n.push({start:c.index,end:c.index+c[0].length,className:`meta`}),r.lastIndex=c?c.index+c[0].length:e.length}return n}function qT(e,t,n){let r=[],i=e;for(let e of[...n].sort((e,t)=>e.start-t.start))e.start>i&&r.push({start:i,end:e.start,className:`code-inline`}),r.push(e),i=e.end;return i<t&&r.push({start:i,end:t,className:`code-inline`}),r}var JT=Kw({name:`plaintext`,aliases:[`text`,`txt`,`-->`],tokenize:()=>[]}),YT=Kw({name:`python`,aliases:[`py`],tokenize(e){return fT(e,[{className:e=>e[0].startsWith(`#`)?`comment`:`string`,regex:/#[^\n]*|(?:br|rb|fr|rf|[rubf])?(?:"""[\s\S]*?"""|'''[\s\S]*?'''|"(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*')/gi},{className:`keyword`,regex:/\b(?:and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|raise|return|try|while|with|yield)\b/g},{className:`literal`,regex:/\b(?:False|None|True|NotImplemented|Ellipsis)\b/g},{className:`function`,regex:/@[A-Za-z_][\w.]*/g},{className:`function`,regex:/\bdef\s+([A-Za-z_]\w*)/g,group:1},{className:`type`,regex:/\b(?:bool|bytes|dict|float|frozenset|int|list|object|set|str|tuple|type)\b/g},{className:`number`,regex:/\b(?:0x[\da-f_]+|0b[01_]+|0o[0-7_]+|\d[\d_]*(?:\.\d[\d_]*)?(?:e[+-]?\d[\d_]*)?j?)\b/gi}])}}),XT=Kw({name:`shell`,aliases:[`bash`,`sh`,`zsh`,`cmd`,`console`],tokenize(e){return fT(e,[{collect:ZT},{className:`variable`,regex:/\$[A-Za-z_][A-Za-z0-9_]*|\b[A-Z_][A-Z0-9_]*(?==)/g},{className:`keyword`,regex:/\b(?:case|do|done|elif|else|esac|export|fi|for|function|if|in|select|then|time|until|while)\b/g},{className:`command`,regex:/(^|[\n;|&])\s*([A-Za-z0-9_./-]+)(?=\s|$)/g,group:2}])}});function ZT(e){let t=[];QT(e,t);let n=0;for(;n<e.length;){if(eE(n,t)){n=t.find(e=>e.start<=n&&e.end>n).end;continue}let r=e[n];if(r===`"`||r===`'`){let i=r,a=n+1;for(;a<e.length;)if(e[a]===`\\`&&i===`"`)a+=2;else if(e[a]===i){a++;break}else a++;t.push({start:n,end:a,className:`string`}),n=a;continue}if(r===`$`&&e[n+1]===`{`){let r=e.indexOf(`}`,n+2),i=r<0?e.length:r+1;t.push({start:n,end:i,className:`variable`}),n=i;continue}if(r===`#`&&(n===0||e[n-1]===`
|
|
2067
|
+
`||/[\s;|&()]/.test(e[n-1]))){let r=e.indexOf(`
|
|
2068
|
+
`,n),i=r<0?e.length:r;t.push({start:n,end:i,className:`comment`}),n=i;continue}n++}return t}function QT(e,t){let n=/<<-?\s*(['"]?)([A-Za-z_][A-Za-z0-9_]*)\1/g,r;for(;r=n.exec(e);){if(e[r.index-1]===`<`||$T(e,r.index))continue;let n=e.indexOf(`
|
|
2069
|
+
`,r.index+r[0].length);if(n<0)continue;let i=n+1,a=RegExp(`^\\t*${tE(r[2])}\\s*$`,`m`).exec(e.slice(i));if(!a){t.push({start:i,end:e.length,className:`string`});continue}let o=i+a.index;o>i&&t.push({start:i,end:o,className:`string`});let s=i+a.index;t.push({start:s,end:s+a[0].length,className:`meta`})}}function $T(e,t){let n=e.lastIndexOf(`
|
|
2070
|
+
`,t-1)+1,r=``;for(let i=n;i<t;i++)e[i]===`\\`&&r!==`'`?i++:r&&e[i]===r?r=``:!r&&(e[i]===`"`||e[i]===`'`)&&(r=e[i]);return!!r}function eE(e,t){return t.some(t=>t.start<=e&&t.end>e)}function tE(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var nE=Kw({name:`sql`,tokenize:dT([{className:e=>e[0].startsWith(`--`)||e[0].startsWith(`/*`)?`comment`:`string`,regex:/--[^\n]*|\/\*[\s\S]*?\*\/|'(?:''|[^'])*'|"(?:""|[^"])*"/g},{className:`keyword`,regex:/\b(?:add|all|alter|and|as|asc|begin|between|by|case|check|column|commit|constraint|create|cross|database|default|delete|desc|distinct|drop|else|end|exists|foreign|from|full|group|having|index|inner|insert|into|join|key|left|like|limit|not|null|on|or|order|outer|primary|references|returning|right|rollback|select|set|table|then|union|unique|update|using|values|view|when|where|with)\b/gi},{className:`literal`,regex:/\b(?:false|null|true)\b/gi},{className:`number`,regex:/\b\d+(?:\.\d+)?\b/g},{className:`function`,regex:/\b[A-Za-z_][A-Za-z0-9_]*(?=\s*\()/g}])}),rE=Kw({name:`ts`,aliases:[`typescript`,`angular-ts`],tokenize:e=>OT(e)}),iE=Kw({name:`tsx`,tokenize:e=>OT(e,!0)}),aE=Kw({name:`yaml`,aliases:[`yml`],tokenize(e){let t=[...oE(e),...sE(e)];return fT(e,[{className:`property`,regex:/^[ \t-]*([A-Za-z0-9_.-]+)(?=\s*:)/gm,group:1},{collect:cE},{className:`literal`,regex:/\b(?:false|null|true|yes|no|on|off|~)\b/gi},{className:`number`,regex:/\b\d+(?:\.\d+)?\b/g}],t)}});function oE(e){let t=[],n=/^(\s*)[\w.-]+:\s*[>|][+-]?\s*(?:#.*)?$/gm,r;for(;r=n.exec(e);){let n=e.indexOf(`
|
|
2071
|
+
`,r.index+r[0].length);if(n<0)continue;let i=r[1].length,a=n+1;for(;a<e.length;){let t=e.indexOf(`
|
|
2072
|
+
`,a),n=t<0?e.length:t,r=e.slice(a,n);if(r.trim()&&(r.match(/^\s*/)?.[0].length||0)<=i)break;a=t<0?e.length:t+1}a>n+1&&t.push({start:n+1,end:a,className:`string`})}return t}function sE(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(r===`"`||r===`'`){let i=r,a=n+1;for(;a<e.length&&e[a]!==`
|
|
2073
|
+
`;)if(e[a]===`\\`&&i===`"`)a+=2;else if(e[a]===i){a++;break}else a++;t.push({start:n,end:a,className:`string`}),n=a;continue}if(r===`#`&&(n===0||e[n-1]===`
|
|
2074
|
+
`||/\s/.test(e[n-1]))){let r=e.indexOf(`
|
|
2075
|
+
`,n),i=r<0?e.length:r;t.push({start:n,end:i,className:`comment`}),n=i;continue}n++}return t}function cE(e){let t=[],n=/:\s*([^\n]*)/g,r;for(;r=n.exec(e);){let n=r[1],i=n.trimEnd();if(!i)continue;let a=r.index+r[0].indexOf(n),o=a+i.length,s=/\s+#/.exec(i);for(s&&(o=a+s.index);o>a&&/\s/.test(e[o-1]);)o--;o>a&&t.push({start:a,end:o,className:`string`})}return t}var lE=/[ \t]*(?:(?:\/\/|#)[ \t]*\[!code[ \t]+(\+\+|--)\]|\/\*[ \t]*\[!code[ \t]+(\+\+|--)\][ \t]*\*\/|<!--[ \t]*\[!code[ \t]+(\+\+|--)\][ \t]*-->)[ \t]*$/;function uE(e){let t=[];return{code:e.split(`
|
|
2076
|
+
`).map((e,n)=>{let r=lE.exec(e);if(!r)return e;let i=r[1]||r[2]||r[3];return t.push({className:i===`++`?`th-line--inserted`:`th-line--deleted`,lines:n+1}),e.slice(0,r.index)}).join(`
|
|
2077
|
+
`),decorations:t}}function dE(e){return(t,n=`plaintext`,r={})=>{let i=uE(t);return Yw(Jw(e.tokenize(i.code,{lang:n}).tokens,{...r.lineNumbers===void 0?{}:{lineNumbers:r.lineNumbers},...i.decorations.length||r.highlightLines?.length?{decorations:[...i.decorations,...(r.highlightLines||[]).map(e=>({className:`th-line--highlighted`,lines:e}))]}:{}}))}}var fE=dE(qw({fallbackLanguage:`plaintext`,languages:[_T,vT,ET,HT,UT,WT,GT,JT,YT,XT,nE,rE,iE,aE]})),pE=(0,N.forwardRef)(function({className:e,variant:t=`default`,...n},r){return(0,P.jsx)(`article`,{...n,className:we(`prose prose-caps`,t===`dropcap`&&`caps-prose-dropcap`,e),ref:r})});function mE(e){return URL.parse(e)?.protocol??null}function hE(e){if(e===``||e.startsWith(`//`))return!1;let t=mE(e);return t===null||t===`http:`||t===`https:`||t===`mailto:`}function gE(e){let t=mE(e);return t===`http:`||t===`https:`}function _E(e){if(e===``||e.startsWith(`//`))return!1;let t=mE(e);return t===null||t===`http:`||t===`https:`}function vE({children:e,className:t,components:n,frontmatter:r=!0,policy:i=`default`,typography:a=`prose`}){let o=(0,N.useMemo)(()=>_w(e,{allowHtml:!1,frontmatter:r}),[e,r]),s=(0,N.useMemo)(()=>({...n,a(e){let t=e.href??``;if(i===`visitor`){let n=URL.parse(t);return n===null||!gE(n.href)?(0,P.jsx)(`span`,{children:e.children}):(0,P.jsx)(`a`,{href:n.href,target:`_blank`,rel:`noopener noreferrer`,children:e.children})}if(!hE(t))return(0,P.jsx)(P.Fragment,{children:e.children});let n=gE(t);return(0,P.jsx)(`a`,{...e,href:t,rel:n?`noopener noreferrer`:e.rel,target:n?`_blank`:e.target})},img(e){if(i===`visitor`)return(0,P.jsx)(`span`,{className:`text-dim`,children:`Image removed`});let t=e.src??``;return _E(t)?n?.img?(0,N.createElement)(n.img,e):(0,P.jsx)(`img`,{alt:e.alt??``,className:`max-w-full`,src:t}):(0,P.jsx)(P.Fragment,{children:e.alt??``})}}),[n,i]),c=(0,P.jsx)(jw,{allowHtml:!1,components:s,highlighter:fE,children:o}),l=we(`min-w-0 break-words`,t);return a===`prose`?(0,P.jsx)(pE,{className:l,children:c}):(0,P.jsx)(`div`,{className:l,children:c})}function yE(e){return e.replace(/^\uFEFF/u,``).replace(/\r\n?/gu,`
|
|
2078
|
+
`)}function bE({document:e,theme:t,sourceLabel:n,savedConflict:r=!1}){if(!e.conflict)return null;let i=e.saving||e.resolving;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`inkcap-conflict`,role:`region`,"aria-label":`File conflict`,children:[(0,P.jsx)(Fe,{tone:`warning`,title:n?`The repository changed since you opened this file`:`This file changed on the Computer since you opened it`,description:r?`Your file is saved in Bonsai. Your saved text and any newer edits stay here.`:`Your edits are still here and have not been saved.`}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-xs`,children:[(0,P.jsx)(re,{size:`sm`,disabled:i,onClick:()=>{e.keepMine()},children:`Keep mine`}),(0,P.jsx)(re,{size:`sm`,variant:`outline`,disabled:i,onClick:()=>{e.reloadTheirs()},children:`Reload theirs`}),(0,P.jsx)(re,{size:`sm`,variant:`ghost`,disabled:i,onClick:()=>{e.compare()},children:e.resolving?`Loading…`:`Compare`})]}),(0,P.jsxs)(`p`,{className:`text-xs text-dim`,children:[`Keep mine`,` `,n?`saves your file in Bonsai and retries sync`:`overwrites the Computer file`,`. Reload theirs replaces your edits.`]})]}),(0,P.jsx)(_e,{open:e.comparison!==null,onOpenChange:t=>{t||e.closeComparison()},children:(0,P.jsxs)(pe,{className:`inkcap-compare-dialog`,children:[(0,P.jsxs)(de,{children:[(0,P.jsx)(he,{children:`Compare file versions`}),(0,P.jsxs)(ae,{children:[`Removed lines are from `,n??`the Computer`,`. Added lines are your edits. Nothing is saved by comparing.`]})]}),(0,P.jsx)(`div`,{className:`inkcap-conflict-diff`,role:`region`,"aria-label":`File comparison`,children:e.comparison===null?null:(0,P.jsx)(Ty,{oldFile:{name:e.currentPath,contents:yE(e.comparison)},newFile:{name:e.currentPath,contents:yE(e.contents)},options:{diffStyle:`unified`,disableFileHeader:!0,themeType:t===`mocha`?`dark`:`light`,theme:{dark:`catppuccin-mocha`,light:`catppuccin-latte`}}})}),(0,P.jsx)(j,{children:(0,P.jsx)(re,{variant:`ghost`,onClick:e.closeComparison,children:`Back to editing`})})]})})]})}function xE(e,t){return{...e,contents:t}}function SE(e,t){return{...e,saved:t}}function CE(e){return e.contents!==e.saved}function wE({path:e,initial:t,local:n,onSaveAs:r,onPathChange:i,onStatus:a,write:o,overwrite:s,readCurrent:c,target:l,syncConflict:u=!1}){let d=(0,N.useRef)({saved:t,contents:t}),f=(0,N.useRef)(e),p=(0,N.useRef)(o),m=(0,N.useRef)(s),h=(0,N.useRef)(c),g=(0,N.useRef)(r),_=(0,N.useRef)(i),v=(0,N.useRef)(a),y=(0,N.useRef)(l);p.current=o,m.current=s,h.current=c,g.current=r,_.current=i,v.current=a,y.current=l;let[b,x]=(0,N.useState)(!1),[S,C]=(0,N.useState)(t),[w,T]=(0,N.useState)(!1),[E,O]=(0,N.useState)(``),[k,ee]=(0,N.useState)(!1),A=(0,N.useRef)(!1),j=(0,N.useRef)(u);j.current=u;function te(e){A.current=e,ee(e)}let[ne,re]=(0,N.useState)(null),[ie,ae]=(0,N.useState)(!1),[oe,se]=(0,N.useState)(0),[ce,le]=(0,N.useState)(!1),ue=(0,N.useRef)(!1),de=(0,N.useRef)({dirty:!1,saving:!1});function fe(e,t){x(e),T(t);let n=y.current;n&&(n.revision+=1,n.dirty=e,n.saving=t),(de.current.dirty!==e||de.current.saving!==t)&&(de.current={dirty:e,saving:t},v.current(e,t))}function pe(e){d.current=xE(d.current,e),C(e),fe(CE(d.current)||A.current,de.current.saving)}async function me(){if(ue.current||k||j.current||!CE(d.current))return!1;ue.current=!0,fe(!0,!0),O(``);let e=d.current.contents;try{return await p.current(e,d.current.saved),d.current=SE(d.current,e),fe(CE(d.current)||A.current,!0),!0}catch(e){if(e instanceof D&&e.code===`CANCELLED`)return!1;if(e instanceof D&&e.code===`CONFLICT`)return te(!0),re(null),!1;console.error(`Inkcap save failed`,e);let t=n?`Download could not start. Your edits remain in this tab.`:`Save was denied or failed. Your edits remain in this tab; retry with the same or another path.`;throw O(t),Error(t,{cause:e})}finally{ue.current=!1,fe(CE(d.current)||A.current,!1)}}async function he(){if(!k&&!j.current||ue.current)return!1;ue.current=!0,fe(!0,!0),O(``);let e=d.current.contents;try{return await m.current(e),d.current=SE(d.current,e),te(!1),re(null),!0}catch(e){return e instanceof D&&e.code===`CANCELLED`?!1:(console.error(`Inkcap explicit overwrite failed`,e),O(`Could not overwrite the file. Your edits remain in this tab.`),!1)}finally{ue.current=!1,fe(CE(d.current)||A.current,!1)}}async function ge(e){if(!k&&!j.current||ue.current)return!1;ue.current=!0,ae(!0),O(``);let t=y.current?.revision,n=d.current.contents;try{let r=await h.current(e);return y.current?.closed?!1:e?d.current.contents!==n||y.current?.revision!==t?(O(`Your edits changed while reloading. They remain in this tab; compare or reload again.`),!1):(d.current={saved:r,contents:r},C(r),te(!1),re(null),se(e=>e+1),fe(!1,!1),!0):(re(r),!0)}catch(e){return console.error(`Inkcap conflict read failed`,e),O(`Could not read the file. Your edits remain in this tab.`),!1}finally{ue.current=!1,ae(!1)}}async function _e(e){let t=e.trim();if(!n&&t===f.current)return me();if(!t||t.endsWith(`/`)||ue.current)return!1;ue.current=!0,fe(!0,!0),O(``);let r=d.current.contents;try{if(!g.current)throw Error(`Save As is unavailable`);let e=await g.current(t,r);return d.current=SE(d.current,r),f.current=e,te(!1),re(null),_.current?.(e),fe(CE(d.current)||A.current,!0),!0}catch(e){return e instanceof D&&e.code===`CANCELLED`?!1:(console.error(`Inkcap save failed`,e),O(`Save As was denied or failed. Your edits remain in this tab; retry with the same or another path.`),!1)}finally{ue.current=!1,fe(CE(d.current)||A.current,!1)}}return{currentPath:f.current,contents:S,dirty:b,saving:w,error:E,conflict:k||u,comparison:ne,resolving:ie,reloadVersion:oe,keepMine:he,compare:()=>ge(!1),reloadTheirs:()=>ge(!0),closeComparison:()=>{re(null)},imageError:ce,setImageError:le,edit:pe,save:me,saveAs:_e}}function TE({path:e,initial:t,active:n,narrow:r,tabKey:i,savable:a,local:o,sourceLabel:s,activityNotice:c,onDismissActivityNotice:l,previewUrl:u,previewKind:d,onReopen:f,onSaveAs:p,onPathChange:m,target:h,write:g,overwrite:_,readCurrent:v,onStatus:y,onSaveBinding:b,syncConflict:x=!1}){let[S,C]=(0,N.useState)(()=>ze()??`latte`),w=(0,N.useRef)(null),[T,E]=(0,N.useState)(!1),[D,O]=(0,N.useState)(!1);(0,N.useEffect)(()=>{let e=w.current?.closest(`[data-theme]`);return C(ze(e??void 0)??`latte`),Pe(C,e??void 0)},[]);let k=wE({path:e,initial:t,local:o,onSaveAs:p,onPathChange:m,onStatus:y,target:h,write:g,overwrite:_,readCurrent:v,syncConflict:x}),ee=(0,N.useRef)(k.save),A=(0,N.useRef)(k.dirty),j=(0,N.useRef)(k.saving),te=(0,N.useRef)(a),ne=(0,N.useRef)(!1);ee.current=k.save,A.current=k.dirty,j.current=k.saving,te.current=a&&!k.conflict&&!k.resolving,ne.current=h?.closed??!1;let re=(0,N.useMemo)(()=>({availability:()=>{let e=h?.dirty??A.current,t=h?.saving??j.current;return ne.current||!te.current||!e?{status:`unavailable`,reason:`No focused savable dirty document.`}:t?{status:`unavailable`,reason:`A save is already running.`}:{status:`available`}},save:()=>ee.current()}),[]);(0,N.useEffect)(()=>(b(i,re),()=>{b(i,void 0)}),[b,re,i]);let ie=(0,N.useMemo)(()=>({name:k.currentPath,contents:k.contents}),[k.currentPath,k.contents]),ae=(0,N.useMemo)(()=>({onAttach:e=>{o&&n&&e.focus({lineNumber:1,character:0})},onChange:e=>{k.edit(e.contents)}}),[k.edit,o,n]),oe=Re(k.currentPath);return(0,P.jsx)(EE,{themeRoot:w,tabKey:i,savable:a,narrow:r,local:o,sourceLabel:s,savedConflict:x,activityNotice:c,onDismissActivityNotice:l,previewUrl:u,previewKind:d,onSaveAs:p,onReopen:f,document:k,file:ie,editorOptions:ae,theme:S,saveAsOpen:T,setSaveAsOpen:E,canPreviewMarkdown:oe,markdownPreview:oe&&D,onToggleMarkdownPreview:()=>{O(e=>!e)}})}function EE({themeRoot:e,tabKey:t,savable:n,narrow:r,local:i,sourceLabel:a,savedConflict:o,activityNotice:s,onDismissActivityNotice:c,previewUrl:l,previewKind:u,onSaveAs:d,onReopen:f,document:p,file:m,editorOptions:h,theme:g,saveAsOpen:_,setSaveAsOpen:v,canPreviewMarkdown:y,markdownPreview:b,onToggleMarkdownPreview:x}){return(0,P.jsxs)(Le,{ref:e,className:`inkcap-editor mt-0`,value:String(t),forceMount:!0,"aria-label":p.currentPath,children:[(0,P.jsx)(DE,{narrow:r,savable:n&&!p.conflict&&!p.resolving,path:p.currentPath,sourceLabel:a,activityNotice:s,onDismissActivityNotice:c,dirty:p.dirty,saving:p.saving,local:i,canSaveAs:!!(d&&!l),canPreviewMarkdown:y,markdownPreview:b,onToggleMarkdownPreview:x,onSave:()=>{p.save().catch(e=>{console.error(`Inkcap save failed`,e)})},onSaveAs:()=>{v(!0)},onReopen:f}),(0,P.jsx)(bE,{document:p,theme:g,sourceLabel:a,savedConflict:o}),p.error?(0,P.jsx)(Fe,{className:`inkcap-notice`,tone:`error`,title:p.conflict?`Couldn't resolve the file conflict`:`Couldn't save`,description:p.error}):null,(0,P.jsx)(kE,{previewUrl:l,previewKind:u,path:p.currentPath,imageError:p.imageError,setImageError:p.setImageError,file:m,editorOptions:h,theme:g,narrow:r,markdownPreview:b},p.reloadVersion),(0,P.jsx)(ME,{sourceLabel:a,error:p.error,path:p.currentPath,open:_,busy:p.saving,onSubmit:p.saveAs,onOpenChange:v})]})}function DE({narrow:e,savable:t,path:r,dirty:i,saving:a,local:o,sourceLabel:s,activityNotice:c,onDismissActivityNotice:l,canSaveAs:u,canPreviewMarkdown:d,markdownPreview:f,onToggleMarkdownPreview:m,onSave:g,onSaveAs:_,onReopen:v}){let[y,b]=(0,N.useState)(a),[x,S]=(0,N.useState)(void 0);return y!==a&&(b(a),S(a?void 0:i?`failed`:`done`)),(0,P.jsxs)(`div`,{className:`inkcap-file-toolbar`,"aria-label":`File actions`,children:[(0,P.jsxs)(`span`,{className:`inkcap-path`,title:r,children:[r,s?` · ${s}`:``]}),d?(0,P.jsx)(n,{variant:`ghost`,size:`xs`,icon:(0,P.jsx)(Ne,{}),"aria-label":`Preview Markdown`,title:`Preview Markdown`,active:f,"aria-pressed":f,onClick:m}):null,(0,P.jsx)(n,{variant:`ghost`,size:`xs`,icon:o?(0,P.jsx)(Be,{}):(0,P.jsx)(Ue,{}),"aria-label":OE(o,i,a),title:OE(o,i,a),disabled:!t||!i||a,onClick:g,result:x}),c?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`small`,{role:`status`,className:e?`sr-only`:`whitespace-nowrap`,children:[OE(o,i,a),` · Recent files didn't update`]}),e?(0,P.jsxs)(RC,{children:[(0,P.jsx)(zC,{asChild:!0,children:(0,P.jsx)(n,{icon:(0,P.jsx)(Ve,{}),"aria-label":`Recent files didn't update`,variant:`ghost`,size:`xs`})}),(0,P.jsxs)(BC,{children:[OE(o,i,a),` · Recent files didn't update`]})]}):null,(0,P.jsx)(n,{icon:(0,P.jsx)(p,{}),"aria-label":`Dismiss Recent Files notice`,title:`Dismiss Recent Files notice`,variant:`ghost`,size:`xs`,onClick:l})]}):null,u&&(0,P.jsx)(n,{icon:(0,P.jsx)(He,{}),"aria-label":`Save file as`,title:`Save file as`,variant:`ghost`,size:`xs`,disabled:!t||a,onClick:_}),v&&(0,P.jsx)(n,{icon:(0,P.jsx)(h,{}),"aria-label":`Reload file`,title:`Reload saved file`,variant:`ghost`,size:`xs`,disabled:!t||i||a,onClick:v})]})}function OE(e,t,n){return n?e?`Downloading…`:`Saving…`:t?e?`Download`:`Save`:e?`Download ready`:`Saved`}function kE({previewUrl:e,previewKind:t,path:n,imageError:r,setImageError:i,file:a,editorOptions:o,theme:s,narrow:c,markdownPreview:l}){return e?t===`video`?(0,P.jsx)(jE,{path:n,url:e}):(0,P.jsx)(AE,{path:n,url:e,failed:r,onFailed:i}):l?(0,P.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto`,children:(0,P.jsx)(vE,{className:`max-w-none p-lg`,children:a.contents})}):(0,P.jsx)(`div`,{className:`inkcap-code`,children:(0,P.jsx)(Ye,{createEditor:e=>new gC(e),children:(0,P.jsx)(xy,{file:a,edit:!0,editorOptions:o,options:{disableFileHeader:!0,overflow:c?`wrap`:`scroll`,themeType:s===`mocha`?`dark`:`light`,theme:{dark:`catppuccin-mocha`,light:`catppuccin-latte`}}})})})}function AE({path:e,url:t,failed:n,onFailed:r}){let i=Ie(e)===`image/svg+xml`;return(0,P.jsx)(`div`,{className:`inkcap-preview`,children:n?(0,P.jsxs)(`div`,{role:`alert`,children:[(0,P.jsx)(`strong`,{children:`Preview unavailable`}),(0,P.jsx)(`span`,{children:e})]}):(0,P.jsx)(`img`,{src:t,alt:e,draggable:!i&&void 0,onContextMenu:e=>{i&&e.preventDefault()},onError:()=>{i&&URL.revokeObjectURL(t),r(!0)},onLoad:()=>{i&&URL.revokeObjectURL(t),r(!1)}})})}function jE({path:e,url:t}){return(0,P.jsx)(`div`,{className:`inkcap-preview`,children:(0,P.jsx)(`video`,{src:t,controls:!0,"aria-label":e})})}function ME({sourceLabel:e,error:t,path:n,open:r,busy:i,onSubmit:a,onOpenChange:o}){let s=Me({defaultValues:{path:n},onSubmit:async({value:e})=>{await a(e.path)&&o(!1)}}),c=je(s.store,e=>e.isSubmitting),l=i||c;return(0,N.useEffect)(()=>{r&&s.setFieldValue(`path`,n)},[r,n]),(0,P.jsx)(_e,{open:r&&!(e&&i),onOpenChange:e=>{i||o(e)},children:(0,P.jsxs)(pe,{children:[(0,P.jsxs)(de,{children:[(0,P.jsx)(he,{children:`Save file as`}),(0,P.jsx)(ae,{children:e?`Choose a relative repository path in ${e}.`:`Choose the Computer path for this document.`})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(s.Field,{name:`path`,validators:{onChange:({value:e})=>e.trim()?e.trim().endsWith(`/`)?`Save As needs a file path.`:void 0:`A file path is required.`},children:e=>(0,P.jsx)(Ee,{label:`File path`,required:!0,error:e.state.meta.errors[0]??t,children:(0,P.jsx)(De,{value:e.state.value,onBlur:e.handleBlur,onChange:t=>{e.handleChange(t.target.value)},onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),l||s.handleSubmit())},autoFocus:!0,disabled:l,required:!0})})}),(0,P.jsxs)(j,{children:[(0,P.jsx)(ue,{disabled:l,children:`Cancel`}),(0,P.jsx)(re,{type:`button`,disabled:l,onClick:()=>{s.handleSubmit()},children:l?`Saving…`:`Save As`})]})]})]})})}export{TE as FileTab};
|