diff --git a/README.md b/README.md index 58e700e..942a569 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ A fully local browser-based code review UI. Review your (or your agent's) diff _ - GitHub-style split or unified diff view with syntax highlighting - Mark files as viewed - Inline review comments are written directly into source files as code comments +- Click any line number to highlight it and get a shareable deeplink in the URL (GitHub-style `…R76` / `…L12` anchors) - Works with [jj](https://jj-vcs.dev/) and git (tries jj first, falls back to git) - Vim-style navigation shortcuts (press `?` to see the list) diff --git a/dist/assets/index-BICZuJgD.js b/dist/assets/index-BICZuJgD.js new file mode 100644 index 0000000..c4af420 --- /dev/null +++ b/dist/assets/index-BICZuJgD.js @@ -0,0 +1,1900 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-BZNntD0J.js","assets/rolldown-runtime-S-ySWqyJ.js","assets/html-ddqpqPg0.js","assets/css-DRmnABqB.js","assets/javascript-Cop1kpy_.js","assets/angular-ts-SQQMYL2C.js","assets/scss-DNczJ95n.js","assets/apl-D5V6uPDr.js","assets/json-CTw4n7kn.js","assets/xml-eU7M3iZJ.js","assets/java-DVLnIrqC.js","assets/astro-DeXKSaFP.js","assets/postcss-BTQso3H9.js","assets/tsx-BjkCKOtw.js","assets/typescript-BoHeP9q1.js","assets/blade-Bu5re0Vg.js","assets/html-derivative-DWGxf_At.js","assets/sql-CrTmZCMa.js","assets/bsl-B1qbqNES.js","assets/sdbl-BmWYR-pI.js","assets/c-Nc9zJT78.js","assets/cairo-BDj8wWhy.js","assets/python-CKg5r0C3.js","assets/cobol-nvZDS9LT.js","assets/coffee-BKLOTq4e.js","assets/cpp-D6g1DVNt.js","assets/glsl-JAhLUe0P.js","assets/regexp-3-A0406L.js","assets/crystal-DfoZI57w.js","assets/shellscript-DaVPunOM.js","assets/edge-DwocGnOF.js","assets/elixir-Dtbfds1r.js","assets/elm-CpPtm471.js","assets/erb--z3IM9Cb.js","assets/ruby-Cl8PVkbY.js","assets/graphql-D2ba3BkR.js","assets/jsx-0oMUGqZj.js","assets/haml-C-oIZcDo.js","assets/lua-31hdJClp.js","assets/yaml-BTD1XHJG.js","assets/erlang-Bc4hQuqa.js","assets/markdown-BaI9LyM4.js","assets/fortran-fixed-form-B02FOYI-.js","assets/fortran-free-form-BPTf0lbT.js","assets/fsharp-DhdR18vN.js","assets/gdresource-DgnrMPIx.js","assets/gdscript-CsadCSaZ.js","assets/gdshader-PfnN_8tR.js","assets/git-commit-DGJi7qBD.js","assets/diff-CdkWtnkL.js","assets/git-rebase-Ce47xoa6.js","assets/glimmer-js-C0BuzxQC.js","assets/glimmer-ts-irOZ-cAQ.js","assets/hack-CgzUpY8l.js","assets/handlebars-CbP-Mhzf.js","assets/http-Bg1nG1nG.js","assets/hurl-zm47Pi1n.js","assets/csv-DNUpVBxl.js","assets/hxml-adC65L_J.js","assets/haxe-DfXTCEOz.js","assets/jinja-Bnj4awH5.js","assets/jison-CuCNs9Q3.js","assets/julia-DNYHzXlE.js","assets/r-UcxRcvcA.js","assets/just-BlWkkmf2.js","assets/perl-CAGVW6Ra.js","assets/latex-DqPzjMIt.js","assets/tex-D8LVuLf5.js","assets/liquid-BURJK16h.js","assets/marko-C2ZcdSLh.js","assets/less-C95PyOu0.js","assets/mdc-N1ii9pk5.js","assets/nextflow-JEyYUlIq.js","assets/nextflow-groovy-wvmJO4hi.js","assets/nginx-BuomO0W8.js","assets/nim-hKoEPsYL.js","assets/php-BycclmzS.js","assets/pug-4maJHz9G.js","assets/qml-JLIQfzyb.js","assets/razor-P8rbooCh.js","assets/csharp-BDKQY1K9.js","assets/rst-C6GHyL-N.js","assets/cmake-D5rSbMir.js","assets/sas-CXoVwlZN.js","assets/shaderlab-DZ3Lsiak.js","assets/hlsl-DpuYn7pp.js","assets/shellsession-COm1V40U.js","assets/soy-DwewhJ_3.js","assets/sparql-B9c85a_o.js","assets/turtle-CqNXyJWZ.js","assets/stata-Bl--TAbZ.js","assets/surrealql-BW79EE-U.js","assets/svelte-ziMErdPi.js","assets/templ-C_9I6ncv.js","assets/go-DLnOLj8q.js","assets/ts-tags-DKuFCGsc.js","assets/twig-Bs1kcsO6.js","assets/vue-Dnf0y5RU.js","assets/vue-html-CRtKS76J.js","assets/vue-vine-BxjPqU7T.js","assets/stylus-sKwvsUaC.js","assets/xsl-DSqe4nTO.js"])))=>i.map(i=>d[i]); +import{n as e,r as t,t as n}from"./rolldown-runtime-S-ySWqyJ.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var r=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,E());else{var t=n(l);t!==null&&ie(x,t.startTime-e)}}var S=!1,C=-1,w=5,ee=-1;function T(){return g?!0:!(e.unstable_now()-eet&&T());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ie(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?E():S=!1}}}var E;if(typeof y==`function`)E=function(){y(te)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,re=ne.port2;ne.port1.onmessage=te,E=function(){re.postMessage(null)}}else E=function(){_(te,0)};function ie(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ie(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,E()))),r},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=n(((e,t)=>{t.exports=r()})),a=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},ee=Object.prototype.hasOwnProperty;function T(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function te(e,t){return T(e.type,t,e.props)}function E(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ne(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var re=/\/+/g;function ie(e,t){return typeof e==`object`&&e&&e.key!=null?ne(``+e.key):t.toString(36)}function ae(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function oe(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,oe(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ie(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(re,`$&/`)+`/`),oe(o,r,i,``,function(e){return e})):o!=null&&(E(o)&&(o=te(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(re,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=a()})),s=n((e=>{var t=o();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=n((e=>{var t=i(),n=o(),r=c();function a(e){var t=`https://react.dev/errors/`+e;if(1de||(e.current=ue[de],ue[de]=null,de--)}function k(e,t){de++,ue[de]=e.current,e.current=t}var me=fe(null),he=fe(null),A=fe(null),ge=fe(null);function _e(e,t){switch(k(A,t),k(he,e),k(me,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}pe(me),k(me,e)}function ve(){pe(me),pe(he),pe(A)}function ye(e){e.memoizedState!==null&&k(ge,e);var t=me.current,n=Hd(t,e.type);t!==n&&(k(he,e),k(me,n))}function be(e){he.current===e&&(pe(me),pe(he)),ge.current===e&&(pe(ge),Qf._currentValue=le)}var xe,Se;function Ce(e){if(xe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);xe=t&&t[1]||``,Se=-1)`:-1i||c[r]!==l[i]){var u=` +`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{we=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ce(n):``}function Ee(e,t){switch(e.tag){case 26:case 27:case 5:return Ce(e.type);case 16:return Ce(`Lazy`);case 13:return e.child!==t&&t!==null?Ce(`Suspense Fallback`):Ce(`Suspense`);case 19:return Ce(`SuspenseList`);case 0:case 15:return Te(e.type,!1);case 11:return Te(e.type.render,!1);case 1:return Te(e.type,!0);case 31:return Ce(`Activity`);default:return``}}function De(e){try{var t=``,n=null;do t+=Ee(e,n),n=e,e=e.return;while(e);return t}catch(e){return` +Error generating stack: `+e.message+` +`+e.stack}}var Oe=Object.prototype.hasOwnProperty,ke=t.unstable_scheduleCallback,Ae=t.unstable_cancelCallback,je=t.unstable_shouldYield,Me=t.unstable_requestPaint,Ne=t.unstable_now,Pe=t.unstable_getCurrentPriorityLevel,Fe=t.unstable_ImmediatePriority,Ie=t.unstable_UserBlockingPriority,Le=t.unstable_NormalPriority,Re=t.unstable_LowPriority,ze=t.unstable_IdlePriority,Be=t.log,Ve=t.unstable_setDisableYieldValue,He=null,Ue=null;function We(e){if(typeof Be==`function`&&Ve(e),Ue&&typeof Ue.setStrictMode==`function`)try{Ue.setStrictMode(He,e)}catch{}}var j=Math.clz32?Math.clz32:Ke,M=Math.log,Ge=Math.LN2;function Ke(e){return e>>>=0,e===0?32:31-(M(e)/Ge|0)|0}var qe=256,Je=262144,Ye=4194304;function Xe(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ze(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Xe(n))):i=Xe(o):i=Xe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Xe(n))):i=Xe(o)):i=Xe(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Qe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function $e(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function et(){var e=Ye;return Ye<<=1,!(Ye&62914560)&&(Ye=4194304),e}function tt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function nt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function rt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),fn=!1;if(dn)try{var pn={};Object.defineProperty(pn,`passive`,{get:function(){fn=!0}}),window.addEventListener(`test`,pn,pn),window.removeEventListener(`test`,pn,pn)}catch{fn=!1}var mn=null,hn=null,gn=null;function _n(){if(gn)return gn;var e,t=hn,n=t.length,r,i=`value`in mn?mn.value:mn.textContent,a=i.length;for(e=0;e=Yn),Qn=` `,$n=!1;function er(e,t){switch(e){case`keyup`:return qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function tr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var nr=!1;function rr(e,t){switch(e){case`compositionend`:return tr(t);case`keypress`:return t.which===32?($n=!0,Qn):null;case`textInput`:return e=t.data,e===Qn&&$n?null:e;default:return null}}function ir(e,t){if(nr)return e===`compositionend`||!Jn&&er(e,t)?(e=_n(),gn=hn=mn=null,nr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Er(n)}}function Or(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Or(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function kr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Vt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Vt(e.document)}return t}function Ar(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var jr=dn&&`documentMode`in document&&11>=document.documentMode,Mr=null,Nr=null,Pr=null,Fr=!1;function Ir(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Fr||Mr==null||Mr!==Vt(r)||(r=Mr,`selectionStart`in r&&Ar(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Pr&&Tr(Pr,r)||(Pr=r,r=Ed(Nr,`onSelect`),0>=o,i-=o,Di=1<<32-j(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),R&&ki(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),R&&ki(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return R&&ki(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),R&&ki(i,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=i(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===E&&ka(l)===r.type){n(e,r.sibling),c=i(r,o.props),Ia(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=mi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=pi(o.type,o.key,o.props,null,e.mode,c),Ia(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=i(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=_i(o,e.mode,c),c.return=e,e=c}return s(e);case E:return o=ka(o),b(e,r,o,c)}if(ce(o))return h(e,r,o,c);if(ae(o)){if(l=ae(o),typeof l!=`function`)throw Error(a(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Fa(o),c);if(o.$$typeof===C)return b(e,r,ra(e,o),c);La(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,o),c.return=e,e=c):(n(e,r),c=hi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Pa=0;var i=b(e,t,n,r);return Na=null,i}catch(t){if(t===Ca||t===Ta)throw t;var a=ui(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var za=Ra(!0),Ba=Ra(!1),Va=!1;function Ha(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ua(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Wa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ga(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,W&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=si(e),oi(e,null,n),t}return ri(e,r,t,n),si(e)}function Ka(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,at(e,n)}}function qa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ja=!1;function Ya(){if(Ja){var e=ma;if(e!==null)throw e}}function Xa(e,t,n,r){Ja=!1;var i=e.updateQueue;Va=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(q&f)===f:(r&f)===f){f!==0&&f===pa&&(Ja=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Va=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),ql|=o,e.lanes=o,e.memoizedState=d}}function Za(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function Qa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=D.T,s={};D.T=s,Is(e,!1,t,n);try{var c=i(),l=D.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Fs(e,t,_a(c,r),pu(e)):Fs(e,t,r,pu(e))}catch(n){Fs(e,t,{then:function(){},status:`rejected`,reason:n},pu())}finally{O.p=a,o!==null&&s.types!==null&&(o.types=s.types),D.T=o}}function Ts(){}function Es(e,t,n,r){if(e.tag!==5)throw Error(a(476));var i=Ds(e).queue;ws(e,i,t,le,n===null?Ts:function(){return Os(e),n(r)})}function Ds(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:le,baseState:le,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:le},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Os(e){var t=Ds(e);t.next===null&&(t=e.alternate.memoizedState),Fs(e,t.next.queue,{},pu())}function ks(){return na(Qf)}function As(){return No().memoizedState}function js(){return No().memoizedState}function Ms(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=pu();e=Wa(n);var r=Ga(t,e,n);r!==null&&(hu(r,t,n),Ka(r,t,n)),t={cache:la()},e.payload=t;return}t=t.return}}function Ns(e,t,n){var r=pu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ls(e)?Rs(t,n):(n=ii(e,t,n,r),n!==null&&(hu(n,e,r),zs(n,t,r)))}function Ps(e,t,n){Fs(e,t,n,pu())}function Fs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ls(e))Rs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,wr(s,o))return ri(e,t,i,0),G===null&&ni(),!1}catch{}if(n=ii(e,t,i,r),n!==null)return hu(n,e,r),zs(n,t,r),!0}return!1}function Is(e,t,n,r){if(r={lane:2,revertLane:dd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ls(e)){if(t)throw Error(a(479))}else t=ii(e,n,r,2),t!==null&&hu(t,e,2)}function Ls(e){var t=e.alternate;return e===z||t!==null&&t===z}function Rs(e,t){_o=go=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function zs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,at(e,n)}}var Bs={readContext:na,use:Io,useCallback:Co,useContext:Co,useEffect:Co,useImperativeHandle:Co,useLayoutEffect:Co,useInsertionEffect:Co,useMemo:Co,useReducer:Co,useRef:Co,useState:Co,useDebugValue:Co,useDeferredValue:Co,useTransition:Co,useSyncExternalStore:Co,useId:Co,useHostTransitionStatus:Co,useFormState:Co,useActionState:Co,useOptimistic:Co,useMemoCache:Co,useCacheRefresh:Co};Bs.useEffectEvent=Co;var Vs={readContext:na,use:Io,useCallback:function(e,t){return Mo().memoizedState=[e,t===void 0?null:t],e},useContext:na,useEffect:fs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),us(4194308,4,vs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return us(4194308,4,e,t)},useInsertionEffect:function(e,t){us(4,2,e,t)},useMemo:function(e,t){var n=Mo();t=t===void 0?null:t;var r=e();if(vo){We(!0);try{e()}finally{We(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Mo();if(n!==void 0){var i=n(t);if(vo){We(!0);try{n(t)}finally{We(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ns.bind(null,z,e),[r.memoizedState,e]},useRef:function(e){var t=Mo();return e={current:e},t.memoizedState=e},useState:function(e){e=Jo(e);var t=e.queue,n=Ps.bind(null,z,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:bs,useDeferredValue:function(e,t){return Cs(Mo(),e,t)},useTransition:function(){var e=Jo(!1);return e=ws.bind(null,z,e.queue,!0,!1),Mo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=z,i=Mo();if(R){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),G===null)throw Error(a(349));q&127||Uo(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,fs(Go.bind(null,r,o,e),[e]),r.flags|=2048,cs(9,{destroy:void 0},Wo.bind(null,r,o,n,t),null),n},useId:function(){var e=Mo(),t=G.identifierPrefix;if(R){var n=Oi,r=Di;n=(r&~(1<<32-j(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=yo++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}o[ft]=t,o[pt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Fc(t)}}return H(t),Ic(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Fc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=A.current,Hi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Pi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[ft]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Md(e.nodeValue,n)),e||zi(t,!0)}else e=Bd(e).createTextNode(r),e[ft]=t,t.stateNode=e}return H(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Hi(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[ft]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;H(t),e=!1}else n=Wi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(uo(t),t):(uo(t),null);if(t.flags&128)throw Error(a(558))}return H(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Hi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));i[ft]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;H(t),i=!1}else i=Wi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(uo(t),t):(uo(t),null)}return uo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Rc(t,t.updateQueue),H(t),null);case 4:return ve(),e===null&&Sd(t.stateNode.containerInfo),H(t),null;case 10:return Xi(t.type),H(t),null;case 19:if(pe(fo),r=t.memoizedState,r===null)return H(t),null;if(i=(t.flags&128)!=0,o=r.rendering,o===null)if(i)zc(r,!1);else{if(Kl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=po(e),o!==null){for(t.flags|=128,zc(r,!1),e=o.updateQueue,t.updateQueue=e,Rc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)fi(n,e),n=n.sibling;return k(fo,fo.current&1|2),R&&ki(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ne()>ru&&(t.flags|=128,i=!0,zc(r,!1),t.lanes=4194304)}else{if(!i)if(e=po(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Rc(t,e),zc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!R)return H(t),null}else 2*Ne()-r.renderingStartTime>ru&&n!==536870912&&(t.flags|=128,i=!0,zc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(H(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ne(),e.sibling=null,n=fo.current,k(fo,i?n&1|2:n&1),R&&ki(t,r.treeForkCount),e);case 22:case 23:return uo(t),ro(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(H(t),t.subtreeFlags&6&&(t.flags|=8192)):H(t),n=t.updateQueue,n!==null&&Rc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&pe(ya),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Xi(ca),H(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function Vc(e,t){switch(Mi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xi(ca),ve(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return be(t),null;case 31:if(t.memoizedState!==null){if(uo(t),t.alternate===null)throw Error(a(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(uo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return pe(fo),null;case 4:return ve(),null;case 10:return Xi(t.type),null;case 22:case 23:return uo(t),ro(),e!==null&&pe(ya),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Xi(ca),null;case 25:return null;default:return null}}function Hc(e,t){switch(Mi(t),t.tag){case 3:Xi(ca),ve();break;case 26:case 27:case 5:be(t);break;case 4:ve();break;case 31:t.memoizedState!==null&&uo(t);break;case 13:uo(t);break;case 19:pe(fo);break;case 10:Xi(t.type);break;case 22:case 23:uo(t),ro(),e!==null&&pe(ya);break;case 24:Xi(ca)}}function Uc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Z(t,t.return,e)}}function Wc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Z(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Z(t,t.return,e)}}function Gc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Qa(t,n)}catch(t){Z(e,e.return,t)}}}function Kc(e,t,n){n.props=Js(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Z(e,t,n)}}function qc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Z(e,t,n)}}function Jc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Z(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Z(e,t,n)}else n.current=null}function Yc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Z(e,e.return,t)}}function Xc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[pt]=t}catch(t){Z(e,e.return,t)}}function Zc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Zc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function $c(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=tn));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function el(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(el(e,t,n),e=e.sibling;e!==null;)el(e,t,n),e=e.sibling}function tl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[ft]=e,t[pt]=n}catch(t){Z(e,e.return,t)}}var nl=!1,rl=!1,il=!1,al=typeof WeakSet==`function`?WeakSet:Set,ol=null;function sl(e,t){if(e=e.containerInfo,Rd=sp,e=kr(e),Ar(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,ol=t;ol!==null;)if(t=ol,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,ol=e;else for(;ol!==null;){switch(t=ol,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Pd(o,r,n),o[ft]=e,Tt(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=Dr(s,h),v=Dr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,D.T=null,n=lu,lu=null;var o=Y,s=su;if(ou=0,X=Y=null,su=0,W&6)throw Error(a(331));var c=W;if(W|=4,Il(o.current),Ol(o,o.current,s,n),W=c,id(0,!1),Ue&&typeof Ue.onPostCommitFiberRoot==`function`)try{Ue.onPostCommitFiberRoot(He,o)}catch{}return!0}finally{O.p=i,D.T=r,Vu(e,t)}}function Wu(e,t,n){t=yi(n,t),t=ec(e.stateNode,t,2),e=Ga(e,t,2),e!==null&&(nt(e,2),rd(e))}function Z(e,t,n){if(e.tag===3)Wu(e,e,n);else for(;t!==null;){if(t.tag===3){Wu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(au===null||!au.has(r))){e=yi(n,e),n=tc(2),r=Ga(t,n,2),r!==null&&(nc(n,r,t,e),nt(r,2),rd(r));break}}t=t.return}}function Gu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Bl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Wl=!0,i.add(n),e=Ku.bind(null,e,t,n),t.then(e,e))}function Ku(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,G===e&&(q&n)===n&&(Kl===4||Kl===3&&(q&62914560)===q&&300>Ne()-tu?!(W&2)&&Su(e,0):Yl|=n,Zl===q&&(Zl=0)),rd(e)}function qu(e,t){t===0&&(t=et()),e=ai(e,t),e!==null&&(nt(e,t),rd(e))}function Ju(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qu(e,n)}function Yu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),qu(e,n)}function Xu(e,t){return ke(e,t)}var Zu=null,Qu=null,$u=!1,ed=!1,td=!1,nd=0;function rd(e){e!==Qu&&e.next===null&&(Qu===null?Zu=Qu=e:Qu=Qu.next=e),ed=!0,$u||($u=!0,ud())}function id(e,t){if(!td&&ed){td=!0;do for(var n=!1,r=Zu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-j(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ld(r,a))}else a=q,a=Ze(r,r===G?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Qe(r,a)||(n=!0,ld(r,a));r=r.next}while(n);td=!1}}function ad(){od()}function od(){ed=$u=!1;var e=0;nd!==0&&Gd()&&(e=nd);for(var t=Ne(),n=null,r=Zu;r!==null;){var i=r.next,a=sd(r,t);a===0?(r.next=null,n===null?Zu=i:n.next=i,i===null&&(Qu=n)):(n=r,(e!==0||a&3)&&(ed=!0)),r=i}ou!==0&&ou!==5||id(e,!1),nd!==0&&(nd=0)}function sd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Ut(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),Tt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ut(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ut(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ut(n.imageSizes)+`"]`)):i+=`[href="`+Ut(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),Tt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ut(r)+`"][href="`+Ut(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),Tt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=wt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);Tt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=wt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),Tt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=wt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),Tt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=A.current)?gf(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=wt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=wt(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(i,e,n,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=wt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Af(e){return`href="`+Ut(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),Tt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Ut(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ut(n.href)+`"]`);if(r)return t.instance=r,Tt(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Tt(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var o=e.querySelector(jf(i));if(o)return t.state.loading|=4,t.instance=o,Tt(o),o;r=Mf(n),(i=mf.get(i))&&Rf(r,i),o=(e.ownerDocument||e).createElement(`link`),Tt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(i=e.querySelector(Ff(o)))?(t.instance=i,Tt(i),i):(r=n,(i=mf.get(o))&&(r=h({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Tt(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Tt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),Tt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=l()}))(),d=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},f=new class extends d{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},p={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},m=new class{#e=p;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function h(e){setTimeout(e,0)}var g=typeof window>`u`||`Deno`in globalThis;function _(){}function v(e,t){return typeof e==`function`?e(t):e}function y(e){return typeof e==`number`&&e>=0&&e!==1/0}function b(e,t){return Math.max(e+(t||0)-Date.now(),0)}function x(e,t){return typeof e==`function`?e(t):e}function S(e,t){return typeof e==`function`?e(t):e}function C(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ee(o,t.options))return!1}else if(!te(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function w(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(T(t.options.mutationKey)!==T(a))return!1}else if(!te(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ee(e,t){return(t?.queryKeyHashFn||T)(e)}function T(e){return JSON.stringify(e,(e,t)=>ae(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function te(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>te(e[n],t[n])):!1}var E=Object.prototype.hasOwnProperty;function ne(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ie(e)&&ie(t);if(!r&&!(ae(e)&&ae(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{m.setTimeout(t,e)})}function ce(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:ne(e,t)}function D(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function O(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var le=Symbol();function ue(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===le?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function de(e,t){return typeof e==`function`?e(...t):!!e}function fe(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var pe=(()=>{let e=()=>g;return{isServer(){return e()},setIsServer(t){e=t}}})();function k(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var me=h;function he(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=me,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var A=he(),ge=new class extends d{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function _e(e){return Math.min(1e3*2**e,3e4)}function ve(e){return(e??`online`)===`online`?ge.isOnline():!0}var ye=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function be(e){let t=!1,n=0,r,i=k(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new ye(t);p(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>f.isFocused()&&(e.networkMode===`always`||ge.isOnline())&&e.canRun(),u=()=>ve(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},p=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(pe.isServer()?0:3),o=e.retryDelay??_e,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&nl()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?h():m().then(h),i)}}var xe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),y(this.gcTime)&&(this.#e=m.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(pe.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(m.clearTimeout(this.#e),void 0)}},Se=class extends xe{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Te(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Te(this.options);e.data!==void 0&&(this.setState(we(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=ce(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#c({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(_).catch(_):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>S(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===le||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>x(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!b(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o||this.#s()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#s(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=ue(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=be({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ye&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof ye){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ce(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...we(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),A.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function Ce(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ve(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function we(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Te(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Ee=class extends d{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=k(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Oe(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ke(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ke(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof S(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!re(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Ae(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||S(this.options.enabled,this.#t)!==S(t.enabled,this.#t)||x(this.options.staleTime,this.#t)!==x(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||S(this.options.enabled,this.#t)!==S(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Me(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(_)),t}#g(){this.#b();let e=x(this.options.staleTime,this.#t);if(pe.isServer()||this.#r.isStale||!y(e))return;let t=b(this.#r.dataUpdatedAt,e)+1;this.#d=m.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(pe.isServer()||S(this.options.enabled,this.#t)===!1||!y(this.#p)||this.#p===0)&&(this.#f=m.setInterval(()=>{(this.options.refetchIntervalInBackground||f.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(m.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(m.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Oe(e,t),o=i&&Ae(e,n,t,r);(a||o)&&(l={...l,...Ce(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=ce(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=ce(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:je(e,t),refetch:this.refetch,promise:this.#o,isEnabled:S(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=k())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!re(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){A.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function De(e,t){return S(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function Oe(e,t){return De(e,t)||e.state.data!==void 0&&ke(e,t,t.refetchOnMount)}function ke(e,t,n){if(S(t.enabled,e)!==!1&&x(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&je(e,t)}return!1}function Ae(e,t,n,r){return(e!==t||S(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&je(e,n)}function je(e,t){return S(t.enabled,e)!==!1&&e.isStaleByTime(x(t.staleTime,e))}function Me(e,t){return!re(e.getCurrentResult(),t)}function Ne(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{fe(e,()=>t.signal,()=>n=!0)},u=ue(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?O:D;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Fe:Pe,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Pe(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Pe(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Fe(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Ie=class extends xe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Le(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=be({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),A.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Le(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Re=class extends d{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Ie({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ze(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ze(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ze(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=ze(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){A.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>w(t,e))}findAll(e={}){return this.getAll().filter(t=>w(e,t))}notify(e){A.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return A.batch(()=>Promise.all(e.map(e=>e.continue().catch(_))))}};function ze(e){return e.options.scope?.id}var Be=class extends d{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),re(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&T(t.mutationKey)!==T(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Le();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){A.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Ve=class extends d{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??ee(r,t),a=this.get(i);return a||(a=new Se({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){A.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>C(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>C(e,t)):t}notify(e){A.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){A.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){A.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},He=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ve,this.#t=e.mutationCache||new Re,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=f.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ge.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(x(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=v(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return A.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;A.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return A.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=A.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(_).catch(_)}invalidateQueries(e,t={}){return A.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=A.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(_)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(_)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(x(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_).catch(_)}fetchInfiniteQuery(e){return e.behavior=Ne(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_).catch(_)}ensureInfiniteQueryData(e){return e.behavior=Ne(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ge.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(T(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{te(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(T(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{te(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=ee(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===le&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ue=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),We=n(((e,t)=>{t.exports=Ue()})),j=t(o(),1),M=We(),Ge=j.createContext(void 0),Ke=e=>{let t=j.useContext(Ge);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},qe=({client:e,children:t})=>(j.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,M.jsx)(Ge.Provider,{value:e,children:t})),Je=j.createContext(!1),Ye=()=>j.useContext(Je);Je.Provider;function Xe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ze=j.createContext(Xe()),Qe=()=>j.useContext(Ze),$e=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?de(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},et=e=>{j.useEffect(()=>{e.clearReset()},[e])},tt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||de(n,[e.error,r])),nt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},rt=(e,t)=>e.isLoading&&e.isFetching&&!t,it=(e,t)=>e?.suspense&&t.isPending,at=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ot(e,t,n){let r=Ye(),i=Qe(),a=Ke(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,nt(o),$e(o,i,s),et(i);let c=!a.getQueryCache().get(o.queryHash),[l]=j.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(j.useSyncExternalStore(j.useCallback(e=>{let t=d?l.subscribe(A.batchCalls(e)):_;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),j.useEffect(()=>{l.setOptions(o)},[o,l]),it(o,u))throw at(o,l,i);if(tt({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!pe.isServer()&&rt(u,r)&&(c?at(o,l,i):s?.promise)?.catch(_).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function st(e,t){return ot(e,Ee,t)}function ct(e,t){let n=Ke(t),[r]=j.useState(()=>new Be(n,e));j.useEffect(()=>{r.setOptions(e)},[r,e]);let i=j.useSyncExternalStore(j.useCallback(e=>r.subscribe(A.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=j.useCallback((e,t)=>{r.mutate(e,t).catch(_)},[r]);if(i.error&&de(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var lt=`diffs-container`,ut=/(?=^From [a-f0-9]+ .+$)/m,dt=/(?=^diff --git)/gm,ft=/(?=^---\s+\S)/gm,pt=/(?=^@@ )/gm,mt=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,ht=/(?<=\n)/,gt=/^(---|\+\+\+)\s+([^\t\r\n]+)/,_t=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,vt=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,yt=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,bt=`header-prefix`,xt=`header-metadata`,St=`header-custom`,Ct={dark:`pierre-dark`,light:`pierre-light`},wt=`data-theme-css`,Tt=`data-unsafe-css`,Et={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,hunkSeparatorHeight:32,fileGap:8},Dt=Object.freeze({fromStart:0,fromEnd:0}),Ot={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},kt={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function At(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function jt(e){return{type:`text`,value:e}}function N({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function Mt({name:e,width:t=16,height:n=16,properties:r}){return N({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[N({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function Nt(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 Pt(e){return N({tagName:`div`,properties:{"data-gutter":``},children:e})}function Ft(e,t,n,r={}){return N({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[N({tagName:`span`,properties:{"data-line-number-content":``},children:[jt(`${t}`)]})]})}function It(e,t,n){return N({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 Lt(){return N({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[Mt({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function Rt(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}var zt=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],Bt=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Bt.prototype.normal={},Bt.prototype.property={},Bt.prototype.space=void 0;function Vt(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Bt(n,r,t)}function Ht(e){return e.toLowerCase()}var Ut=class{constructor(e,t){this.attribute=t,this.property=e}};Ut.prototype.attribute=``,Ut.prototype.booleanish=!1,Ut.prototype.boolean=!1,Ut.prototype.commaOrSpaceSeparated=!1,Ut.prototype.commaSeparated=!1,Ut.prototype.defined=!1,Ut.prototype.mustUseProperty=!1,Ut.prototype.number=!1,Ut.prototype.overloadedBoolean=!1,Ut.prototype.property=``,Ut.prototype.spaceSeparated=!1,Ut.prototype.space=void 0;var Wt=e({boolean:()=>P,booleanish:()=>Kt,commaOrSpaceSeparated:()=>Yt,commaSeparated:()=>Jt,number:()=>F,overloadedBoolean:()=>qt,spaceSeparated:()=>I}),Gt=0,P=Xt(),Kt=Xt(),qt=Xt(),F=Xt(),I=Xt(),Jt=Xt(),Yt=Xt();function Xt(){return 2**++Gt}var Zt=Object.keys(Wt),Qt=class extends Ut{constructor(e,t,n,r){let i=-1;if(super(e,t),$t(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&fn.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(dn,hn);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!dn.test(e)){let n=e.replace(un,mn);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Qt}return new i(r,t)}function mn(e){return`-`+e.toLowerCase()}function hn(e){return e.charAt(1).toUpperCase()}var gn=Vt([tn,an,sn,cn,ln],`html`),_n=Vt([tn,on,sn,cn,ln],`svg`),vn={}.hasOwnProperty;function yn(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&vn.call(t,e)){let n=String(t[e]);i=vn.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 bn=/["&'<>`]/g,xn=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Sn=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Cn=/[|\\{}()[\]^$+*?.]/g,wn=new WeakMap;function Tn(e,t){if(e=e.replace(t.subset?En(t.subset):bn,r),t.subset||t.escapeOnly)return e;return e.replace(xn,n).replace(Sn,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 En(e){let t=wn.get(e);return t||(t=Dn(e),wn.set(e,t)),t}function Dn(e){let t=[],n=-1;for(;++n`,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:`€`},Pn=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],Fn={}.hasOwnProperty,In={},Ln;for(Ln in Nn)Fn.call(Nn,Ln)&&(In[Nn[Ln]]=Ln);var Rn=/[^\dA-Za-z]/;function zn(e,t,n,r){let i=String.fromCharCode(e);if(Fn.call(In,i)){let e=In[i],a=`&`+e;return n&&Mn.includes(e)&&!Pn.includes(e)&&(!r||t&&t!==61&&Rn.test(String.fromCharCode(t)))?a:a+`;`}return``}function Bn(e,t,n){let r=kn(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=zn(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=jn(e,t,n.omitOptionalSemicolons);i.length|^->||--!>|`],Wn=[`<`,`>`];function Gn(e,t,n,r){return r.settings.bogusComments?``:``;function i(e){return Vn(e,Object.assign({},r.settings.characterReferences,{subset:Wn}))}}function Kn(e,t,n,r){return``}function qn(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 Jn(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function Yn(e){return e.join(` `).trim()}var Xn=/[ \t\n\f\r]/g;function Zn(e){return typeof e==`object`?e.type===`text`?Qn(e.value):!1:Qn(e)}function Qn(e){return e.replace(Xn,``)===``}var $n=nr(1),er=nr(-1),tr=[];function nr(e){return t;function t(t,n,r){let i=t?t.children:tr,a=(n||0)+e,o=i[a];if(!r)for(;o&&Zn(o);)a+=e,o=i[a];return o}}var rr={}.hasOwnProperty;function ir(e){return t;function t(t,n,r){return rr.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var ar=ir({body:cr,caption:or,colgroup:or,dd:fr,dt:dr,head:or,html:sr,li:ur,optgroup:mr,option:hr,p:lr,rp:pr,rt:pr,tbody:_r,td:br,tfoot:vr,th:br,thead:gr,tr:yr});function or(e,t,n){let r=$n(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&Zn(r.value.charAt(0)))}function sr(e,t,n){let r=$n(n,t);return!r||r.type!==`comment`}function cr(e,t,n){let r=$n(n,t);return!r||r.type!==`comment`}function lr(e,t,n){let r=$n(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 ur(e,t,n){let r=$n(n,t);return!r||r.type===`element`&&r.tagName===`li`}function dr(e,t,n){let r=$n(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function fr(e,t,n){let r=$n(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function pr(e,t,n){let r=$n(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function mr(e,t,n){let r=$n(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function hr(e,t,n){let r=$n(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function gr(e,t,n){let r=$n(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function _r(e,t,n){let r=$n(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function vr(e,t,n){return!$n(n,t)}function yr(e,t,n){let r=$n(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function br(e,t,n){let r=$n(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var xr=ir({body:wr,colgroup:Tr,head:Cr,html:Sr,tbody:Er});function Sr(e){let t=$n(e,-1);return!t||t.type!==`comment`}function Cr(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 wr(e){let t=$n(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&Zn(t.value.charAt(0)))&&!(t.type===`element`&&(t.tagName===`meta`||t.tagName===`link`||t.tagName===`script`||t.tagName===`style`||t.tagName===`template`))}function Tr(e,t,n){let r=er(n,t),i=$n(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&ar(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function Er(e,t,n){let r=er(n,t),i=$n(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&ar(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var Dr={name:[[` +\f\r &/=>`.split(``),` +\f\r "&'/=>\``.split(``)],[`\0 +\f\r "&'/<=>`.split(``),`\0 +\f\r "&'/<=>\``.split(``)]],unquoted:[[` +\f\r &>`.split(``),`\0 +\f\r "&'<=>\``.split(``)],[`\0 +\f\r "&'<=>\``.split(``),`\0 +\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function Or(e,t,n,r){let i=r.schema,a=i.space===`svg`?!1: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=_n);let l=kr(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!xr(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||!ar(e,t,n))&&s.push(``),s.join(``)}function kr(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=Ar(e,i,t[i]);r&&n.push(r)}}for(;++rqn(n,e.alternative)&&(o=e.alternative),s=o+Vn(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?Dr.single:Dr.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var jr=[`<`,`&`];function Mr(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:Vn(e.value,Object.assign({},r.settings.characterReferences,{subset:jr}))}function Nr(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Mr(e,t,n,r)}function Pr(e,t,n,r){return r.all(e)}var Fr=yn(`type`,{invalid:Ir,unknown:Lr,handlers:{comment:Gn,doctype:Kn,element:Or,raw:Nr,root:Pr,text:Mr}});function Ir(e){throw Error("Expected node, not `"+e+"`")}function Lr(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var Rr={},zr={},Br=[];function Vr(e,t){let n=t||Rr,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Hr,all:Ur,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||zt,characterReferences:n.characterReferences||zr,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?_n:gn,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function Hr(e,t,n){return Fr(e,t,n,this)}function Ur(e){let t=[],n=e&&e.children||Br,r=-1;for(;++r{if(this.hoveredLine!=null){if(this.mode===`diff`&&this.hoveredLine.type===`diff-line`)return{lineNumber:this.hoveredLine.lineNumber,side:this.hoveredLine.annotationSide};if(this.mode===`file`&&this.hoveredLine.type===`line`)return{lineNumber:this.hoveredLine.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&&ni(e.composedPath())||(ri(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e}))};handlePointerMove=e=>{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||(ri(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(ri(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){ri(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.gutterUtilityContainer?.remove(),this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine())};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();ri(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);ri(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=Yr(i)&&this.hoveredLine?.lineElement===i.lineElement;Jr(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),Jr(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(this.gutterUtilityContainer?.remove(),c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Yr(i)&&(this.setHoveredLine(this.toEventBaseProps(i)),this.gutterUtilityContainer!=null&&i.numberElement.appendChild(this.gutterUtilityContainer),s?.({...this.hoveredLine,event:t})));break}case`click`:{if(i==null)break;if(Zr(i)&&p!=null){p(i);break}if(Xr(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Yr(i))break;Jr(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,ri(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})()),ri(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),ri(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();ni(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e,t):this.startLineSelectionFromPointerDown(e,t)};startLineSelectionFromPointerDown(e,t){let{enableLineSelection:n=!1}=this.options;if(!n)return;let r=this.getSelectionPointerInfo(t,!0);if(r==null)return;let{pre:i}=this;if(i==null)return;e.preventDefault();let{lineNumber:a,eventSide:o,lineIndex:s}=r;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,i.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?s>=t.start:s<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(a,o,!1),this.notifySelectionStart(this.selectedRange),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===a&&this.selectedRange?.end===a){let t={lineNumber:a,side:o};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.selectedRange=null,this.selectionAnchor={lineNumber:a,side:o},this.updateSelection(a,o,!1),this.notifySelectionStart(this.selectedRange),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e,t){let{enableLineSelection:n=!1,onGutterUtilityClick:r}=this.options;if(r==null)return;let i=this.getSelectionPointFromPath(t);i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:i},n&&(this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(i.lineNumber,i.side,!1),this.notifySelectionStart(this.selectedRange)),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{let{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;let n=this.getSelectionPointFromPath(e.composedPath());if(n==null)return;this.pointerSession.current=n,t===!0&&this.updateSelection(n.lineNumber,n.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;let t=this.getSelectionPointerInfo(e.composedPath(),!1);if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;let t=this.getSelectionPointerInfo(e.composedPath(),!1);if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(Rt(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.selectedRange),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;let r=this.getSelectionPointFromPath(e.composedPath());r!=null&&(this.pointerSession.current=r,t&&this.updateSelection(r.lineNumber,r.side)),n?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.selectedRange),this.notifySelectionCommitted()),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.selectedRange),this.notifySelectionCommitted();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.selectedRange),this.notifySelectionCommitted()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){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=Vr(Lt());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!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`})}getSelectionPointerInfo(e,t){let n=this.resolvePointerTarget(e);if(qr(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}getSelectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(qr(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}updateSelection(e,t,n=!0){let{selectedRange:r}=this,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)}At(r??void 0,i??void 0)||(this.selectedRange=i,n&&this.notifySelectionChangeDelta(),this.queuedSelectionRender??=requestAnimationFrame(this.renderSelection))}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}renderSelection=()=>{if(this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;let e=this.pre.querySelectorAll(`[data-selected-line]`);for(let t of e)t.removeAttribute(`data-selected-line`);if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;let{children:t}=this.pre;if(t.length===0)return;if(t.length>2)throw console.error(t),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let n=this.pre.getAttribute(`data-diff-type`)===`split`,r=this.getIndexesFromSelection(this.selectedRange,n);if(r==null)throw console.error({rowRange:r,selectedRange:this.selectedRange}),Error(`InteractionManager.renderSelection: No valid rowRange`);let i=r.start===r.end,a=Math.min(r.start,r.end),o=Math.max(r.start,r.end);for(let e of t){let[t,r]=e.children,s=r.children.length;if(s!==t.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);for(let e=0;eo)break;if(l==null||lNumber.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Gr({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,enableHoverUtility:n,lineHoverHighlight:r,onGutterUtilityClick:i,onLineClick:a,onLineEnter:o,onLineLeave:s,onLineNumberClick:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,renderGutterUtility:f,renderHoverUtility:p,__debugPointerEvents:m,enableLineSelection:h,onLineSelected:g,onLineSelectionStart:_,onLineSelectionChange:v,onLineSelectionEnd:y},b,x,S){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:Kr({enableGutterUtility:t,enableHoverUtility:n,renderGutterUtility:f,renderHoverUtility:p,onGutterUtilityClick:i}),usesCustomGutterUtility:f!=null||p!=null,lineHoverHighlight:r,onGutterUtilityClick:i,onHunkExpand:b,onMergeConflictActionClick:S,onLineClick:a,onLineEnter:o,onLineLeave:s,onLineNumberClick:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,__debugPointerEvents:m,enableLineSelection:h,onLineSelected:g,onLineSelectionStart:_,onLineSelectionChange:v,onLineSelectionEnd:y,getLineIndex:x}}function Kr({enableGutterUtility:e,enableHoverUtility:t,renderGutterUtility:n,renderHoverUtility:r,onGutterUtilityClick:i}){if(e!==void 0&&t!==void 0)throw Error(`Cannot use both 'enableGutterUtility' and deprecated 'enableHoverUtility'. Use only 'enableGutterUtility'.`);if(n!=null&&r!=null)throw Error(`Cannot use both 'renderGutterUtility' and deprecated 'renderHoverUtility'. Use only 'renderGutterUtility'.`);if(i!=null&&(n!=null||r!=null))throw Error(`Cannot use both 'onGutterUtilityClick' and render utility callbacks ('renderGutterUtility'/'renderHoverUtility'). Use only one gutter utility API.`);return e??t??!1}function qr(e){return e!=null&&`kind`in e&&e.kind===`line`}function Jr(e){return e!=null&&`kind`in e&&e.kind===`token`}function Yr(e){return qr(e)||Jr(e)}function Xr(e){return`type`in e&&e.type===`line-info`}function Zr(e){return`kind`in e&&e.kind===`merge-conflict-action`}function Qr(e){return e===`current`||e===`incoming`||e===`both`}function $r(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function ei(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function ti(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 ni(e){for(let t of e)if(t instanceof HTMLElement&&t.hasAttribute(`data-utility-button`))return!0;return!1}function ri(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;break}console.log(...n)}var ii=class{observedNodes=new Map;queuedUpdates=new Map;cleanUp(){this.resizeObserver?.disconnect(),this.observedNodes.clear(),this.queuedUpdates.clear()}resizeObserver;setup(e,t){this.resizeObserver??=new ResizeObserver(this.handleResizeObserver);let n=e.querySelectorAll(`code`),r=new Map(this.observedNodes);this.observedNodes.clear();for(let e of n){let t=r.get(e);if(t!=null&&t.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let n=e.firstElementChild;n instanceof HTMLElement||(n=null),t==null?(t={type:`code`,codeElement:e,numberElement:n,codeWidth:`auto`,numberWidth:0},this.observedNodes.set(e,t),this.resizeObserver.observe(e),n!=null&&(this.observedNodes.set(n,t),this.resizeObserver.observe(n))):(this.observedNodes.set(e,t),r.delete(e),t.numberElement===n?t.numberElement!=null&&(r.delete(t.numberElement),this.observedNodes.set(t.numberElement,t)):(t.numberElement!=null&&this.resizeObserver.unobserve(t.numberElement),n!=null&&(this.resizeObserver.observe(n),r.delete(n),this.observedNodes.set(n,t)),t.numberElement=n))}if(n.length>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let{lineAnnotation:t=``}=e.dataset;if(!/^\d+,\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let 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,o=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(o instanceof HTMLElement))continue;let s=r.get(a);if(s!=null){this.observedNodes.set(a,s),this.observedNodes.set(o,s),r.delete(a),r.delete(o);continue}s={type:`annotations`,column1:{container:n,child:a,childHeight:a.getBoundingClientRect().height},column2:{container:i,child:o,childHeight:o.getBoundingClientRect().height},currentHeight:`auto`};let c=Math.max(s.column1.childHeight,s.column2.childHeight);this.applyNewHeight(s,c),this.observedNodes.set(a,s),this.observedNodes.set(o,s),this.resizeObserver.observe(a),this.resizeObserver.observe(o)}}for(let e of r.keys())e.isConnected&&(e.style.removeProperty(`--diffs-column-content-width`),e.style.removeProperty(`--diffs-column-number-width`),e.style.removeProperty(`--diffs-column-width`),e.parentElement instanceof HTMLElement&&e.parentElement.style.removeProperty(`--diffs-annotation-min-height`)),this.resizeObserver.unobserve(e);r.clear()}handleResizeObserver=e=>{for(let t of e){let{target:e,borderBoxSize:n,contentBoxSize:r}=t;if(!(e instanceof HTMLElement)){console.error(`FileDiff.handleResizeObserver: Invalid element for ResizeObserver`,t);continue}let i=this.observedNodes.get(e);if(i==null){console.error(`FileDiff.handleResizeObserver: Not a valid observed node`,t);continue}if(i.type===`annotations`){let t=(()=>{if(e===i.column1.child)return i.column1;if(e===i.column2.child)return i.column2})();if(t==null){console.error(`FileDiff.handleResizeObserver: Couldn't find a column for`,{item:i,target:e});continue}t.childHeight=n[0].blockSize;let r=Math.max(i.column1.childHeight,i.column2.childHeight);this.applyNewHeight(i,r)}else if(i.type===`code`){let t=[e,r[0].inlineSize],n=this.queuedUpdates.get(i)??[];n.push(t),this.queuedUpdates.set(i,n)}}this.handleColumnChange()};handleColumnChange=()=>{for(let[e,t]of this.queuedUpdates)for(let[n,r]of t)if(n===e.codeElement){let n=Math.max(Math.floor(r),0);if(n!==e.codeWidth){let t=Math.max(n-e.numberWidth,0);e.codeWidth=n===0?`auto`:n,e.codeElement.style.setProperty(`--diffs-column-content-width`,`${t>0?`${t}px`:`auto`}`),e.codeElement.style.setProperty(`--diffs-column-width`,`${typeof e.codeWidth==`number`?`${e.codeWidth}px`:`auto`}`)}e.numberElement!=null&&typeof e.codeWidth==`number`&&e.numberWidth===0&&t.push([e.numberElement,e.numberElement.getBoundingClientRect().width])}else if(n===e.numberElement){let t=Math.max(Math.ceil(r),0);if(t!==e.numberWidth&&(e.numberWidth=t,e.codeElement.style.setProperty(`--diffs-column-number-width`,`${e.numberWidth===0?`auto`:`${e.numberWidth}px`}`),e.codeWidth!==`auto`)){let t=Math.max(e.codeWidth-e.numberWidth,0);e.codeElement.style.setProperty(`--diffs-column-content-width`,`${t===0?`auto`:`${t}px`}`)}}this.queuedUpdates.clear()};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}},ai=new Map,oi=new Map,si=new Map,ci=new Set;function li(e){for(let t of Array.isArray(e)?e:[e])if(!(t===`text`||t===`ansi`)&&!ci.has(t))return!1;return!0}function ui(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(ci.has(n.name))continue;let e=ai.get(n.name);e??(e=n,ai.set(n.name,e)),ci.add(e.name),t.loadLanguageSync(e.data)}}function di(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var L=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function fi(e){return pi(e)}function pi(e){return Array.isArray(e)?mi(e):e instanceof RegExp?e:typeof e==`object`?hi(e):e}function mi(e){let t=[];for(let n=0,r=e.length;n{for(let n in t)e[n]=t[n]}),e}function _i(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?_i(e.substring(0,e.length-1)):e.substr(~t+1)}var vi=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,yi=class{static hasCaptures(e){return e===null?!1:(vi.lastIndex=0,vi.test(e))}static replaceCaptures(e,t,n){return e.replace(vi,(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 bi(e,t){return et)}function xi(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;rthis._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=>Di(e.parent,t.parentScopes));return n?new ki(n.fontStyle,n.foreground,n.background):null}},Ei=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`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Oi(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Oi(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var ki=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Ai(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new ji(l,u,e,o,s,c)}}return n}var ji=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}},Mi=(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))(Mi||{});function Ni(e,t){e.sort((e,t)=>{let n=bi(e.scope,t.scope);return n!==0||(n=xi(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 Pi(t),o=new ki(n,a.getId(r),a.getId(i)),s=new Ii(new R(0,null,-1,0,0),[]);for(let t=0,n=e.length;te?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},Ii=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(),R.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>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!=0}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=zi(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 Ri(e){return e}function zi(e){return e}function Bi(e,t){let n=[],r=Hi(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(Vi(i)){let e=[];do e.push(i),i=r.next();while(Vi(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 Vi(e){return!!e&&!!e.match(/[\w\.:]+/)}function Hi(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 Ui(e){typeof e.dispose==`function`&&e.dispose()}var Wi=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Gi=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Ki=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))}},qi=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Wi(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new Ki;for(let n of e)Ji(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof Wi){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 Ji(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 Wi?Xi({baseGrammar:a,selfGrammar:i},r):Yi(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 Wi(e))}function Yi(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];Zi([r],t,n)}}function Xi(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Zi(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Zi(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Zi(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?gi({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&Zi(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=ra(i);switch(a.kind){case 0:Xi({...t,selfGrammar:t.baseGrammar},n);break;case 1:Xi(t,n);break;case 2:Yi(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?Yi(a.ruleName,i,n):Xi(i,n)}else a.kind===4?n.add(new Gi(a.scopeName,a.ruleName)):n.add(new Wi(a.scopeName));break}}}var Qi=class{kind=0},$i=class{kind=1},ea=class{constructor(e){this.ruleName=e}kind=2},ta=class{constructor(e){this.scopeName=e}kind=3},na=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function ra(e){if(e===`$base`)return new Qi;if(e===`$self`)return new $i;let t=e.indexOf(`#`);return t===-1?new ta(e):t===0?new ea(e.substring(1)):new na(e.substring(0,t),e.substring(t+1))}var ia=/\\(\d+)/,aa=/\\(\d+)/g,oa=-1,sa=-2;function ca(e){return e}function la(e){return e}var ua=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=yi.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=yi.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${_i(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:yi.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:yi.replaceCaptures(this._contentName,e,t)}},da=class extends ua{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!`)}},fa=class extends ua{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new _a(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 va,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},pa=class extends ua{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 va,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ma=class extends ua{_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 _a(i,this.id),this.beginCaptures=a,this._end=new _a(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 va;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}},ha=class extends ua{_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 _a(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new _a(o,sa),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 va;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 va,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},ga=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new da(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new fa(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=gi({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new pa(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new ha(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 ma(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;ae.substring(t.start,t.end));return aa.lastIndex=0,this.source.replace(aa,(e,t)=>Ci(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;ie.source);this._cached=new ya(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 ya(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},ya=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;tnew ba(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/},Sa=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])=>Ci(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 Ca=!1,wa=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Ta(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Ea(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 wa(i,!0);f()}return new wa(i,!1);function f(){let o=Da(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===oa){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Na(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 ma){let r=o;Na(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 ha){let r=o;Na(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(Na(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 Ea(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 ha&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=ja(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==sa){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Na(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 Da(e,t,n,r,i,a){let o=Oa(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=ka(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=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 Aa(e,t,n,r,i){return Ca?{ruleScanner:e.compile(t,n),findOptions:Ma(r,i)}:{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function ja(e,t,n,r,i){return Ca?{ruleScanner:e.compileWhile(t,n),findOptions:Ma(r,i)}:{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Ma(e,t){let n=0;return e||(n|=1),t||(n|=4),n}function Na(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;tu)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));Ta(e,p,n&&d.start===0,d.start,f,i,!1,0),Ui(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 Pa(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Pa=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function Fa(e,t,n,r,i,a,o,s){return new za(e,t,n,r,i,a,o,s)}function Ia(e,t,n,r,i){let a=Bi(t,La),o=ga.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 La(e,t){if(t.length{for(let r=n;rn&&e.substr(0,n)===t&&e[n]===`.`}var za=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new xa(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Ba(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Bi(e,La);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)Ia(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&&Ia(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(ca(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[la(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]=Ba(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=ga.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Ha.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=Li.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?Va.createRootAndLookUpScopeName(a,r,this):Va.createRoot(`unknown`,r),t=new Ha(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=` +`;let a=this.createOnigString(e),o=a.content.length,s=new Wa(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Ta(this,a,i,0,t,s,!0,r);return Ui(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Ba(e,t){return e=fi(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 Va=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=Ei.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Ei(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Ei(null,t),o=r.themeProvider.themeMatch(a);return new e(null,a,e.mergeAttributes(n,i,o))}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),Li.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);return new e(t,a,e.mergeAttributes(t.tokenAttributes,i,o))}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}},Ha=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?!1:e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?Va.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:la(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=Va.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,ca(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Va.fromExtension(r,n.contentNameScopesList))}},Ua=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Bi(e,La).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Bi(e,La).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}},Wa=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=Li.set(n,0,Ri(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=Li.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;e0;)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)}},qa=Ha.NULL;function Ja(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 Ya(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Xa(e){return Array.isArray(e)?e:[e]}async function Za(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function Qa(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function $a(e){return e===`ansi`||Qa(e)}function eo(e){return e===`none`}function to(e){return eo(e)}function no(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(/\s+/g);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function ro(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(/(\r?\n)/g),r=0,i=[];for(let e=0;ee);function n(n){if(n===e.length)return{line:t.length-1,character:t[t.length-1].length};let r=n,i=0;for(let e of t){if(re&&i[e])}var oo=`light-dark()`,so=[`color`,`background-color`];function co(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 ne-t);return n.length?e.map(e=>e.flatMap(e=>{let t=n.filter(t=>e.offsett-e.offset).sort((e,t)=>e-t);return t.length?co(e,t):e})):e}function uo(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>fo(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&&so.includes(a))if(r===oo&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new L('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');c[a]=`light-dark(${o[e][a]||`inherit`}, ${o[r][a]||`inherit`})`,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 fo(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&Mi.Italic&&(t[`font-style`]=`italic`),e.fontStyle&Mi.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&Mi.Underline&&n.push(`underline`),e.fontStyle&Mi.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function po(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}var mo=new WeakMap;function z(e,t){mo.set(e,t)}function B(e){return mo.get(e)}var ho=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(Xa(n).map(e=>[e,qa])),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 go(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function go(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 _o(e,t){if(!(e instanceof ho))throw new L(`Invalid grammar state`);return e.getInternalStack(t)}function vo(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=function(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new L(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...r.indexToPos(e),offset:e}}else{let t=r.lines[e.line];if(t===void 0)throw new L(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${r.lines.length}`);let n=e.character;if(n<0&&(n=t.length+n),n<0||n>t.length)throw new L(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:n,offset:r.posToIndex(e.line,n)}}},r=io(t.source),i=(t.options.decorations||[]).map(e=>({...e,start:n(e.start),end:n(e.end)}));yo(i),e.set(t.meta,{decorations:i,converter:r,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return lo(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=Array.from(e.children).filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new L(`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;ee);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&no(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.linea(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function yo(e){for(let t=0;tn.end.offset)throw new L(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;rNumber.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}else if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function Oo(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)To[r]&&t.push({type:`setDecoration`,value:To[r]});else if(r<=29){let e=To[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:wo[r-30]}});else if(r===38){let n=Do(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:wo[r-40]}});else if(r===48){let n=Do(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:wo[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:wo[r-100+8]}})}return t}function ko(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=Eo(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=Oo(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(aMath.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{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||Mo[t]]}))),o=ko();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=Ya(i,r),o=Ya(o,r),n.decorations.has(`dim`)&&(i=Po(i));let s=Mi.None;return n.decorations.has(`bold`)&&(s|=Mi.Bold),n.decorations.has(`italic`)&&(s|=Mi.Italic),n.decorations.has(`underline`)&&(s|=Mi.Underline),n.decorations.has(`strikethrough`)&&(s|=Mi.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function Po(e){let t=e.match(/#([0-9a-f]{3,8})/i);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}`}else if(e.length===6)return`#${e}80`;else 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`)}`}else 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(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function Fo(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n,i=e.resolveLangAlias(n.lang||`text`);if(Qa(i)||eo(r))return ro(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:a,colorMap:o}=e.setTheme(r);if(i===`ansi`)return No(a,t,n);let s=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==s.name)throw new L(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${s.name}"`);if(!n.grammarState.themes.includes(a.name))throw new L(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${a.name}"`)}return Lo(t,s,a,o,n)}function Io(...e){if(e.length===2)return B(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(Qa(i)||eo(a))throw new L(`Plain language does not have grammar state`);if(i===`ansi`)throw new L(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new ho(Ro(n,c,o,s,r).stateStack,c.name,o.name)}function Lo(e,t,n,r,i){let a=Ro(e,t,n,r,i),o=new ho(a.stateStack,t.name,n.name);return z(a.tokens,o),a.tokens}function Ro(e,t,n,r,i){let a=Ja(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500}=i,c=ro(e),l=i.grammarState?_o(i.grammarState,n.name)??qa:i.grammarContextCode==null?qa:Ro(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,u=[],d=[];for(let e=0,f=c.length;e0&&f.length>=o){u=[],d.push([{content:f,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;i.includeExplanation&&(m=t.tokenizeLine(f,l,s),h=m.tokens,g=0);let _=t.tokenizeLine2(f,l,s),v=_.tokens.length/2;for(let e=0;ee.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(/ /))})}d.explanation=[];let r=0;for(;t+r({scopeName:e}))}function Bo(e,t){let n=[];for(let r=0,i=t.length;r=0&&i>=0;)Vo(e[r],n[i])&&--r,--i;return r===-1}function Uo(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(Ho(e,t,n)){r.push(a);break}return r}function Wo(e,t,n){let r=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),i=r.map(r=>{let i=Fo(e,t,{...n,theme:r.theme});return{tokens:i,state:B(i),theme:typeof r.theme==`string`?r.theme:r.theme.name}}),a=Go(...i.map(e=>e.tokens)),o=a[0].map((e,t)=>e.map((e,i)=>{let o={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(o.explanation=e.explanation),a.forEach((e,n)=>{let{content:a,explanation:s,offset:c,...l}=e[t][i];o.variants[r[n].color]=l}),o})),s=i[0].state?new ho(Object.fromEntries(i.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),i[0].state.lang):void 0;return s&&z(o,s),o}function Go(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;re[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;te[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 L("`themes` option must not be empty");let p=Wo(e,t,n);if(c=B(p),l&&oo!==l&&!f.find(e=>e.color===l))throw new L(`\`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=>uo(e,h,u,l,d))),c&&z(a,c);let g=f.map(e=>Ja(e.theme,n));i=qo(f,m,g,u,l,`fg`,d),r=qo(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=Ja(n.theme,n);a=Fo(e,t,n);let l=e.getTheme(n.theme);r=Ya(l.bg,s),i=Ya(l.fg,s),o=l.name,c=B(a)}else throw new L("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function qo(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=Ya(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===oo&&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 L('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Ya(t[r][a],n[r])||`inherit`}, ${Ya(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}function Jo(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>Jo(e,t,n),codeToTokens:(t,n)=>Ko(e,t,n)}){let i=t;for(let e of So(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=Ko(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=Xo(a):d===`never`&&(a=Zo(a)),f&&(a=Qo(a));let p={...r,get source(){return i}};for(let e of So(n))a=e.tokens?.call(p,a)||a;return Yo(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function Yo(e,t,n,r=B(e)){let i=So(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(t.rootStyle==null?l.style=`background-color:${t.bg};color:${t.fg}`:l.style=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:no,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:` +`}));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=po(a.htmlStyle||fo(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;e0&&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&&z(m,r),m}function Xo(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&Mi.Underline||i.fontStyle&Mi.Strikethrough));o&&i.content.match(/^\s+$/)&&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 Zo(e){return e.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;let t=e.content.match(/^(\s*)(.*?)(\s*)$/);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 Qo(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t[t.length-1],r=po(e.htmlStyle||fo(e)),i=po(n.htmlStyle||fo(n)),a=e.fontStyle&&(e.fontStyle&Mi.Underline||e.fontStyle&Mi.Strikethrough),o=n.fontStyle&&(n.fontStyle&Mi.Underline||n.fontStyle&Mi.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var $o=Vr;function es(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>Jo(e,t,n),codeToTokens:(t,n)=>Ko(e,t,n)},i=$o(Jo(e,t,n,r));for(let e of So(n))i=e.postprocess?.call(r,i,n)||i;return i}var ts={light:`#333333`,dark:`#bbbbbb`},ns={light:`#fffffe`,dark:`#1e1e1e`},rs=`__shiki_resolved`;function is(e){if(e?.[rs])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`?ts.light:ts.dark,n||=t.type===`light`?ns.light:ns.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,rs,{enumerable:!1,writable:!1,value:!0}),t}async function as(e){return Array.from(new Set((await Promise.all(e.filter(e=>!$a(e)).map(async e=>await Za(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function os(e){return(await Promise.all(e.map(async e=>to(e)?null:is(await Za(e))))).filter(e=>!!e)}var ss=3,cs=!1;function ls(e,t=3){if(ss&&!(typeof ss==`number`&&t>ss)){if(cs)throw Error(`[SHIKI DEPRECATE]: ${e}`);console.trace(`[SHIKI DEPRECATE]: ${e}`)}}var us=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function ds(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 us(`Circular alias \`${Array.from(n).join(` -> `)} -> ${e}\``);n.add(e)}}return e}var fs=class extends Ka{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)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=is(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=Ti.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=ds(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=Array.from(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 us(`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))}},ps=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}},ms=0;function hs(e){ms+=1,e.warnings!==!1&&ms>=10&&ms%10==0&&console.warn(`[Shiki] ${ms} 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 us("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(is),i=new fs(new ps(e.engine,n),r,n,e.langAlias),a;function o(t){return ds(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new us(`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 us(`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 as(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await os(e))}function g(){if(t)throw new us(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--ms)}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 gs(e){e.engine||ls("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([os(e.themes||[]),as(e.langs||[]),e.engine]);return hs({...e,themes:t,langs:n,engine:r})}async function _s(e){let t=await gs(e);return{getLastGrammarState:(...e)=>Io(t,...e),codeToTokensBase:(e,n)=>Fo(t,e,n),codeToTokensWithThemes:(e,n)=>Wo(t,e,n),codeToTokens:(e,n)=>Ko(t,e,n),codeToHast:(e,n)=>Jo(t,e,n),codeToHtml:(e,n)=>es(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function vs(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,$a(n))return[];let r=t[n];if(!r)throw new L(`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(to(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new L(`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 _s({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 ys(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}else{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 bs(e,t){let n=ys(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 xs=`modulepreload`,Ss=function(e){return`/`+e},Cs={},V=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Ss(t,n),t in Cs)return;Cs[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:xs,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},ws=[{id:`abap`,name:`ABAP`,import:(()=>V(()=>import(`./abap-smLpETzL.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,import:(()=>V(()=>import(`./actionscript-3-o-aRvjY5.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>V(()=>import(`./ada-D5RRX1i4.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>V(()=>import(`./angular-html-BZNntD0J.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>V(()=>import(`./angular-ts-SQQMYL2C.js`),__vite__mapDeps([5,0,1,2,3,4,6])))},{id:`apache`,name:`Apache Conf`,import:(()=>V(()=>import(`./apache-DttKlSqg.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>V(()=>import(`./apex-DL7j-a2n.js`),[]))},{id:`apl`,name:`APL`,import:(()=>V(()=>import(`./apl-D5V6uPDr.js`),__vite__mapDeps([7,3,1,2,4,8,9,10])))},{id:`applescript`,name:`AppleScript`,import:(()=>V(()=>import(`./applescript-DCbL_2FX.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>V(()=>import(`./ara-DqheWJCe.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>V(()=>import(`./asciidoc-BH2sf2K4.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>V(()=>import(`./asm-rfjOMz3U.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>V(()=>import(`./astro-DeXKSaFP.js`),__vite__mapDeps([11,3,1,4,8,12,13,14])))},{id:`awk`,name:`AWK`,import:(()=>V(()=>import(`./awk-CMV5n9Z7.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>V(()=>import(`./ballerina-BjMqJjlr.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`],import:(()=>V(()=>import(`./bat-BaVbo_qw.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>V(()=>import(`./beancount-DBt5Mbc_.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>V(()=>import(`./berry-Cyjuxiss.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>V(()=>import(`./bibtex-BV_0nsPq.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>V(()=>import(`./bicep-C2gEwu4J.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>V(()=>import(`./bird2-BRyaEJd0.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>V(()=>import(`./blade-Bu5re0Vg.js`),__vite__mapDeps([15,3,1,16,2,4,8,17,9,10])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>V(()=>import(`./bsl-B1qbqNES.js`),__vite__mapDeps([18,19])))},{id:`c`,name:`C`,import:(()=>V(()=>import(`./c-Nc9zJT78.js`).then(e=>e.n),__vite__mapDeps([20,1])))},{id:`c3`,name:`C3`,import:(()=>V(()=>import(`./c3-DTTbp5N2.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>V(()=>import(`./cadence-CPz83cmI.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>V(()=>import(`./cairo-BDj8wWhy.js`),__vite__mapDeps([21,22])))},{id:`clarity`,name:`Clarity`,import:(()=>V(()=>import(`./clarity-CFJ2Yc3q.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>V(()=>import(`./clojure-6R01QgJC.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>V(()=>import(`./cmake-D5rSbMir.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>V(()=>import(`./cobol-nvZDS9LT.js`),__vite__mapDeps([23,2,1,3,4,10])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>V(()=>import(`./codeowners-_3A-ClkN.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>V(()=>import(`./codeql-DlIhJTR7.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>V(()=>import(`./coffee-BKLOTq4e.js`),__vite__mapDeps([24,4,1])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>V(()=>import(`./common-lisp-BvQzz173.js`),[]))},{id:`coq`,name:`Coq`,import:(()=>V(()=>import(`./coq-DTNXReIC.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>V(()=>import(`./cpp-D6g1DVNt.js`).then(e=>e.n),__vite__mapDeps([25,1,26,20,27,17])))},{id:`crystal`,name:`Crystal`,import:(()=>V(()=>import(`./crystal-DfoZI57w.js`),__vite__mapDeps([28,20,1,3,2,4,29,17])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>V(()=>import(`./csharp-BDKQY1K9.js`),[]))},{id:`css`,name:`CSS`,import:(()=>V(()=>import(`./css-DRmnABqB.js`).then(e=>e.n),__vite__mapDeps([3,1])))},{id:`csv`,name:`CSV`,import:(()=>V(()=>import(`./csv-DNUpVBxl.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>V(()=>import(`./cue-DDdBc2s3.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>V(()=>import(`./cypher-CguaznO2.js`),[]))},{id:`d`,name:`D`,import:(()=>V(()=>import(`./d-CHcoyjv3.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>V(()=>import(`./dart-RM3aRphk.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>V(()=>import(`./dax-nbnY1d79.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>V(()=>import(`./desktop-BD76cvxT.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>V(()=>import(`./diff-CdkWtnkL.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>V(()=>import(`./docker-ZyPHc6zB.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>V(()=>import(`./dotenv-BdJZEwA6.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>V(()=>import(`./dream-maker-BJL4qlg3.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>V(()=>import(`./edge-DwocGnOF.js`),__vite__mapDeps([30,16,2,1,3,4,14])))},{id:`elixir`,name:`Elixir`,import:(()=>V(()=>import(`./elixir-Dtbfds1r.js`),__vite__mapDeps([31,2,1,3,4])))},{id:`elm`,name:`Elm`,import:(()=>V(()=>import(`./elm-CpPtm471.js`),__vite__mapDeps([32,26,1,20])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>V(()=>import(`./emacs-lisp-_LyYa2Ky.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>V(()=>import(`./erb--z3IM9Cb.js`),__vite__mapDeps([33,2,1,3,4,34,20,25,26,27,17,35,36,13,14,37,38,29,9,10,39])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>V(()=>import(`./erlang-Bc4hQuqa.js`),__vite__mapDeps([40,41])))},{id:`fennel`,name:`Fennel`,import:(()=>V(()=>import(`./fennel-CC2BkRsS.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>V(()=>import(`./fish-D2ZCzqcE.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>V(()=>import(`./fluent-DKAm3m7q.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>V(()=>import(`./fortran-fixed-form-B02FOYI-.js`),__vite__mapDeps([42,43])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>V(()=>import(`./fortran-free-form-BPTf0lbT.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>V(()=>import(`./fsharp-DhdR18vN.js`),__vite__mapDeps([44,41])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>V(()=>import(`./gdresource-DgnrMPIx.js`),__vite__mapDeps([45,46,47])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>V(()=>import(`./gdscript-CsadCSaZ.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>V(()=>import(`./gdshader-PfnN_8tR.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>V(()=>import(`./genie-Bj-orPAV.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>V(()=>import(`./gherkin-COVWpJ-Q.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>V(()=>import(`./git-commit-DGJi7qBD.js`),__vite__mapDeps([48,49])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>V(()=>import(`./git-rebase-Ce47xoa6.js`),__vite__mapDeps([50,29,1])))},{id:`gleam`,name:`Gleam`,import:(()=>V(()=>import(`./gleam-BF2NigGj.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>V(()=>import(`./glimmer-js-C0BuzxQC.js`),__vite__mapDeps([51,3,1,2,4,14])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>V(()=>import(`./glimmer-ts-irOZ-cAQ.js`),__vite__mapDeps([52,3,1,2,4,14])))},{id:`glsl`,name:`GLSL`,import:(()=>V(()=>import(`./glsl-JAhLUe0P.js`).then(e=>e.n),__vite__mapDeps([26,1,20])))},{id:`gn`,name:`GN`,import:(()=>V(()=>import(`./gn-CMIt9roj.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>V(()=>import(`./gnuplot-DgWlRTEj.js`),[]))},{id:`go`,name:`Go`,import:(()=>V(()=>import(`./go-DLnOLj8q.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>V(()=>import(`./graphql-D2ba3BkR.js`).then(e=>e.n),__vite__mapDeps([35,1,4,36,13,14])))},{id:`groovy`,name:`Groovy`,import:(()=>V(()=>import(`./groovy-B9qLWIkE.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>V(()=>import(`./hack-CgzUpY8l.js`),__vite__mapDeps([53,2,1,3,4,17])))},{id:`haml`,name:`Ruby Haml`,import:(()=>V(()=>import(`./haml-C-oIZcDo.js`).then(e=>e.n),__vite__mapDeps([37,1,3,4])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>V(()=>import(`./handlebars-CbP-Mhzf.js`),__vite__mapDeps([54,3,1,2,4,39])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>V(()=>import(`./haskell-BaGpmm_c.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>V(()=>import(`./haxe-DfXTCEOz.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>V(()=>import(`./hcl-CbCtpSbi.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>V(()=>import(`./hjson-_4-w-pHU.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>V(()=>import(`./hlsl-DpuYn7pp.js`),[]))},{id:`html`,name:`HTML`,import:(()=>V(()=>import(`./html-ddqpqPg0.js`).then(e=>e.n),__vite__mapDeps([2,1,3,4])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>V(()=>import(`./html-derivative-DWGxf_At.js`),__vite__mapDeps([16,2,1,3,4])))},{id:`http`,name:`HTTP`,import:(()=>V(()=>import(`./http-Bg1nG1nG.js`),__vite__mapDeps([55,35,1,4,36,13,14,8,29,9,10])))},{id:`hurl`,name:`Hurl`,import:(()=>V(()=>import(`./hurl-zm47Pi1n.js`),__vite__mapDeps([56,57,35,1,4,36,13,14,9,10])))},{id:`hxml`,name:`HXML`,import:(()=>V(()=>import(`./hxml-adC65L_J.js`),__vite__mapDeps([58,59])))},{id:`hy`,name:`Hy`,import:(()=>V(()=>import(`./hy-t9zDXBje.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>V(()=>import(`./imba-Bxu-TDfw.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>V(()=>import(`./ini-D-v34c8N.js`),[]))},{id:`java`,name:`Java`,import:(()=>V(()=>import(`./java-DVLnIrqC.js`).then(e=>e.n),__vite__mapDeps([10,1])))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>V(()=>import(`./javascript-Cop1kpy_.js`).then(e=>e.n),__vite__mapDeps([4,1])))},{id:`jinja`,name:`Jinja`,import:(()=>V(()=>import(`./jinja-Bnj4awH5.js`),__vite__mapDeps([60,2,1,3,4])))},{id:`jison`,name:`Jison`,import:(()=>V(()=>import(`./jison-CuCNs9Q3.js`),__vite__mapDeps([61,4,1])))},{id:`json`,name:`JSON`,import:(()=>V(()=>import(`./json-CTw4n7kn.js`).then(e=>e.n),__vite__mapDeps([8,1])))},{id:`json5`,name:`JSON5`,import:(()=>V(()=>import(`./json5-D0XL1D5m.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>V(()=>import(`./jsonc-BBgf3TX3.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>V(()=>import(`./jsonl-KrKLbtB7.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>V(()=>import(`./jsonnet-B2ZwWMOt.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>V(()=>import(`./jssm-ByRpI9-B.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>V(()=>import(`./jsx-0oMUGqZj.js`).then(e=>e.n),__vite__mapDeps([36,1])))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>V(()=>import(`./julia-DNYHzXlE.js`),__vite__mapDeps([62,25,1,26,20,27,17,4,22,63])))},{id:`just`,name:`Just`,import:(()=>V(()=>import(`./just-BlWkkmf2.js`),__vite__mapDeps([64,4,1,65,3,2,17,9,10,22,34,20,25,26,27,35,36,13,14,37,38,29,39])))},{id:`kdl`,name:`KDL`,import:(()=>V(()=>import(`./kdl-6FPPEH4H.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>V(()=>import(`./kotlin-D4L3Nd2D.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>V(()=>import(`./kusto-D-mmc07O.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>V(()=>import(`./latex-DqPzjMIt.js`),__vite__mapDeps([66,67,63,1])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>V(()=>import(`./lean-BMVMuP2E.js`),[]))},{id:`less`,name:`Less`,import:(()=>V(()=>import(`./less-C95PyOu0.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>V(()=>import(`./liquid-BURJK16h.js`),__vite__mapDeps([68,3,1,2,4,8])))},{id:`llvm`,name:`LLVM IR`,import:(()=>V(()=>import(`./llvm-Dy3qORTl.js`),[]))},{id:`log`,name:`Log file`,import:(()=>V(()=>import(`./log-BQop7fzg.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>V(()=>import(`./logo-DKtnYmrp.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>V(()=>import(`./lua-31hdJClp.js`).then(e=>e.n),__vite__mapDeps([38,1,20])))},{id:`luau`,name:`Luau`,import:(()=>V(()=>import(`./luau-Dha4KG0q.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>V(()=>import(`./make-DfmS6buu.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>V(()=>import(`./markdown-BaI9LyM4.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>V(()=>import(`./marko-C2ZcdSLh.js`),__vite__mapDeps([69,3,1,70,6,14])))},{id:`matlab`,name:`MATLAB`,import:(()=>V(()=>import(`./matlab-BT79Cq_j.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>V(()=>import(`./mdc-N1ii9pk5.js`),__vite__mapDeps([71,16,2,1,3,4,41,39])))},{id:`mdx`,name:`MDX`,import:(()=>V(()=>import(`./mdx-CxGBwLNt.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>V(()=>import(`./mermaid-DLf3axBN.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>V(()=>import(`./mipsasm-DXuU_0cI.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>V(()=>import(`./mojo-1Omp2pIo.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>V(()=>import(`./moonbit-DZzq699o.js`),[]))},{id:`move`,name:`Move`,import:(()=>V(()=>import(`./move-DxDAOJVd.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>V(()=>import(`./narrat-CxDcPPb9.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>V(()=>import(`./nextflow-JEyYUlIq.js`),__vite__mapDeps([72,73])))},{id:`nextflow-groovy`,name:`nextflow-groovy`,import:(()=>V(()=>import(`./nextflow-groovy-wvmJO4hi.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>V(()=>import(`./nginx-BuomO0W8.js`),__vite__mapDeps([74,38,1,20])))},{id:`nim`,name:`Nim`,import:(()=>V(()=>import(`./nim-hKoEPsYL.js`),__vite__mapDeps([75,20,1,3,26,2,4,41,9,10])))},{id:`nix`,name:`Nix`,import:(()=>V(()=>import(`./nix-DsFTDHWT.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>V(()=>import(`./nushell-BQ_rO0AM.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>V(()=>import(`./objective-c-BMq6JT_m.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>V(()=>import(`./objective-cpp-DRwojuGv.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>V(()=>import(`./ocaml-e4_gKO6E.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>V(()=>import(`./odin-mdTPwYOg.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>V(()=>import(`./openscad-D2aTdNfr.js`),[]))},{id:`pascal`,name:`Pascal`,import:(()=>V(()=>import(`./pascal-D4n_G8vj.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>V(()=>import(`./perl-CAGVW6Ra.js`),__vite__mapDeps([65,3,1,2,4,17,9,10])))},{id:`php`,name:`PHP`,import:(()=>V(()=>import(`./php-BycclmzS.js`),__vite__mapDeps([76,3,1,2,4,8,17,9,10])))},{id:`pkl`,name:`Pkl`,import:(()=>V(()=>import(`./pkl-DcjhAp0L.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>V(()=>import(`./plsql-BSy3Ag0J.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>V(()=>import(`./po-Be96RYkA.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>V(()=>import(`./polar-BmhMKWum.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>V(()=>import(`./postcss-BTQso3H9.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>V(()=>import(`./powerquery-DVyQv3M2.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`],import:(()=>V(()=>import(`./powershell-BmtCGJVD.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>V(()=>import(`./prisma-CCFA9rEj.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>V(()=>import(`./prolog-DWGEEo78.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>V(()=>import(`./proto-C3eop1kM.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>V(()=>import(`./pug-4maJHz9G.js`),__vite__mapDeps([77,3,1,2,4])))},{id:`puppet`,name:`Puppet`,import:(()=>V(()=>import(`./puppet-C0_7Nv5A.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>V(()=>import(`./purescript-Bv-B8yRw.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>V(()=>import(`./python-CKg5r0C3.js`),[]))},{id:`qml`,name:`QML`,import:(()=>V(()=>import(`./qml-JLIQfzyb.js`),__vite__mapDeps([78,4,1])))},{id:`qmldir`,name:`QML Directory`,import:(()=>V(()=>import(`./qmldir-Cqfb4Lox.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>V(()=>import(`./qss-Csho9BH8.js`),[]))},{id:`r`,name:`R`,import:(()=>V(()=>import(`./r-UcxRcvcA.js`).then(e=>e.n),__vite__mapDeps([63,1])))},{id:`racket`,name:`Racket`,import:(()=>V(()=>import(`./racket-D8-uWeQH.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>V(()=>import(`./raku-Cj4JSa8p.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>V(()=>import(`./razor-P8rbooCh.js`),__vite__mapDeps([79,80,2,1,3,4])))},{id:`reg`,name:`Windows Registry Script`,import:(()=>V(()=>import(`./reg-DXGFiJSl.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>V(()=>import(`./regexp-3-A0406L.js`).then(e=>e.n),__vite__mapDeps([27,1])))},{id:`rel`,name:`Rel`,import:(()=>V(()=>import(`./rel-CunnVTBK.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>V(()=>import(`./riscv-C8BcOCkS.js`),[]))},{id:`ron`,name:`RON`,import:(()=>V(()=>import(`./ron-DiDyR9oa.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>V(()=>import(`./rosmsg-CHmL1Uyj.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>V(()=>import(`./rst-C6GHyL-N.js`),__vite__mapDeps([81,82,25,1,26,20,27,17,16,2,3,4,22,34,35,36,13,14,37,38,29,9,10,39])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>V(()=>import(`./ruby-Cl8PVkbY.js`),__vite__mapDeps([34,20,1,25,26,27,17,3,35,4,36,13,14,37,2,38,29,9,10,39])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>V(()=>import(`./rust-DjJFInu3.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>V(()=>import(`./sas-CXoVwlZN.js`),__vite__mapDeps([83,17,1])))},{id:`sass`,name:`Sass`,import:(()=>V(()=>import(`./sass-D3xZ5o-v.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>V(()=>import(`./scala-B0IRml5w.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>V(()=>import(`./scheme-BhwcV3Av.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>V(()=>import(`./scss-DNczJ95n.js`).then(e=>e.n),__vite__mapDeps([6,1,3])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>V(()=>import(`./sdbl-BmWYR-pI.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>V(()=>import(`./shaderlab-DZ3Lsiak.js`),__vite__mapDeps([84,85])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>V(()=>import(`./shellscript-DaVPunOM.js`).then(e=>e.n),__vite__mapDeps([29,1])))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>V(()=>import(`./shellsession-COm1V40U.js`),__vite__mapDeps([86,29,1])))},{id:`smalltalk`,name:`Smalltalk`,import:(()=>V(()=>import(`./smalltalk-DVQuUMII.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>V(()=>import(`./solidity-gQ4WXILB.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>V(()=>import(`./soy-DwewhJ_3.js`),__vite__mapDeps([87,2,1,3,4])))},{id:`sparql`,name:`SPARQL`,import:(()=>V(()=>import(`./sparql-B9c85a_o.js`),__vite__mapDeps([88,89])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>V(()=>import(`./splunk-OB48_RcD.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>V(()=>import(`./sql-CrTmZCMa.js`).then(e=>e.n),__vite__mapDeps([17,1])))},{id:`ssh-config`,name:`SSH Config`,import:(()=>V(()=>import(`./ssh-config-DA9YMRGV.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>V(()=>import(`./stata-Bl--TAbZ.js`),__vite__mapDeps([90,17,1])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>V(()=>import(`./stylus-sKwvsUaC.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>V(()=>import(`./surrealql-BW79EE-U.js`),__vite__mapDeps([91,4,1])))},{id:`svelte`,name:`Svelte`,import:(()=>V(()=>import(`./svelte-ziMErdPi.js`),__vite__mapDeps([92,3,1,4,12,14])))},{id:`swift`,name:`Swift`,import:(()=>V(()=>import(`./swift-C72NbAtg.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>V(()=>import(`./system-verilog-CnWMF7Nq.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>V(()=>import(`./systemd-DMzItW5N.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>V(()=>import(`./talonscript-DopQCWDL.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>V(()=>import(`./tasl-C28SYKbq.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>V(()=>import(`./tcl-DHq7zmoF.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>V(()=>import(`./templ-C_9I6ncv.js`),__vite__mapDeps([93,3,1,94,4])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>V(()=>import(`./terraform-CogS1YKX.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>V(()=>import(`./tex-D8LVuLf5.js`),__vite__mapDeps([67,63,1])))},{id:`toml`,name:`TOML`,import:(()=>V(()=>import(`./toml-BH_iPsgK.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>V(()=>import(`./ts-tags-DKuFCGsc.js`),__vite__mapDeps([95,3,1,26,20,2,4,17,14,9,10])))},{id:`tsv`,name:`TSV`,import:(()=>V(()=>import(`./tsv-BIkdBZX1.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>V(()=>import(`./tsx-BjkCKOtw.js`).then(e=>e.n),__vite__mapDeps([13,1])))},{id:`turtle`,name:`Turtle`,import:(()=>V(()=>import(`./turtle-CqNXyJWZ.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>V(()=>import(`./twig-Bs1kcsO6.js`),__vite__mapDeps([96,3,1,4,76,2,8,17,9,10,22,34,20,25,26,27,35,36,13,14,37,38,29,39,6])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>V(()=>import(`./typescript-BoHeP9q1.js`).then(e=>e.n),__vite__mapDeps([14,1])))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>V(()=>import(`./typespec-CQ9LYD_e.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>V(()=>import(`./typst-T-Fsk-Sv.js`),[]))},{id:`v`,name:`V`,import:(()=>V(()=>import(`./v-BhMEOw9x.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>V(()=>import(`./vala-DzajMnwt.js`),[]))},{id:`vb`,name:`Visual Basic`,aliases:[`cmd`],import:(()=>V(()=>import(`./vb-7Xr8dEYW.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>V(()=>import(`./verilog-AvXtwZir.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>V(()=>import(`./vhdl-BHu0zg1P.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>V(()=>import(`./viml-Di0QpLfC.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>V(()=>import(`./vue-Dnf0y5RU.js`),__vite__mapDeps([97,3,1,16,2,4,8,14])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>V(()=>import(`./vue-html-CRtKS76J.js`),__vite__mapDeps([98,4,1])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>V(()=>import(`./vue-vine-BxjPqU7T.js`),__vite__mapDeps([99,3,1,4,70,12,6,100])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>V(()=>import(`./vyper-C3R5yXgx.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>V(()=>import(`./wasm-Chsuwt1A.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>V(()=>import(`./wenyan-BonVcr2i.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>V(()=>import(`./wgsl-D59WYmNq.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>V(()=>import(`./wikitext-ariTI2Wk.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>V(()=>import(`./wit-EA4fa3Dt.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>V(()=>import(`./wolfram-DDp7LhyU.js`),[]))},{id:`xml`,name:`XML`,import:(()=>V(()=>import(`./xml-eU7M3iZJ.js`).then(e=>e.n),__vite__mapDeps([9,1,10])))},{id:`xsl`,name:`XSL`,import:(()=>V(()=>import(`./xsl-DSqe4nTO.js`),__vite__mapDeps([101,9,1,10])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>V(()=>import(`./yaml-BTD1XHJG.js`).then(e=>e.n),__vite__mapDeps([39,1])))},{id:`zenscript`,name:`ZenScript`,import:(()=>V(()=>import(`./zenscript-4WaROUyc.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>V(()=>import(`./zig-CJoLJGwV.js`),[]))}],Ts=Object.fromEntries(ws.map(e=>[e.id,e.import])),Es=Object.fromEntries(ws.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),Ds={...Ts,...Es},Os=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>V(()=>import(`./andromeeda-N4z3YzmR.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>V(()=>import(`./aurora-x-CND-FqEb.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>V(()=>import(`./ayu-dark-on7xzq_B.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>V(()=>import(`./ayu-light-DnGeGGc2.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>V(()=>import(`./ayu-mirage-DG3LlYC_.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>V(()=>import(`./catppuccin-frappe-Dr22sraq.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>V(()=>import(`./catppuccin-latte-C57EeX8c.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>V(()=>import(`./catppuccin-macchiato-CpheI4uD.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>V(()=>import(`./catppuccin-mocha-D8Lmdks_.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>V(()=>import(`./dark-plus-CqeW_0kH.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>V(()=>import(`./dracula-CtqCPLGa.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>V(()=>import(`./dracula-soft-DmBpwRAy.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>V(()=>import(`./everforest-dark-CrbyKk4n.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>V(()=>import(`./everforest-light-DRbSh8Tm.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>V(()=>import(`./github-dark-ipGuFGYC.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>V(()=>import(`./github-dark-default-DX3IG_X0.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>V(()=>import(`./github-dark-dimmed-CH6p_7ez.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>V(()=>import(`./github-dark-high-contrast-Bg2sSao5.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>V(()=>import(`./github-light-BxjqOQl0.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>V(()=>import(`./github-light-default-DwpDd1IQ.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>V(()=>import(`./github-light-high-contrast-C0QeixPf.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>V(()=>import(`./gruvbox-dark-hard-BIMX9ePb.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>V(()=>import(`./gruvbox-dark-medium-DxuwyVzM.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>V(()=>import(`./gruvbox-dark-soft-ba2fjht0.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>V(()=>import(`./gruvbox-light-hard-DAJK2PqC.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>V(()=>import(`./gruvbox-light-medium-WRifDAJD.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>V(()=>import(`./gruvbox-light-soft-B0dBOoVB.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>V(()=>import(`./horizon-C5RtD1fY.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`dark`,import:(()=>V(()=>import(`./horizon-bright-pEOice34.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>V(()=>import(`./houston-A0zg9vNP.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>V(()=>import(`./kanagawa-dragon-CtPmcCMp.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>V(()=>import(`./kanagawa-lotus-DpOXEGCa.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>V(()=>import(`./kanagawa-wave-CLVCyc-n.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>V(()=>import(`./laserwave-7fEj4XGb.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>V(()=>import(`./light-plus-DHI2dh3p.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>V(()=>import(`./material-theme-Dm6ETY8i.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>V(()=>import(`./material-theme-darker-BeyjmM5Z.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>V(()=>import(`./material-theme-lighter-CCOYYzKL.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>V(()=>import(`./material-theme-ocean-CUtPiiX3.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>V(()=>import(`./material-theme-palenight-2L4zMwIM.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>V(()=>import(`./min-dark-B8TUPGHg.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>V(()=>import(`./min-light-BDOoBxcA.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>V(()=>import(`./monokai-E_VBmXGZ.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>V(()=>import(`./night-owl-DefhalNX.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>V(()=>import(`./night-owl-light-byb3AbEn.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>V(()=>import(`./nord-D5rQzHT-.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>V(()=>import(`./one-dark-pro-DxXww9jg.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>V(()=>import(`./one-light-D9c03w7t.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>V(()=>import(`./plastic-uOsw7z1x.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>V(()=>import(`./poimandres-CyO4HORD.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>V(()=>import(`./red-z4H4llUY.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>V(()=>import(`./rose-pine-BADquuIH.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>V(()=>import(`./rose-pine-dawn-BLcEeBoh.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>V(()=>import(`./rose-pine-moon-BK_tLY1Y.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>V(()=>import(`./slack-dark-DOnVms5P.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>V(()=>import(`./slack-ochin-DcRTft4q.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>V(()=>import(`./snazzy-light-x9CLJ1W9.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>V(()=>import(`./solarized-dark-BB1sh-pe.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>V(()=>import(`./solarized-light-9-RPS998.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>V(()=>import(`./synthwave-84-eJ9uRN_S.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>V(()=>import(`./tokyo-night-B9N7LyrF.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>V(()=>import(`./vesper-CtgQQ2sf.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>V(()=>import(`./vitesse-black-jXdfyqgD.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>V(()=>import(`./vitesse-dark-B88PxG1r.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>V(()=>import(`./vitesse-light-BXxZh2iV.js`),[]))}].map(e=>[e.id,e.import])),ks=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function As(){return 2147483648}function js(){return typeof performance<`u`?performance.now():Date.now()}var Ms=(e,t)=>e+(t-e%t)%t;async function Ns(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=As();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,Ms(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>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:js,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 Ps=Object.defineProperty,Fs=(e,t,n)=>t in e?Ps(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Is=(e,t,n)=>Fs(e,typeof t==`symbol`?t:t+``,n),Ls=null;function Rs(e){throw new ks(e.UTF8ToString(e.getLastOnigError()))}var zs=class e{constructor(t){Is(this,`utf16Length`),Is(this,`utf8Length`),Is(this,`utf16Value`),Is(this,`utf8Value`),Is(this,`utf16OffsetToUtf8`),Is(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=55296&&r<=56319&&e+1=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=55296&&i<=56319&&n+1=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}a<=127?t+=1:a<=2047?t+=2:a<=65535?t+=3:t+=4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},Bs=class e{constructor(t){if(Is(this,`id`,++e.LAST_ID),Is(this,`_onigBinding`),Is(this,`content`),Is(this,`utf16Length`),Is(this,`utf8Length`),Is(this,`utf16OffsetToUtf8`),Is(this,`utf8OffsetToUtf16`),Is(this,`ptr`),!Ls)throw new ks(`Must invoke loadWasm first.`);this._onigBinding=Ls,this.content=t;let n=new zs(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=Ls.omalloc(1e4),e._sharedPtrInUse=!0,Ls.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(Ls)}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)}};Is(Bs,`LAST_ID`,0),Is(Bs,`_sharedPtr`,0),Is(Bs,`_sharedPtrInUse`,!1);var Vs=Bs,Hs=class{constructor(e){if(Is(this,`_onigBinding`),Is(this,`_ptr`),!Ls)throw new ks(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),Us(n)?n=await n.instantiator(t):Ws(n)?n=await n.default(t):(Gs(n)&&(n=n.data),Ks(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await Zs(n)(t):await Qs(n)(t):qs(n)||n instanceof WebAssembly.Module?n=await Xs(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Xs(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Js=t(),Js}function Xs(e){return t=>WebAssembly.instantiate(e,t)}function Zs(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Qs(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}async function $s(e){return e&&await Ys(e),{createScanner(e){return new Hs(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new Vs(e)}}}var ec=vs({langs:Ds,themes:Os,engine:()=>$s(V(()=>import(`./wasm-CEUrWlVz.js`),[]))}),{codeToHtml:tc,codeToHast:nc,codeToTokens:rc,codeToTokensBase:ic,codeToTokensWithThemes:ac,getSingletonHighlighter:oc,getLastGrammarState:sc}=bs(ec,{guessEmbeddedLanguages:ao});function cc(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function lc(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var uc=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),dc=String.raw;function fc(e,t){if(e==null)throw Error(t??`Value expected`);return e}var pc=dc`\[\^?`,mc=`c.? | C(?:-.?)?|${dc`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${dc`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${dc`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${dc`o\{[^\}]*\}?`}|${dc`\d{1,3}`}`,hc=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,gc=new RegExp(dc` + \\ (?: + ${mc} + | [gk]<[^>]*>? + | [gk]'[^']*'? + | . + ) + | \( (?: + \? (?: + [:=!>({] + | <[=!] + | <[^>]*> + | '[^']*' + | ~\|? + | #(?:[^)\\]|\\.?)* + | [^:)]*[:)] + )? + | \*[^\)]*\)? + )? + | (?:${hc.source})+ + | ${pc} + | . +`.replace(/\s+/g,``),`gsu`),_c=new RegExp(dc` + \\ (?: + ${mc} + | . + ) + | \[:(?:\^?\p{Alpha}+|\^):\] + | ${pc} + | && + | . +`.replace(/\s+/g,``),`gsu`);function vc(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=qc(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(gc.lastIndex=0;s=gc.exec(e);){let t=yc(a,e,s[0],gc.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(gc.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`?Yc(e,u):e).flat(),flags:r}}function yc(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=bc(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:wc(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:Rc(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:Tc(n)}}if(a===`K`)return{token:Mc(`keep`,n)};if(a===`N`||a===`R`)return{token:jc(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:jc(`any`,n)};if(a===`X`)return{token:jc(`text_segment`,n)};let e=Sc(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:Hc(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:Vc(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:Fc(`group`,n)};if(n===`(?>`)return{token:Fc(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:Fc(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:Fc(`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:Pc(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(` +`,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:jc(`dot`,n)}:n===`^`||n===`$`?{token:wc(e.singleline?{"^":dc`\A`,$:dc`\Z`}[n]:n,n)}:n===`|`?{token:Cc(n)}:hc.test(n)?{tokens:Xc(n)}:{token:Ec(cc(n),n)}}function bc(e,t,n){let r=[Ac(t[1]===`^`,t)],i=1,a;for(_c.lastIndex=n;a=_c.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(Ac(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(Ec(93,e));else if(i--,r.push(Dc(e)),!i)break}else{let t=xc(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:_c.lastIndex||e.length}}function xc(e){if(e[0]===`\\`)return Sc(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?\^?)(?[a-z]+):\]/.exec(e);if(!t||!uc.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return jc(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?Oc(e):e===`&&`?kc(e):Ec(cc(e),e)}function Sc(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return Bc(e);if(`dDhHsSwW`.includes(n))return Wc(e);if(e.startsWith(dc`\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 Gc(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 Ec(cc(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return Ec(Jc(e),e);if(H.has(n))return Ec(H.get(n),e);if(/\d/.test(n))return Nc(t,e);if(e===`\\`)throw Error(dc`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return Ec(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function Cc(e){return{type:`Alternator`,raw:e}}function wc(e,t){return{type:`Assertion`,kind:e,raw:t}}function Tc(e){return{type:`Backreference`,raw:e}}function Ec(e,t){return{type:`Character`,value:e,raw:t}}function Dc(e){return{type:`CharacterClassClose`,raw:e}}function Oc(e){return{type:`CharacterClassHyphen`,raw:e}}function kc(e){return{type:`CharacterClassIntersector`,raw:e}}function Ac(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function jc(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function Mc(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:fc(n.flags),raw:t}}function Nc(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function Pc(e){return{type:`GroupClose`,raw:e}}function Fc(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function Ic(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function Lc(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function Rc(e){return{type:`Subroutine`,raw:e}}var zc=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),H=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function Bc(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return Ec(cc(t.toUpperCase())-64,e)}function Vc(e,t){let{on:n,off:r}=/^\(\?(?[imx]*)(?:-(?[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=Kc(n),o=Kc(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),Mc(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,Fc(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function Hc(e){let t=/\(\*(?[A-Za-z_]\w*)?(?:\[(?(?:[A-Za-z_]\w*)?)\])?(?:\{(?[^}]*)\})?\)/.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=zc.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 Ic(l,r??null,i?.split(`,`)??null,e)}function Uc(e){let t=null,n,r;if(e[0]===`{`){let{minStr:i,maxStr:a}=/^\{(?\d*)(?:,(?\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 Lc(t,n,r,e)}function Wc(e){let t=e[1].toLowerCase();return jc({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function Gc(e){let{p:t,neg:n,value:r}=/^\\(?

[pP])\{(?\^?)(?[^}]+)/.exec(e).groups;return jc(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function Kc(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 qc(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function Yc(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[Tc(n)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e127)throw Error(dc`Octal encoded byte above 177 unsupported "${n}"`)}else r=cc(t);a.push(Ec(r,(e===0?`\\`:``)+t))}return a}function Xc(e){let t=[],n=new RegExp(hc,`gy`),r;for(;r=n.exec(e);){let e=r[0];if(e[0]===`{`){let r=/^\{(?\d+),(?\d+)\}\??$/.exec(e);if(r){let{min:i,max:a}=r.groups;if(+i>+a&&e.endsWith(`?`)){n.lastIndex--,t.push(Uc(e.slice(0,-1)));continue}}}t.push(Uc(e))}return t}function Zc(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 Qc(e){return $c.has(e.type)}var $c=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function el(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=vc(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 U();case`Assertion`:return tl(n);case`Backreference`:return nl(n,a);case`Character`:return pl(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return rl(n,a,t);case`CharacterClassOpen`:return il(n,a,t);case`CharacterSet`:return al(n,a);case`Directive`:return _l(n.kind,{flags:n.flags});case`GroupOpen`:return ol(n,a,t);case`NamedCallout`:return xl(n.kind,n.tag,n.arguments);case`Quantifier`:return sl(n,a);case`Subroutine`:return cl(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=wl(vl(r.flags)),s=o.body[0];for(;a.nextIndexc.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(dc`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(dc`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function tl({kind:e}){return ul(fc({"^":`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===dc`\B`||e===dc`\Y`})}function nl({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,dl(r?i+1-n:n,{orphan:a})};if(n){let n=/^(?-?)0*(?[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 dl(r)}return i(+r)}function rl(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(),hl(o,e);throw Error(`Invalid character class range`)}return pl(cc(`-`))}function il({negate:e},t,n){let{tokens:r,walk:i}=t,a=r[t.nextIndex],o=[ml()],s=Fl(a);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)o.push(ml()),t.nextIndex++;else{let e=o.at(-1);e.body.push(i(e,n))}s=Fl(r[t.nextIndex],a)}let c=ml({negate:e});return o.length===1?c.body=o[0].body:(c.kind=`intersection`,c.body=o.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function al({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=Pl(n);if(uc.has(r)&&!o?.has(r))e=`posix`,n=r;else return El(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?Sl(n,{negate:t}):gl(e,{negate:t})}function ol(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=Dl(e),l=c.type===`AbsenceFunction`,u=jl(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&lc(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=Il(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push(U()),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(Al(t)||t.type===`CapturingGroup`)throw Error(e)}else if(Al(t)||jl(t)&&t.negate)throw Error(e)}}f=Il(r[t.nextIndex])}return t.nextIndex++,c}function sl({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!Qc(a))throw Error(`Quantifier requires a repeatable token`);let o=Cl(e,t,n,a);return i.body.pop(),o}function cl({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),a=/^(?[-+]?)0*(?[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=Tl(i);return r.push(o),o}function ll(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:Ol(t?.body)}}function U(e){return{type:`Alternative`,body:kl(e?.body)}}function ul(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function dl(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function fl(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!Ml(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:Ol(t?.body)}}function pl(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 ml(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:kl(e?.body)}}function hl(e,t){if(t.valuen)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function wl(e,t){return{type:`Regex`,body:Ol(t?.body),flags:e}}function Tl(e){return{type:`Subroutine`,ref:e}}function El(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(Pl(e));if(!r){if(n.normalizeUnknownPropertyNames)r=Nl(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(dc`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function Dl({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return ll(`repeater`);case`atomic`:return yl({atomic:!0});case`capturing`:return fl(i,{name:n});case`group`:return yl({flags:e});case`lookahead`:case`lookbehind`:return bl({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function Ol(e){if(e===void 0)e=[U()];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 kl(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 Al(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function jl(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function Ml(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function Nl(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 Pl(e){return e.replace(/[- _]+/g,``).toLowerCase()}function Fl(e,t){return fc(e,`${t?.type===`Character`&&t.value===93?`Empty`:`Unclosed`} character class`)}function Il(e){return fc(e,`Unclosed group`)}function Ll(e,t,n=null){function r(e,t){for(let n=0;nA-Za-z\-]|<[=!]|\(DEFINE\))`;function W(e,t){for(let n=0;n=t&&e[n]++}function G(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var K=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function q(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===K.DEFAULT==!o)){n instanceof Function?s+=n(t,{context:o?K.CHAR_CLASS:K.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 J(e,t,n,r){q(e,t,n,r)}function Vl(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===K.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function Hl(e,t,n){return!!Vl(e,t,0,n)}function Ul(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 Wl=new RegExp(String.raw`(?${Bl})|(?\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function Gl(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(Wl.lastIndex=Number.isNaN(c)?0:c+7;f=Wl.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),W(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=q(e,String.raw`\\(?[1-9]\d*)|<\$\$(?\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}`},K.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var Kl=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,ql=new RegExp(String.raw` +\\(?: \d+ + | c[A-Za-z] + | [gk]<[^>]+> + | [pPu]\{[^\}]+\} + | u[A-Fa-f\d]{4} + | x[A-Fa-f\d]{2} + ) +| \((?: \? (?: [:=!>] + | <(?:[=!]|[^>]+>) + | [A-Za-z\-]+: + | \(DEFINE\) + ))? +| (?${Kl})(?[?+]?)(?[?*+\{]?) +| \\?. +`.replace(/\s+/g,``),`gsu`);function Jl(e){if(!RegExp(`${Kl}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(ql.lastIndex=0;o=ql.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=G(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}ql.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null);i=s}return{pattern:e}}var Yl=String.raw,Xl=Yl`\(\?R=(?[^\)]+)\)|${Yl`\\g<(?[^>&]+)&R=(?[^>]+)>`}`,Zl=Yl`\(\?<(?![=!])(?[^>]+)>`,Ql=Yl`${Zl}|(?\()(?!\?)`,$l=new RegExp(Yl`${Zl}|${Xl}|\(\?|\\?.`,`gsu`),eu=`Cannot use multiple overlapping recursions`;function tu(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(Xl,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&Hl(e,Yl`\(\?\(DEFINE\)`,K.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=Hl(e,Yl`\\[1-9]`,K.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for($l.lastIndex=0;f=$l.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(nu(m),l)throw Error(eu);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($l.lastIndex);if(Hl(s,Xl,K.DEFAULT))throw Error(eu);let c=m-1;e=ru(t,s,c,!1,n,a,d),i=ou(i,t,c,a.length,0,d);break}else if(h){nu(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(eu);break}if(!u)throw Error(Yl`Recursive \g cannot be used outside the referenced group "${r===`external`?h:Yl`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=Ul(e,p);if(o&&Hl(m,Yl`${Zl}|\((?!\?)`,K.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=ru(_,v,b,!0,n,a,d);i=ou(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,$l.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),$l.lastIndex),s.set(p,$l.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),$l.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function nu(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 ru(e,t,n,r,i,a,o){let s=new Set;r&&J(e+t,Zl,({groups:{captureName:e}})=>{s.add(e)},K.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${iu(`(?:${e}`,`forward`,...c)}(?:)${iu(`${t})`,`backward`,...c)}${t}`}function iu(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t[^>]+)>`,({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),au(i,n),s?e:`(?<${t}${l}>`}return Yl`\k<${c}${l}>`},K.DEFAULT)}return c}function au(e,t){for(let n=0;n=t&&e[n]++}function ou(e,t,n,r,i,a){if(e.size&&r){let o=0;J(t,Ql,()=>o++,K.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 Y=String.fromCodePoint,X=String.raw,su={},cu=globalThis.RegExp;su.flagGroups=(()=>{try{new cu(`(?i:)`)}catch{return!1}return!0})(),su.unicodeSets=(()=>{try{new cu(`[[]]`,`v`)}catch{return!1}return!0})(),su.bugFlagVLiteralHyphenIsRange=su.unicodeSets?(()=>{try{new cu(X`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,su.bugNestedClassIgnoresNegation=su.unicodeSets&&new cu(`[[^a]]`,`v`).test(`a`);function lu(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function uu(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function du(e,t){return pu[e]>=pu[t]}function fu(e,t){if(e==null)throw Error(t??`Value expected`);return e}var pu={ES2025:2025,ES2024:2024,ES2018:2018},mu={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function hu(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!mu[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=su.flagGroups?`ES2025`:su.unicodeSets?`ES2024`:`ES2018`),t}var gu=`[ -\r ]`,_u=new Set([Y(304),Y(305)]),vu=X`[\p{L}\p{M}\p{N}\p{Pc}]`;function yu(e){if(_u.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=Cu.get(n),a=xu.get(n),o=Su.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 bu=new Map(`C Other +Cc Control cntrl +Cf Format +Cn Unassigned +Co Private_Use +Cs Surrogate +L Letter +LC Cased_Letter +Ll Lowercase_Letter +Lm Modifier_Letter +Lo Other_Letter +Lt Titlecase_Letter +Lu Uppercase_Letter +M Mark Combining_Mark +Mc Spacing_Mark +Me Enclosing_Mark +Mn Nonspacing_Mark +N Number +Nd Decimal_Number digit +Nl Letter_Number +No Other_Number +P Punctuation punct +Pc Connector_Punctuation +Pd Dash_Punctuation +Pe Close_Punctuation +Pf Final_Punctuation +Pi Initial_Punctuation +Po Other_Punctuation +Ps Open_Punctuation +S Symbol +Sc Currency_Symbol +Sk Modifier_Symbol +Sm Math_Symbol +So Other_Symbol +Z Separator +Zl Line_Separator +Zp Paragraph_Separator +Zs Space_Separator +ASCII +ASCII_Hex_Digit AHex +Alphabetic Alpha +Any +Assigned +Bidi_Control Bidi_C +Bidi_Mirrored Bidi_M +Case_Ignorable CI +Cased +Changes_When_Casefolded CWCF +Changes_When_Casemapped CWCM +Changes_When_Lowercased CWL +Changes_When_NFKC_Casefolded CWKCF +Changes_When_Titlecased CWT +Changes_When_Uppercased CWU +Dash +Default_Ignorable_Code_Point DI +Deprecated Dep +Diacritic Dia +Emoji +Emoji_Component EComp +Emoji_Modifier EMod +Emoji_Modifier_Base EBase +Emoji_Presentation EPres +Extended_Pictographic ExtPict +Extender Ext +Grapheme_Base Gr_Base +Grapheme_Extend Gr_Ext +Hex_Digit Hex +IDS_Binary_Operator IDSB +IDS_Trinary_Operator IDST +ID_Continue IDC +ID_Start IDS +Ideographic Ideo +Join_Control Join_C +Logical_Order_Exception LOE +Lowercase Lower +Math +Noncharacter_Code_Point NChar +Pattern_Syntax Pat_Syn +Pattern_White_Space Pat_WS +Quotation_Mark QMark +Radical +Regional_Indicator RI +Sentence_Terminal STerm +Soft_Dotted SD +Terminal_Punctuation Term +Unified_Ideograph UIdeo +Uppercase Upper +Variation_Selector VS +White_Space space +XID_Continue XIDC +XID_Start XIDS`.split(/\s/).map(e=>[Pl(e),e])),xu=new Map([[`s`,Y(383)],[Y(383),`s`]]),Su=new Map([[Y(223),Y(7838)],[Y(107),Y(8490)],[Y(229),Y(8491)],[Y(969),Y(8486)]]),Cu=new Map([Eu(453),Eu(456),Eu(459),Eu(498),...Du(8072,8079),...Du(8088,8095),...Du(8104,8111),Eu(8124),Eu(8140),Eu(8188)]),wu=new Map([[`alnum`,X`[\p{Alpha}\p{Nd}]`],[`alpha`,X`\p{Alpha}`],[`ascii`,X`\p{ASCII}`],[`blank`,X`[\p{Zs}\t]`],[`cntrl`,X`\p{Cc}`],[`digit`,X`\p{Nd}`],[`graph`,X`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,X`\p{Lower}`],[`print`,X`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,X`[\p{P}\p{S}]`],[`space`,X`\p{space}`],[`upper`,X`\p{Upper}`],[`word`,X`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,X`\p{AHex}`]]);function Tu(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function Eu(e){let t=Y(e);return[t.toLowerCase(),t]}function Du(e,t){return Tu(e,t).map(e=>Eu(e))}var Ou=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function ku(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};Nu(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:du(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};Ll(e,Au,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 Ll(e,ju,a),Ll(e,Mu,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var Au={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=yl();e.body[0].body.push(bl({negate:!0,body:r}),El(`Any`));let i=yl();i.body[0].body.push(Cl(`greedy`,0,1/0,e)),n(Zu(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\r\n|${i?X`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(Xu(El(`AHex`,{negate:l}),t));else if(c===`newline`)n(Zu(Ju(l?`[^ +]`:`(?>\r +?|[ +\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-${Y(e.codePointAt(0)-1)}${Y(e.codePointAt(2)+1)}-\u{10FFFF}`),n(Zu(Ju(`[${e}]`),t))}else n(Zu(Yu(Ju(wu.get(u)),l),t));else if(c===`property`)bu.has(Pl(u))||(e.key=`sc`);else if(c===`space`)n(Xu(El(`space`,{negate:l}),t));else if(c===`word`)n(Zu(Yu(Ju(vu),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=yl({flags:c});e.body[0].body=o(),i(Zu(e,t),{traverse:!0})}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&Zc(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(X`Uses "\K" in a way that's unsupported`);let o=bl({behind:!0});o.body[0].body=a(),i(Zu(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(Zu(bl({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=yl();t.body[0].body.push(e.body),e.body=Zu(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=Uu(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(X`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!qu(n)&&(n=zu(n,t),e.ref=n)}},ju={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=Xu(Lu(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&uu(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;te.type===`Group`&&!!e.flags)),t=e?lu(r.globalFlags,e):r.globalFlags;Pu(t,r.currentFlags)||(l=yl({flags:Vu(t)}),l.body[0].body.push(c))}n(Zu(l,t),{traverse:!s})}},Mu={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=>Fu(t,e));i.length?i.length>1?n(Zu(yl({atomic:!0,body:i.reverse().map(e=>U({body:[dl(e.number)]}))}),t)):e.ref=i[0].number:n(Zu(bl({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{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 Vu({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 Hu(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function Uu(e){let t=e.find(e=>e.kind===`search_start`||Ku(e,{negate:!1})||!Z(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=Uu(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function Wu(e,t){let n=Hu(e)??[];for(let e of n)if(e===t||Wu(e,t))return!0;return!1}function Z({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function Gu(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function Ku(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&Zc(e.body[0],{type:`Assertion`,kind:`search_start`})}function qu(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function Ju(e,t){let n=el(e,{...t,unicodePropertyMap:bu}).body;return n.length>1||n[0].body.length>1?yl({body:n}):n[0].body[0]}function Yu(e,t){return e.negate=t,e}function Xu(e,t){return e.parent=t,e}function Zu(e,t){return Nu(e),e.parent=t,e}function Qu(e,t){let n=hu(t),r=du(n.target,`ES2024`),i=du(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];Ll(e,$u,{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,fu(ed[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&&uu(f._captureTransfers,e.transferTo,[]).push(t)}),f}var $u={"*":{enter({node:e},t){if(fd(e)){let n=t.getCurrentModI();t.pushModI(e.flags?lu({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){fd(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){od(Y(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),sd(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&Ou.has(e.value)&&t.setHasCasedChar()}},ed={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?X`\B`:X`\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=Y(e),r=cd(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&od(n)){let e=yu(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`);su.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(md)&&(o=[pl(45),...o.filter(e=>!md(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||su.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=yl(),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=U({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`&&!(su.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=cd(n,i),o=cd(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&ld(sd(e)).forEach(e=>{s.add(Array.isArray(e)?`${cd(e[0],i)}-${cd(e[1],i)}`:cd(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?`.`:`[^]`:X`[^\n]`;if(e===`digit`)return t?X`\D`:X`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&Ou.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?X`\P`:X`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?X`\W`:X`\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=lu(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${ud(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)+dd(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})`:X`\g<${t}&R=${r}>`}},td=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),nd=new Set([`-`,`\\`,`]`,`^`,`[`]),rd=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),id=new Map([[9,X`\t`],[10,X`\n`],[11,X`\v`],[12,X`\f`],[13,X`\r`],[8232,X`\u2028`],[8233,X`\u2029`],[65279,X`\uFEFF`]]),ad=/^\p{Cased}$/u;function od(e){return ad.test(e)}function sd(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=Y(e);if(!od(t))continue;let o=yu(t).filter(e=>{let t=e.codePointAt(0);return ti});if(o.length&&(a.push(...o),n))break}return a}function cd(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(id.has(e))return id.get(e);if(e<32||e>126&&e<160||e>262143||t&&pd(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?rd:nd:td,a=Y(e);return(i.has(a)?`\\`:``)+a}function ld(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e`;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 dd({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 fd({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function pd(e){return e>47&&e<58}function md({type:e,value:t}){return e===`Character`&&t===45}var hd=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=_d(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&&(gd(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{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function _d(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)uu(n,t,{}).transferTo=e;return n}function vd(e){let t=/(?\((?:\?<(?![=!])(?[^>]+)>|(?!\?)))|\\?./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 yd(e,t){let n=Q(e,t);return n.options?new hd(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function Q(e,t){let n=hu(t),r=ku(el(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:bu}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=Qu(r,n),a=tu(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=Gl(Jl(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}var bd=4294967295,xd=class{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}})}regexps;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:bd,end:bd,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;ee[1].index));for(let[t,n,r]of i)if(n.index===e)return a(t,n,r)}return null}};function Sd(e,t){return yd(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function Cd(e={}){let t=Object.assign({target:`auto`,cache:new Map},e);return t.regexConstructor||=e=>Sd(e,{target:t.target}),{createScanner(e){return new xd(e,t)},createString(e){return{content:e}}}}async function wd(e){if(di())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=oi.get(e);if(t!=null)return t;try{let t=si.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(Ds,e)&&(t=Ds[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 ai.has(e)||ai.set(e,n),n});return oi.set(e,n),await n}finally{oi.delete(e)}}function Td(e){return ai.get(e)??wd(e)}var Ed=new Map,Dd=new Map,Od=new Map,kd=new Set;function Ad(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=Ed.get(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,Ed.has(n)||Ed.set(n,e);kd.has(n)||(kd.add(n),t.loadThemeSync(e))}}async function jd(e){if(di())throw Error(`resolveTheme("${e}") cannot be called from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=Dd.get(e);if(t!=null)return t;try{let t=Od.get(e)??Os[e];if(t==null)throw Error(`resolveTheme: No valid loader for ${e}`);let n=t().then(t=>Md(e,`default`in t?t.default:t));Dd.set(e,n);let r=await n;if(r.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${r.name}`);return Ed.set(r.name,r),r}finally{Dd.delete(e)}}function Md(e,t){return Ed.get(e)??(t=is(t),Ed.set(e,t),t)}function $(e){return Ed.get(e)??jd(e)}function Nd(e,t){if(Od.has(e)){console.error(`SharedHighlight.registerCustomTheme: theme name already registered`,e);return}Od.set(e,t)}var Pd;async function Fd({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){Pd??=ec({themes:[],langs:[`text`],engine:n===`shiki-wasm`?$s(V(()=>import(`./wasm-CEUrWlVz.js`),[])):Cd()});let r=Ld(Pd)?await Pd:Pd;Pd=r;let i=[];for(let e of t){if(e===`text`||e===`ansi`)continue;let t=Td(e);`then`in t?i.push(t):ui(t,r)}let a=[];for(let t of e){let e=$(t);`then`in e?a.push(e):Ad(e,Pd)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{ui(e,r)}),Promise.all(a).then(e=>{Ad(e,r)})]),r}function Id(){if(Pd!=null&&!(`then`in Pd))return Pd}function Ld(e=Pd){return e!=null&&`then`in e}Nd(`pierre-dark`,async()=>{let{default:e}=await V(async()=>{let{default:e}=await import(`./pierre-dark-CizZ1Z5z.js`);return{default:e}},[]);return{...e,name:`pierre-dark`}}),Nd(`pierre-light`,async()=>{let{default:e}=await V(async()=>{let{default:e}=await import(`./pierre-light-CHMWfAMe.js`);return{default:e}},[]);return{...e,name:`pierre-light`}});function Rd(e=Ct){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}function zd(e){for(let t of Rd(e))if(!kd.has(t))return!1;return!0}function Bd(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 Vd(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function Hd(e){return N({tagName:`div`,children:[N({tagName:`div`,children:e.annotations?.map(e=>N({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function Ud(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 Wd({fileOrDiff:e,mode:t}){let n=`type`in e?e:void 0,r={"data-diffs-header":t,"data-change-type":n?.type};return N({tagName:`div`,children:[t===`custom`?N({tagName:`slot`,properties:{name:St}}):Gd({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:n?.type??`file`}),...t===`custom`?[]:[Kd(n)]],properties:r})}function Gd({name:e,prevName:t,iconType:n}){let r=[N({tagName:`slot`,properties:{name:bt}}),Mt({name:Ud(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(N({tagName:`div`,children:[N({tagName:`bdi`,children:[jt(t)]})],properties:{"data-prev-name":``}})),r.push(Mt({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(N({tagName:`div`,children:[N({tagName:`bdi`,children:[jt(e)]})],properties:{"data-title":``}})),N({tagName:`div`,children:r,properties:{"data-header-content":``}})}function Kd(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(N({tagName:`span`,children:[jt(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(N({tagName:`span`,children:[jt(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(N({tagName:`slot`,properties:{name:xt}})),N({tagName:`div`,children:t,properties:{"data-metadata":``}})}function qd(e){return N({tagName:`pre`,properties:Jd(e)})}function Jd({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,tabIndex:0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}var Yd=new Map,Xd={"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`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function Zd(e){if(Yd.has(e))return Yd.get(e)??`text`;if(Xd[e]!=null)return Xd[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Yd.has(t[1]))return Yd.get(t[1])??`text`;if(Xd[t[1]]!=null)return Xd[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return Yd.has(n)?Yd.get(n)??`text`:Xd[n]??`text`}function Qd(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:Rd(t),preferredHighlighter:n}}function $d(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function ef(e){return e.replace(/\n$|\r\n$/,``)}function tf(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(jt(` +`)),e}var nf=Symbol(`no-token`),rf=Symbol(`multiple-tokens`);function af(e){let t=of(e);if(t!=null)return t;let n=nf,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`){cf(e,a);for(let t of e.children)sf(t)}else sf(e);r.push(e),i=[],a=void 0;return}for(let e of i)sf(e);r.push(N({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==nf){if(e===rf){n=rf;return}if(n===nf){n=e;return}n!==e&&(n=rf)}};for(let t of e.children){let e=t.type===`element`?af(t):nf;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 of(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function sf(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)sf(t)}}function cf(e,t){e.properties[`data-char`]=t}function lf(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=t+uf(typeof e==`string`?e:a(e))+n;return o=r(o),i.has(o)||i.set(o,typeof e==`string`?e:{...e}),o}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 uf(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t>>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 df(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=Nt(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&af(a),i.push(tf(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(pf,ff),{state:n,transformers:r,toClass:ff}}var ff=lf({classPrefix:`hl-`}),pf={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 mf(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}function hf({theme:e=Ct,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e);r+=`color:${i.fg};`,r+=`background-color:${i.bg};`,r+=`${mf(`global`)}fg:${i.fg};`,r+=`${mf(`global`)}bg:${i.bg};`,r+=gf(i,n)}else{let n=t.getTheme(e.dark);r+=`${mf(`global`)}dark:${n.fg};`,r+=`${mf(`global`)}dark-bg:${n.bg};`,r+=gf(n,`dark`),n=t.getTheme(e.light),r+=`${mf(`global`)}light:${n.fg};`,r+=`${mf(`global`)}light-bg:${n.bg};`,r+=gf(n,`light`)}return r}function gf(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${mf(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${mf(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${mf(`global`)}${t}modified-color:${a};`),n}function _f(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}function vf(e,t){return N({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function yf(e){return e.useTokenTransformer===!0||e.onTokenClick!=null||e.onTokenEnter!=null||e.onTokenLeave!=null}var bf=``;function xf(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Sf(e,t){return e==null||t==null?e===t:wf(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 Cf={};function wf(e=Cf,t=Cf){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 Tf(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function Ef(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e}function Df(){let e=document.createElement(`style`);return e.setAttribute(Tt,``),e}var Of=`@layer base, theme, rendered, unsafe; + +@layer base { + :host { + --diffs-font-fallback: + 'SF Mono', Monaco, Consolas, 'Ubuntu Mono', 'Liberation Mono', + 'Courier New', monospace; + --diffs-header-font-fallback: + system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', + 'Noto Sans', 'Liberation Sans', Arial, sans-serif; + + --diffs-mixer: light-dark(black, white); + --diffs-gap-fallback: 8px; + + --diffs-added-light: #0dbe4e; + --diffs-added-dark: #5ecc71; + --diffs-modified-light: #009fff; + --diffs-modified-dark: #69b1ff; + --diffs-deleted-light: #ff2e3f; + --diffs-deleted-dark: #ff6762; + + /* + // Available CSS Color Overrides + --diffs-bg-buffer-override + --diffs-bg-hover-override + --diffs-bg-context-override + --diffs-bg-separator-override + + --diffs-fg-number-override + --diffs-fg-number-addition-override + --diffs-fg-number-deletion-override + --diffs-fg-conflict-marker-override + + --diffs-deletion-color-override + --diffs-addition-color-override + --diffs-modified-color-override + + --diffs-bg-deletion-override + --diffs-bg-deletion-number-override + --diffs-bg-deletion-hover-override + --diffs-bg-deletion-emphasis-override + + --diffs-bg-addition-override + --diffs-bg-addition-number-override + --diffs-bg-addition-hover-override + --diffs-bg-addition-emphasis-override + + // Line Selection Color Overrides (for enableLineSelection) + --diffs-selection-color-override + --diffs-bg-selection-override + --diffs-bg-selection-number-override + --diffs-bg-selection-background-override + --diffs-bg-selection-number-background-override + + // Available CSS Layout Overrides + --diffs-gap-inline + --diffs-gap-block + --diffs-gap-style + --diffs-tab-size + */ + + color-scheme: light dark; + display: block; + font-family: var( + --diffs-header-font-family, + var(--diffs-header-font-fallback) + ); + font-size: var(--diffs-font-size, 13px); + line-height: var(--diffs-line-height, 20px); + font-feature-settings: var(--diffs-font-features); + + /* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor + * and vscode use an older build of chrome that appears to have a bug with + * color-mix and 'in oklch', so use 'in lab' instead */ + --diffs-bg: light-dark( + var(--diffs-light-bg, #fff), + var(--diffs-dark-bg, #000) + ); + --diffs-bg-buffer: var( + --diffs-bg-buffer-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)), + color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)) + ) + ); + --diffs-bg-hover: var( + --diffs-bg-hover-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 97%, var(--diffs-mixer)), + color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-mixer)) + ) + ); + + --diffs-bg-context: var( + --diffs-bg-context-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)), + color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer)) + ) + ); + --diffs-bg-context-number: var( + --diffs-bg-context-number-override, + light-dark( + color-mix(in lab, var(--diffs-bg-context) 80%, var(--diffs-bg)), + color-mix(in lab, var(--diffs-bg-context) 60%, var(--diffs-bg)) + ) + ); + --diffs-bg-conflict-marker: var( + --diffs-bg-conflict-marker-override, + light-dark( + color-mix( + in lab, + var(--diffs-bg-context) 88%, + var(--diffs-modified-base) + ), + color-mix( + in lab, + var(--diffs-bg-context) 80%, + var(--diffs-modified-base) + ) + ) + ); + --diffs-bg-conflict-current: var( + --diffs-bg-conflict-current-override, + light-dark(#e5f8ea, #274432) + ); + --diffs-bg-conflict-base: var( + --diffs-bg-conflict-base-override, + light-dark( + color-mix( + in lab, + var(--diffs-bg-context) 90%, + var(--diffs-modified-base) + ), + color-mix( + in lab, + var(--diffs-bg-context) 82%, + var(--diffs-modified-base) + ) + ) + ); + --diffs-bg-conflict-incoming: var( + --diffs-bg-conflict-incoming-override, + light-dark(#e6f1ff, #253b5a) + ); + --diffs-bg-conflict-marker-number: var( + --diffs-bg-conflict-marker-number-override, + light-dark( + color-mix(in lab, var(--diffs-bg-conflict-marker) 72%, var(--diffs-bg)), + color-mix(in lab, var(--diffs-bg-conflict-marker) 54%, var(--diffs-bg)) + ) + ); + --diffs-bg-conflict-current-number: var( + --diffs-bg-conflict-current-number-override, + light-dark(#d7f1de, #30533d) + ); + --diffs-bg-conflict-base-number: var( + --diffs-bg-conflict-base-number-override, + light-dark( + color-mix(in lab, var(--diffs-bg-conflict-base) 72%, var(--diffs-bg)), + color-mix(in lab, var(--diffs-bg-conflict-base) 54%, var(--diffs-bg)) + ) + ); + --diffs-bg-conflict-incoming-number: var( + --diffs-bg-conflict-incoming-number-override, + light-dark(#d8e8ff, #2f4b73) + ); + --conflict-bg-current: var( + --conflict-bg-current-override, + var(--diffs-bg-addition) + ); + --conflict-bg-incoming: var( + --conflict-bg-incoming-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-modified-base)), + color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-modified-base)) + ) + ); + --conflict-bg-current-number: var( + --conflict-bg-current-number-override, + var(--diffs-bg-addition-number) + ); + --conflict-bg-incoming-number: var( + --conflict-bg-incoming-number-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-modified-base)), + color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-modified-base)) + ) + ); + --conflict-bg-current-header: var( + --conflict-bg-current-header-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 78%, var(--diffs-addition-base)), + color-mix(in lab, var(--diffs-bg) 68%, var(--diffs-addition-base)) + ) + ); + --conflict-bg-incoming-header: var( + --conflict-bg-incoming-header-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 78%, var(--diffs-modified-base)), + color-mix(in lab, var(--diffs-bg) 68%, var(--diffs-modified-base)) + ) + ); + --conflict-bg-current-header-number: var( + --conflict-bg-current-header-number-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 72%, var(--diffs-addition-base)), + color-mix(in lab, var(--diffs-bg) 62%, var(--diffs-addition-base)) + ) + ); + --conflict-bg-incoming-header-number: var( + --conflict-bg-incoming-header-number-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 72%, var(--diffs-modified-base)), + color-mix(in lab, var(--diffs-bg) 62%, var(--diffs-modified-base)) + ) + ); + + --diffs-bg-separator: var( + --diffs-bg-separator-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)), + color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer)) + ) + ); + + --diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff)); + --diffs-fg-number: var( + --diffs-fg-number-override, + light-dark( + color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)), + color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)) + ) + ); + --diffs-fg-conflict-marker: var( + --diffs-fg-conflict-marker-override, + var(--diffs-fg-number) + ); + + --diffs-deletion-base: var( + --diffs-deletion-color-override, + light-dark( + var( + --diffs-light-deletion-color, + var(--diffs-deletion-color, var(--diffs-deleted-light)) + ), + var( + --diffs-dark-deletion-color, + var(--diffs-deletion-color, var(--diffs-deleted-dark)) + ) + ) + ); + --diffs-addition-base: var( + --diffs-addition-color-override, + light-dark( + var( + --diffs-light-addition-color, + var(--diffs-addition-color, var(--diffs-added-light)) + ), + var( + --diffs-dark-addition-color, + var(--diffs-addition-color, var(--diffs-added-dark)) + ) + ) + ); + --diffs-modified-base: var( + --diffs-modified-color-override, + light-dark( + var( + --diffs-light-modified-color, + var(--diffs-modified-color, var(--diffs-modified-light)) + ), + var( + --diffs-dark-modified-color, + var(--diffs-modified-color, var(--diffs-modified-dark)) + ) + ) + ); + + /* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor + * and vscode use an older build of chrome that appears to have a bug with + * color-mix and 'in oklch', so use 'in lab' instead */ + --diffs-bg-deletion: var( + --diffs-bg-deletion-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)), + color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base)) + ) + ); + --diffs-bg-deletion-number: var( + --diffs-bg-deletion-number-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-deletion-base)), + color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-deletion-base)) + ) + ); + --diffs-bg-deletion-hover: var( + --diffs-bg-deletion-hover-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base)), + color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-deletion-base)) + ) + ); + --diffs-bg-deletion-emphasis: var( + --diffs-bg-deletion-emphasis-override, + light-dark( + rgb(from var(--diffs-deletion-base) r g b / 0.15), + rgb(from var(--diffs-deletion-base) r g b / 0.2) + ) + ); + + --diffs-bg-addition: var( + --diffs-bg-addition-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)), + color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base)) + ) + ); + --diffs-bg-addition-number: var( + --diffs-bg-addition-number-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-addition-base)), + color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-addition-base)) + ) + ); + --diffs-bg-addition-hover: var( + --diffs-bg-addition-hover-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base)), + color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-addition-base)) + ) + ); + --diffs-bg-addition-emphasis: var( + --diffs-bg-addition-emphasis-override, + light-dark( + rgb(from var(--diffs-addition-base) r g b / 0.15), + rgb(from var(--diffs-addition-base) r g b / 0.2) + ) + ); + + --diffs-selection-base: var(--diffs-modified-base); + --diffs-selection-number-fg: light-dark( + color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)), + color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)) + ); + --diffs-bg-selection: var( + --diffs-bg-selection-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 82%, var(--diffs-selection-base)), + color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-selection-base)) + ) + ); + --diffs-bg-selection-number: var( + --diffs-bg-selection-number-override, + light-dark( + color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-selection-base)), + color-mix(in lab, var(--diffs-bg) 60%, var(--diffs-selection-base)) + ) + ); + + background-color: var(--diffs-bg); + color: var(--diffs-fg); + } + + /* NOTE(mdo): Some semantic HTML elements (e.g. \`pre\`, \`code\`) have default + * user-agent styles. These must be overridden to use our custom styles. */ + pre, + code, + [data-error-wrapper] { + isolation: isolate; + margin: 0; + padding: 0; + display: block; + outline: none; + font-family: var(--diffs-font-family, var(--diffs-font-fallback)); + } + + pre, + code { + background-color: var(--diffs-bg); + } + + code { + contain: content; + } + + *, + *::before, + *::after { + box-sizing: border-box; + } + + [data-icon-sprite] { + display: none; + } + + /* NOTE(mdo): Headers and separators are within pre/code, so we need to reset + * their font-family explicitly. */ + [data-diffs-header], + [data-separator] { + font-family: var( + --diffs-header-font-family, + var(--diffs-header-font-fallback) + ); + } + + [data-file-info] { + padding: 10px; + font-weight: 700; + color: var(--fg); + /* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor + * and vscode use an older build of chrome that appears to have a bug with + * color-mix and 'in oklch', so use 'in lab' instead */ + background-color: color-mix(in lab, var(--bg) 98%, var(--fg)); + border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg)); + } + + [data-diff], + [data-file] { + /* This feels a bit crazy to me... so I need to think about it a bit more... */ + --diffs-grid-number-column-width: minmax(min-content, max-content); + --diffs-code-grid: var(--diffs-grid-number-column-width) 1fr; + + &[data-dehydrated] { + --diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr); + } + + &:hover [data-code]::-webkit-scrollbar-thumb { + background-color: var(--diffs-bg-context); + } + } + + [data-line] span { + color: light-dark( + var(--diffs-token-light, var(--diffs-light)), + var(--diffs-token-dark, var(--diffs-dark)) + ); + background-color: light-dark( + var(--diffs-token-light-bg, inherit), + var(--diffs-token-dark-bg, inherit) + ); + font-weight: light-dark( + var(--diffs-token-light-font-weight, inherit), + var(--diffs-token-dark-font-weight, inherit) + ); + font-style: light-dark( + var(--diffs-token-light-font-style, inherit), + var(--diffs-token-dark-font-style, inherit) + ); + -webkit-text-decoration: light-dark( + var(--diffs-token-light-text-decoration, inherit), + var(--diffs-token-dark-text-decoration, inherit) + ); + text-decoration: light-dark( + var(--diffs-token-light-text-decoration, inherit), + var(--diffs-token-dark-text-decoration, inherit) + ); + } + + [data-line], + [data-gutter-buffer], + [data-line-annotation], + [data-no-newline] { + color: var(--diffs-fg); + background-color: var(--diffs-line-bg, var(--diffs-bg)); + } + + [data-no-newline] { + -webkit-user-select: none; + user-select: none; + + span { + opacity: 0.6; + } + } + + [data-diff-type='split'][data-overflow='scroll'] { + display: grid; + grid-template-columns: 1fr 1fr; + + [data-additions] { + border-left: 1px solid var(--diffs-bg); + } + + [data-deletions] { + border-right: 1px solid var(--diffs-bg); + } + } + + [data-code] { + display: grid; + grid-auto-flow: dense; + grid-template-columns: var(--diffs-code-grid); + overflow: scroll clip; + overscroll-behavior-x: none; + tab-size: var(--diffs-tab-size, 2); + align-self: flex-start; + padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback)); + padding-bottom: max( + 0px, + calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) - 6px) + ); + } + + [data-container-size] { + container-type: inline-size; + } + + [data-code]::-webkit-scrollbar { + width: 0; + height: 6px; + } + + [data-code]::-webkit-scrollbar-track { + background: transparent; + } + + [data-code]::-webkit-scrollbar-thumb { + background-color: transparent; + border: 1px solid transparent; + background-clip: content-box; + border-radius: 3px; + } + + [data-code]::-webkit-scrollbar-corner { + background-color: transparent; + } + + /* + * If we apply these rules globally it will mean that webkit will opt into the + * standards compliant version of custom css scrollbars, which we do not want + * because the custom stuff will look better + */ + @supports (-moz-appearance: none) { + [data-code] { + scrollbar-width: thin; + scrollbar-color: var(--diffs-bg-context) transparent; + padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback)); + } + } + + [data-diffs-header] ~ [data-diff], + [data-diffs-header] ~ [data-file] { + [data-code], + &[data-overflow='wrap'] { + padding-top: 0; + } + } + + [data-gutter] { + display: grid; + grid-template-rows: subgrid; + grid-template-columns: subgrid; + grid-column: 1; + z-index: 3; + position: relative; + background-color: var(--diffs-bg); + + [data-gutter-buffer], + [data-column-number] { + border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg)); + } + } + + [data-content] { + display: grid; + grid-template-rows: subgrid; + grid-template-columns: subgrid; + grid-column: 2; + min-width: 0; + } + + [data-diff-type='split'][data-overflow='wrap'] { + display: grid; + grid-auto-flow: dense; + grid-template-columns: repeat(2, var(--diffs-code-grid)); + padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback)); + + [data-deletions] { + display: contents; + + [data-gutter] { + grid-column: 1; + } + + [data-content] { + grid-column: 2; + border-right: 1px solid var(--diffs-bg); + } + } + + [data-additions] { + display: contents; + + [data-gutter] { + grid-column: 3; + border-left: 1px solid var(--diffs-bg); + } + + [data-content] { + grid-column: 4; + } + } + } + + [data-overflow='scroll'] [data-gutter] { + position: sticky; + left: 0; + } + + [data-line-annotation][data-selected-line] { + background-color: unset; + + &::before { + content: ''; + /* FIXME(amadeus): This needs to be audited ... */ + position: sticky; + top: 0; + left: 0; + display: block; + border-right: var(--diffs-gap-style, 1px solid var(--diffs-bg)); + background-color: var(--diffs-bg-selection-number); + } + + [data-annotation-content] { + background-color: var(--diffs-bg-selection); + } + } + + [data-interactive-lines] [data-line] { + cursor: pointer; + } + + [data-content-buffer], + [data-gutter-buffer] { + position: relative; + -webkit-user-select: none; + user-select: none; + min-height: 1lh; + } + + [data-gutter-buffer='annotation'] { + min-height: 0; + } + + [data-gutter-buffer='buffer'] { + background-size: 8px 8px; + background-position: 0 0; + background-origin: border-box; + background-color: var(--diffs-bg); + /* This is incredibley expensive... */ + background-image: repeating-linear-gradient( + -45deg, + transparent, + transparent calc(3px * 1.414), + rgb(from var(--diffs-bg-buffer) r g b / 0.8) calc(3px * 1.414), + rgb(from var(--diffs-bg-buffer) r g b / 0.8) calc(4px * 1.414) + ); + } + + [data-content-buffer] { + grid-column: 1; + /* We multiply by 1.414 (√2) to better approximate the diagonal repeat distance */ + background-size: 8px 8px; + background-position: 5px 0; + background-origin: border-box; + background-color: var(--diffs-bg); + /* This is incredibley expensive... */ + background-image: repeating-linear-gradient( + -45deg, + transparent, + transparent calc(3px * 1.414), + var(--diffs-bg-buffer) calc(3px * 1.414), + var(--diffs-bg-buffer) calc(4px * 1.414) + ); + } + + [data-separator] { + box-sizing: content-box; + background-color: var(--diffs-bg); + } + + [data-separator='simple'] { + min-height: 4px; + } + + [data-separator='line-info'], + [data-separator='line-info-basic'], + [data-separator='metadata'], + [data-separator='simple'] { + background-color: var(--diffs-bg-separator); + } + + [data-separator='line-info'], + [data-separator='line-info-basic'], + [data-separator='metadata'] { + height: 32px; + position: relative; + } + + [data-separator-wrapper] { + -webkit-user-select: none; + user-select: none; + fill: currentColor; + position: absolute; + inset-inline: 0; + display: flex; + align-items: center; + background-color: var(--diffs-bg); + height: 100%; + } + + [data-content] [data-separator-wrapper] { + display: none; + } + + [data-separator='metadata'] [data-separator-wrapper] { + inset-inline: 100% auto; + padding-inline: 1ch; + height: 100%; + background-color: var(--diffs-bg-separator); + color: var(--diffs-fg-number); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + min-width: min-content; + } + + [data-separator='line-info'] { + margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback)); + } + + [data-separator='line-info-basic'], + [data-separator='metadata'] { + margin-block: 0; + } + + [data-separator='line-info'][data-separator-first] { + margin-top: 0; + } + + [data-separator='line-info'][data-separator-last] { + margin-bottom: 0; + } + + [data-expand-index] [data-separator-wrapper] { + display: grid; + grid-template-columns: 32px auto; + } + + [data-expand-index] [data-separator-wrapper][data-separator-multi-button] { + grid-template-columns: 32px 32px auto; + } + + [data-expand-button], + [data-separator-content] { + display: flex; + flex: 0 0 auto; + align-items: center; + background-color: var(--diffs-bg-separator); + } + + [data-expand-index] [data-separator-content]:hover { + text-decoration: underline; + cursor: pointer; + } + + [data-expand-button] { + justify-content: center; + flex-shrink: 0; + cursor: pointer; + min-width: 32px; + align-self: stretch; + color: var(--diffs-fg-number); + border-right: 2px solid var(--diffs-bg); + + &:hover { + color: var(--diffs-fg); + } + + &[data-expand-all-button] { + display: none; + } + } + + [data-expand-down] [data-icon] { + transform: scaleY(-1); + } + + [data-separator-content] { + flex: 1 1 auto; + padding: 0 1ch; + height: 100%; + color: var(--diffs-fg-number); + + overflow: hidden; + justify-content: flex-start; + } + + [data-separator='line-info'], + [data-separator='line-info-basic'] { + [data-separator-content] { + height: 100%; + -webkit-user-select: none; + user-select: none; + overflow: clip; + } + } + + @supports (width: 1cqi) { + [data-unified] { + [data-separator='line-info'] [data-separator-wrapper] { + padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback)); + width: 100cqi; + + [data-separator-content] { + border-radius: 6px; + } + } + + [data-separator='line-info'][data-expand-index] + [data-separator-wrapper] + [data-separator-content] { + border-top-left-radius: unset; + border-bottom-left-radius: unset; + } + } + + [data-gutter] { + [data-separator='line-info'] [data-separator-wrapper] { + padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback)); + } + + [data-separator='line-info'] [data-separator-content] { + border-top-left-radius: 6px; + border-bottom-left-radius: 6px; + } + + [data-separator='line-info'][data-expand-index] [data-separator-content] { + border-top-left-radius: unset; + border-bottom-left-radius: unset; + } + } + + [data-additions] { + [data-content] [data-separator='line-info'] { + background-color: var(--diffs-bg); + + [data-separator-wrapper] { + display: none; + } + } + + [data-gutter] [data-separator='line-info'] [data-separator-wrapper] { + display: block; + height: 100%; + background-color: var(--diffs-bg-separator); + border-top-right-radius: 6px; + border-bottom-right-radius: 6px; + + [data-separator-content], + [data-expand-button] { + display: none; + } + } + } + + [data-overflow='scroll'] + [data-additions] + [data-gutter] + [data-separator='line-info'] + [data-separator-wrapper] { + width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback))); + } + + [data-overflow='wrap'] + [data-additions] + [data-content] + [data-separator='line-info'] + [data-separator-wrapper] { + background-color: var(--diffs-bg-separator); + display: block; + height: 100%; + margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback)); + border-top-right-radius: 6px; + border-bottom-right-radius: 6px; + + [data-separator-content], + [data-expand-button] { + display: none; + } + } + + [data-separator='line-info'] [data-separator-wrapper] { + [data-expand-both], + [data-expand-down], + [data-expand-up] { + border-top-left-radius: 6px; + border-bottom-left-radius: 6px; + } + } + + @media (pointer: fine) { + [data-separator='line-info'] [data-separator-wrapper] { + &[data-separator-multi-button] { + [data-expand-up] { + border-top-left-radius: 6px; + border-bottom-left-radius: unset; + } + + [data-expand-down] { + border-bottom-left-radius: 6px; + border-top-left-radius: unset; + } + } + } + } + } + + @media (pointer: coarse) { + [data-separator='line-info-basic'] + [data-separator-wrapper][data-separator-multi-button] { + grid-template-columns: 34px 34px auto; + + [data-separator-content] { + grid-column: unset; + grid-row: unset; + } + } + + @supports (width: 1cqi) { + [data-separator='line-info'] [data-separator-wrapper] { + [data-expand-both], + [data-expand-down], + [data-expand-up] { + border-top-left-radius: 6px; + border-bottom-left-radius: 6px; + } + + &[data-separator-multi-button] { + [data-expand-up] { + border-top-left-radius: 6px; + border-bottom-left-radius: 6px; + } + + [data-expand-down] { + border-bottom-left-radius: unset; + border-top-left-radius: unset; + } + } + } + } + } + + @media (pointer: fine) { + [data-separator-wrapper][data-separator-multi-button] { + display: grid; + grid-template-rows: 50% 50%; + + [data-separator-content] { + grid-column: 2; + grid-row: 1 / -1; + min-width: min-content; + } + + [data-expand-button] { + grid-column: 1; + } + } + + [data-separator='line-info'] [data-separator-wrapper], + [data-separator='line-info'] + [data-separator-wrapper][data-separator-multi-button] { + grid-template-columns: 34px auto; + } + + [data-separator='line-info-basic'][data-expand-index] + [data-separator-wrapper] { + grid-template-columns: 100% auto; + } + + [data-separator='line-info'], + [data-separator='line-info-basic'] { + [data-separator-multi-button] { + [data-expand-up] { + border-bottom: 1px solid var(--diffs-bg); + border-right: 2px solid var(--diffs-bg); + } + [data-expand-down] { + border-top: 1px solid var(--diffs-bg); + border-right: 2px solid var(--diffs-bg); + } + } + } + } + + [data-additions] [data-gutter] [data-separator-wrapper], + [data-additions] [data-separator='line-info-basic'] [data-separator-wrapper], + [data-content] [data-separator-wrapper] { + display: none; + } + + [data-line-annotation], + [data-gutter-buffer='annotation'] { + --diffs-line-bg: var(--diffs-bg-context); + } + + [data-merge-conflict-actions], + [data-gutter-buffer='merge-conflict-action'] { + --diffs-line-bg: var(--diffs-bg-context); + } + + [data-has-merge-conflict] [data-line-annotation], + [data-has-merge-conflict] [data-gutter-buffer='annotation'] { + --diffs-line-bg: var(--diffs-bg); + } + + [data-has-merge-conflict] [data-gutter-buffer='merge-conflict-action'] { + --diffs-line-bg: var(--diffs-bg); + } + + [data-line-annotation] { + min-height: var(--diffs-annotation-min-height, 0); + z-index: 2; + } + + [data-merge-conflict-actions] { + z-index: 2; + } + + [data-separator='custom'] { + display: grid; + grid-template-columns: subgrid; + } + + [data-line], + [data-column-number], + [data-no-newline] { + position: relative; + padding-inline: 1ch; + } + + [data-indicators='classic'] [data-line] { + padding-inline-start: 2ch; + } + + [data-indicators='classic'] { + [data-line-type='change-addition'], + [data-line-type='change-deletion'] { + &[data-no-newline], + &[data-line] { + &::before { + display: inline-block; + width: 1ch; + height: 1lh; + position: absolute; + top: 0; + left: 0; + -webkit-user-select: none; + user-select: none; + } + } + } + + [data-line-type='change-addition'] { + &[data-line], + &[data-no-newline] { + &::before { + content: '+'; + color: var(--diffs-addition-base); + } + } + } + + [data-line-type='change-deletion'] { + &[data-line], + &[data-no-newline] { + &::before { + content: '-'; + color: var(--diffs-deletion-base); + } + } + } + } + + [data-indicators='bars'] { + [data-line-type='change-deletion'], + [data-line-type='change-addition'] { + &[data-column-number] { + &::before { + content: ''; + display: block; + width: 4px; + height: 100%; + position: absolute; + top: 0; + left: 0; + -webkit-user-select: none; + user-select: none; + contain: strict; + } + } + } + + [data-line-type='change-deletion'] { + &[data-column-number] { + &::before { + background-image: linear-gradient( + 0deg, + var(--diffs-bg-deletion) 50%, + var(--diffs-deletion-base) 50% + ); + background-repeat: repeat; + background-size: 2px 2px; + background-size: calc(1lh / round(1lh / 2px)) + calc(1lh / round(1lh / 2px)); + } + } + } + + [data-line-type='change-addition'] { + &[data-column-number] { + &::before { + background-color: var(--diffs-addition-base); + } + } + } + } + + [data-overflow='wrap'] { + [data-line], + [data-annotation-content] { + white-space: pre-wrap; + word-break: break-word; + } + } + + [data-overflow='scroll'] [data-line] { + white-space: pre; + min-height: 1lh; + } + + [data-column-number] { + box-sizing: content-box; + text-align: right; + -webkit-user-select: none; + user-select: none; + background-color: var(--diffs-bg); + color: var(--diffs-fg-number); + padding-left: 2ch; + } + + [data-line-number-content] { + display: inline-block; + min-width: var( + --diffs-min-number-column-width, + var(--diffs-min-number-column-width-default, 3ch) + ); + } + + [data-disable-line-numbers] { + [data-column-number] { + min-width: 4px; + padding: 0; + } + + [data-line-number-content] { + display: none; + } + + [data-gutter-utility-slot] { + right: unset; + left: 0; + justify-content: flex-start; + } + + &[data-indicators='bars'] [data-gutter-utility-slot] { + /* Using 5px here because theres a 1px separator after the bar */ + left: 5px; + } + } + + [data-file][data-disable-line-numbers] { + [data-gutter-buffer], + [data-column-number] { + min-width: 0; + border-right: 0; + } + } + + [data-interactive-line-numbers] [data-column-number] { + cursor: pointer; + } + + [data-diff-span] { + border-radius: 3px; + -webkit-box-decoration-break: clone; + box-decoration-break: clone; + } + + [data-line-type='change-addition'] { + &[data-column-number] { + color: var( + --diffs-fg-number-addition-override, + var(--diffs-addition-base) + ); + } + + [data-diff-span] { + background-color: var(--diffs-bg-addition-emphasis); + } + } + + [data-line-type='change-deletion'] { + &[data-column-number] { + color: var( + --diffs-fg-number-deletion-override, + var(--diffs-deletion-base) + ); + } + + [data-diff-span] { + background-color: var(--diffs-bg-deletion-emphasis); + } + } + + [data-background] [data-line-type='change-addition'] { + --diffs-line-bg: var(--diffs-bg-addition); + + &[data-column-number] { + background-color: var(--diffs-bg-addition-number); + } + } + + [data-background] [data-line-type='change-deletion'] { + --diffs-line-bg: var(--diffs-bg-deletion); + + &[data-column-number] { + background-color: var(--diffs-bg-deletion-number); + } + } + + [data-merge-conflict='marker-start'], + [data-merge-conflict='marker-base'], + [data-merge-conflict='marker-separator'], + [data-merge-conflict='marker-end'] { + padding-left: 1ch; + color: var(--diffs-fg); + } + + [data-merge-conflict='marker-start'], + [data-merge-conflict='marker-end'] { + display: flex; + align-items: center; + + &::after { + color: var(--diffs-fg-conflict-marker); + font-style: normal; + font-size: 0.75rem; + line-height: 1.25rem; + padding-left: 1ch; + font-family: var( + --diffs-header-font-family, + var(--diffs-header-font-fallback) + ); + } + } + + [data-merge-conflict='marker-start']::after { + content: '(Current Change)'; + } + + [data-merge-conflict='marker-end']::after { + content: '(Incoming Change)'; + } + + [data-merge-conflict='marker-base'], + [data-merge-conflict='marker-end'] { + &[data-line], + &[data-no-newline] { + background-color: var(--diffs-bg-conflict-marker); + } + + &[data-column-number] { + background-color: var(--diffs-bg-conflict-marker-number); + color: var(--diffs-fg-conflict-marker); + + [data-line-number-content] { + color: var(--diffs-fg-conflict-marker); + } + } + } + + [data-merge-conflict='current'] { + &[data-line], + &[data-no-newline] { + background-color: var(--conflict-bg-current); + } + + &[data-column-number] { + background-color: var(--conflict-bg-current-number); + color: var(--diffs-addition-base); + } + } + + [data-gutter-buffer='merge-conflict-marker-start'], + [data-merge-conflict='marker-start'] { + background-color: var(--conflict-bg-current-header); + } + + [data-gutter-buffer='merge-conflict-marker-end'], + [data-merge-conflict='marker-end'] { + background-color: var(--conflict-bg-incoming-header); + } + + [data-merge-conflict='marker-separator'] { + &[data-line], + &[data-no-newline] { + background-color: var(--diffs-bg); + } + + &[data-column-number] { + background-color: var(--diffs-bg); + } + } + + [data-merge-conflict='base'] { + &[data-line], + &[data-no-newline] { + background-color: var(--diffs-bg-conflict-base); + } + + &[data-column-number] { + background-color: var(--diffs-bg-conflict-base-number); + color: var(--diffs-modified-base); + } + } + + [data-merge-conflict='incoming'] { + &[data-line], + &[data-no-newline] { + background-color: var(--conflict-bg-incoming); + } + + &[data-column-number] { + background-color: var(--conflict-bg-incoming-number); + color: var(--diffs-modified-base); + } + } + + @media (pointer: fine) { + [data-column-number], + [data-line] { + &[data-hovered] { + background-color: var(--diffs-bg-hover); + } + } + + [data-background] { + [data-column-number], + [data-line] { + &[data-hovered] { + &[data-line-type='change-deletion'] { + background-color: var(--diffs-bg-deletion-hover); + } + + &[data-line-type='change-addition'] { + background-color: var(--diffs-bg-addition-hover); + } + } + } + } + } + + [data-diffs-header='default'] { + position: relative; + background-color: var(--diffs-bg); + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + gap: var(--diffs-gap-inline, var(--diffs-gap-fallback)); + min-height: calc( + 1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3) + ); + padding-inline: 16px; + top: 0; + z-index: 2; + } + + [data-header-content] { + display: flex; + flex-direction: row; + align-items: center; + gap: var(--diffs-gap-inline, var(--diffs-gap-fallback)); + min-width: 0; + white-space: nowrap; + } + + [data-header-content] [data-prev-name], + [data-header-content] [data-title] { + direction: rtl; + overflow: hidden; + text-overflow: ellipsis; + min-width: 0; + white-space: nowrap; + } + + [data-prev-name] { + opacity: 0.7; + } + + [data-rename-icon] { + fill: currentColor; + flex-shrink: 0; + flex-grow: 0; + } + + [data-diffs-header='default'] [data-metadata] { + display: flex; + align-items: center; + gap: 1ch; + white-space: nowrap; + } + + [data-diffs-header='default'] [data-additions-count] { + font-family: var(--diffs-font-family, var(--diffs-font-fallback)); + color: var(--diffs-addition-base); + } + + [data-diffs-header='default'] [data-deletions-count] { + font-family: var(--diffs-font-family, var(--diffs-font-fallback)); + color: var(--diffs-deletion-base); + } + + [data-annotation-content] { + position: relative; + display: flow-root; + align-self: flex-start; + z-index: 2; + min-width: 0; + isolation: isolate; + } + + [data-merge-conflict-actions-content] { + display: flex; + align-items: center; + gap: 0.25rem; + padding-inline: 0.5rem; + min-height: 1.75rem; + font-family: var( + --diffs-header-font-family, + var(--diffs-header-font-fallback) + ); + font-size: 0.75rem; + line-height: 1.2; + color: var(--diffs-fg); + } + + [data-merge-conflict-action] { + appearance: none; + border: 0; + background: transparent; + color: var(--diffs-fg-number); + font: inherit; + font-style: normal; + cursor: pointer; + padding: 0; + } + + [data-merge-conflict-action]:hover { + color: var(--diffs-fg); + } + + [data-merge-conflict-action='current']:hover { + color: var(--diffs-addition-base); + } + + [data-merge-conflict-action='incoming']:hover { + color: var(--diffs-modified-base); + } + + [data-merge-conflict-action-separator] { + color: var(--diffs-fg-number); + opacity: 0.6; + -webkit-user-select: none; + user-select: none; + } + + /* Sticky positioning has a composite costs, so we should _only_ pay it if we + * need to */ + [data-overflow='scroll'] [data-annotation-content] { + position: sticky; + width: var(--diffs-column-content-width, auto); + left: var(--diffs-column-number-width, 0); + } + + [data-overflow='scroll'] [data-merge-conflict-actions-content] { + position: sticky; + width: var(--diffs-column-content-width, auto); + left: var(--diffs-column-number-width, 0); + } + + /* Undo some of the stuff that the 'pre' tag does */ + [data-annotation-slot] { + text-wrap-mode: wrap; + word-break: normal; + white-space-collapse: collapse; + } + + [data-change-icon] { + fill: currentColor; + flex-shrink: 0; + } + + [data-change-icon='change'], + [data-change-icon='rename-pure'], + [data-change-icon='rename-changed'] { + color: var(--diffs-modified-base); + } + + [data-change-icon='new'] { + color: var(--diffs-addition-base); + } + + [data-change-icon='deleted'] { + color: var(--diffs-deletion-base); + } + + [data-change-icon='file'] { + opacity: 0.6; + } + + /* Line selection highlighting */ + [data-selected-line] { + &[data-gutter-buffer='annotation'], + &[data-column-number] { + color: var(--diffs-selection-number-fg); + background-color: var(--diffs-bg-selection-number); + } + + &[data-line] { + background-color: var(--diffs-bg-selection); + } + } + + [data-line-type='change-addition'], + [data-line-type='change-deletion'] { + &[data-selected-line] { + &[data-line], + &[data-line][data-hovered] { + background-color: light-dark( + color-mix( + in lab, + var(--diffs-line-bg, var(--diffs-bg)) 82%, + var(--diffs-selection-base) + ), + color-mix( + in lab, + var(--diffs-line-bg, var(--diffs-bg)) 75%, + var(--diffs-selection-base) + ) + ); + } + + &[data-column-number], + &[data-column-number][data-hovered] { + color: var(--diffs-selection-number-fg); + background-color: light-dark( + color-mix( + in lab, + var(--diffs-line-bg, var(--diffs-bg)) 75%, + var(--diffs-selection-base) + ), + color-mix( + in lab, + var(--diffs-line-bg, var(--diffs-bg)) 60%, + var(--diffs-selection-base) + ) + ); + } + } + } + + [data-gutter-utility-slot] { + position: absolute; + top: 0; + bottom: 0; + right: 0; + display: flex; + justify-content: flex-end; + } + + [data-unmodified-lines] { + display: block; + overflow: hidden; + min-width: 0; + text-overflow: ellipsis; + white-space: nowrap; + flex: 0 1 auto; + } + + [data-error-wrapper] { + overflow: auto; + padding: var(--diffs-gap-block, var(--diffs-gap-fallback)) + var(--diffs-gap-inline, var(--diffs-gap-fallback)); + max-height: 400px; + scrollbar-width: none; + + [data-error-message] { + font-weight: bold; + font-size: 18px; + color: var(--diffs-deletion-base); + } + + [data-error-stack] { + color: var(--diffs-fg-number); + } + } + + [data-placeholder] { + contain: strict; + } + + [data-utility-button] { + display: flex; + align-items: center; + justify-content: center; + border: none; + appearance: none; + width: 1lh; + height: 1lh; + margin-right: calc((1lh - 1ch) * -1); + padding: 0; + cursor: pointer; + font-size: var(--diffs-font-size, 13px); + line-height: var(--diffs-line-height, 20px); + border-radius: 4px; + background-color: var(--diffs-modified-base); + color: var(--diffs-bg); + fill: currentColor; + position: relative; + z-index: 4; + } +} +`,kf=`@layer base, theme, rendered, unsafe;`;function Af(e){return`${kf} +@layer unsafe { + ${e} +}`}function jf(e,t=`system`){return`${kf} +@layer rendered { + :host {${t===`system`?``:` + color-scheme: ${t};`} + ${e} + } +}`}function Mf({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 Nf(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function Pf(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`);break}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.tabIndex=0,e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}function Ff({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=If(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function If(){let e=document.createElement(`style`);return e.setAttribute(wt,``),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(Of)),t.adoptedStyleSheets=[e]}}customElements.define(lt,t)}var Lf=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 Rf(e,t){return Vd(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function zf(e){return N({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function Bf(e){return N({tagName:`div`,children:[N({tagName:`span`,children:[jt(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function Vf(e){return N({tagName:`div`,children:[Mt({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 Hf({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(N({tagName:`div`,children:[jt(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(Vf(`up`)),s++),o||(e.push(Vf(`down`)),s++)):(e.push(Vf(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(N({tagName:`div`,children:[N({tagName:`span`,children:[jt(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(N({tagName:`div`,children:[jt(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(N({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(N({tagName:`slot`,properties:{name:i}})),N({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 Uf(e,t){return`hunk-separator-${e}-${t}`}function Wf(e){let t=e.at(-1);return t==null?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function Gf(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}var Kf=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}else 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=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+1e.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}},qf=new class extends Kf{};function Jf(e,t,n){return qf.diff(e,t,n)}function Yf(e,t){let n;for(n=0;nt.length&&(n=e.length-t.length);let r=t.length;e.length0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function rp(e){let t;for(t=e.length-1;t>=0&&e[t].match(/\s/);t--);return e.substring(t+1)}function ip(e){let t=e.match(/^\s*/);return t?t[0]:``}var ap=`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}`,op=RegExp(`[${ap}]+|\\s+|[^${ap}]`,`ug`);new class extends Kf{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=[];for(let t of Array.from(r.segment(e))){let e=t.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}}else n=e.match(op)||[];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)&&sp(n,i,r,e),n=e,r=null,i=null)}),(r||i)&&sp(n,i,r,null),e}};function sp(e,t,n,r){if(t&&n){let i=ip(t.value),a=rp(t.value),o=ip(n.value),s=rp(n.value);if(e){let r=Yf(i,o);e.value=Qf(e.value,o,r),t.value=$f(t.value,r),n.value=$f(n.value,r)}if(r){let e=Xf(a,s);r.value=Zf(r.value,s,e),t.value=ep(t.value,e),n.value=ep(n.value,e)}}else if(n){if(e){let e=ip(n.value);n.value=n.value.substring(e.length)}if(r){let e=ip(r.value);r.value=r.value.substring(e.length)}}else if(e&&r){let n=ip(r.value),i=ip(t.value),a=rp(t.value),o=Yf(n,i);t.value=$f(t.value,o);let s=Xf($f(n,o),a);t.value=ep(t.value,s),r.value=Zf(r.value,n,s),e.value=Qf(e.value,n,n.slice(0,n.length-s.length))}else if(r){let e=ip(r.value),n=tp(rp(t.value),e);t.value=ep(t.value,n)}else if(e){let n=tp(rp(e.value),ip(t.value));t.value=$f(t.value,n)}}var cp=new class extends Kf{tokenize(e){let t=RegExp(`(\\r?\\n)|[${ap}]+|[^\\S\\n\\r]+|[^${ap}]`,`ug`);return e.match(t)||[]}};function lp(e,t,n){return cp.diff(e,t,n)}var up=new class extends Kf{constructor(){super(...arguments),this.tokenize=fp}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(` +`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(` +`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(` +`)&&(e=e.slice(0,-1)),t.endsWith(` +`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function dp(e,t,n){return up.diff(e,t,n)}function fp(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,` +`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;et===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(mp(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 mp(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a{e(l(t))}}))}else return l(dp(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;e0?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&&e1&&!t.includeFileHeaders)throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>_p(e,t)).join(` +`)}let n=[];t.includeIndex&&e.oldFileName==e.newFileName&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`),t.includeFileHeaders&&(n.push(`--- `+e.oldFileName+(e.oldHeader===void 0?``:` `+e.oldHeader)),n.push(`+++ `+e.newFileName+(e.newHeader===void 0?``:` `+e.newHeader)));for(let t=0;t{s(e?_p(e,o.headerOptions):void 0)}}))}else{let s=gp(e,t,n,r,i,a,o);return s?_p(s,o?.headerOptions):void 0}}function yp(e){let t=e.endsWith(` +`),n=e.split(` +`).map(e=>e+` +`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function bp({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 xp({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])}function Sp({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s={finalHunk:e.hunks.at(-1),viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:0,unifiedCount:0,shouldBreak(){if(!s.isWindowedHighlight)return!1;let e=s.unifiedCount>=n+r,i=s.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!s.isWindowedHighlight)return!1;let i=s.unifiedCount+e=n-e&&s.unifiedCount=n-e&&s.splitCount{if(r!==s.finalHunk||!wp(e))return;let t=e.additionLines.length-(r.additionLineIndex+r.additionCount),n=e.deletionLines.length-(r.deletionLineIndex+r.deletionCount);if(t!==n)throw Error(`iterateOverDiff: trailing context mismatch (additions=${t}, deletions=${n}) for ${e.name}`);let o=Math.min(t,n);return Cp(e.isPartial,o,i,e.hunks.length,a)})(),l=o.fromStart+o.fromEnd;function u(e,n){return c==null||c.collapsedLines<=0||c.fromStart+c.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?c.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?c.collapsedLines:0}function d(){if(o.collapsedLines===0)return 0;let e=o.collapsedLines;return o.collapsedLines=0,e}if(s.shouldSkip(l,l))s.incrementCounts(l,l),d();else{let e=r.unifiedLineStart-o.rangeSize,t=r.splitLineStart-o.rangeSize,i=r.deletionLineIndex-o.rangeSize,a=r.additionLineIndex-o.rangeSize,c=r.deletionStart-o.rangeSize,l=r.additionStart-o.rangeSize,u=0;for(;u=t;return{fromStart:l?t:o,fromEnd:l?0:s,rangeSize:t,collapsedLines:Math.max(t-c,0)}}function wp(e){let t=e.hunks.at(-1);return t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0?!1:t.additionLineIndex+t.additionCount=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 Ep({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:a=f.deletions?c+(a-f.deletions):void 0:a=f.deletions?u+(a-f.deletions):void 0:a0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=hf({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)??Ap();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)}Sp({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:c?h:!0,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&&kp({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}=jp({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;t0)for(let e of i.additionSegments)for(let t=0;ts||t.length>s))return;let c=o===`char`?Jf(e,t):lp(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?(xp({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),xp({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?xp({item:e,arr:l,enableJoin:d,isLastItem:t}):xp({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(bp({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(bp({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function Ap(){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 jp({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c=Ct,...l}}){let u=s??Zd(e.name),d=s??Zd(t.name),{state:f,transformers:p}=df(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:mf(`token`)}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:mf(`token`)};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,_f(i.codeToHast(ef(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,_f(i.codeToHast(ef(t.contents),m)))}}function Mp(e){let t=e.lang??Zd(e.name),n=e.lang??(e.prevName==null?`text`:Zd(e.prevName));return t===`text`&&n===`text`}var Np=-1,Pp=class{__id=`diff-hunks-renderer:${++Np}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;constructor(e={theme:Ct},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=zd(e.theme??Ct)?Id():void 0)}cleanUp(){this.highlighter=void 0,this.diff=void 0,this.renderCache=void 0,this.workerManager?.cleanUpPendingTasks(this),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.renderCache=void 0,this.workerManager?.cleanUpPendingTasks(this)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let 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.renderCache=void 0),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??Dt}getExpandedHunksMap(){return this.expandedHunks}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)}}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e}}getSplitLineDecoration({side:e,type:t}){return t===`change`?{gutterLineType:e===`deletions`?`change-deletion`:`change-addition`}:{gutterLineType:t}}createAnnotationElement(e){return Hd(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`,theme:m=Ct,headerRenderMode:h=`default`,tokenizeMaxLineLength:g=1e3,useTokenTransformer:_=!1,useCSSClasses:v=!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,theme:this.workerManager?.getDiffRenderOptions().theme??m,headerRenderMode:h,tokenizeMaxLineLength:g,useTokenTransformer:_,useCSSClasses:v}}async initializeHighlighter(){return this.highlighter=await Fd(Qd(this.computedLang,this.options)),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=this.workerManager?.getDiffResultCache(e);n!=null&&!Rf(t,n.options)&&(n=void 0),this.renderCache??={diff:e,highlighted:!Mp(e),options:t,result:n?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result??this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLang=e.lang??Zd(e.name),this.initializeHighlighter())}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getDiffRenderOptions();let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:yf(this.options),tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||e!==n.diff||!Rf(t,n.options)?{options:t,forceRender:!0}:{options:t,forceRender:!1}}renderDiff(e=this.renderCache?.diff,t=Ot){if(e==null)return;let{expandUnchanged:n=!1,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),i=this.workerManager?.getDiffResultCache(e);i!=null&&this.renderCache==null&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...i});let{options:a,forceRender:o}=this.getRenderOptions(e);if(this.renderCache??={diff:e,highlighted:!1,options:a,result:void 0,renderRange:void 0},this.workerManager?.isWorkingPool()===!0)(this.renderCache.result==null||!this.renderCache.highlighted&&(e!==this.renderCache.diff||!Bd(this.renderCache.renderRange,t)))&&(this.renderCache.diff=e,this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,Gf(t)||n?!0:this.expandedHunks,r),this.renderCache.renderRange=t),t.totalLines>0&&(!this.renderCache.highlighted||o)&&this.workerManager.highlightDiffAST(this,e);else{this.computedLang=e.lang??Zd(e.name);let t=this.highlighter!=null&&zd(a.theme),n=this.highlighter!=null&&li(this.computedLang);if(this.highlighter!=null&&t&&(o||!this.renderCache.highlighted&&n||this.renderCache.result==null)){let{result:t,options:r}=this.renderDiffWithHighlighter(e,this.highlighter,!n);this.renderCache={diff:e,options:r,highlighted:n,result:t,renderRange:void 0}}(!t||!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=Ot){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 qd({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){this.computedLang=e.lang??Zd(e.name);let t=this.highlighter!=null&&zd(this.options.theme??Ct),n=this.highlighter!=null&&li(this.computedLang);return(this.highlighter==null||!t||!n)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults();return{result:Op(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i}),options:r}}onHighlightSuccess(e,t,n){if(this.renderCache==null)return;let r=!this.renderCache.highlighted||!Rf(this.renderCache.options,n)||this.renderCache.diff!==e;this.renderCache={diff:e,options:n,highlighted:!0,result:t,renderRange:void 0},r&&this.onRenderUpdate?.()}onHighlightError(e){console.error(e)}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults();this.diff=e;let d=a===`unified`,f=[],p=[],m=[],h=[],{additionLines:g,deletionLines:_}=n,v={rowCount:0,hunkSeparators:u,additionsContentAST:f,deletionsContentAST:p,unifiedContentAST:m,unifiedGutterAST:Pt(),deletionsGutterAST:Pt(),additionsGutterAST:Pt(),expansionLineCount:c,hunkData:h,incrementRowCount(e=1){v.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:v.unifiedGutterAST.children.push(t);break;case`deletions`:v.deletionsGutterAST.children.push(t);break;case`additions`:v.additionsGutterAST.children.push(t);break}}},y=Vp(e),b={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`?(v.pushToGutter(`additions`,It(void 0,`buffer`,this.size)),f?.push(zf(this.size))):(v.pushToGutter(`deletions`,It(void 0,`buffer`,this.size)),p?.push(zf(this.size))),this.size=0,this.side=void 0}}},x=(e,t,n,r,i)=>{v.pushToGutter(e,Ft(t,n,r,i))};function S(e){b.flush(),a===`unified`?zp(`unified`,e,v):(zp(`deletions`,e,v),zp(`additions`,e,v))}Sp({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,d=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&b.flush(),r>0&&S({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:!e.isPartial});let f=a===`unified`?d:l,p={type:c,hunkIndex:t,lineIndex:f,unifiedLineIndex:d,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(p);n?.before!=null&&Ip(n.before,v);let r=s==null?void 0:_[s.lineIndex],i=o==null?void 0:g[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});x(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${d},${l}`,u.gutterProperties),i==null?r!=null&&(r=Bp(r,u.contentProperties)):i=Bp(i,u.contentProperties),Rp({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,f),createAnnotationElement:e=>this.createAnnotationElement(e),context:v}),n?.after!=null&&Ip(n.after,v)}else{let n=this.getSplitInjectedRowsForLine?.(p);n?.before!=null&&Lp(n.before,v,b);let r=s==null?void 0:_[s.lineIndex],i=o==null?void 0:g[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 d=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();if(d!=null){if(b.side!=null&&b.side!==d)throw Error(`DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits`);b.side=d,b.increment()}let m=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,f);if(m!=null&&b.size>0&&b.flush(),s!=null){let e=Bp(r,a.contentProperties);x(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=Bp(i,u.contentProperties);x(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Rp({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...m,createAnnotationElement:e=>this.createAnnotationElement(e),context:v}),n?.after!=null&&Lp(n.after,v,b)}let m=s?.noEOFCR??!1,h=o?.noEOFCR??!1;if(h||m){if(m){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(v.unifiedContentAST.push(Bf(e)),v.pushToGutter(`unified`,It(e,`metadata`,1))):(v.deletionsContentAST.push(Bf(e)),v.pushToGutter(`deletions`,It(e,`metadata`,1)),h||(v.pushToGutter(`additions`,It(void 0,`buffer`,1)),v.additionsContentAST.push(zf(1))))}if(h){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(v.unifiedContentAST.push(Bf(e)),v.pushToGutter(`unified`,It(e,`metadata`,1))):(v.additionsContentAST.push(Bf(e)),v.pushToGutter(`additions`,It(e,`metadata`,1)),m||(v.pushToGutter(`deletions`,It(void 0,`buffer`,1)),v.deletionsContentAST.push(zf(1))))}v.incrementRowCount(1)}i>0&&u!==`simple`&&S({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:i,rangeSize:y,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!e.isPartial}),v.incrementRowCount(1)}}),a===`split`&&b.flush();let C=Math.max(Wf(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),w=t.bufferBefore>0||t.bufferAfter>0,ee=!d&&e.type!==`deleted`,T=!d&&e.type!==`new`,te=v.rowCount>0||w;f=ee&&te?f:void 0,p=T&&te?p:void 0,m=d&&te?m:void 0;let E=this.createPreElement(p!=null&&f!=null,C);return{unifiedGutterAST:d&&te?v.unifiedGutterAST.children:void 0,unifiedContentAST:m,deletionsGutterAST:T&&te?v.deletionsGutterAST.children:void 0,deletionsContentAST:p,additionsGutterAST:ee&&te?v.additionsGutterAST.children:void 0,additionsContentAST:f,hunkData:h,preNode:E,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:C,rowCount:v.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=Pt(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,vf(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(N({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(N({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(N({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return Vr(this.renderFullAST(e,t))}renderPartialHTML(e,t){return Vr(t==null?e:N({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}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($d(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($d(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}=this.getOptionsWithDefaults();return Wd({fileOrDiff:e,mode:t})}};function Fp(e){return`${e} unmodified line${e>1?`s`:``}`}function Ip(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function Lp(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 Rp({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`,It(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`,It(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`,It(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function zp(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,Hf({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(Hf({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,Hf({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(Hf({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=Uf(e,t),d=r>c.expansionLineCount,f=s?t:void 0;c.pushToGutter(e,Hf({type:c.hunkSeparators,content:Fp(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(Hf({type:c.hunkSeparators,content:Fp(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:n,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function Bp(e,t){return e==null||e.type!==`element`||t==null?e:{...e,properties:{...e.properties,...t}}}function Vp(e){let t=e.hunks.at(-1);if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let n=e.additionLines.length-(t.additionLineIndex+t.additionCount),r=e.deletionLines.length-(t.deletionLineIndex+t.deletionCount);if(n!==r)throw Error(`DiffHunksRenderer.processDiffResult: trailing context mismatch (additions=${n}, deletions=${r}) for ${e.name}`);return Math.min(n,r)}function Hp(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Up(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function Wp(e){let t=e[0];if(t!==`+`&&t!==`-`&&t!==` `&&t!==`\\`){console.error(`parseLineType: Invalid firstChar: "${t}", full line: "${e}"`);return}let n=e.substring(1);return{line:n===``?` +`:n,type:t===` `?`context`:t===`\\`?`metadata`:t===`+`?`addition`:`deletion`}}function Gp(e,t,n=!1){let r=dt.test(e),i=e.split(r?dt:ft),a,o=[];for(let e of i){if(r&&!dt.test(e)){if(a==null)a=e;else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}else if(!r&&!ft.test(e)){if(a==null)a=e;else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let i=Kp(e,{cacheKey:t==null?void 0:`${t}-${o.length}`,isGitDiff:r,throwOnError:n});i!=null&&o.push(i)}return{patchMetadata:a,files:o}}function Kp(e,{cacheKey:t,isGitDiff:n=dt.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=e.split(pt),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=e.split(ht),f=s.shift();if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=f.match(mt),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?i.contents.split(ht):[],deletionLines:!l&&r!=null&&i!=null?r.contents.split(ht):[],cacheKey:t},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0),s.unshift(f);for(let e of s){let t=e.match(n?_t:gt);if(e.startsWith(`diff --git`)){let[,,t,,n]=e.trim().match(vt)??[];c.name=n.trim(),t!==n&&(c.prevName=t.trim())}else if(t!=null){let[,e,n]=t;e===`---`&&n!==`/dev/null`?(c.prevName=n.trim(),c.name=n.trim()):e===`+++`&&n!==`/dev/null`&&(c.name=n.trim())}else if(n){if(e.startsWith(`new mode `)&&(c.mode=e.replace(`new mode`,``).trim()),e.startsWith(`old mode `)&&(c.prevMode=e.replace(`old mode`,``).trim()),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=e.replace(`new file mode`,``).trim()),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=e.replace(`deleted file mode`,``).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(yt)??[];t!=null&&(c.prevObjectId=t),n!=null&&(c.newObjectId=n),r!=null&&(c.mode=r)}e.startsWith(`rename from `)&&(c.prevName=e.replace(`rename from `,``).trim()),e.startsWith(`rename to `)&&(c.name=e.replace(`rename to `,``).trim())}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===` +`||s[s.length-1]===`\r`||s[s.length-1]===`\r +`||s[s.length-1]===``);)s.pop();let v=parseInt(p[3]),y=parseInt(p[1]);u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:parseInt(p[4]??`1`),additionStart:v,additionLines:m,deletionCount:parseInt(p[2]??`1`),deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:p[5],hunkSpecs:f,noEOFCRAdditions:!1,noEOFCRDeletions:!1};if(isNaN(b.additionCount)||isNaN(b.deletionCount)||isNaN(b.additionStart)||isNaN(b.deletionStart)){if(a)throw Error(`parsePatchContent: invalid hunk metadata`);console.error(`parsePatchContent: invalid hunk metadata`,b);continue}for(let e of s){let t=Wp(e);if(t==null){console.error(`processFile: invalid rawLine:`,e);continue}let{type:n,line:r}=t;if(n===`addition`)(g==null||g.type!==`change`)&&(g=Jp(`change`,u,d),b.hunkContent.push(g)),d++,l&&c.additionLines.push(r),g.additions++,m++,_=`addition`;else if(n===`deletion`)(g==null||g.type!==`change`)&&(g=Jp(`change`,u,d),b.hunkContent.push(g)),u++,l&&c.deletionLines.push(r),g.deletions++,h++,_=`deletion`;else if(n===`context`)(g==null||g.type!==`context`)&&(g=Jp(`context`,u,d),b.hunkContent.push(g)),d++,u++,l&&(c.deletionLines.push(r),c.additionLines.push(r)),g.lines++,_=`context`;else if(n===`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]=ef(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=ef(c.deletionLines[e]))}}}b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(b.additionStart-1-o,0),c.hunks.push(b),o=b.additionStart+b.additionCount-1;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(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=e.additionStart+e.additionCount-1,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`:i!=null&&i.contents===``?c.type=`deleted`:r!=null&&r.contents===``&&(c.type=`new`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),c}}function qp(e,t,n=!1){let r=[];for(let i of e.split(ut))try{r.push(Gp(i,t==null?void 0:`${t}-${r.length}`,n))}catch(e){if(n)throw e;console.error(e)}return r}function Jp(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}function Yp(e,t,n,r=!1){let i=Kp(vp(e.name,t.name,e.contents,t.contents,e.header,t.header,n),{cacheKey:(()=>{if(e.cacheKey!=null&&t.cacheKey!=null)return`${e.cacheKey}:${t.cacheKey}`})(),oldFile:e,newFile:t,throwOnError:r});if(i==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);return t.lang!=null&&(i.lang=t.lang),i}var Xp=-1,Zp=class{static LoadedCustomComponent=!0;__id=`file-diff:${++Xp}`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];deletionFile;additionFile;fileDiff;renderRange;appliedPreAttributes;lastRenderedHeaderHTML;lastRowCount;enabled=!0;constructor(e={theme:Ct},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new ii,this.scrollSyncManager=new Lf,this.interactionManager=new Wr(`diff`,Gr(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{...e,headerRenderMode:e.renderCustomHeader==null?`default`:`custom`,hunkSeparators:typeof e.hunkSeparators==`function`?`custom`:e.hunkSeparators}}createHunksRenderer(e){return new Pp(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{if(this.fileDiff==null)return;let n=this.fileDiff.hunks.at(-1),r,i;hunkIterator:for(let a of this.fileDiff.hunks){let o=t===`deletions`?a.deletionStart:a.additionStart,s=t===`deletions`?a.deletionCount:a.additionCount,c=a.splitLineStart,l=a.unifiedLineStart;if(e=o+s){if(a===n){let t=e-(o+s);r=l+a.unifiedLineCount+t,i=c+a.splitLineCount+t;break hunkIterator}continue}for(let n of a.hunkContent)if(n.type===`context`)if(ethis.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e){this.interactionManager.setSelection(e)}cleanUp(e=!1){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer?.shadowRoot!=null&&(this.fileContainer.shadowRoot.innerHTML=``),this.fileContainer=void 0,this.pre!=null&&(this.pre.innerHTML=``,this.pre=void 0),this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,lineAnnotations:i,oldFile:a,newFile:o,fileDiff:s}=e;this.hydrateElements(t,n),this.pre==null&&this.headerElement==null?this.render({...e,preventEmit:!0}):this.hydrationSetup({fileDiff:s,oldFile:a,newFile:o,lineAnnotations:i}),r||this.emitPostRender()}hydrateElements(e,t){Nf(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.pre!=null||this.headerElement!=null)&&(this.fileContainer=e)}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){let{diffStyle:i=`split`,overflow:a=`scroll`}=this.options;this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!=null&&n!=null?Yp(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,a===`wrap`),a===`scroll`&&i===`split`&&this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions))}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.rerender()};render({oldFile:e,newFile:t,fileDiff:n,forceRender:r=!1,preventEmit:i=!1,lineAnnotations:a,fileContainer:o,containerWrapper:s,renderRange:c}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let{collapsed:l=!1}=this.options,u=l?void 0:c,d=e!=null&&t!=null&&(!xf(e,this.deletionFile)||!xf(t,this.additionFile)),f=n!=null&&n!==this.fileDiff,p=a!=null&&(a.length>0||this.lineAnnotations.length>0)?a!==this.lineAnnotations:!1;if(!l&&Bd(u,this.renderRange)&&!r&&!p&&(n!=null&&n===this.fileDiff||n==null&&!d))return!1;let{renderRange:m}=this;if(this.renderRange=u,this.deletionFile=e,this.additionFile=t,n==null?e!=null&&t!=null&&d&&(f=!0,this.fileDiff=Yp(e,t,this.options.parseDiffOptions)):this.fileDiff=n,a!=null&&this.setLineAnnotations(a),this.fileDiff==null)return!1;this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{diffStyle:h=`split`,disableErrorHandling:g=!1,disableFileHeader:_=!1,overflow:v=`scroll`,themeType:y=`system`}=this.options;if(_&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),o=this.getOrCreateFileContainer(o,s),l){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,kt);e!=null&&this.applyThemeState(o,e.themeStyles,y,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,o),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,o)}return i||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(o);if(!(this.canPartiallyRender(r,p,d||f)&&this.applyPartialRender({previousRenderRange:m,renderRange:u}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,u);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(o,t.themeStyles,y,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,o),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,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.interactionManager.setup(e),this.resizeManager.setup(e,v===`wrap`),v===`scroll`&&h===`split`?this.scrollSyncManager.setup(e,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,o)}return i||this.emitPostRender(),!0}emitPostRender(){this.fileContainer!=null&&this.options.onPostRender?.(this.fileContainer,this)}removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();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.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}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.gutterUtilityContent?.remove(),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.gutterUtilityContent=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||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||!Up(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}-${$d(r)}`,a=this.annotationCache.get(i);if(a==null||!Hp(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:Tf($d(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 e=this.options.renderGutterUtility??this.options.renderHoverUtility;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=Ef();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let n=this.fileContainer;if(this.fileContainer=e??this.fileContainer??document.createElement(`diffs-container`),n!=null&&n!==this.fileContainer&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=bf;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t,this.fileContainer.shadowRoot?.appendChild(this.spriteSVG))}return this.fileContainer}getFileContainer(){return this.fileContainer}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return 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&&(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=Vr(e);if(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,renderHeaderMetadata:o}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,St,e),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0;return}let s=a?.(n)??void 0,c=o?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,bt,s),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,xt,c),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,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??=Df(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Af(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n;this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a||(this.themeCSSStyle=Ff({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:jf(t,a)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{themeStyles:t,themeType:a,baseThemeType:r})}applyHunksToDOM(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);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=Mf({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),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=Mf({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),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=Mf({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),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(`applyPartialRender: failed to trim to overlap`);if(this.lastRowCount{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&&lp)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`)}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=Qp(t[0]),i=Qp(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(;a0||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}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}else throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getCodeColumns(e,t,n,r){function i(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}}if(e===`unified`)return i(t);{let e=i(n),t=i(r);return e!=null||t!=null?[e,t]:void 0}}applyBuffers(e,t){let{disableVirtualizationBuffers:n=!1}=this.options;if(n||t==null){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)}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`?!1:t!=null&&n!=null,totalLines:r,customProperties:i};Sf(u,this.appliedPreAttributes)||(Pf(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper();let n=this.getOrCreatePreNode(t);n.innerHTML=``,n.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let r=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.innerHTML=``,r.appendChild(this.errorWrapper);let i=document.createElement(`div`);i.dataset.errorMessage=``,i.innerText=e.message,this.errorWrapper.appendChild(i);let a=document.createElement(`pre`);a.dataset.errorStack=``,a.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(a)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Qp(e){if(!(e==null||e.type!==`element`))return e.children??[]}function $p({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function em(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:tm(n,e.startContentIndex)}}function tm(e,t){let n=e.unifiedLineStart;for(let r=0;rthis.fileContainer==null?!1:(e&&(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer)),this.render());cleanUp(){this.fileContainer!=null&&this.virtualizer.disconnect(this.fileContainer),super.cleanUp()}expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.computeApproximateSize(),this.renderRange=void 0,this.virtualizer.instanceChanged(this)};setVisibility(e){this.fileContainer!=null&&(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}computeApproximateSize(){let e=this.height===0;if(this.height=0,this.fileDiff==null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:r=!1,collapsedContextThreshold:i=1,hunkSeparators:a=`line-info`}=this.options,{diffHeaderHeight:o,fileGap:s,hunkSeparatorHeight:c}=this.metrics,l=this.getDiffStyle(),u=a!==`simple`&&a!==`metadata`&&a!==`line-info-basic`?s:0;if(t?a!==`simple`&&a!==`metadata`&&(this.height+=s):this.height+=o,!r&&(Sp({diff:this.fileDiff,diffStyle:l,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({hunkIndex:e,collapsedBefore:t,collapsedAfter:n,deletionLine:r,additionLine:i})=>{let o=i==null?r.splitLineIndex:i.splitLineIndex,s=i==null?r.unifiedLineIndex:i.unifiedLineIndex,d=(i?.noEOFCR??!1)||(r?.noEOFCR??!1);t>0&&(e>0&&(this.height+=u),this.height+=c+u),this.height+=this.getLineHeight(l===`split`?o:s,d),n>0&&a!==`simple`&&(this.height+=u+c)}}),this.fileDiff.hunks.length>0&&(this.height+=s),this.fileContainer!=null&&this.virtualizer.config.resizeDebugging&&!e)){let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:this.fileDiff.name,elementHeight:e.height,computedHeight:this.height})}}render({fileContainer:e,oldFile:t,newFile:n,fileDiff:r,...i}={}){let a=this.fileContainer==null;if(this.fileDiff??=r??(t!=null&&n!=null?Yp(t,n,this.options.parseDiffOptions):void 0),e=this.getOrCreateFileContainer(e),this.fileDiff==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;if(a?(this.computeApproximateSize(),this.virtualizer.connect(e,this),this.top??=this.virtualizer.getOffsetInScrollContainer(e),this.isVisible=this.virtualizer.isInstanceVisible(this.top,this.height)):this.top??=this.virtualizer.getOffsetInScrollContainer(e),!this.isVisible)return this.renderPlaceholder(this.height);let o=this.virtualizer.getWindowSpecs(),s=this.computeRenderRangeFromWindow(this.fileDiff,this.top,o);return super.render({fileDiff:this.fileDiff,fileContainer:e,renderRange:s,oldFile:t,newFile:n,...i})}getDiffStyle(){return this.options.diffStyle??`split`}getExpandedRegion(e,t,n){if(n<=0||e)return{fromStart:0,fromEnd:0,collapsedLines:Math.max(n,0),renderAll:!1};let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;if(r||n<=i)return{fromStart:n,fromEnd:0,collapsedLines:0,renderAll:!0};let a=this.hunksRenderer.getExpandedHunk(t),o=Math.min(Math.max(a.fromStart,0),n),s=Math.min(Math.max(a.fromEnd,0),n),c=o+s,l=c>=n;return{fromStart:o,fromEnd:s,collapsedLines:Math.max(n-c,0),renderAll:l}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}for(let[r,i]of e.hunks.entries()){let a=t===`split`?i.splitLineCount:i.unifiedLineCount;n+=a;let o=Math.max(i.collapsedBefore,0),{fromStart:s,fromEnd:c,renderAll:l}=this.getExpandedRegion(e.isPartial,r,o);o>0&&(n+=l?o:s+c)}let r=e.hunks.at(-1);if(r!=null&&om(e)){let t=e.additionLines.length-(r.additionLineIndex+r.additionCount),i=e.deletionLines.length-(r.deletionLineIndex+r.deletionCount);if(r!=null&&t!==i)throw Error(`VirtualizedFileDiff: trailing context mismatch (additions=${t}, deletions=${i}) for ${e.name}`);let a=Math.min(t,i);if(r!=null&&a>0){let{fromStart:t,renderAll:r}=this.getExpandedRegion(e.isPartial,e.hunks.length,a);n+=r?a:t}}return n}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1,hunkSeparators:s=`line-info`}=this.options,{diffHeaderHeight:c,fileGap:l,hunkLineCount:u,hunkSeparatorHeight:d,lineHeight:f}=this.metrics,p=this.getDiffStyle(),m=this.height,h=this.getExpandedLineCount(e,p),g=i?l:c;if(tr)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:m-g-l};if(h<=u||e.hunks.length===0)return{startingLine:0,totalLines:u,bufferBefore:0,bufferAfter:0};let _=Math.ceil(Math.max(r-n,0)/f),v=Math.ceil(_/u)*u+u,y=v/u,b=y,x=[],S=(n+r)/2,C=s===`simple`||s===`metadata`||s===`line-info-basic`?0:l,w=t+g,ee=0,T,te,E;if(Sp({diff:e,diffStyle:p,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,collapsedBefore:i,collapsedAfter:a,deletionLine:o,additionLine:c})=>{let l=c==null?o.splitLineIndex:c.splitLineIndex,f=c==null?o.unifiedLineIndex:c.unifiedLineIndex,m=(c?.noEOFCR??!1)||(o?.noEOFCR??!1),h=i>0?d+C+(e>0?C:0):0;e===0&&s===`simple`&&(h=0),w+=h;let _=ee%u===0;if(_&&(x.push(w-(t+g+h)),E!=null)){if(E<=0)return!0;E--}let v=this.getLineHeight(p===`split`?l:f,m),y=Math.floor(ee/u);return w>n-v&&wS&&(te=y),E==null&&w>=r&&_&&(E=b),ee++,w+=v,a>0&&s!==`simple`&&(w+=d+C),!1}}),T==null)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:m-g-l};let ne=x.length;te??=T;let re=Math.round(te-y/2),ie=Math.max(0,ne-y),ae=Math.max(0,Math.min(re,ie)),oe=ae*u,se=re<0?v+re*u:v,ce=x[ae]??0,D=ae+se/u;return{startingLine:oe,totalLines:se,bufferBefore:ce,bufferAfter:D`u`&&t!=null?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,M.jsx)(M.Fragment,{children:e})}var hm=(0,j.createContext)(void 0);function gm(){return(0,j.useContext)(hm)}var _m=(0,j.createContext)(void 0);function vm(e){let t=(0,j.useRef)(e);return(0,j.useInsertionEffect)(()=>void(t.current=e)),(0,j.useCallback)((...e)=>t.current(...e),[])}function ym({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o,renderHoverUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d}){let f=o??s,p=n?.(e),m=r?.(e),h=i?.(e);return(0,M.jsxs)(M.Fragment,{children:[p==null?(0,M.jsxs)(M.Fragment,{children:[m!=null&&(0,M.jsx)(`div`,{slot:`header-prefix`,children:m}),h!=null&&(0,M.jsx)(`div`,{slot:`header-metadata`,children:h})]}):(0,M.jsx)(`div`,{slot:St,children:p}),a!=null&&l?.map((e,t)=>(0,M.jsx)(`div`,{slot:$d(e),children:a(e)},t)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=bm(t,e);return(0,M.jsx)(`div`,{slot:n,style:fm,children:c(t,d)},n)}),f!=null&&(0,M.jsx)(`div`,{slot:`gutter-utility-slot`,style:dm,children:f(u)})]})}function bm(e,t){let n=em(e,t);return n==null?void 0:$p({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}var xm=typeof window>`u`?j.useEffect:j.useLayoutEffect;function Sm({fileDiff:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,metrics:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c}){let l=gm(),u=(0,j.useContext)(_m),d=(0,j.useRef)(null),f=vm(r=>{if(r!=null){if(d.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);l==null?d.current=new Zp(Cm({hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c?void 0:u,!0):d.current=new am(Cm({hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),l,a,c?void 0:u,!0),d.current.hydrate({fileDiff:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:i})}else{if(d.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);d.current.cleanUp(),d.current=null}});return xm(()=>{let{current:i}=d;if(i==null)return;let a=Cm({hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c=!lm(i.options,a);i.setOptions(a),i.render({forceRender:c,fileDiff:e,lineAnnotations:n}),r!==void 0&&i.setSelectedLines(r)}),{ref:f,getHoveredLine:(0,j.useCallback)(()=>d.current?.getHoveredLine(),[])}}function Cm({options:e,hasCustomHeader:t,hasGutterRenderUtility:n}){return n||t?{...e,renderCustomHeader:t?pm:void 0,renderGutterUtility:n?pm:void 0}:e}function wm({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,className:a,style:o,prerenderedHTML:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderMetadata:d,renderGutterUtility:f,renderHoverUtility:p,disableWorkerPool:m=!1}){let{ref:h,getHoveredLine:g}=Sm({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:s,hasGutterRenderUtility:f!=null||p!=null,hasCustomHeader:l!=null,disableWorkerPool:m});return(0,M.jsx)(lt,{ref:h,className:a,style:o,children:mm(ym({fileDiff:e,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderMetadata:d,renderAnnotation:c,renderGutterUtility:f,lineAnnotations:r,renderHoverUtility:p,getHoveredLine:g}),s)})}var Tm=[{prefix:`#`},{prefix:`//`},{prefix:``},{prefix:`/*`,suffix:`*/`},{prefix:`--`},{prefix:`%`},{prefix:`;`},{prefix:`"`}],Em=``,Dm=``;function Om(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function km(e,t){let n=Om(e.prefix),r=e.suffix?`(?:\\s*${Om(e.suffix)})?`:``;return`${n}\\s*${Om(t)}${r}`}function Am(e,t){let n=e.map(e=>km(e,t)).join(`|`);return RegExp(`^\\s*(?:${n})\\s*$`)}var jm=Am(Tm,Em),Mm=Am(Tm,Dm),Nm=new He;async function Pm(e,t={method:`GET`}){let n=await fetch(e,{method:t.method,headers:t.body===void 0?void 0:{"Content-Type":`application/json`},body:t.body===void 0?void 0:JSON.stringify(t.body)});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??`Request failed (${n.status})`)}return n.json()}var Fm=`(min-width: 1060px)`;function Im(){return(0,j.useSyncExternalStore)(e=>{let t=window.matchMedia(Fm);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>window.matchMedia(Fm).matches)}function Lm(e=1500){let[t,n]=(0,j.useState)(null),r=(0,j.useRef)(void 0),i=(0,j.useRef)(0);return{toast:t,showToast:(0,j.useCallback)(t=>{clearTimeout(r.current),n({content:t,key:++i.current}),r.current=setTimeout(()=>n(null),e)},[e])}}function Rm(e,t){let n=[];for(let r of e.hunks){let i=null;for(let a=0;at&&r.topUm(t)&&n.topt.some(t=>e>=t.start&&e<=t.end);Xm(r,(e,t,n)=>{n.isDeletionsCol||n.lineType!==`change-addition`||i(n.lineNumber)&&(e.setAttribute(`data-review-comment`,``),t.setAttribute(`data-review-comment`,``))})}function Qm(e,t){return e.lineNumber===t.line?t.side===`additions`?!e.isDeletionsCol&&e.lineType!==`change-deletion`:e.lineType===`change-deletion`||e.isDeletionsCol&&e.lineType!==`change-addition`:!1}function $m(e,t){let n=(document.querySelectorAll(`.file-card`)[e]?.querySelector(`diffs-container`))?.shadowRoot?.querySelector(`pre`);if(!n)return null;let r=null;return Xm(n,(e,n,i)=>{!r&&Qm(i,t)&&(r=n)}),r}function eh({variant:e=`secondary`,onClick:t,disabled:n,children:r}){return(0,M.jsx)(`button`,{type:`button`,className:`btn btn-${e}`,onClick:t,disabled:n,children:r})}function th({onSubmit:e,onCancel:t,submitting:n,error:r}){let[i,a]=(0,j.useState)(``),o=(0,j.useRef)(null);(0,j.useEffect)(()=>{o.current?.focus()},[]);let s=()=>{let t=i.trim();!t||n||e(t)};return(0,M.jsxs)(`div`,{className:`comment-form`,onClick:e=>e.stopPropagation(),children:[(0,M.jsx)(`textarea`,{ref:o,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),s()),e.key===`Escape`&&t()},placeholder:`Leave a review comment... (Cmd+Enter to submit)`,rows:3,disabled:n}),(0,M.jsxs)(`div`,{className:`comment-form-actions`,children:[r&&(0,M.jsx)(`div`,{className:`comment-form-error`,children:r}),(0,M.jsx)(eh,{onClick:t,disabled:n,children:`Cancel`}),(0,M.jsx)(eh,{variant:`primary`,disabled:!i.trim()||n,onClick:s,children:`Comment`})]})]})}var nh=20,rh=!1,ih=(0,j.memo)(function({fileDiff:e,diffStyle:t,lineAnnotations:n,selectedLines:r,renderAnnotation:i,onGutterUtilityClick:a,onLineNumberClick:o,commentsEnabled:s}){return(0,M.jsx)(`div`,{ref:(0,j.useCallback)(n=>{rh||!n||requestAnimationFrame(()=>{let r=t===`split`?e.splitLineCount:e.unifiedLineCount;r>0&&n.offsetHeight>0&&(nh=n.offsetHeight/r,rh=!0)})},[e,t]),children:(0,M.jsx)(wm,{fileDiff:e,options:{theme:`github-dark-default`,diffStyle:t,diffIndicators:`classic`,hunkSeparators:`line-info-basic`,overflow:`wrap`,disableFileHeader:!0,enableGutterUtility:s,onGutterUtilityClick:a,lineHoverHighlight:`number`,onLineNumberClick:e=>o(e.lineNumber,e.annotationSide)},lineAnnotations:n,selectedLines:r,renderAnnotation:i})})},(e,t)=>e.fileDiff===t.fileDiff&&e.diffStyle===t.diffStyle&&e.lineAnnotations===t.lineAnnotations&&e.selectedLines===t.selectedLines);function ah({fileDiff:e,isViewed:t,isStale:n,diffStyle:r,collapsed:i,composing:a,focused:o,onToggleCollapse:s,onToggleViewed:c,onStartComment:l,onSubmitComment:u,onResolveComment:d,onCancelComment:f,onSelectLine:p,anchor:m,commentsEnabled:h,submitting:g,submitError:_}){let{additions:v,deletions:y}=zm(e),b=e.name,x=(0,j.useMemo)(()=>{if(!h)return[];let t=Rm(e,b);return a&&t.push({side:`additions`,lineNumber:a.line,metadata:{type:`composing`,file:b}}),t},[e,b,a,h]),S=(0,j.useMemo)(()=>m?{start:m.line,end:m.line,side:m.side}:null,[m]),C=(0,j.useCallback)(e=>{let t=e.metadata;return t.type===`review`?(0,M.jsx)(`div`,{className:`review-annotation`,children:(0,M.jsx)(eh,{onClick:()=>d(t.startLine),children:`Resolve comment`})}):t.type===`composing`?(0,M.jsx)(th,{onSubmit:t=>u(e.lineNumber,t),onCancel:f,submitting:g,error:_}):null},[d,u,f,g,_]),w=(0,j.useCallback)(e=>{!h||e.side!==`additions`||x.some(t=>t.metadata.type===`review`&&e.start>=t.metadata.startLine&&e.start<=t.metadata.endLine)||l(e.start)},[l,h,x]),ee=(0,j.useRef)(null),[T,te]=(0,j.useState)(!1);(0,j.useEffect)(()=>{let e=ee.current;if(!e)return;let t=new IntersectionObserver(e=>{e[0]?.isIntersecting&&(te(!0),t.disconnect())},{rootMargin:`2000px`});return t.observe(e),()=>t.disconnect()},[]);let E=T&&!i;(0,j.useEffect)(()=>{if(!E)return;let e=ee.current;if(!e)return;let t=x.flatMap(e=>e.metadata.type===`review`?[{start:e.metadata.startLine,end:e.metadata.endLine}]:[]),n=0,r=null,i=0,a=()=>Zm(e,t),o=()=>{let t=e.querySelector(`diffs-container`)?.shadowRoot,s=t?.querySelector(`pre`);if(!t||!s){i++<60&&(n=requestAnimationFrame(o));return}Jm(t),a(),r=new MutationObserver(a),r.observe(s,{childList:!0,subtree:!0})};return n=requestAnimationFrame(o),()=>{cancelAnimationFrame(n),r?.disconnect()}},[x,E,r,e]);let ne=(r===`split`?e.splitLineCount:e.unifiedLineCount)*nh;return(0,M.jsxs)(`div`,{ref:ee,className:`file-card`+(o?` focused`:``),children:[(0,M.jsxs)(`div`,{className:`file-header`,onClick:s,children:[(0,M.jsx)(`span`,{className:`collapse-chevron`+(i?` collapsed`:``),children:`▶`}),(0,M.jsx)(`span`,{className:`file-header-name`,children:b}),(0,M.jsxs)(`span`,{className:`file-header-stats`,children:[v>0&&(0,M.jsxs)(`span`,{className:`stat-add`,children:[`+`,v]}),y>0&&(0,M.jsxs)(`span`,{className:`stat-del`,children:[`-`,y]})]}),(0,M.jsxs)(`button`,{type:`button`,className:`viewed-button`+(n?` stale`:``)+(t?` checked`:``),onClick:e=>{e.stopPropagation(),c()},children:[(0,M.jsx)(`input`,{type:`checkbox`,className:`viewed-checkbox`+(n?` stale`:``),checked:t,readOnly:!0,tabIndex:-1}),n?`Changed`:`Viewed`]})]}),E?(0,M.jsx)(ih,{fileDiff:e,diffStyle:r,lineAnnotations:x,selectedLines:S,renderAnnotation:C,onGutterUtilityClick:w,onLineNumberClick:p,commentsEnabled:h}):!i&&(0,M.jsx)(`div`,{style:{height:ne}})]})}function oh({fileHashes:e,viewed:t}){let n=Object.keys(e).length,r=Object.entries(e).filter(([e,n])=>t[e]===n).length;return n===0?null:(0,M.jsxs)(`div`,{className:`progress-bar`,children:[(0,M.jsxs)(`span`,{children:[r,`/`,n,` files viewed`]}),(0,M.jsx)(`div`,{className:`progress-track`,children:(0,M.jsx)(`div`,{className:`progress-fill`,style:{width:`${r/n*100}%`}})})]})}function sh({onClose:e,children:t}){let n=(0,j.useRef)(null);return(0,j.useEffect)(()=>n.current?.showModal(),[]),(0,M.jsx)(`dialog`,{ref:n,className:`help-modal`,onClose:e,onClick:e=>{e.target===e.currentTarget&&n.current?.close()},children:t})}var ch=[[`j / k`,`Next / previous line`],[`n / p`,`Next / previous file`],[`v`,`Toggle viewed`],[`e / E`,`Toggle collapse file / all files`],[`s`,`Toggle split mode (responsive / unified)`],[`c`,`Comment on line`],[`Esc`,`Close / cancel`],[`?`,`Toggle this help`]];function lh({onClose:e}){return(0,M.jsxs)(sh,{onClose:e,children:[(0,M.jsx)(`h3`,{children:`Keyboard Shortcuts`}),(0,M.jsx)(`table`,{children:(0,M.jsx)(`tbody`,{children:ch.map(([e,t])=>(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`td`,{children:e.split(` / `).map((e,t)=>(0,M.jsxs)(`span`,{children:[t>0&&` / `,(0,M.jsx)(`kbd`,{children:e})]},e))}),(0,M.jsx)(`td`,{children:t})]},e))})})]})}function uh({onClose:e,vcs:t}){return(0,M.jsxs)(sh,{onClose:e,children:[(0,M.jsxs)(`p`,{children:[`Comments work by inserting lines into the code. This can only work if the`,` `,t===`jj`?(0,M.jsxs)(M.Fragment,{children:[`revset includes `,(0,M.jsx)(`code`,{children:`@`})]}):`commit range includes the working copy`,`. Otherwise, the inserted lines will land in`,` `,t===`jj`?(0,M.jsx)(`code`,{children:`@`}):`the working copy`,` but not in the diff being viewed.`]}),t===`jj`?(0,M.jsxs)(`p`,{children:[`The easiest way to get a diff with comments enabled is to run with the`,` `,(0,M.jsx)(`code`,{children:`-f`}),` flag to get a diff that starts at some revision and ends at`,` `,(0,M.jsx)(`code`,{children:`@`}),`.`]}):(0,M.jsxs)(`p`,{children:[`The easiest way to get a diff with comments enabled is to run with `,(0,M.jsx)(`code`,{children:`-f`}),` `,`only (no `,(0,M.jsx)(`code`,{children:`-t`}),`), so the diff goes from a commit to the working tree.`]})]})}function dh({onLearnMore:e,vcs:t}){return(0,M.jsxs)(`div`,{className:`comments-disabled-banner`,children:[t===`jj`?(0,M.jsxs)(M.Fragment,{children:[`Comments are disabled because the revset does not include `,(0,M.jsx)(`code`,{children:`@`}),`.`]}):`Comments are disabled because the commit range does not end at the working copy.`,` `,(0,M.jsx)(`a`,{href:`#`,onClick:t=>{t.preventDefault(),e()},children:`Learn more`})]})}var fh=[`responsive`,`unified`];function ph(){let e=Im(),[t,n]=(0,j.useState)(`responsive`),r=t===`responsive`&&e?`split`:`unified`,{toast:i,showToast:a}=Lm(),[o,s]=(0,j.useState)({}),[c,l]=(0,j.useState)(null),[u,d]=(0,j.useState)(null),f=(0,j.useRef)(!1),{data:p,error:m,isLoading:h}=st({queryKey:[`diff`],queryFn:()=>Pm(`/api/diff`)});(0,j.useEffect)(()=>{p?.revset&&(document.title=`skepsis | ${p.revset}`)},[p?.revset]),(0,j.useEffect)(()=>{if(f.current||!p?.fileHashes)return;f.current=!0;let e={};for(let[t,n]of Object.entries(p.fileHashes))p.viewed[t]===n&&(e[t]=!0);s(e)},[p]);let g=Ke(),_=ct({mutationFn:({file:e,hash:t,mark:n})=>Pm(`/api/viewed`,{method:n?`POST`:`DELETE`,body:{file:e,hash:t}}),onSettled:()=>g.invalidateQueries({queryKey:[`diff`]})}),v=ct({mutationFn:({file:e,afterLine:t,text:n})=>Pm(`/api/comment`,{method:`POST`,body:{file:e,afterLine:t,text:n}}),onSuccess:()=>l(null),onSettled:()=>g.invalidateQueries({queryKey:[`diff`]})}),y=ct({mutationFn:({file:e,line:t})=>Pm(`/api/comment`,{method:`DELETE`,body:{file:e,line:t}}),onSettled:()=>g.invalidateQueries({queryKey:[`diff`]})}),b=p?.patch,x=(0,j.useMemo)(()=>b?qp(b).flatMap(e=>e.files):[],[b]),S=(0,j.useMemo)(()=>{let e={...p?.viewed};if(_.isPending&&_.variables){let{file:t,hash:n,mark:r}=_.variables;r?e[t]=n:delete e[t]}return e},[p,_.isPending,_.variables]),[C,w]=(0,j.useState)(0),[ee,T]=(0,j.useState)(0),[te,E]=(0,j.useState)(!1),[ne,re]=(0,j.useState)(!1),ie=(0,j.useRef)(null),ae=(0,j.useRef)(0),oe=(0,j.useRef)({focusedFileIdx:0,cursorIdx:0,showHelp:!1,composing:null,selected:null,files:[],collapsed:{},fileHashes:{},viewed:{},markMutate:_.mutate});oe.current={focusedFileIdx:C,cursorIdx:ee,showHelp:te,composing:c,selected:u,files:x,collapsed:o,fileHashes:p?.fileHashes??{},viewed:S,markMutate:_.mutate};let se=(0,j.useCallback)((e,t,n)=>{let r=oe.current.selected;if(r&&r.file===e&&r.line===t&&r.side===n){d(null),history.replaceState(null,``,location.pathname+location.search);return}let i={file:e,line:t,side:n};d(i),history.replaceState(null,``,`#`+Bm(i));let a=oe.current.files.findIndex(t=>t.name===e);a>=0&&w(a)},[]),ce=(0,j.useCallback)(e=>{let t=oe.current.files.findIndex(t=>t.name===e.file);if(t<0)return;w(t),s(t=>t[e.file]?{...t,[e.file]:!1}:t),document.querySelectorAll(`.file-card`)[t]?.scrollIntoView({block:`start`});let n=0,r=()=>{let i=$m(t,e);if(i){i.scrollIntoView({block:`center`});return}n++<120&&requestAnimationFrame(r)};requestAnimationFrame(r)},[]),D=(0,j.useRef)(!1);(0,j.useEffect)(()=>{if(D.current||x.length===0)return;D.current=!0;let e=Vm(location.hash);e&&(d(e),ce(e))},[x,ce]),(0,j.useEffect)(()=>{let e=()=>{let e=Vm(location.hash);d(e),e&&ce(e)};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[ce]),(0,j.useLayoutEffect)(()=>{Km();let e=ie.current;ie.current=null,e===`file`&&document.querySelectorAll(`.file-card`)[C]?.scrollIntoView({block:`start`});let t=x[C];if(!t||(o[t.name]??!1))return;let n=Hm(C),r=n[Math.min(ee,Math.max(n.length-1,0))];if(!r)return;let i=r.gutterEl.getRootNode();i instanceof ShadowRoot&&qm(i),r.gutterEl.setAttribute(`data-cursor-line`,``),r.contentEl.setAttribute(`data-cursor-line`,``),e===`line`&&r.contentEl.scrollIntoView({block:`nearest`})},[C,ee,b,c,o,x]),(0,j.useEffect)(()=>{function e(e){if(e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLInputElement||e.ctrlKey||e.metaKey||e.altKey)return;let t=oe.current;switch(e.key){case`?`:e.preventDefault(),E(e=>!e);break;case`Escape`:t.showHelp?(e.preventDefault(),E(!1)):t.composing&&(e.preventDefault(),l(null));break;case`n`:case`p`:{if(t.showHelp||t.composing)break;e.preventDefault();let n=e.key===`n`?1:-1,r=Math.max(0,Math.min(t.focusedFileIdx+n,t.files.length-1));r!==t.focusedFileIdx&&(ae.current=Date.now(),w(r),T(0),ie.current=`file`);break}case`j`:case`k`:{if(t.showHelp||t.composing)break;e.preventDefault();let n=t.files[t.focusedFileIdx]?.name;if(!n||(t.collapsed[n]??!1))break;let r=Hm(t.focusedFileIdx);if(r.length===0)break;let i=t.cursorIdx,a=r[Math.min(i,r.length-1)];if(a&&!Gm(a.contentEl,t.focusedFileIdx)){let e=Wm(t.focusedFileIdx);e>=0&&(i=e)}let o=Math.max(0,Math.min(i+(e.key===`j`?1:-1),r.length-1));o!==t.cursorIdx&&(ae.current=Date.now(),T(o),ie.current=`line`);break}case`v`:{if(t.showHelp||t.composing)break;e.preventDefault();let n=t.files[t.focusedFileIdx];if(!n)break;let r=t.fileHashes[n.name];if(!r)break;let i=t.viewed[n.name]!==r;s(e=>({...e,[n.name]:i})),t.markMutate({file:n.name,hash:r,mark:i});break}case`e`:{if(t.showHelp||t.composing)break;e.preventDefault();let n=t.files[t.focusedFileIdx];if(!n)break;ae.current=Date.now(),s(e=>({...e,[n.name]:!(e[n.name]??!1)}));break}case`E`:{if(t.showHelp||t.composing)break;e.preventDefault(),ae.current=Date.now();let n=t.files.some(e=>!(t.collapsed[e.name]??!1));s(Object.fromEntries(t.files.map(e=>[e.name,n])));break}case`s`:if(t.showHelp||t.composing)break;e.preventDefault(),n(e=>{let t=fh[(fh.indexOf(e)+1)%fh.length];return a((0,M.jsxs)(M.Fragment,{children:[`Split mode: `,(0,M.jsx)(`code`,{children:t})]})),t});break;case`c`:{if(!p?.commentsEnabled||t.showHelp||t.composing)break;e.preventDefault();let n=t.files[t.focusedFileIdx];if(!n||(t.collapsed[n.name]??!1))break;let r=Hm(t.focusedFileIdx)[t.cursorIdx];if(!r||r.lineType===`change-deletion`)break;l({file:n.name,line:r.lineNumber});break}}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a,p?.commentsEnabled]);let O=(0,j.useRef)(new Set);if((0,j.useEffect)(()=>{O.current.clear();let e=new IntersectionObserver(e=>{for(let t of e){let e=Number(t.target.dataset.fileIdx);t.isIntersecting?O.current.add(e):O.current.delete(e)}if(Date.now()-ae.current<150||O.current.size===0)return;let t=Math.min(...O.current),n=oe.current;if(t!==n.focusedFileIdx){w(t);let e=n.files[t];if(e&&!(n.collapsed[e.name]??!1)){let e=Wm(t);e>=0&&T(e)}}},{threshold:0});return document.querySelectorAll(`.file-card`).forEach((t,n)=>{t.dataset.fileIdx=String(n),e.observe(t)}),()=>e.disconnect()},[x]),h||!p)return(0,M.jsx)(`div`,{className:`empty-diff`,children:`Loading...`});if(m)return(0,M.jsx)(`pre`,{style:{color:`red`,padding:20},children:String(m)});if(p.error)return(0,M.jsx)(`pre`,{style:{color:`red`,padding:20},children:p.error});if(!b)return(0,M.jsxs)(`div`,{className:`empty-diff`,children:[(0,M.jsx)(`code`,{children:p.revset}),` is empty`]});let{fileHashes:le}=p;return(0,M.jsxs)(M.Fragment,{children:[!p.commentsEnabled&&(0,M.jsx)(dh,{vcs:p.vcs,onLearnMore:()=>re(!0)}),(0,M.jsxs)(`div`,{className:`diff-container`,children:[(0,M.jsx)(oh,{fileHashes:le,viewed:S}),te&&(0,M.jsx)(lh,{onClose:()=>E(!1)}),ne&&(0,M.jsx)(uh,{vcs:p.vcs,onClose:()=>re(!1)}),i&&(0,M.jsx)(`div`,{className:`toast`,children:i.content},i.key),x.map((e,t)=>{let n=e.name,i=le[n],a=S[n],d=i!=null&&a===i,f=a!=null&&i!=null&&a!==i,m=o[n]??!1;return(0,M.jsx)(ah,{fileDiff:e,isViewed:d,isStale:f,diffStyle:r,collapsed:m,composing:c?.file===n?{line:c.line}:null,anchor:u?.file===n?u:null,focused:t===C,onToggleCollapse:()=>s(e=>({...e,[n]:!m})),onToggleViewed:()=>{if(i){let e=!d;s(t=>({...t,[n]:e})),_.mutate({file:n,hash:i,mark:e})}},onStartComment:e=>{v.reset(),l({file:n,line:e})},onSubmitComment:(e,t)=>v.mutate({file:n,afterLine:e,text:t}),onResolveComment:e=>y.mutate({file:n,line:e}),onCancelComment:()=>l(null),onSelectLine:(e,t)=>se(n,e,t),commentsEnabled:p.commentsEnabled,submitting:v.isPending&&v.variables?.file===n,submitError:v.variables?.file===n&&v.error?v.error.message:null},n??t)})]})]})}function mh(){return(0,M.jsx)(qe,{client:Nm,children:(0,M.jsx)(ph,{})})}(0,u.createRoot)(document.getElementById(`root`)).render((0,M.jsx)(mh,{})); \ No newline at end of file diff --git a/dist/assets/index-DP_ri0XS.js b/dist/assets/index-DP_ri0XS.js deleted file mode 100644 index 443f370..0000000 --- a/dist/assets/index-DP_ri0XS.js +++ /dev/null @@ -1,1894 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-BZNntD0J.js","assets/rolldown-runtime-S-ySWqyJ.js","assets/html-ddqpqPg0.js","assets/css-DRmnABqB.js","assets/javascript-Cop1kpy_.js","assets/angular-ts-SQQMYL2C.js","assets/scss-DNczJ95n.js","assets/apl-D5V6uPDr.js","assets/json-CTw4n7kn.js","assets/xml-eU7M3iZJ.js","assets/java-DVLnIrqC.js","assets/astro-DeXKSaFP.js","assets/postcss-BTQso3H9.js","assets/tsx-BjkCKOtw.js","assets/typescript-BoHeP9q1.js","assets/blade-Bu5re0Vg.js","assets/html-derivative-DWGxf_At.js","assets/sql-CrTmZCMa.js","assets/bsl-B1qbqNES.js","assets/sdbl-BmWYR-pI.js","assets/c-Nc9zJT78.js","assets/cairo-BDj8wWhy.js","assets/python-CKg5r0C3.js","assets/cobol-nvZDS9LT.js","assets/coffee-BKLOTq4e.js","assets/cpp-D6g1DVNt.js","assets/glsl-JAhLUe0P.js","assets/regexp-3-A0406L.js","assets/crystal-DfoZI57w.js","assets/shellscript-DaVPunOM.js","assets/edge-DwocGnOF.js","assets/elixir-Dtbfds1r.js","assets/elm-CpPtm471.js","assets/erb--z3IM9Cb.js","assets/ruby-Cl8PVkbY.js","assets/graphql-D2ba3BkR.js","assets/jsx-0oMUGqZj.js","assets/haml-C-oIZcDo.js","assets/lua-31hdJClp.js","assets/yaml-BTD1XHJG.js","assets/erlang-Bc4hQuqa.js","assets/markdown-BaI9LyM4.js","assets/fortran-fixed-form-B02FOYI-.js","assets/fortran-free-form-BPTf0lbT.js","assets/fsharp-DhdR18vN.js","assets/gdresource-DgnrMPIx.js","assets/gdscript-CsadCSaZ.js","assets/gdshader-PfnN_8tR.js","assets/git-commit-DGJi7qBD.js","assets/diff-CdkWtnkL.js","assets/git-rebase-Ce47xoa6.js","assets/glimmer-js-C0BuzxQC.js","assets/glimmer-ts-irOZ-cAQ.js","assets/hack-CgzUpY8l.js","assets/handlebars-CbP-Mhzf.js","assets/http-Bg1nG1nG.js","assets/hurl-zm47Pi1n.js","assets/csv-DNUpVBxl.js","assets/hxml-adC65L_J.js","assets/haxe-DfXTCEOz.js","assets/jinja-Bnj4awH5.js","assets/jison-CuCNs9Q3.js","assets/julia-DNYHzXlE.js","assets/r-UcxRcvcA.js","assets/just-BlWkkmf2.js","assets/perl-CAGVW6Ra.js","assets/latex-DqPzjMIt.js","assets/tex-D8LVuLf5.js","assets/liquid-BURJK16h.js","assets/marko-C2ZcdSLh.js","assets/less-C95PyOu0.js","assets/mdc-N1ii9pk5.js","assets/nextflow-JEyYUlIq.js","assets/nextflow-groovy-wvmJO4hi.js","assets/nginx-BuomO0W8.js","assets/nim-hKoEPsYL.js","assets/php-BycclmzS.js","assets/pug-4maJHz9G.js","assets/qml-JLIQfzyb.js","assets/razor-P8rbooCh.js","assets/csharp-BDKQY1K9.js","assets/rst-C6GHyL-N.js","assets/cmake-D5rSbMir.js","assets/sas-CXoVwlZN.js","assets/shaderlab-DZ3Lsiak.js","assets/hlsl-DpuYn7pp.js","assets/shellsession-COm1V40U.js","assets/soy-DwewhJ_3.js","assets/sparql-B9c85a_o.js","assets/turtle-CqNXyJWZ.js","assets/stata-Bl--TAbZ.js","assets/surrealql-BW79EE-U.js","assets/svelte-ziMErdPi.js","assets/templ-C_9I6ncv.js","assets/go-DLnOLj8q.js","assets/ts-tags-DKuFCGsc.js","assets/twig-Bs1kcsO6.js","assets/vue-Dnf0y5RU.js","assets/vue-html-CRtKS76J.js","assets/vue-vine-BxjPqU7T.js","assets/stylus-sKwvsUaC.js","assets/xsl-DSqe4nTO.js"])))=>i.map(i=>d[i]); -import{n as e,r as t,t as n}from"./rolldown-runtime-S-ySWqyJ.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var r=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,ne());else{var t=n(l);t!==null&&ae(x,t.startTime-e)}}var S=!1,C=-1,w=5,ee=-1;function T(){return g?!0:!(e.unstable_now()-eet&&T());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ae(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ne():S=!1}}}var ne;if(typeof y==`function`)ne=function(){y(te)};else if(typeof MessageChannel<`u`){var re=new MessageChannel,ie=re.port2;re.port1.onmessage=te,ne=function(){ie.postMessage(null)}}else ne=function(){_(te,0)};function ae(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ae(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,ne()))),r},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=n(((e,t)=>{t.exports=r()})),a=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},ee=Object.prototype.hasOwnProperty;function T(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function te(e,t){return T(e.type,t,e.props)}function ne(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function re(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ie=/\/+/g;function ae(e,t){return typeof e==`object`&&e&&e.key!=null?re(``+e.key):t.toString(36)}function oe(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function se(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,se(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ae(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ie,`$&/`)+`/`),se(o,r,i,``,function(e){return e})):o!=null&&(ne(o)&&(o=te(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ie,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=a()})),s=n((e=>{var t=o();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=n((e=>{var t=i(),n=o(),r=c();function a(e){var t=`https://react.dev/errors/`+e;if(1fe||(e.current=de[fe],de[fe]=null,fe--)}function O(e,t){fe++,de[fe]=e.current,e.current=t}var he=pe(null),ge=pe(null),k=pe(null),_e=pe(null);function ve(e,t){switch(O(k,t),O(ge,e),O(he,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}me(he),O(he,e)}function ye(){me(he),me(ge),me(k)}function be(e){e.memoizedState!==null&&O(_e,e);var t=he.current,n=Hd(t,e.type);t!==n&&(O(ge,e),O(he,n))}function xe(e){ge.current===e&&(me(he),me(ge)),_e.current===e&&(me(_e),Qf._currentValue=ue)}var Se,Ce;function we(e){if(Se===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Se=t&&t[1]||``,Ce=-1)`:-1i||c[r]!==l[i]){var u=` -`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Te=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?we(n):``}function De(e,t){switch(e.tag){case 26:case 27:case 5:return we(e.type);case 16:return we(`Lazy`);case 13:return e.child!==t&&t!==null?we(`Suspense Fallback`):we(`Suspense`);case 19:return we(`SuspenseList`);case 0:case 15:return Ee(e.type,!1);case 11:return Ee(e.type.render,!1);case 1:return Ee(e.type,!0);case 31:return we(`Activity`);default:return``}}function Oe(e){try{var t=``,n=null;do t+=De(e,n),n=e,e=e.return;while(e);return t}catch(e){return` -Error generating stack: `+e.message+` -`+e.stack}}var ke=Object.prototype.hasOwnProperty,Ae=t.unstable_scheduleCallback,je=t.unstable_cancelCallback,Me=t.unstable_shouldYield,Ne=t.unstable_requestPaint,Pe=t.unstable_now,Fe=t.unstable_getCurrentPriorityLevel,Ie=t.unstable_ImmediatePriority,Le=t.unstable_UserBlockingPriority,Re=t.unstable_NormalPriority,ze=t.unstable_LowPriority,Be=t.unstable_IdlePriority,Ve=t.log,He=t.unstable_setDisableYieldValue,Ue=null,We=null;function Ge(e){if(typeof Ve==`function`&&He(e),We&&typeof We.setStrictMode==`function`)try{We.setStrictMode(Ue,e)}catch{}}var A=Math.clz32?Math.clz32:qe,j=Math.log,Ke=Math.LN2;function qe(e){return e>>>=0,e===0?32:31-(j(e)/Ke|0)|0}var Je=256,Ye=262144,Xe=4194304;function Ze(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Qe(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ze(n))):i=Ze(o):i=Ze(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ze(n))):i=Ze(o)):i=Ze(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function $e(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function et(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function tt(){var e=Xe;return Xe<<=1,!(Xe&62914560)&&(Xe=4194304),e}function nt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function rt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function it(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),pn=!1;if(fn)try{var mn={};Object.defineProperty(mn,`passive`,{get:function(){pn=!0}}),window.addEventListener(`test`,mn,mn),window.removeEventListener(`test`,mn,mn)}catch{pn=!1}var hn=null,gn=null,_n=null;function vn(){if(_n)return _n;var e,t=gn,n=t.length,r,i=`value`in hn?hn.value:hn.textContent,a=i.length;for(e=0;e=Xn),$n=` `,er=!1;function tr(e,t){switch(e){case`keyup`:return Jn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function nr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var rr=!1;function ir(e,t){switch(e){case`compositionend`:return nr(t);case`keypress`:return t.which===32?(er=!0,$n):null;case`textInput`:return e=t.data,e===$n&&er?null:e;default:return null}}function ar(e,t){if(rr)return e===`compositionend`||!Yn&&tr(e,t)?(e=vn(),_n=gn=hn=null,rr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Dr(n)}}function kr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?kr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ar(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ht(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ht(e.document)}return t}function jr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Mr=fn&&`documentMode`in document&&11>=document.documentMode,Nr=null,Pr=null,Fr=null,Ir=!1;function Lr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ir||Nr==null||Nr!==Ht(r)||(r=Nr,`selectionStart`in r&&jr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Fr&&Er(Fr,r)||(Fr=r,r=Dd(Pr,`onSelect`),0>=o,i-=o,Oi=1<<32-A(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),L&&Ai(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),L&&Ai(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return L&&Ai(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),L&&Ai(i,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=i(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===ne&&Aa(l)===r.type){n(e,r.sibling),c=i(r,o.props),La(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=hi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=mi(o.type,o.key,o.props,null,e.mode,c),La(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=i(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=vi(o,e.mode,c),c.return=e,e=c}return s(e);case ne:return o=Aa(o),b(e,r,o,c)}if(le(o))return h(e,r,o,c);if(oe(o)){if(l=oe(o),typeof l!=`function`)throw Error(a(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Ia(o),c);if(o.$$typeof===C)return b(e,r,ia(e,o),c);Ra(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,o),c.return=e,e=c):(n(e,r),c=gi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Fa=0;var i=b(e,t,n,r);return Pa=null,i}catch(t){if(t===wa||t===Ea)throw t;var a=di(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ba=za(!0),Va=za(!1),Ha=!1;function Ua(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ga(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ka(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,U&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ci(e),si(e,null,n),t}return ii(e,r,t,n),ci(e)}function qa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ot(e,n)}}function Ja(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ya=!1;function Xa(){if(Ya){var e=ha;if(e!==null)throw e}}function Za(e,t,n,r){Ya=!1;var i=e.updateQueue;Ha=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(K&f)===f:(r&f)===f){f!==0&&f===ma&&(Ya=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Ha=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Jl|=o,e.lanes=o,e.memoizedState=d}}function Qa(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function $a(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=E.T,s={};E.T=s,Ls(e,!1,t,n);try{var c=i(),l=E.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Is(e,t,va(c,r),mu(e)):Is(e,t,r,mu(e))}catch(n){Is(e,t,{then:function(){},status:`rejected`,reason:n},mu())}finally{D.p=a,o!==null&&s.types!==null&&(o.types=s.types),E.T=o}}function Es(){}function Ds(e,t,n,r){if(e.tag!==5)throw Error(a(476));var i=Os(e).queue;Ts(e,i,t,ue,n===null?Es:function(){return ks(e),n(r)})}function Os(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ue,baseState:ue,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:ue},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ks(e){var t=Os(e);t.next===null&&(t=e.alternate.memoizedState),Is(e,t.next.queue,{},mu())}function As(){return ra(Qf)}function js(){return Po().memoizedState}function Ms(){return Po().memoizedState}function Ns(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=mu();e=Ga(n);var r=Ka(t,e,n);r!==null&&(gu(r,t,n),qa(r,t,n)),t={cache:ua()},e.payload=t;return}t=t.return}}function Ps(e,t,n){var r=mu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Rs(e)?zs(t,n):(n=ai(e,t,n,r),n!==null&&(gu(n,e,r),Bs(n,t,r)))}function Fs(e,t,n){Is(e,t,n,mu())}function Is(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Rs(e))zs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Tr(s,o))return ii(e,t,i,0),W===null&&ri(),!1}catch{}if(n=ai(e,t,i,r),n!==null)return gu(n,e,r),Bs(n,t,r),!0}return!1}function Ls(e,t,n,r){if(r={lane:2,revertLane:fd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Rs(e)){if(t)throw Error(a(479))}else t=ai(e,n,r,2),t!==null&&gu(t,e,2)}function Rs(e){var t=e.alternate;return e===R||t!==null&&t===R}function zs(e,t){vo=_o=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Bs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ot(e,n)}}var Vs={readContext:ra,use:Lo,useCallback:wo,useContext:wo,useEffect:wo,useImperativeHandle:wo,useLayoutEffect:wo,useInsertionEffect:wo,useMemo:wo,useReducer:wo,useRef:wo,useState:wo,useDebugValue:wo,useDeferredValue:wo,useTransition:wo,useSyncExternalStore:wo,useId:wo,useHostTransitionStatus:wo,useFormState:wo,useActionState:wo,useOptimistic:wo,useMemoCache:wo,useCacheRefresh:wo};Vs.useEffectEvent=wo;var Hs={readContext:ra,use:Lo,useCallback:function(e,t){return No().memoizedState=[e,t===void 0?null:t],e},useContext:ra,useEffect:ps,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ds(4194308,4,ys.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ds(4194308,4,e,t)},useInsertionEffect:function(e,t){ds(4,2,e,t)},useMemo:function(e,t){var n=No();t=t===void 0?null:t;var r=e();if(yo){Ge(!0);try{e()}finally{Ge(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=No();if(n!==void 0){var i=n(t);if(yo){Ge(!0);try{n(t)}finally{Ge(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ps.bind(null,R,e),[r.memoizedState,e]},useRef:function(e){var t=No();return e={current:e},t.memoizedState=e},useState:function(e){e=Yo(e);var t=e.queue,n=Fs.bind(null,R,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:xs,useDeferredValue:function(e,t){return ws(No(),e,t)},useTransition:function(){var e=Yo(!1);return e=Ts.bind(null,R,e.queue,!0,!1),No().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=R,i=No();if(L){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),W===null)throw Error(a(349));K&127||Wo(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,ps(Ko.bind(null,r,o,e),[e]),r.flags|=2048,ls(9,{destroy:void 0},Go.bind(null,r,o,n,t),null),n},useId:function(){var e=No(),t=W.identifierPrefix;if(L){var n=ki,r=Oi;n=(r&~(1<<32-A(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=bo++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}o[pt]=t,o[mt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch($(o,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Ic(t)}}return V(t),Lc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ic(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=k.current,Ui(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Fi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[pt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Nd(e.nodeValue,n)),e||Bi(t,!0)}else e=Bd(e).createTextNode(r),e[pt]=t,t.stateNode=e}return V(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ui(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[pt]=t}else Wi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;V(t),e=!1}else n=Gi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(fo(t),t):(fo(t),null);if(t.flags&128)throw Error(a(558))}return V(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Ui(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));i[pt]=t}else Wi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;V(t),i=!1}else i=Gi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(fo(t),t):(fo(t),null)}return fo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),zc(t,t.updateQueue),V(t),null);case 4:return ye(),e===null&&Cd(t.stateNode.containerInfo),V(t),null;case 10:return Zi(t.type),V(t),null;case 19:if(me(po),r=t.memoizedState,r===null)return V(t),null;if(i=(t.flags&128)!=0,o=r.rendering,o===null)if(i)Bc(r,!1);else{if(ql!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=mo(e),o!==null){for(t.flags|=128,Bc(r,!1),e=o.updateQueue,t.updateQueue=e,zc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)pi(n,e),n=n.sibling;return O(po,po.current&1|2),L&&Ai(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Pe()>iu&&(t.flags|=128,i=!0,Bc(r,!1),t.lanes=4194304)}else{if(!i)if(e=mo(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,zc(t,e),Bc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!L)return V(t),null}else 2*Pe()-r.renderingStartTime>iu&&n!==536870912&&(t.flags|=128,i=!0,Bc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(V(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Pe(),e.sibling=null,n=po.current,O(po,i?n&1|2:n&1),L&&Ai(t,r.treeForkCount),e);case 22:case 23:return fo(t),io(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(V(t),t.subtreeFlags&6&&(t.flags|=8192)):V(t),n=t.updateQueue,n!==null&&zc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&me(ba),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Zi(la),V(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function Hc(e,t){switch(Ni(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Zi(la),ye(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return xe(t),null;case 31:if(t.memoizedState!==null){if(fo(t),t.alternate===null)throw Error(a(340));Wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(fo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));Wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return me(po),null;case 4:return ye(),null;case 10:return Zi(t.type),null;case 22:case 23:return fo(t),io(),e!==null&&me(ba),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Zi(la),null;case 25:return null;default:return null}}function Uc(e,t){switch(Ni(t),t.tag){case 3:Zi(la),ye();break;case 26:case 27:case 5:xe(t);break;case 4:ye();break;case 31:t.memoizedState!==null&&fo(t);break;case 13:fo(t);break;case 19:me(po);break;case 10:Zi(t.type);break;case 22:case 23:fo(t),io(),e!==null&&me(ba);break;case 24:Zi(la)}}function Wc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){X(t,t.return,e)}}function Gc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){X(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){X(t,t.return,e)}}function Kc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{$a(t,n)}catch(t){X(e,e.return,t)}}}function qc(e,t,n){n.props=Ys(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){X(e,t,n)}}function Jc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){X(e,t,n)}}function Yc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){X(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){X(e,t,n)}else n.current=null}function Xc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){X(e,e.return,t)}}function Zc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[mt]=t}catch(t){X(e,e.return,t)}}function Qc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function $c(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Qc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function el(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=nn));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(el(e,t,n),e=e.sibling;e!==null;)el(e,t,n),e=e.sibling}function tl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(tl(e,t,n),e=e.sibling;e!==null;)tl(e,t,n),e=e.sibling}function nl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);$(t,r,n),t[pt]=e,t[mt]=n}catch(t){X(e,e.return,t)}}var rl=!1,il=!1,al=!1,ol=typeof WeakSet==`function`?WeakSet:Set,sl=null;function cl(e,t){if(e=e.containerInfo,Rd=sp,e=Ar(e),jr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,sl=t;sl!==null;)if(t=sl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,sl=e;else for(;sl!==null;){switch(t=sl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),$(o,r,n),o[pt]=e,Et(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=Or(s,h),v=Or(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,E.T=null,n=uu,uu=null;var o=J,s=cu;if(su=0,Y=J=null,cu=0,U&6)throw Error(a(331));var c=U;if(U|=4,Ll(o.current),kl(o,o.current,s,n),U=c,ad(0,!1),We&&typeof We.onPostCommitFiberRoot==`function`)try{We.onPostCommitFiberRoot(Ue,o)}catch{}return!0}finally{D.p=i,E.T=r,Hu(e,t)}}function Gu(e,t,n){t=bi(n,t),t=tc(e.stateNode,t,2),e=Ka(e,t,2),e!==null&&(rt(e,2),id(e))}function X(e,t,n){if(e.tag===3)Gu(e,e,n);else for(;t!==null;){if(t.tag===3){Gu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ou===null||!ou.has(r))){e=bi(n,e),n=nc(2),r=Ka(t,n,2),r!==null&&(rc(n,r,t,e),rt(r,2),id(r));break}}t=t.return}}function Ku(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Vl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Gl=!0,i.add(n),e=qu.bind(null,e,t,n),t.then(e,e))}function qu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,W===e&&(K&n)===n&&(ql===4||ql===3&&(K&62914560)===K&&300>Pe()-nu?!(U&2)&&Cu(e,0):Xl|=n,Ql===K&&(Ql=0)),id(e)}function Ju(e,t){t===0&&(t=tt()),e=oi(e,t),e!==null&&(rt(e,t),id(e))}function Yu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ju(e,n)}function Xu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),Ju(e,n)}function Zu(e,t){return Ae(e,t)}var Qu=null,$u=null,ed=!1,td=!1,nd=!1,rd=0;function id(e){e!==$u&&e.next===null&&($u===null?Qu=$u=e:$u=$u.next=e),td=!0,ed||(ed=!0,dd())}function ad(e,t){if(!nd&&td){nd=!0;do for(var n=!1,r=Qu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-A(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ud(r,a))}else a=K,a=Qe(r,r===W?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||$e(r,a)||(n=!0,ud(r,a));r=r.next}while(n);nd=!1}}function od(){sd()}function sd(){td=ed=!1;var e=0;rd!==0&&Gd()&&(e=rd);for(var t=Pe(),n=null,r=Qu;r!==null;){var i=r.next,a=cd(r,t);a===0?(r.next=null,n===null?Qu=i:n.next=i,i===null&&($u=n)):(n=r,(e!==0||a&3)&&(td=!0)),r=i}su!==0&&su!==5||ad(e,!1),rd!==0&&(rd=0)}function cd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Wt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),$(t,`link`,e),Et(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Wt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Wt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Wt(n.imageSizes)+`"]`)):i+=`[href="`+Wt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),$(t,`link`,e),Et(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Wt(r)+`"][href="`+Wt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),$(r,`link`,e),Et(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=Tt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);Et(c),$(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=Tt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),Et(a),$(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=Tt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),Et(a),$(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=k.current)?gf(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=Tt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=Tt(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(i,e,n,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=Tt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Af(e){return`href="`+Wt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),$(t,`link`,n),Et(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Wt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Wt(n.href)+`"]`);if(r)return t.instance=r,Et(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Et(r),$(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var o=e.querySelector(jf(i));if(o)return t.state.loading|=4,t.instance=o,Et(o),o;r=Mf(n),(i=mf.get(i))&&Rf(r,i),o=(e.ownerDocument||e).createElement(`link`),Et(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),$(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(i=e.querySelector(Ff(o)))?(t.instance=i,Et(i),i):(r=n,(i=mf.get(o))&&(r=h({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Et(i),$(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Et(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),Et(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),$(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=l()}))(),d=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},f=new class extends d{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},p={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},m=new class{#e=p;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function h(e){setTimeout(e,0)}var g=typeof window>`u`||`Deno`in globalThis;function _(){}function v(e,t){return typeof e==`function`?e(t):e}function y(e){return typeof e==`number`&&e>=0&&e!==1/0}function b(e,t){return Math.max(e+(t||0)-Date.now(),0)}function x(e,t){return typeof e==`function`?e(t):e}function S(e,t){return typeof e==`function`?e(t):e}function C(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ee(o,t.options))return!1}else if(!te(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function w(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(T(t.options.mutationKey)!==T(a))return!1}else if(!te(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ee(e,t){return(t?.queryKeyHashFn||T)(e)}function T(e){return JSON.stringify(e,(e,t)=>oe(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function te(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>te(e[n],t[n])):!1}var ne=Object.prototype.hasOwnProperty;function re(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ae(e)&&ae(t);if(!r&&!(oe(e)&&oe(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{m.setTimeout(t,e)})}function le(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:re(e,t)}function E(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function D(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ue=Symbol();function de(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ue?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function fe(e,t){return typeof e==`function`?e(...t):!!e}function pe(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var me=(()=>{let e=()=>g;return{isServer(){return e()},setIsServer(t){e=t}}})();function O(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var he=h;function ge(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=he,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var k=ge(),_e=new class extends d{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function ve(e){return Math.min(1e3*2**e,3e4)}function ye(e){return(e??`online`)===`online`?_e.isOnline():!0}var be=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function xe(e){let t=!1,n=0,r,i=O(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new be(t);p(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>f.isFocused()&&(e.networkMode===`always`||_e.isOnline())&&e.canRun(),u=()=>ye(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},p=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(me.isServer()?0:3),o=e.retryDelay??ve,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&nl()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?h():m().then(h),i)}}var Se=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),y(this.gcTime)&&(this.#e=m.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(me.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(m.clearTimeout(this.#e),void 0)}},Ce=class extends Se{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Ee(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ee(this.options);e.data!==void 0&&(this.setState(Te(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=le(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#c({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(_).catch(_):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>S(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ue||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>x(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!b(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o||this.#s()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#s(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=de(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=xe({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof be&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof be){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...we(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Te(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),k.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function we(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ye(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Te(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ee(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var De=class extends d{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=O(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ke(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ae(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ae(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof S(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!ie(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&je(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||S(this.options.enabled,this.#t)!==S(t.enabled,this.#t)||x(this.options.staleTime,this.#t)!==x(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||S(this.options.enabled,this.#t)!==S(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Ne(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(_)),t}#g(){this.#b();let e=x(this.options.staleTime,this.#t);if(me.isServer()||this.#r.isStale||!y(e))return;let t=b(this.#r.dataUpdatedAt,e)+1;this.#d=m.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(me.isServer()||S(this.options.enabled,this.#t)===!1||!y(this.#p)||this.#p===0)&&(this.#f=m.setInterval(()=>{(this.options.refetchIntervalInBackground||f.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(m.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(m.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ke(e,t),o=i&&je(e,n,t,r);(a||o)&&(l={...l,...we(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=le(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=le(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Me(e,t),refetch:this.refetch,promise:this.#o,isEnabled:S(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=O())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!ie(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){k.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Oe(e,t){return S(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function ke(e,t){return Oe(e,t)||e.state.data!==void 0&&Ae(e,t,t.refetchOnMount)}function Ae(e,t,n){if(S(t.enabled,e)!==!1&&x(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Me(e,t)}return!1}function je(e,t,n,r){return(e!==t||S(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Me(e,n)}function Me(e,t){return S(t.enabled,e)!==!1&&e.isStaleByTime(x(t.staleTime,e))}function Ne(e,t){return!ie(e.getCurrentResult(),t)}function Pe(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{pe(e,()=>t.signal,()=>n=!0)},u=de(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?D:E;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Ie:Fe,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Fe(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Fe(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ie(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Le=class extends Se{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Re(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=xe({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),k.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Re(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ze=class extends d{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Le({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Be(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Be(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Be(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Be(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){k.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>w(t,e))}findAll(e={}){return this.getAll().filter(t=>w(e,t))}notify(e){k.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return k.batch(()=>Promise.all(e.map(e=>e.continue().catch(_))))}};function Be(e){return e.options.scope?.id}var Ve=class extends d{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),ie(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&T(t.mutationKey)!==T(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Re();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){k.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},He=class extends d{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??ee(r,t),a=this.get(i);return a||(a=new Ce({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){k.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>C(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>C(e,t)):t}notify(e){k.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){k.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){k.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ue=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new He,this.#t=e.mutationCache||new ze,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=f.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=_e.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(x(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=v(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return k.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;k.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return k.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=k.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(_).catch(_)}invalidateQueries(e,t={}){return k.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=k.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(_)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(_)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(x(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_).catch(_)}fetchInfiniteQuery(e){return e.behavior=Pe(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_).catch(_)}ensureInfiniteQueryData(e){return e.behavior=Pe(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return _e.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(T(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{te(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(T(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{te(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=ee(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===ue&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},We=n((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Ge=n(((e,t)=>{t.exports=We()})),A=t(o(),1),j=Ge(),Ke=A.createContext(void 0),qe=e=>{let t=A.useContext(Ke);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Je=({client:e,children:t})=>(A.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,j.jsx)(Ke.Provider,{value:e,children:t})),Ye=A.createContext(!1),Xe=()=>A.useContext(Ye);Ye.Provider;function Ze(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Qe=A.createContext(Ze()),$e=()=>A.useContext(Qe),et=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?fe(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},tt=e=>{A.useEffect(()=>{e.clearReset()},[e])},nt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||fe(n,[e.error,r])),rt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},it=(e,t)=>e.isLoading&&e.isFetching&&!t,at=(e,t)=>e?.suspense&&t.isPending,ot=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function st(e,t,n){let r=Xe(),i=$e(),a=qe(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,rt(o),et(o,i,s),tt(i);let c=!a.getQueryCache().get(o.queryHash),[l]=A.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(A.useSyncExternalStore(A.useCallback(e=>{let t=d?l.subscribe(k.batchCalls(e)):_;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),A.useEffect(()=>{l.setOptions(o)},[o,l]),at(o,u))throw ot(o,l,i);if(nt({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!me.isServer()&&it(u,r)&&(c?ot(o,l,i):s?.promise)?.catch(_).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function ct(e,t){return st(e,De,t)}function lt(e,t){let n=qe(t),[r]=A.useState(()=>new Ve(n,e));A.useEffect(()=>{r.setOptions(e)},[r,e]);let i=A.useSyncExternalStore(A.useCallback(e=>r.subscribe(k.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=A.useCallback((e,t)=>{r.mutate(e,t).catch(_)},[r]);if(i.error&&fe(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var ut=`diffs-container`,dt=/(?=^From [a-f0-9]+ .+$)/m,ft=/(?=^diff --git)/gm,pt=/(?=^---\s+\S)/gm,mt=/(?=^@@ )/gm,ht=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,gt=/(?<=\n)/,_t=/^(---|\+\+\+)\s+([^\t\r\n]+)/,vt=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,yt=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,bt=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,xt=`header-prefix`,St=`header-metadata`,Ct=`header-custom`,wt={dark:`pierre-dark`,light:`pierre-light`},Tt=`data-theme-css`,Et=`data-unsafe-css`,Dt={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,hunkSeparatorHeight:32,fileGap:8},Ot=Object.freeze({fromStart:0,fromEnd:0}),kt={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},At={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function jt(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Mt(e){return{type:`text`,value:e}}function M({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function Nt({name:e,width:t=16,height:n=16,properties:r}){return M({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[M({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function Pt(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 Ft(e){return M({tagName:`div`,properties:{"data-gutter":``},children:e})}function It(e,t,n,r={}){return M({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[M({tagName:`span`,properties:{"data-line-number-content":``},children:[Mt(`${t}`)]})]})}function Lt(e,t,n){return M({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 Rt(){return M({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[Nt({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function zt(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}var Bt=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],Vt=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Vt.prototype.normal={},Vt.prototype.property={},Vt.prototype.space=void 0;function Ht(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Vt(n,r,t)}function Ut(e){return e.toLowerCase()}var Wt=class{constructor(e,t){this.attribute=t,this.property=e}};Wt.prototype.attribute=``,Wt.prototype.booleanish=!1,Wt.prototype.boolean=!1,Wt.prototype.commaOrSpaceSeparated=!1,Wt.prototype.commaSeparated=!1,Wt.prototype.defined=!1,Wt.prototype.mustUseProperty=!1,Wt.prototype.number=!1,Wt.prototype.overloadedBoolean=!1,Wt.prototype.property=``,Wt.prototype.spaceSeparated=!1,Wt.prototype.space=void 0;var Gt=e({boolean:()=>N,booleanish:()=>qt,commaOrSpaceSeparated:()=>Xt,commaSeparated:()=>Yt,number:()=>P,overloadedBoolean:()=>Jt,spaceSeparated:()=>F}),Kt=0,N=Zt(),qt=Zt(),Jt=Zt(),P=Zt(),F=Zt(),Yt=Zt(),Xt=Zt();function Zt(){return 2**++Kt}var Qt=Object.keys(Gt),$t=class extends Wt{constructor(e,t,n,r){let i=-1;if(super(e,t),en(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&pn.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(fn,gn);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!fn.test(e)){let n=e.replace(dn,hn);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=$t}return new i(r,t)}function hn(e){return`-`+e.toLowerCase()}function gn(e){return e.charAt(1).toUpperCase()}var _n=Ht([nn,on,cn,ln,un],`html`),vn=Ht([nn,sn,cn,ln,un],`svg`),yn={}.hasOwnProperty;function bn(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&yn.call(t,e)){let n=String(t[e]);i=yn.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 xn=/["&'<>`]/g,Sn=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Cn=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,wn=/[|\\{}()[\]^$+*?.]/g,Tn=new WeakMap;function En(e,t){if(e=e.replace(t.subset?Dn(t.subset):xn,r),t.subset||t.escapeOnly)return e;return e.replace(Sn,n).replace(Cn,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 Dn(e){let t=Tn.get(e);return t||(t=On(e),Tn.set(e,t)),t}function On(e){let t=[],n=-1;for(;++n`,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:`€`},Fn=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],In={}.hasOwnProperty,Ln={},Rn;for(Rn in Pn)In.call(Pn,Rn)&&(Ln[Pn[Rn]]=Rn);var zn=/[^\dA-Za-z]/;function Bn(e,t,n,r){let i=String.fromCharCode(e);if(In.call(Ln,i)){let e=Ln[i],a=`&`+e;return n&&Nn.includes(e)&&!Fn.includes(e)&&(!r||t&&t!==61&&zn.test(String.fromCharCode(t)))?a:a+`;`}return``}function Vn(e,t,n){let r=An(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Bn(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=Mn(e,t,n.omitOptionalSemicolons);i.length|^->||--!>|`],Gn=[`<`,`>`];function Kn(e,t,n,r){return r.settings.bogusComments?``:``;function i(e){return Hn(e,Object.assign({},r.settings.characterReferences,{subset:Gn}))}}function qn(e,t,n,r){return``}function Jn(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 Yn(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function Xn(e){return e.join(` `).trim()}var Zn=/[ \t\n\f\r]/g;function Qn(e){return typeof e==`object`?e.type===`text`?$n(e.value):!1:$n(e)}function $n(e){return e.replace(Zn,``)===``}var er=rr(1),tr=rr(-1),nr=[];function rr(e){return t;function t(t,n,r){let i=t?t.children:nr,a=(n||0)+e,o=i[a];if(!r)for(;o&&Qn(o);)a+=e,o=i[a];return o}}var ir={}.hasOwnProperty;function ar(e){return t;function t(t,n,r){return ir.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var or=ar({body:lr,caption:sr,colgroup:sr,dd:pr,dt:fr,head:sr,html:cr,li:dr,optgroup:hr,option:gr,p:ur,rp:mr,rt:mr,tbody:vr,td:xr,tfoot:yr,th:xr,thead:_r,tr:br});function sr(e,t,n){let r=er(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&Qn(r.value.charAt(0)))}function cr(e,t,n){let r=er(n,t);return!r||r.type!==`comment`}function lr(e,t,n){let r=er(n,t);return!r||r.type!==`comment`}function ur(e,t,n){let r=er(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 dr(e,t,n){let r=er(n,t);return!r||r.type===`element`&&r.tagName===`li`}function fr(e,t,n){let r=er(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function pr(e,t,n){let r=er(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function mr(e,t,n){let r=er(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function hr(e,t,n){let r=er(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function gr(e,t,n){let r=er(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function _r(e,t,n){let r=er(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function vr(e,t,n){let r=er(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function yr(e,t,n){return!er(n,t)}function br(e,t,n){let r=er(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function xr(e,t,n){let r=er(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var Sr=ar({body:Tr,colgroup:Er,head:wr,html:Cr,tbody:Dr});function Cr(e){let t=er(e,-1);return!t||t.type!==`comment`}function wr(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 Tr(e){let t=er(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&Qn(t.value.charAt(0)))&&!(t.type===`element`&&(t.tagName===`meta`||t.tagName===`link`||t.tagName===`script`||t.tagName===`style`||t.tagName===`template`))}function Er(e,t,n){let r=tr(n,t),i=er(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&or(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function Dr(e,t,n){let r=tr(n,t),i=er(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&or(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var Or={name:[[` -\f\r &/=>`.split(``),` -\f\r "&'/=>\``.split(``)],[`\0 -\f\r "&'/<=>`.split(``),`\0 -\f\r "&'/<=>\``.split(``)]],unquoted:[[` -\f\r &>`.split(``),`\0 -\f\r "&'<=>\``.split(``)],[`\0 -\f\r "&'<=>\``.split(``),`\0 -\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function kr(e,t,n,r){let i=r.schema,a=i.space===`svg`?!1: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=vn);let l=Ar(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!Sr(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||!or(e,t,n))&&s.push(``),s.join(``)}function Ar(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=jr(e,i,t[i]);r&&n.push(r)}}for(;++rJn(n,e.alternative)&&(o=e.alternative),s=o+Hn(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?Or.single:Or.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var Mr=[`<`,`&`];function Nr(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:Hn(e.value,Object.assign({},r.settings.characterReferences,{subset:Mr}))}function Pr(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Nr(e,t,n,r)}function Fr(e,t,n,r){return r.all(e)}var Ir=bn(`type`,{invalid:Lr,unknown:Rr,handlers:{comment:Kn,doctype:qn,element:kr,raw:Pr,root:Fr,text:Nr}});function Lr(e){throw Error("Expected node, not `"+e+"`")}function Rr(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var zr={},Br={},Vr=[];function Hr(e,t){let n=t||zr,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Ur,all:Wr,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||Bt,characterReferences:n.characterReferences||Br,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?vn:_n,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function Ur(e,t,n){return Ir(e,t,n,this)}function Wr(e){let t=[],n=e&&e.children||Vr,r=-1;for(;++r{if(this.hoveredLine!=null){if(this.mode===`diff`&&this.hoveredLine.type===`diff-line`)return{lineNumber:this.hoveredLine.lineNumber,side:this.hoveredLine.annotationSide};if(this.mode===`file`&&this.hoveredLine.type===`line`)return{lineNumber:this.hoveredLine.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&&ri(e.composedPath())||(ii(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e}))};handlePointerMove=e=>{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||(ii(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(ii(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){ii(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.gutterUtilityContainer?.remove(),this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine())};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();ii(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);ii(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=Xr(i)&&this.hoveredLine?.lineElement===i.lineElement;Yr(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),Yr(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(this.gutterUtilityContainer?.remove(),c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Xr(i)&&(this.setHoveredLine(this.toEventBaseProps(i)),this.gutterUtilityContainer!=null&&i.numberElement.appendChild(this.gutterUtilityContainer),s?.({...this.hoveredLine,event:t})));break}case`click`:{if(i==null)break;if(Qr(i)&&p!=null){p(i);break}if(Zr(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Xr(i))break;Yr(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,ii(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})()),ii(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),ii(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();ri(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e,t):this.startLineSelectionFromPointerDown(e,t)};startLineSelectionFromPointerDown(e,t){let{enableLineSelection:n=!1}=this.options;if(!n)return;let r=this.getSelectionPointerInfo(t,!0);if(r==null)return;let{pre:i}=this;if(i==null)return;e.preventDefault();let{lineNumber:a,eventSide:o,lineIndex:s}=r;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,i.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?s>=t.start:s<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(a,o,!1),this.notifySelectionStart(this.selectedRange),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===a&&this.selectedRange?.end===a){let t={lineNumber:a,side:o};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.selectedRange=null,this.selectionAnchor={lineNumber:a,side:o},this.updateSelection(a,o,!1),this.notifySelectionStart(this.selectedRange),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e,t){let{enableLineSelection:n=!1,onGutterUtilityClick:r}=this.options;if(r==null)return;let i=this.getSelectionPointFromPath(t);i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:i},n&&(this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(i.lineNumber,i.side,!1),this.notifySelectionStart(this.selectedRange)),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{let{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;let n=this.getSelectionPointFromPath(e.composedPath());if(n==null)return;this.pointerSession.current=n,t===!0&&this.updateSelection(n.lineNumber,n.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;let t=this.getSelectionPointerInfo(e.composedPath(),!1);if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;let t=this.getSelectionPointerInfo(e.composedPath(),!1);if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(zt(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.selectedRange),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;let r=this.getSelectionPointFromPath(e.composedPath());r!=null&&(this.pointerSession.current=r,t&&this.updateSelection(r.lineNumber,r.side)),n?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.selectedRange),this.notifySelectionCommitted()),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.selectedRange),this.notifySelectionCommitted();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.selectedRange),this.notifySelectionCommitted()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){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=Hr(Rt());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!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`})}getSelectionPointerInfo(e,t){let n=this.resolvePointerTarget(e);if(Jr(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}getSelectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(Jr(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}updateSelection(e,t,n=!0){let{selectedRange:r}=this,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)}jt(r??void 0,i??void 0)||(this.selectedRange=i,n&&this.notifySelectionChangeDelta(),this.queuedSelectionRender??=requestAnimationFrame(this.renderSelection))}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}renderSelection=()=>{if(this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;let e=this.pre.querySelectorAll(`[data-selected-line]`);for(let t of e)t.removeAttribute(`data-selected-line`);if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;let{children:t}=this.pre;if(t.length===0)return;if(t.length>2)throw console.error(t),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let n=this.pre.getAttribute(`data-diff-type`)===`split`,r=this.getIndexesFromSelection(this.selectedRange,n);if(r==null)throw console.error({rowRange:r,selectedRange:this.selectedRange}),Error(`InteractionManager.renderSelection: No valid rowRange`);let i=r.start===r.end,a=Math.min(r.start,r.end),o=Math.max(r.start,r.end);for(let e of t){let[t,r]=e.children,s=r.children.length;if(s!==t.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);for(let e=0;eo)break;if(l==null||lNumber.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Kr({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,enableHoverUtility:n,lineHoverHighlight:r,onGutterUtilityClick:i,onLineClick:a,onLineEnter:o,onLineLeave:s,onLineNumberClick:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,renderGutterUtility:f,renderHoverUtility:p,__debugPointerEvents:m,enableLineSelection:h,onLineSelected:g,onLineSelectionStart:_,onLineSelectionChange:v,onLineSelectionEnd:y},b,x,S){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:qr({enableGutterUtility:t,enableHoverUtility:n,renderGutterUtility:f,renderHoverUtility:p,onGutterUtilityClick:i}),usesCustomGutterUtility:f!=null||p!=null,lineHoverHighlight:r,onGutterUtilityClick:i,onHunkExpand:b,onMergeConflictActionClick:S,onLineClick:a,onLineEnter:o,onLineLeave:s,onLineNumberClick:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,__debugPointerEvents:m,enableLineSelection:h,onLineSelected:g,onLineSelectionStart:_,onLineSelectionChange:v,onLineSelectionEnd:y,getLineIndex:x}}function qr({enableGutterUtility:e,enableHoverUtility:t,renderGutterUtility:n,renderHoverUtility:r,onGutterUtilityClick:i}){if(e!==void 0&&t!==void 0)throw Error(`Cannot use both 'enableGutterUtility' and deprecated 'enableHoverUtility'. Use only 'enableGutterUtility'.`);if(n!=null&&r!=null)throw Error(`Cannot use both 'renderGutterUtility' and deprecated 'renderHoverUtility'. Use only 'renderGutterUtility'.`);if(i!=null&&(n!=null||r!=null))throw Error(`Cannot use both 'onGutterUtilityClick' and render utility callbacks ('renderGutterUtility'/'renderHoverUtility'). Use only one gutter utility API.`);return e??t??!1}function Jr(e){return e!=null&&`kind`in e&&e.kind===`line`}function Yr(e){return e!=null&&`kind`in e&&e.kind===`token`}function Xr(e){return Jr(e)||Yr(e)}function Zr(e){return`type`in e&&e.type===`line-info`}function Qr(e){return`kind`in e&&e.kind===`merge-conflict-action`}function $r(e){return e===`current`||e===`incoming`||e===`both`}function ei(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function ti(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function ni(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 ri(e){for(let t of e)if(t instanceof HTMLElement&&t.hasAttribute(`data-utility-button`))return!0;return!1}function ii(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;break}console.log(...n)}var ai=class{observedNodes=new Map;queuedUpdates=new Map;cleanUp(){this.resizeObserver?.disconnect(),this.observedNodes.clear(),this.queuedUpdates.clear()}resizeObserver;setup(e,t){this.resizeObserver??=new ResizeObserver(this.handleResizeObserver);let n=e.querySelectorAll(`code`),r=new Map(this.observedNodes);this.observedNodes.clear();for(let e of n){let t=r.get(e);if(t!=null&&t.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let n=e.firstElementChild;n instanceof HTMLElement||(n=null),t==null?(t={type:`code`,codeElement:e,numberElement:n,codeWidth:`auto`,numberWidth:0},this.observedNodes.set(e,t),this.resizeObserver.observe(e),n!=null&&(this.observedNodes.set(n,t),this.resizeObserver.observe(n))):(this.observedNodes.set(e,t),r.delete(e),t.numberElement===n?t.numberElement!=null&&(r.delete(t.numberElement),this.observedNodes.set(t.numberElement,t)):(t.numberElement!=null&&this.resizeObserver.unobserve(t.numberElement),n!=null&&(this.resizeObserver.observe(n),r.delete(n),this.observedNodes.set(n,t)),t.numberElement=n))}if(n.length>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let{lineAnnotation:t=``}=e.dataset;if(!/^\d+,\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let 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,o=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(o instanceof HTMLElement))continue;let s=r.get(a);if(s!=null){this.observedNodes.set(a,s),this.observedNodes.set(o,s),r.delete(a),r.delete(o);continue}s={type:`annotations`,column1:{container:n,child:a,childHeight:a.getBoundingClientRect().height},column2:{container:i,child:o,childHeight:o.getBoundingClientRect().height},currentHeight:`auto`};let c=Math.max(s.column1.childHeight,s.column2.childHeight);this.applyNewHeight(s,c),this.observedNodes.set(a,s),this.observedNodes.set(o,s),this.resizeObserver.observe(a),this.resizeObserver.observe(o)}}for(let e of r.keys())e.isConnected&&(e.style.removeProperty(`--diffs-column-content-width`),e.style.removeProperty(`--diffs-column-number-width`),e.style.removeProperty(`--diffs-column-width`),e.parentElement instanceof HTMLElement&&e.parentElement.style.removeProperty(`--diffs-annotation-min-height`)),this.resizeObserver.unobserve(e);r.clear()}handleResizeObserver=e=>{for(let t of e){let{target:e,borderBoxSize:n,contentBoxSize:r}=t;if(!(e instanceof HTMLElement)){console.error(`FileDiff.handleResizeObserver: Invalid element for ResizeObserver`,t);continue}let i=this.observedNodes.get(e);if(i==null){console.error(`FileDiff.handleResizeObserver: Not a valid observed node`,t);continue}if(i.type===`annotations`){let t=(()=>{if(e===i.column1.child)return i.column1;if(e===i.column2.child)return i.column2})();if(t==null){console.error(`FileDiff.handleResizeObserver: Couldn't find a column for`,{item:i,target:e});continue}t.childHeight=n[0].blockSize;let r=Math.max(i.column1.childHeight,i.column2.childHeight);this.applyNewHeight(i,r)}else if(i.type===`code`){let t=[e,r[0].inlineSize],n=this.queuedUpdates.get(i)??[];n.push(t),this.queuedUpdates.set(i,n)}}this.handleColumnChange()};handleColumnChange=()=>{for(let[e,t]of this.queuedUpdates)for(let[n,r]of t)if(n===e.codeElement){let n=Math.max(Math.floor(r),0);if(n!==e.codeWidth){let t=Math.max(n-e.numberWidth,0);e.codeWidth=n===0?`auto`:n,e.codeElement.style.setProperty(`--diffs-column-content-width`,`${t>0?`${t}px`:`auto`}`),e.codeElement.style.setProperty(`--diffs-column-width`,`${typeof e.codeWidth==`number`?`${e.codeWidth}px`:`auto`}`)}e.numberElement!=null&&typeof e.codeWidth==`number`&&e.numberWidth===0&&t.push([e.numberElement,e.numberElement.getBoundingClientRect().width])}else if(n===e.numberElement){let t=Math.max(Math.ceil(r),0);if(t!==e.numberWidth&&(e.numberWidth=t,e.codeElement.style.setProperty(`--diffs-column-number-width`,`${e.numberWidth===0?`auto`:`${e.numberWidth}px`}`),e.codeWidth!==`auto`)){let t=Math.max(e.codeWidth-e.numberWidth,0);e.codeElement.style.setProperty(`--diffs-column-content-width`,`${t===0?`auto`:`${t}px`}`)}}this.queuedUpdates.clear()};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}},oi=new Map,si=new Map,ci=new Map,li=new Set;function ui(e){for(let t of Array.isArray(e)?e:[e])if(!(t===`text`||t===`ansi`)&&!li.has(t))return!1;return!0}function di(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(li.has(n.name))continue;let e=oi.get(n.name);e??(e=n,oi.set(n.name,e)),li.add(e.name),t.loadLanguageSync(e.data)}}function fi(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var I=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function pi(e){return mi(e)}function mi(e){return Array.isArray(e)?hi(e):e instanceof RegExp?e:typeof e==`object`?gi(e):e}function hi(e){let t=[];for(let n=0,r=e.length;n{for(let n in t)e[n]=t[n]}),e}function vi(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?vi(e.substring(0,e.length-1)):e.substr(~t+1)}var yi=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,bi=class{static hasCaptures(e){return e===null?!1:(yi.lastIndex=0,yi.test(e))}static replaceCaptures(e,t,n){return e.replace(yi,(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 xi(e,t){return et)}function Si(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;rthis._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=>Oi(e.parent,t.parentScopes));return n?new Ai(n.fontStyle,n.foreground,n.background):null}},Di=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`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!ki(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function ki(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Ai=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function ji(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new Mi(l,u,e,o,s,c)}}return n}var Mi=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}},Ni=(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))(Ni||{});function Pi(e,t){e.sort((e,t)=>{let n=xi(e.scope,t.scope);return n!==0||(n=Si(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 Fi(t),o=new Ai(n,a.getId(r),a.getId(i)),s=new Li(new L(0,null,-1,0,0),[]);for(let t=0,n=e.length;te?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},Li=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(),L.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>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!=0}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=Bi(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 zi(e){return e}function Bi(e){return e}function Vi(e,t){let n=[],r=Ui(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(Hi(i)){let e=[];do e.push(i),i=r.next();while(Hi(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 Hi(e){return!!e&&!!e.match(/[\w\.:]+/)}function Ui(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 Wi(e){typeof e.dispose==`function`&&e.dispose()}var Gi=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Ki=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},qi=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))}},Ji=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Gi(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new qi;for(let n of e)Yi(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof Gi){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 Yi(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 Gi?Zi({baseGrammar:a,selfGrammar:i},r):Xi(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 Gi(e))}function Xi(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];Qi([r],t,n)}}function Zi(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Qi(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Qi(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Qi(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?_i({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&Qi(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=ia(i);switch(a.kind){case 0:Zi({...t,selfGrammar:t.baseGrammar},n);break;case 1:Zi(t,n);break;case 2:Xi(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?Xi(a.ruleName,i,n):Zi(i,n)}else a.kind===4?n.add(new Ki(a.scopeName,a.ruleName)):n.add(new Gi(a.scopeName));break}}}var $i=class{kind=0},ea=class{kind=1},ta=class{constructor(e){this.ruleName=e}kind=2},na=class{constructor(e){this.scopeName=e}kind=3},ra=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function ia(e){if(e===`$base`)return new $i;if(e===`$self`)return new ea;let t=e.indexOf(`#`);return t===-1?new na(e):t===0?new ta(e.substring(1)):new ra(e.substring(0,t),e.substring(t+1))}var aa=/\\(\d+)/,oa=/\\(\d+)/g,sa=-1,ca=-2;function la(e){return e}function ua(e){return e}var da=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=bi.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=bi.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${vi(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:bi.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:bi.replaceCaptures(this._contentName,e,t)}},fa=class extends da{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!`)}},pa=class extends da{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new va(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 ya,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ma=class extends da{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 ya,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ha=class extends da{_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 va(i,this.id),this.beginCaptures=a,this._end=new va(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 ya;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}},ga=class extends da{_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 va(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new va(o,ca),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 ya;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 ya,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},_a=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new fa(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new pa(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=_i({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new ma(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new ga(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 ha(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;ae.substring(t.start,t.end));return oa.lastIndex=0,this.source.replace(oa,(e,t)=>wi(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;ie.source);this._cached=new ba(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 ba(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},ba=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;tnew xa(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/},Ca=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])=>wi(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 wa=!1,Ta=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Ea(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Da(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 Ta(i,!0);f()}return new Ta(i,!1);function f(){let o=Oa(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===sa){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Pa(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 ha){let r=o;Pa(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 ga){let r=o;Pa(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(Pa(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 Da(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 ga&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=Ma(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==ca){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Pa(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 Oa(e,t,n,r,i,a){let o=ka(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Aa(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=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 ja(e,t,n,r,i){return wa?{ruleScanner:e.compile(t,n),findOptions:Na(r,i)}:{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Ma(e,t,n,r,i){return wa?{ruleScanner:e.compileWhile(t,n),findOptions:Na(r,i)}:{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Na(e,t){let n=0;return e||(n|=1),t||(n|=4),n}function Pa(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;tu)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));Ea(e,p,n&&d.start===0,d.start,f,i,!1,0),Wi(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 Fa(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Fa=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function Ia(e,t,n,r,i,a,o,s){return new Ba(e,t,n,r,i,a,o,s)}function La(e,t,n,r,i){let a=Vi(t,Ra),o=_a.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 Ra(e,t){if(t.length{for(let r=n;rn&&e.substr(0,n)===t&&e[n]===`.`}var Ba=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new Sa(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Va(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Vi(e,Ra);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)La(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&&La(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(la(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[ua(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]=Va(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=_a.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Ua.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=Ri.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?Ha.createRootAndLookUpScopeName(a,r,this):Ha.createRoot(`unknown`,r),t=new Ua(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=` -`;let a=this.createOnigString(e),o=a.content.length,s=new Ga(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Ea(this,a,i,0,t,s,!0,r);return Wi(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Va(e,t){return e=pi(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 Ha=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=Di.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Di(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Di(null,t),o=r.themeProvider.themeMatch(a);return new e(null,a,e.mergeAttributes(n,i,o))}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),Ri.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);return new e(t,a,e.mergeAttributes(t.tokenAttributes,i,o))}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}},Ua=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?!1:e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?Ha.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:ua(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=Ha.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,la(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Ha.fromExtension(r,n.contentNameScopesList))}},Wa=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Vi(e,Ra).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Vi(e,Ra).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}},Ga=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=Ri.set(n,0,zi(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=Ri.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;e0;)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)}},Ja=Ua.NULL;function Ya(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 Xa(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Za(e){return Array.isArray(e)?e:[e]}async function Qa(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function $a(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function eo(e){return e===`ansi`||$a(e)}function to(e){return e===`none`}function no(e){return to(e)}function ro(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(/\s+/g);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function io(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(/(\r?\n)/g),r=0,i=[];for(let e=0;ee);function n(n){if(n===e.length)return{line:t.length-1,character:t[t.length-1].length};let r=n,i=0;for(let e of t){if(re&&i[e])}var so=`light-dark()`,co=[`color`,`background-color`];function lo(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 ne-t);return n.length?e.map(e=>e.flatMap(e=>{let t=n.filter(t=>e.offsett-e.offset).sort((e,t)=>e-t);return t.length?lo(e,t):e})):e}function fo(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>po(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&&co.includes(a))if(r===so&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new I('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');c[a]=`light-dark(${o[e][a]||`inherit`}, ${o[r][a]||`inherit`})`,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 po(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&Ni.Italic&&(t[`font-style`]=`italic`),e.fontStyle&Ni.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&Ni.Underline&&n.push(`underline`),e.fontStyle&Ni.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function mo(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}var ho=new WeakMap;function R(e,t){ho.set(e,t)}function z(e){return ho.get(e)}var go=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(Za(n).map(e=>[e,Ja])),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 _o(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function _o(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 vo(e,t){if(!(e instanceof go))throw new I(`Invalid grammar state`);return e.getInternalStack(t)}function yo(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=function(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new I(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...r.indexToPos(e),offset:e}}else{let t=r.lines[e.line];if(t===void 0)throw new I(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${r.lines.length}`);let n=e.character;if(n<0&&(n=t.length+n),n<0||n>t.length)throw new I(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:n,offset:r.posToIndex(e.line,n)}}},r=ao(t.source),i=(t.options.decorations||[]).map(e=>({...e,start:n(e.start),end:n(e.end)}));bo(i),e.set(t.meta,{decorations:i,converter:r,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return uo(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=Array.from(e.children).filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new I(`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;ee);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&ro(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.linea(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function bo(e){for(let t=0;tn.end.offset)throw new I(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;rNumber.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}else if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function ko(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)Eo[r]&&t.push({type:`setDecoration`,value:Eo[r]});else if(r<=29){let e=Eo[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:To[r-30]}});else if(r===38){let n=Oo(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:To[r-40]}});else if(r===48){let n=Oo(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:To[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:To[r-100+8]}})}return t}function Ao(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=Do(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=ko(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(aMath.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{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||No[t]]}))),o=Ao();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=Xa(i,r),o=Xa(o,r),n.decorations.has(`dim`)&&(i=Fo(i));let s=Ni.None;return n.decorations.has(`bold`)&&(s|=Ni.Bold),n.decorations.has(`italic`)&&(s|=Ni.Italic),n.decorations.has(`underline`)&&(s|=Ni.Underline),n.decorations.has(`strikethrough`)&&(s|=Ni.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function Fo(e){let t=e.match(/#([0-9a-f]{3,8})/i);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}`}else if(e.length===6)return`#${e}80`;else 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`)}`}else 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(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function Io(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n,i=e.resolveLangAlias(n.lang||`text`);if($a(i)||to(r))return io(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:a,colorMap:o}=e.setTheme(r);if(i===`ansi`)return Po(a,t,n);let s=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==s.name)throw new I(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${s.name}"`);if(!n.grammarState.themes.includes(a.name))throw new I(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${a.name}"`)}return Ro(t,s,a,o,n)}function Lo(...e){if(e.length===2)return z(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if($a(i)||to(a))throw new I(`Plain language does not have grammar state`);if(i===`ansi`)throw new I(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new go(zo(n,c,o,s,r).stateStack,c.name,o.name)}function Ro(e,t,n,r,i){let a=zo(e,t,n,r,i),o=new go(a.stateStack,t.name,n.name);return R(a.tokens,o),a.tokens}function zo(e,t,n,r,i){let a=Ya(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500}=i,c=io(e),l=i.grammarState?vo(i.grammarState,n.name)??Ja:i.grammarContextCode==null?Ja:zo(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,u=[],d=[];for(let e=0,f=c.length;e0&&f.length>=o){u=[],d.push([{content:f,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;i.includeExplanation&&(m=t.tokenizeLine(f,l,s),h=m.tokens,g=0);let _=t.tokenizeLine2(f,l,s),v=_.tokens.length/2;for(let e=0;ee.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(/ /))})}d.explanation=[];let r=0;for(;t+r({scopeName:e}))}function Vo(e,t){let n=[];for(let r=0,i=t.length;r=0&&i>=0;)Ho(e[r],n[i])&&--r,--i;return r===-1}function Wo(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(Uo(e,t,n)){r.push(a);break}return r}function Go(e,t,n){let r=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),i=r.map(r=>{let i=Io(e,t,{...n,theme:r.theme});return{tokens:i,state:z(i),theme:typeof r.theme==`string`?r.theme:r.theme.name}}),a=Ko(...i.map(e=>e.tokens)),o=a[0].map((e,t)=>e.map((e,i)=>{let o={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(o.explanation=e.explanation),a.forEach((e,n)=>{let{content:a,explanation:s,offset:c,...l}=e[t][i];o.variants[r[n].color]=l}),o})),s=i[0].state?new go(Object.fromEntries(i.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),i[0].state.lang):void 0;return s&&R(o,s),o}function Ko(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;re[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;te[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 I("`themes` option must not be empty");let p=Go(e,t,n);if(c=z(p),l&&so!==l&&!f.find(e=>e.color===l))throw new I(`\`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=>fo(e,h,u,l,d))),c&&R(a,c);let g=f.map(e=>Ya(e.theme,n));i=Jo(f,m,g,u,l,`fg`,d),r=Jo(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=Ya(n.theme,n);a=Io(e,t,n);let l=e.getTheme(n.theme);r=Xa(l.bg,s),i=Xa(l.fg,s),o=l.name,c=z(a)}else throw new I("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function Jo(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=Xa(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===so&&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 I('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Xa(t[r][a],n[r])||`inherit`}, ${Xa(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}function Yo(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>Yo(e,t,n),codeToTokens:(t,n)=>qo(e,t,n)}){let i=t;for(let e of Co(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=qo(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=Zo(a):d===`never`&&(a=Qo(a)),f&&(a=$o(a));let p={...r,get source(){return i}};for(let e of Co(n))a=e.tokens?.call(p,a)||a;return Xo(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function Xo(e,t,n,r=z(e)){let i=Co(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(t.rootStyle==null?l.style=`background-color:${t.bg};color:${t.fg}`:l.style=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:ro,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:` -`}));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=mo(a.htmlStyle||po(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;e0&&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&&R(m,r),m}function Zo(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&Ni.Underline||i.fontStyle&Ni.Strikethrough));o&&i.content.match(/^\s+$/)&&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 Qo(e){return e.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;let t=e.content.match(/^(\s*)(.*?)(\s*)$/);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 $o(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t[t.length-1],r=mo(e.htmlStyle||po(e)),i=mo(n.htmlStyle||po(n)),a=e.fontStyle&&(e.fontStyle&Ni.Underline||e.fontStyle&Ni.Strikethrough),o=n.fontStyle&&(n.fontStyle&Ni.Underline||n.fontStyle&Ni.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var es=Hr;function ts(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>Yo(e,t,n),codeToTokens:(t,n)=>qo(e,t,n)},i=es(Yo(e,t,n,r));for(let e of Co(n))i=e.postprocess?.call(r,i,n)||i;return i}var ns={light:`#333333`,dark:`#bbbbbb`},rs={light:`#fffffe`,dark:`#1e1e1e`},is=`__shiki_resolved`;function as(e){if(e?.[is])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`?ns.light:ns.dark,n||=t.type===`light`?rs.light:rs.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,is,{enumerable:!1,writable:!1,value:!0}),t}async function os(e){return Array.from(new Set((await Promise.all(e.filter(e=>!eo(e)).map(async e=>await Qa(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function ss(e){return(await Promise.all(e.map(async e=>no(e)?null:as(await Qa(e))))).filter(e=>!!e)}var cs=3,ls=!1;function us(e,t=3){if(cs&&!(typeof cs==`number`&&t>cs)){if(ls)throw Error(`[SHIKI DEPRECATE]: ${e}`);console.trace(`[SHIKI DEPRECATE]: ${e}`)}}var ds=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function fs(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 ds(`Circular alias \`${Array.from(n).join(` -> `)} -> ${e}\``);n.add(e)}}return e}var ps=class extends qa{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)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=as(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=Ei.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=fs(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=Array.from(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 ds(`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))}},ms=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}},hs=0;function gs(e){hs+=1,e.warnings!==!1&&hs>=10&&hs%10==0&&console.warn(`[Shiki] ${hs} 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 ds("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(as),i=new ps(new ms(e.engine,n),r,n,e.langAlias),a;function o(t){return fs(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new ds(`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 ds(`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 os(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await ss(e))}function g(){if(t)throw new ds(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--hs)}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 _s(e){e.engine||us("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([ss(e.themes||[]),os(e.langs||[]),e.engine]);return gs({...e,themes:t,langs:n,engine:r})}async function vs(e){let t=await _s(e);return{getLastGrammarState:(...e)=>Lo(t,...e),codeToTokensBase:(e,n)=>Io(t,e,n),codeToTokensWithThemes:(e,n)=>Go(t,e,n),codeToTokens:(e,n)=>qo(t,e,n),codeToHast:(e,n)=>Yo(t,e,n),codeToHtml:(e,n)=>ts(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function ys(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,eo(n))return[];let r=t[n];if(!r)throw new I(`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(no(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new I(`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 vs({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 bs(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}else{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 xs(e,t){let n=bs(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 Ss=`modulepreload`,Cs=function(e){return`/`+e},ws={},B=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Cs(t,n),t in ws)return;ws[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Ss,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Ts=[{id:`abap`,name:`ABAP`,import:(()=>B(()=>import(`./abap-smLpETzL.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,import:(()=>B(()=>import(`./actionscript-3-o-aRvjY5.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>B(()=>import(`./ada-D5RRX1i4.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>B(()=>import(`./angular-html-BZNntD0J.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>B(()=>import(`./angular-ts-SQQMYL2C.js`),__vite__mapDeps([5,0,1,2,3,4,6])))},{id:`apache`,name:`Apache Conf`,import:(()=>B(()=>import(`./apache-DttKlSqg.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>B(()=>import(`./apex-DL7j-a2n.js`),[]))},{id:`apl`,name:`APL`,import:(()=>B(()=>import(`./apl-D5V6uPDr.js`),__vite__mapDeps([7,3,1,2,4,8,9,10])))},{id:`applescript`,name:`AppleScript`,import:(()=>B(()=>import(`./applescript-DCbL_2FX.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>B(()=>import(`./ara-DqheWJCe.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>B(()=>import(`./asciidoc-BH2sf2K4.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>B(()=>import(`./asm-rfjOMz3U.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>B(()=>import(`./astro-DeXKSaFP.js`),__vite__mapDeps([11,3,1,4,8,12,13,14])))},{id:`awk`,name:`AWK`,import:(()=>B(()=>import(`./awk-CMV5n9Z7.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>B(()=>import(`./ballerina-BjMqJjlr.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`],import:(()=>B(()=>import(`./bat-BaVbo_qw.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>B(()=>import(`./beancount-DBt5Mbc_.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>B(()=>import(`./berry-Cyjuxiss.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>B(()=>import(`./bibtex-BV_0nsPq.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>B(()=>import(`./bicep-C2gEwu4J.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>B(()=>import(`./bird2-BRyaEJd0.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>B(()=>import(`./blade-Bu5re0Vg.js`),__vite__mapDeps([15,3,1,16,2,4,8,17,9,10])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>B(()=>import(`./bsl-B1qbqNES.js`),__vite__mapDeps([18,19])))},{id:`c`,name:`C`,import:(()=>B(()=>import(`./c-Nc9zJT78.js`).then(e=>e.n),__vite__mapDeps([20,1])))},{id:`c3`,name:`C3`,import:(()=>B(()=>import(`./c3-DTTbp5N2.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>B(()=>import(`./cadence-CPz83cmI.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>B(()=>import(`./cairo-BDj8wWhy.js`),__vite__mapDeps([21,22])))},{id:`clarity`,name:`Clarity`,import:(()=>B(()=>import(`./clarity-CFJ2Yc3q.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>B(()=>import(`./clojure-6R01QgJC.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>B(()=>import(`./cmake-D5rSbMir.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>B(()=>import(`./cobol-nvZDS9LT.js`),__vite__mapDeps([23,2,1,3,4,10])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>B(()=>import(`./codeowners-_3A-ClkN.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>B(()=>import(`./codeql-DlIhJTR7.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>B(()=>import(`./coffee-BKLOTq4e.js`),__vite__mapDeps([24,4,1])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>B(()=>import(`./common-lisp-BvQzz173.js`),[]))},{id:`coq`,name:`Coq`,import:(()=>B(()=>import(`./coq-DTNXReIC.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>B(()=>import(`./cpp-D6g1DVNt.js`).then(e=>e.n),__vite__mapDeps([25,1,26,20,27,17])))},{id:`crystal`,name:`Crystal`,import:(()=>B(()=>import(`./crystal-DfoZI57w.js`),__vite__mapDeps([28,20,1,3,2,4,29,17])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>B(()=>import(`./csharp-BDKQY1K9.js`),[]))},{id:`css`,name:`CSS`,import:(()=>B(()=>import(`./css-DRmnABqB.js`).then(e=>e.n),__vite__mapDeps([3,1])))},{id:`csv`,name:`CSV`,import:(()=>B(()=>import(`./csv-DNUpVBxl.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>B(()=>import(`./cue-DDdBc2s3.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>B(()=>import(`./cypher-CguaznO2.js`),[]))},{id:`d`,name:`D`,import:(()=>B(()=>import(`./d-CHcoyjv3.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>B(()=>import(`./dart-RM3aRphk.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>B(()=>import(`./dax-nbnY1d79.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>B(()=>import(`./desktop-BD76cvxT.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>B(()=>import(`./diff-CdkWtnkL.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>B(()=>import(`./docker-ZyPHc6zB.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>B(()=>import(`./dotenv-BdJZEwA6.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>B(()=>import(`./dream-maker-BJL4qlg3.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>B(()=>import(`./edge-DwocGnOF.js`),__vite__mapDeps([30,16,2,1,3,4,14])))},{id:`elixir`,name:`Elixir`,import:(()=>B(()=>import(`./elixir-Dtbfds1r.js`),__vite__mapDeps([31,2,1,3,4])))},{id:`elm`,name:`Elm`,import:(()=>B(()=>import(`./elm-CpPtm471.js`),__vite__mapDeps([32,26,1,20])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>B(()=>import(`./emacs-lisp-_LyYa2Ky.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>B(()=>import(`./erb--z3IM9Cb.js`),__vite__mapDeps([33,2,1,3,4,34,20,25,26,27,17,35,36,13,14,37,38,29,9,10,39])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>B(()=>import(`./erlang-Bc4hQuqa.js`),__vite__mapDeps([40,41])))},{id:`fennel`,name:`Fennel`,import:(()=>B(()=>import(`./fennel-CC2BkRsS.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>B(()=>import(`./fish-D2ZCzqcE.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>B(()=>import(`./fluent-DKAm3m7q.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>B(()=>import(`./fortran-fixed-form-B02FOYI-.js`),__vite__mapDeps([42,43])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>B(()=>import(`./fortran-free-form-BPTf0lbT.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>B(()=>import(`./fsharp-DhdR18vN.js`),__vite__mapDeps([44,41])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>B(()=>import(`./gdresource-DgnrMPIx.js`),__vite__mapDeps([45,46,47])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>B(()=>import(`./gdscript-CsadCSaZ.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>B(()=>import(`./gdshader-PfnN_8tR.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>B(()=>import(`./genie-Bj-orPAV.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>B(()=>import(`./gherkin-COVWpJ-Q.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>B(()=>import(`./git-commit-DGJi7qBD.js`),__vite__mapDeps([48,49])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>B(()=>import(`./git-rebase-Ce47xoa6.js`),__vite__mapDeps([50,29,1])))},{id:`gleam`,name:`Gleam`,import:(()=>B(()=>import(`./gleam-BF2NigGj.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>B(()=>import(`./glimmer-js-C0BuzxQC.js`),__vite__mapDeps([51,3,1,2,4,14])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>B(()=>import(`./glimmer-ts-irOZ-cAQ.js`),__vite__mapDeps([52,3,1,2,4,14])))},{id:`glsl`,name:`GLSL`,import:(()=>B(()=>import(`./glsl-JAhLUe0P.js`).then(e=>e.n),__vite__mapDeps([26,1,20])))},{id:`gn`,name:`GN`,import:(()=>B(()=>import(`./gn-CMIt9roj.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>B(()=>import(`./gnuplot-DgWlRTEj.js`),[]))},{id:`go`,name:`Go`,import:(()=>B(()=>import(`./go-DLnOLj8q.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>B(()=>import(`./graphql-D2ba3BkR.js`).then(e=>e.n),__vite__mapDeps([35,1,4,36,13,14])))},{id:`groovy`,name:`Groovy`,import:(()=>B(()=>import(`./groovy-B9qLWIkE.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>B(()=>import(`./hack-CgzUpY8l.js`),__vite__mapDeps([53,2,1,3,4,17])))},{id:`haml`,name:`Ruby Haml`,import:(()=>B(()=>import(`./haml-C-oIZcDo.js`).then(e=>e.n),__vite__mapDeps([37,1,3,4])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>B(()=>import(`./handlebars-CbP-Mhzf.js`),__vite__mapDeps([54,3,1,2,4,39])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>B(()=>import(`./haskell-BaGpmm_c.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>B(()=>import(`./haxe-DfXTCEOz.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>B(()=>import(`./hcl-CbCtpSbi.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>B(()=>import(`./hjson-_4-w-pHU.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>B(()=>import(`./hlsl-DpuYn7pp.js`),[]))},{id:`html`,name:`HTML`,import:(()=>B(()=>import(`./html-ddqpqPg0.js`).then(e=>e.n),__vite__mapDeps([2,1,3,4])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>B(()=>import(`./html-derivative-DWGxf_At.js`),__vite__mapDeps([16,2,1,3,4])))},{id:`http`,name:`HTTP`,import:(()=>B(()=>import(`./http-Bg1nG1nG.js`),__vite__mapDeps([55,35,1,4,36,13,14,8,29,9,10])))},{id:`hurl`,name:`Hurl`,import:(()=>B(()=>import(`./hurl-zm47Pi1n.js`),__vite__mapDeps([56,57,35,1,4,36,13,14,9,10])))},{id:`hxml`,name:`HXML`,import:(()=>B(()=>import(`./hxml-adC65L_J.js`),__vite__mapDeps([58,59])))},{id:`hy`,name:`Hy`,import:(()=>B(()=>import(`./hy-t9zDXBje.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>B(()=>import(`./imba-Bxu-TDfw.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>B(()=>import(`./ini-D-v34c8N.js`),[]))},{id:`java`,name:`Java`,import:(()=>B(()=>import(`./java-DVLnIrqC.js`).then(e=>e.n),__vite__mapDeps([10,1])))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>B(()=>import(`./javascript-Cop1kpy_.js`).then(e=>e.n),__vite__mapDeps([4,1])))},{id:`jinja`,name:`Jinja`,import:(()=>B(()=>import(`./jinja-Bnj4awH5.js`),__vite__mapDeps([60,2,1,3,4])))},{id:`jison`,name:`Jison`,import:(()=>B(()=>import(`./jison-CuCNs9Q3.js`),__vite__mapDeps([61,4,1])))},{id:`json`,name:`JSON`,import:(()=>B(()=>import(`./json-CTw4n7kn.js`).then(e=>e.n),__vite__mapDeps([8,1])))},{id:`json5`,name:`JSON5`,import:(()=>B(()=>import(`./json5-D0XL1D5m.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>B(()=>import(`./jsonc-BBgf3TX3.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>B(()=>import(`./jsonl-KrKLbtB7.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>B(()=>import(`./jsonnet-B2ZwWMOt.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>B(()=>import(`./jssm-ByRpI9-B.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>B(()=>import(`./jsx-0oMUGqZj.js`).then(e=>e.n),__vite__mapDeps([36,1])))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>B(()=>import(`./julia-DNYHzXlE.js`),__vite__mapDeps([62,25,1,26,20,27,17,4,22,63])))},{id:`just`,name:`Just`,import:(()=>B(()=>import(`./just-BlWkkmf2.js`),__vite__mapDeps([64,4,1,65,3,2,17,9,10,22,34,20,25,26,27,35,36,13,14,37,38,29,39])))},{id:`kdl`,name:`KDL`,import:(()=>B(()=>import(`./kdl-6FPPEH4H.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>B(()=>import(`./kotlin-D4L3Nd2D.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>B(()=>import(`./kusto-D-mmc07O.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>B(()=>import(`./latex-DqPzjMIt.js`),__vite__mapDeps([66,67,63,1])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>B(()=>import(`./lean-BMVMuP2E.js`),[]))},{id:`less`,name:`Less`,import:(()=>B(()=>import(`./less-C95PyOu0.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>B(()=>import(`./liquid-BURJK16h.js`),__vite__mapDeps([68,3,1,2,4,8])))},{id:`llvm`,name:`LLVM IR`,import:(()=>B(()=>import(`./llvm-Dy3qORTl.js`),[]))},{id:`log`,name:`Log file`,import:(()=>B(()=>import(`./log-BQop7fzg.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>B(()=>import(`./logo-DKtnYmrp.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>B(()=>import(`./lua-31hdJClp.js`).then(e=>e.n),__vite__mapDeps([38,1,20])))},{id:`luau`,name:`Luau`,import:(()=>B(()=>import(`./luau-Dha4KG0q.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>B(()=>import(`./make-DfmS6buu.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>B(()=>import(`./markdown-BaI9LyM4.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>B(()=>import(`./marko-C2ZcdSLh.js`),__vite__mapDeps([69,3,1,70,6,14])))},{id:`matlab`,name:`MATLAB`,import:(()=>B(()=>import(`./matlab-BT79Cq_j.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>B(()=>import(`./mdc-N1ii9pk5.js`),__vite__mapDeps([71,16,2,1,3,4,41,39])))},{id:`mdx`,name:`MDX`,import:(()=>B(()=>import(`./mdx-CxGBwLNt.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>B(()=>import(`./mermaid-DLf3axBN.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>B(()=>import(`./mipsasm-DXuU_0cI.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>B(()=>import(`./mojo-1Omp2pIo.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>B(()=>import(`./moonbit-DZzq699o.js`),[]))},{id:`move`,name:`Move`,import:(()=>B(()=>import(`./move-DxDAOJVd.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>B(()=>import(`./narrat-CxDcPPb9.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>B(()=>import(`./nextflow-JEyYUlIq.js`),__vite__mapDeps([72,73])))},{id:`nextflow-groovy`,name:`nextflow-groovy`,import:(()=>B(()=>import(`./nextflow-groovy-wvmJO4hi.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>B(()=>import(`./nginx-BuomO0W8.js`),__vite__mapDeps([74,38,1,20])))},{id:`nim`,name:`Nim`,import:(()=>B(()=>import(`./nim-hKoEPsYL.js`),__vite__mapDeps([75,20,1,3,26,2,4,41,9,10])))},{id:`nix`,name:`Nix`,import:(()=>B(()=>import(`./nix-DsFTDHWT.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>B(()=>import(`./nushell-BQ_rO0AM.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>B(()=>import(`./objective-c-BMq6JT_m.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>B(()=>import(`./objective-cpp-DRwojuGv.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>B(()=>import(`./ocaml-e4_gKO6E.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>B(()=>import(`./odin-mdTPwYOg.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>B(()=>import(`./openscad-D2aTdNfr.js`),[]))},{id:`pascal`,name:`Pascal`,import:(()=>B(()=>import(`./pascal-D4n_G8vj.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>B(()=>import(`./perl-CAGVW6Ra.js`),__vite__mapDeps([65,3,1,2,4,17,9,10])))},{id:`php`,name:`PHP`,import:(()=>B(()=>import(`./php-BycclmzS.js`),__vite__mapDeps([76,3,1,2,4,8,17,9,10])))},{id:`pkl`,name:`Pkl`,import:(()=>B(()=>import(`./pkl-DcjhAp0L.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>B(()=>import(`./plsql-BSy3Ag0J.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>B(()=>import(`./po-Be96RYkA.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>B(()=>import(`./polar-BmhMKWum.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>B(()=>import(`./postcss-BTQso3H9.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>B(()=>import(`./powerquery-DVyQv3M2.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`],import:(()=>B(()=>import(`./powershell-BmtCGJVD.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>B(()=>import(`./prisma-CCFA9rEj.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>B(()=>import(`./prolog-DWGEEo78.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>B(()=>import(`./proto-C3eop1kM.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>B(()=>import(`./pug-4maJHz9G.js`),__vite__mapDeps([77,3,1,2,4])))},{id:`puppet`,name:`Puppet`,import:(()=>B(()=>import(`./puppet-C0_7Nv5A.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>B(()=>import(`./purescript-Bv-B8yRw.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>B(()=>import(`./python-CKg5r0C3.js`),[]))},{id:`qml`,name:`QML`,import:(()=>B(()=>import(`./qml-JLIQfzyb.js`),__vite__mapDeps([78,4,1])))},{id:`qmldir`,name:`QML Directory`,import:(()=>B(()=>import(`./qmldir-Cqfb4Lox.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>B(()=>import(`./qss-Csho9BH8.js`),[]))},{id:`r`,name:`R`,import:(()=>B(()=>import(`./r-UcxRcvcA.js`).then(e=>e.n),__vite__mapDeps([63,1])))},{id:`racket`,name:`Racket`,import:(()=>B(()=>import(`./racket-D8-uWeQH.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>B(()=>import(`./raku-Cj4JSa8p.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>B(()=>import(`./razor-P8rbooCh.js`),__vite__mapDeps([79,80,2,1,3,4])))},{id:`reg`,name:`Windows Registry Script`,import:(()=>B(()=>import(`./reg-DXGFiJSl.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>B(()=>import(`./regexp-3-A0406L.js`).then(e=>e.n),__vite__mapDeps([27,1])))},{id:`rel`,name:`Rel`,import:(()=>B(()=>import(`./rel-CunnVTBK.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>B(()=>import(`./riscv-C8BcOCkS.js`),[]))},{id:`ron`,name:`RON`,import:(()=>B(()=>import(`./ron-DiDyR9oa.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>B(()=>import(`./rosmsg-CHmL1Uyj.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>B(()=>import(`./rst-C6GHyL-N.js`),__vite__mapDeps([81,82,25,1,26,20,27,17,16,2,3,4,22,34,35,36,13,14,37,38,29,9,10,39])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>B(()=>import(`./ruby-Cl8PVkbY.js`),__vite__mapDeps([34,20,1,25,26,27,17,3,35,4,36,13,14,37,2,38,29,9,10,39])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>B(()=>import(`./rust-DjJFInu3.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>B(()=>import(`./sas-CXoVwlZN.js`),__vite__mapDeps([83,17,1])))},{id:`sass`,name:`Sass`,import:(()=>B(()=>import(`./sass-D3xZ5o-v.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>B(()=>import(`./scala-B0IRml5w.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>B(()=>import(`./scheme-BhwcV3Av.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>B(()=>import(`./scss-DNczJ95n.js`).then(e=>e.n),__vite__mapDeps([6,1,3])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>B(()=>import(`./sdbl-BmWYR-pI.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>B(()=>import(`./shaderlab-DZ3Lsiak.js`),__vite__mapDeps([84,85])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>B(()=>import(`./shellscript-DaVPunOM.js`).then(e=>e.n),__vite__mapDeps([29,1])))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>B(()=>import(`./shellsession-COm1V40U.js`),__vite__mapDeps([86,29,1])))},{id:`smalltalk`,name:`Smalltalk`,import:(()=>B(()=>import(`./smalltalk-DVQuUMII.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>B(()=>import(`./solidity-gQ4WXILB.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>B(()=>import(`./soy-DwewhJ_3.js`),__vite__mapDeps([87,2,1,3,4])))},{id:`sparql`,name:`SPARQL`,import:(()=>B(()=>import(`./sparql-B9c85a_o.js`),__vite__mapDeps([88,89])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>B(()=>import(`./splunk-OB48_RcD.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>B(()=>import(`./sql-CrTmZCMa.js`).then(e=>e.n),__vite__mapDeps([17,1])))},{id:`ssh-config`,name:`SSH Config`,import:(()=>B(()=>import(`./ssh-config-DA9YMRGV.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>B(()=>import(`./stata-Bl--TAbZ.js`),__vite__mapDeps([90,17,1])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>B(()=>import(`./stylus-sKwvsUaC.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>B(()=>import(`./surrealql-BW79EE-U.js`),__vite__mapDeps([91,4,1])))},{id:`svelte`,name:`Svelte`,import:(()=>B(()=>import(`./svelte-ziMErdPi.js`),__vite__mapDeps([92,3,1,4,12,14])))},{id:`swift`,name:`Swift`,import:(()=>B(()=>import(`./swift-C72NbAtg.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>B(()=>import(`./system-verilog-CnWMF7Nq.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>B(()=>import(`./systemd-DMzItW5N.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>B(()=>import(`./talonscript-DopQCWDL.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>B(()=>import(`./tasl-C28SYKbq.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>B(()=>import(`./tcl-DHq7zmoF.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>B(()=>import(`./templ-C_9I6ncv.js`),__vite__mapDeps([93,3,1,94,4])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>B(()=>import(`./terraform-CogS1YKX.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>B(()=>import(`./tex-D8LVuLf5.js`),__vite__mapDeps([67,63,1])))},{id:`toml`,name:`TOML`,import:(()=>B(()=>import(`./toml-BH_iPsgK.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>B(()=>import(`./ts-tags-DKuFCGsc.js`),__vite__mapDeps([95,3,1,26,20,2,4,17,14,9,10])))},{id:`tsv`,name:`TSV`,import:(()=>B(()=>import(`./tsv-BIkdBZX1.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>B(()=>import(`./tsx-BjkCKOtw.js`).then(e=>e.n),__vite__mapDeps([13,1])))},{id:`turtle`,name:`Turtle`,import:(()=>B(()=>import(`./turtle-CqNXyJWZ.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>B(()=>import(`./twig-Bs1kcsO6.js`),__vite__mapDeps([96,3,1,4,76,2,8,17,9,10,22,34,20,25,26,27,35,36,13,14,37,38,29,39,6])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>B(()=>import(`./typescript-BoHeP9q1.js`).then(e=>e.n),__vite__mapDeps([14,1])))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>B(()=>import(`./typespec-CQ9LYD_e.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>B(()=>import(`./typst-T-Fsk-Sv.js`),[]))},{id:`v`,name:`V`,import:(()=>B(()=>import(`./v-BhMEOw9x.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>B(()=>import(`./vala-DzajMnwt.js`),[]))},{id:`vb`,name:`Visual Basic`,aliases:[`cmd`],import:(()=>B(()=>import(`./vb-7Xr8dEYW.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>B(()=>import(`./verilog-AvXtwZir.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>B(()=>import(`./vhdl-BHu0zg1P.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>B(()=>import(`./viml-Di0QpLfC.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>B(()=>import(`./vue-Dnf0y5RU.js`),__vite__mapDeps([97,3,1,16,2,4,8,14])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>B(()=>import(`./vue-html-CRtKS76J.js`),__vite__mapDeps([98,4,1])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>B(()=>import(`./vue-vine-BxjPqU7T.js`),__vite__mapDeps([99,3,1,4,70,12,6,100])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>B(()=>import(`./vyper-C3R5yXgx.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>B(()=>import(`./wasm-Chsuwt1A.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>B(()=>import(`./wenyan-BonVcr2i.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>B(()=>import(`./wgsl-D59WYmNq.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>B(()=>import(`./wikitext-ariTI2Wk.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>B(()=>import(`./wit-EA4fa3Dt.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>B(()=>import(`./wolfram-DDp7LhyU.js`),[]))},{id:`xml`,name:`XML`,import:(()=>B(()=>import(`./xml-eU7M3iZJ.js`).then(e=>e.n),__vite__mapDeps([9,1,10])))},{id:`xsl`,name:`XSL`,import:(()=>B(()=>import(`./xsl-DSqe4nTO.js`),__vite__mapDeps([101,9,1,10])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>B(()=>import(`./yaml-BTD1XHJG.js`).then(e=>e.n),__vite__mapDeps([39,1])))},{id:`zenscript`,name:`ZenScript`,import:(()=>B(()=>import(`./zenscript-4WaROUyc.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>B(()=>import(`./zig-CJoLJGwV.js`),[]))}],Es=Object.fromEntries(Ts.map(e=>[e.id,e.import])),Ds=Object.fromEntries(Ts.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),Os={...Es,...Ds},ks=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>B(()=>import(`./andromeeda-N4z3YzmR.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>B(()=>import(`./aurora-x-CND-FqEb.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>B(()=>import(`./ayu-dark-on7xzq_B.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>B(()=>import(`./ayu-light-DnGeGGc2.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>B(()=>import(`./ayu-mirage-DG3LlYC_.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>B(()=>import(`./catppuccin-frappe-Dr22sraq.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>B(()=>import(`./catppuccin-latte-C57EeX8c.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>B(()=>import(`./catppuccin-macchiato-CpheI4uD.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>B(()=>import(`./catppuccin-mocha-D8Lmdks_.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>B(()=>import(`./dark-plus-CqeW_0kH.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>B(()=>import(`./dracula-CtqCPLGa.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>B(()=>import(`./dracula-soft-DmBpwRAy.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>B(()=>import(`./everforest-dark-CrbyKk4n.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>B(()=>import(`./everforest-light-DRbSh8Tm.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>B(()=>import(`./github-dark-ipGuFGYC.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>B(()=>import(`./github-dark-default-DX3IG_X0.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>B(()=>import(`./github-dark-dimmed-CH6p_7ez.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>B(()=>import(`./github-dark-high-contrast-Bg2sSao5.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>B(()=>import(`./github-light-BxjqOQl0.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>B(()=>import(`./github-light-default-DwpDd1IQ.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>B(()=>import(`./github-light-high-contrast-C0QeixPf.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>B(()=>import(`./gruvbox-dark-hard-BIMX9ePb.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>B(()=>import(`./gruvbox-dark-medium-DxuwyVzM.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>B(()=>import(`./gruvbox-dark-soft-ba2fjht0.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>B(()=>import(`./gruvbox-light-hard-DAJK2PqC.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>B(()=>import(`./gruvbox-light-medium-WRifDAJD.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>B(()=>import(`./gruvbox-light-soft-B0dBOoVB.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>B(()=>import(`./horizon-C5RtD1fY.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`dark`,import:(()=>B(()=>import(`./horizon-bright-pEOice34.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>B(()=>import(`./houston-A0zg9vNP.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>B(()=>import(`./kanagawa-dragon-CtPmcCMp.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>B(()=>import(`./kanagawa-lotus-DpOXEGCa.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>B(()=>import(`./kanagawa-wave-CLVCyc-n.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>B(()=>import(`./laserwave-7fEj4XGb.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>B(()=>import(`./light-plus-DHI2dh3p.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>B(()=>import(`./material-theme-Dm6ETY8i.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>B(()=>import(`./material-theme-darker-BeyjmM5Z.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>B(()=>import(`./material-theme-lighter-CCOYYzKL.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>B(()=>import(`./material-theme-ocean-CUtPiiX3.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>B(()=>import(`./material-theme-palenight-2L4zMwIM.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>B(()=>import(`./min-dark-B8TUPGHg.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>B(()=>import(`./min-light-BDOoBxcA.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>B(()=>import(`./monokai-E_VBmXGZ.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>B(()=>import(`./night-owl-DefhalNX.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>B(()=>import(`./night-owl-light-byb3AbEn.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>B(()=>import(`./nord-D5rQzHT-.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>B(()=>import(`./one-dark-pro-DxXww9jg.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>B(()=>import(`./one-light-D9c03w7t.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>B(()=>import(`./plastic-uOsw7z1x.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>B(()=>import(`./poimandres-CyO4HORD.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>B(()=>import(`./red-z4H4llUY.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>B(()=>import(`./rose-pine-BADquuIH.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>B(()=>import(`./rose-pine-dawn-BLcEeBoh.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>B(()=>import(`./rose-pine-moon-BK_tLY1Y.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>B(()=>import(`./slack-dark-DOnVms5P.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>B(()=>import(`./slack-ochin-DcRTft4q.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>B(()=>import(`./snazzy-light-x9CLJ1W9.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>B(()=>import(`./solarized-dark-BB1sh-pe.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>B(()=>import(`./solarized-light-9-RPS998.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>B(()=>import(`./synthwave-84-eJ9uRN_S.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>B(()=>import(`./tokyo-night-B9N7LyrF.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>B(()=>import(`./vesper-CtgQQ2sf.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>B(()=>import(`./vitesse-black-jXdfyqgD.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>B(()=>import(`./vitesse-dark-B88PxG1r.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>B(()=>import(`./vitesse-light-BXxZh2iV.js`),[]))}].map(e=>[e.id,e.import])),As=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function js(){return 2147483648}function Ms(){return typeof performance<`u`?performance.now():Date.now()}var Ns=(e,t)=>e+(t-e%t)%t;async function Ps(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=js();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,Ns(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>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:Ms,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 Fs=Object.defineProperty,Is=(e,t,n)=>t in e?Fs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ls=(e,t,n)=>Is(e,typeof t==`symbol`?t:t+``,n),Rs=null;function zs(e){throw new As(e.UTF8ToString(e.getLastOnigError()))}var Bs=class e{constructor(t){Ls(this,`utf16Length`),Ls(this,`utf8Length`),Ls(this,`utf16Value`),Ls(this,`utf8Value`),Ls(this,`utf16OffsetToUtf8`),Ls(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=55296&&r<=56319&&e+1=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=55296&&i<=56319&&n+1=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}a<=127?t+=1:a<=2047?t+=2:a<=65535?t+=3:t+=4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},Vs=class e{constructor(t){if(Ls(this,`id`,++e.LAST_ID),Ls(this,`_onigBinding`),Ls(this,`content`),Ls(this,`utf16Length`),Ls(this,`utf8Length`),Ls(this,`utf16OffsetToUtf8`),Ls(this,`utf8OffsetToUtf16`),Ls(this,`ptr`),!Rs)throw new As(`Must invoke loadWasm first.`);this._onigBinding=Rs,this.content=t;let n=new Bs(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=Rs.omalloc(1e4),e._sharedPtrInUse=!0,Rs.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(Rs)}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)}};Ls(Vs,`LAST_ID`,0),Ls(Vs,`_sharedPtr`,0),Ls(Vs,`_sharedPtrInUse`,!1);var Hs=Vs,Us=class{constructor(e){if(Ls(this,`_onigBinding`),Ls(this,`_ptr`),!Rs)throw new As(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),Ws(n)?n=await n.instantiator(t):Gs(n)?n=await n.default(t):(Ks(n)&&(n=n.data),qs(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await Qs(n)(t):await $s(n)(t):Js(n)||n instanceof WebAssembly.Module?n=await Zs(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Zs(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Ys=t(),Ys}function Zs(e){return t=>WebAssembly.instantiate(e,t)}function Qs(e){return t=>WebAssembly.instantiateStreaming(e,t)}function $s(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}async function ec(e){return e&&await Xs(e),{createScanner(e){return new Us(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new Hs(e)}}}var tc=ys({langs:Os,themes:ks,engine:()=>ec(B(()=>import(`./wasm-CEUrWlVz.js`),[]))}),{codeToHtml:nc,codeToHast:rc,codeToTokens:ic,codeToTokensBase:ac,codeToTokensWithThemes:oc,getSingletonHighlighter:sc,getLastGrammarState:cc}=xs(tc,{guessEmbeddedLanguages:oo});function lc(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function uc(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var dc=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),fc=String.raw;function pc(e,t){if(e==null)throw Error(t??`Value expected`);return e}var mc=fc`\[\^?`,hc=`c.? | C(?:-.?)?|${fc`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${fc`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${fc`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${fc`o\{[^\}]*\}?`}|${fc`\d{1,3}`}`,gc=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,_c=new RegExp(fc` - \\ (?: - ${hc} - | [gk]<[^>]*>? - | [gk]'[^']*'? - | . - ) - | \( (?: - \? (?: - [:=!>({] - | <[=!] - | <[^>]*> - | '[^']*' - | ~\|? - | #(?:[^)\\]|\\.?)* - | [^:)]*[:)] - )? - | \*[^\)]*\)? - )? - | (?:${gc.source})+ - | ${mc} - | . -`.replace(/\s+/g,``),`gsu`),vc=new RegExp(fc` - \\ (?: - ${hc} - | . - ) - | \[:(?:\^?\p{Alpha}+|\^):\] - | ${mc} - | && - | . -`.replace(/\s+/g,``),`gsu`);function yc(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=Jc(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(_c.lastIndex=0;s=_c.exec(e);){let t=bc(a,e,s[0],_c.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(_c.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`?Xc(e,u):e).flat(),flags:r}}function bc(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=xc(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:Tc(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:zc(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:Ec(n)}}if(a===`K`)return{token:Nc(`keep`,n)};if(a===`N`||a===`R`)return{token:Mc(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:Mc(`any`,n)};if(a===`X`)return{token:Mc(`text_segment`,n)};let e=Cc(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:Uc(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:Hc(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:Ic(`group`,n)};if(n===`(?>`)return{token:Ic(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:Ic(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:Ic(`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:Fc(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(` -`,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:Mc(`dot`,n)}:n===`^`||n===`$`?{token:Tc(e.singleline?{"^":fc`\A`,$:fc`\Z`}[n]:n,n)}:n===`|`?{token:wc(n)}:gc.test(n)?{tokens:Zc(n)}:{token:Dc(lc(n),n)}}function xc(e,t,n){let r=[jc(t[1]===`^`,t)],i=1,a;for(vc.lastIndex=n;a=vc.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(jc(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(Dc(93,e));else if(i--,r.push(Oc(e)),!i)break}else{let t=Sc(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:vc.lastIndex||e.length}}function Sc(e){if(e[0]===`\\`)return Cc(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?\^?)(?[a-z]+):\]/.exec(e);if(!t||!dc.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return Mc(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?kc(e):e===`&&`?Ac(e):Dc(lc(e),e)}function Cc(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return Vc(e);if(`dDhHsSwW`.includes(n))return Gc(e);if(e.startsWith(fc`\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 Kc(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 Dc(lc(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return Dc(Yc(e),e);if(V.has(n))return Dc(V.get(n),e);if(/\d/.test(n))return Pc(t,e);if(e===`\\`)throw Error(fc`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return Dc(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function wc(e){return{type:`Alternator`,raw:e}}function Tc(e,t){return{type:`Assertion`,kind:e,raw:t}}function Ec(e){return{type:`Backreference`,raw:e}}function Dc(e,t){return{type:`Character`,value:e,raw:t}}function Oc(e){return{type:`CharacterClassClose`,raw:e}}function kc(e){return{type:`CharacterClassHyphen`,raw:e}}function Ac(e){return{type:`CharacterClassIntersector`,raw:e}}function jc(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function Mc(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function Nc(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:pc(n.flags),raw:t}}function Pc(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function Fc(e){return{type:`GroupClose`,raw:e}}function Ic(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function Lc(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function Rc(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function zc(e){return{type:`Subroutine`,raw:e}}var Bc=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),V=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function Vc(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return Dc(lc(t.toUpperCase())-64,e)}function Hc(e,t){let{on:n,off:r}=/^\(\?(?[imx]*)(?:-(?[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=qc(n),o=qc(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),Nc(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,Ic(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function Uc(e){let t=/\(\*(?[A-Za-z_]\w*)?(?:\[(?(?:[A-Za-z_]\w*)?)\])?(?:\{(?[^}]*)\})?\)/.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=Bc.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 Lc(l,r??null,i?.split(`,`)??null,e)}function Wc(e){let t=null,n,r;if(e[0]===`{`){let{minStr:i,maxStr:a}=/^\{(?\d*)(?:,(?\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 Rc(t,n,r,e)}function Gc(e){let t=e[1].toLowerCase();return Mc({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function Kc(e){let{p:t,neg:n,value:r}=/^\\(?

[pP])\{(?\^?)(?[^}]+)/.exec(e).groups;return Mc(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function qc(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 Jc(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function Xc(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[Ec(n)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e127)throw Error(fc`Octal encoded byte above 177 unsupported "${n}"`)}else r=lc(t);a.push(Dc(r,(e===0?`\\`:``)+t))}return a}function Zc(e){let t=[],n=new RegExp(gc,`gy`),r;for(;r=n.exec(e);){let e=r[0];if(e[0]===`{`){let r=/^\{(?\d+),(?\d+)\}\??$/.exec(e);if(r){let{min:i,max:a}=r.groups;if(+i>+a&&e.endsWith(`?`)){n.lastIndex--,t.push(Wc(e.slice(0,-1)));continue}}}t.push(Wc(e))}return t}function Qc(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 $c(e){return el.has(e.type)}var el=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function tl(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=yc(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 H();case`Assertion`:return nl(n);case`Backreference`:return rl(n,a);case`Character`:return ml(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return il(n,a,t);case`CharacterClassOpen`:return al(n,a,t);case`CharacterSet`:return ol(n,a);case`Directive`:return vl(n.kind,{flags:n.flags});case`GroupOpen`:return sl(n,a,t);case`NamedCallout`:return Sl(n.kind,n.tag,n.arguments);case`Quantifier`:return cl(n,a);case`Subroutine`:return ll(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=Tl(yl(r.flags)),s=o.body[0];for(;a.nextIndexc.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(fc`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(fc`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function nl({kind:e}){return dl(pc({"^":`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===fc`\B`||e===fc`\Y`})}function rl({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,fl(r?i+1-n:n,{orphan:a})};if(n){let n=/^(?-?)0*(?[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 fl(r)}return i(+r)}function il(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(),gl(o,e);throw Error(`Invalid character class range`)}return ml(lc(`-`))}function al({negate:e},t,n){let{tokens:r,walk:i}=t,a=r[t.nextIndex],o=[hl()],s=Il(a);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)o.push(hl()),t.nextIndex++;else{let e=o.at(-1);e.body.push(i(e,n))}s=Il(r[t.nextIndex],a)}let c=hl({negate:e});return o.length===1?c.body=o[0].body:(c.kind=`intersection`,c.body=o.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function ol({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=Fl(n);if(dc.has(r)&&!o?.has(r))e=`posix`,n=r;else return Dl(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?Cl(n,{negate:t}):_l(e,{negate:t})}function sl(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=Ol(e),l=c.type===`AbsenceFunction`,u=Ml(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&uc(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=Ll(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push(H()),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(jl(t)||t.type===`CapturingGroup`)throw Error(e)}else if(jl(t)||Ml(t)&&t.negate)throw Error(e)}}f=Ll(r[t.nextIndex])}return t.nextIndex++,c}function cl({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!$c(a))throw Error(`Quantifier requires a repeatable token`);let o=wl(e,t,n,a);return i.body.pop(),o}function ll({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),a=/^(?[-+]?)0*(?[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=El(i);return r.push(o),o}function ul(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:kl(t?.body)}}function H(e){return{type:`Alternative`,body:Al(e?.body)}}function dl(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function fl(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function pl(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!Nl(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:kl(t?.body)}}function ml(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 hl(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:Al(e?.body)}}function gl(e,t){if(t.valuen)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function Tl(e,t){return{type:`Regex`,body:kl(t?.body),flags:e}}function El(e){return{type:`Subroutine`,ref:e}}function Dl(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(Fl(e));if(!r){if(n.normalizeUnknownPropertyNames)r=Pl(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(fc`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function Ol({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return ul(`repeater`);case`atomic`:return bl({atomic:!0});case`capturing`:return pl(i,{name:n});case`group`:return bl({flags:e});case`lookahead`:case`lookbehind`:return xl({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function kl(e){if(e===void 0)e=[H()];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 Al(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 jl(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function Ml(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function Nl(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function Pl(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 Fl(e){return e.replace(/[- _]+/g,``).toLowerCase()}function Il(e,t){return pc(e,`${t?.type===`Character`&&t.value===93?`Empty`:`Unclosed`} character class`)}function Ll(e){return pc(e,`Unclosed group`)}function Rl(e,t,n=null){function r(e,t){for(let n=0;nA-Za-z\-]|<[=!]|\(DEFINE\))`;function U(e,t){for(let n=0;n=t&&e[n]++}function W(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var G=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function K(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===G.DEFAULT==!o)){n instanceof Function?s+=n(t,{context:o?G.CHAR_CLASS:G.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 q(e,t,n,r){K(e,t,n,r)}function Hl(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===G.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function Ul(e,t,n){return!!Hl(e,t,0,n)}function Wl(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 Gl=new RegExp(String.raw`(?${Vl})|(?\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function Kl(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(Gl.lastIndex=Number.isNaN(c)?0:c+7;f=Gl.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),U(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=K(e,String.raw`\\(?[1-9]\d*)|<\$\$(?\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}`},G.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var ql=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Jl=new RegExp(String.raw` -\\(?: \d+ - | c[A-Za-z] - | [gk]<[^>]+> - | [pPu]\{[^\}]+\} - | u[A-Fa-f\d]{4} - | x[A-Fa-f\d]{2} - ) -| \((?: \? (?: [:=!>] - | <(?:[=!]|[^>]+>) - | [A-Za-z\-]+: - | \(DEFINE\) - ))? -| (?${ql})(?[?+]?)(?[?*+\{]?) -| \\?. -`.replace(/\s+/g,``),`gsu`);function Yl(e){if(!RegExp(`${ql}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(Jl.lastIndex=0;o=Jl.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=W(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}Jl.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null);i=s}return{pattern:e}}var Xl=String.raw,Zl=Xl`\(\?R=(?[^\)]+)\)|${Xl`\\g<(?[^>&]+)&R=(?[^>]+)>`}`,Ql=Xl`\(\?<(?![=!])(?[^>]+)>`,$l=Xl`${Ql}|(?\()(?!\?)`,eu=new RegExp(Xl`${Ql}|${Zl}|\(\?|\\?.`,`gsu`),tu=`Cannot use multiple overlapping recursions`;function nu(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(Zl,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&Ul(e,Xl`\(\?\(DEFINE\)`,G.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=Ul(e,Xl`\\[1-9]`,G.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(eu.lastIndex=0;f=eu.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(ru(m),l)throw Error(tu);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(eu.lastIndex);if(Ul(s,Zl,G.DEFAULT))throw Error(tu);let c=m-1;e=iu(t,s,c,!1,n,a,d),i=su(i,t,c,a.length,0,d);break}else if(h){ru(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(tu);break}if(!u)throw Error(Xl`Recursive \g cannot be used outside the referenced group "${r===`external`?h:Xl`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=Wl(e,p);if(o&&Ul(m,Xl`${Ql}|\((?!\?)`,G.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=iu(_,v,b,!0,n,a,d);i=su(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,eu.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),eu.lastIndex),s.set(p,eu.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),eu.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function ru(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 iu(e,t,n,r,i,a,o){let s=new Set;r&&q(e+t,Ql,({groups:{captureName:e}})=>{s.add(e)},G.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${au(`(?:${e}`,`forward`,...c)}(?:)${au(`${t})`,`backward`,...c)}${t}`}function au(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t[^>]+)>`,({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),ou(i,n),s?e:`(?<${t}${l}>`}return Xl`\k<${c}${l}>`},G.DEFAULT)}return c}function ou(e,t){for(let n=0;n=t&&e[n]++}function su(e,t,n,r,i,a){if(e.size&&r){let o=0;q(t,$l,()=>o++,G.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 J=String.fromCodePoint,Y=String.raw,cu={},lu=globalThis.RegExp;cu.flagGroups=(()=>{try{new lu(`(?i:)`)}catch{return!1}return!0})(),cu.unicodeSets=(()=>{try{new lu(`[[]]`,`v`)}catch{return!1}return!0})(),cu.bugFlagVLiteralHyphenIsRange=cu.unicodeSets?(()=>{try{new lu(Y`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,cu.bugNestedClassIgnoresNegation=cu.unicodeSets&&new lu(`[[^a]]`,`v`).test(`a`);function uu(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function du(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function fu(e,t){return mu[e]>=mu[t]}function pu(e,t){if(e==null)throw Error(t??`Value expected`);return e}var mu={ES2025:2025,ES2024:2024,ES2018:2018},hu={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function gu(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!hu[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=cu.flagGroups?`ES2025`:cu.unicodeSets?`ES2024`:`ES2018`),t}var _u=`[ -\r ]`,vu=new Set([J(304),J(305)]),yu=Y`[\p{L}\p{M}\p{N}\p{Pc}]`;function bu(e){if(vu.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=wu.get(n),a=Su.get(n),o=Cu.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 xu=new Map(`C Other -Cc Control cntrl -Cf Format -Cn Unassigned -Co Private_Use -Cs Surrogate -L Letter -LC Cased_Letter -Ll Lowercase_Letter -Lm Modifier_Letter -Lo Other_Letter -Lt Titlecase_Letter -Lu Uppercase_Letter -M Mark Combining_Mark -Mc Spacing_Mark -Me Enclosing_Mark -Mn Nonspacing_Mark -N Number -Nd Decimal_Number digit -Nl Letter_Number -No Other_Number -P Punctuation punct -Pc Connector_Punctuation -Pd Dash_Punctuation -Pe Close_Punctuation -Pf Final_Punctuation -Pi Initial_Punctuation -Po Other_Punctuation -Ps Open_Punctuation -S Symbol -Sc Currency_Symbol -Sk Modifier_Symbol -Sm Math_Symbol -So Other_Symbol -Z Separator -Zl Line_Separator -Zp Paragraph_Separator -Zs Space_Separator -ASCII -ASCII_Hex_Digit AHex -Alphabetic Alpha -Any -Assigned -Bidi_Control Bidi_C -Bidi_Mirrored Bidi_M -Case_Ignorable CI -Cased -Changes_When_Casefolded CWCF -Changes_When_Casemapped CWCM -Changes_When_Lowercased CWL -Changes_When_NFKC_Casefolded CWKCF -Changes_When_Titlecased CWT -Changes_When_Uppercased CWU -Dash -Default_Ignorable_Code_Point DI -Deprecated Dep -Diacritic Dia -Emoji -Emoji_Component EComp -Emoji_Modifier EMod -Emoji_Modifier_Base EBase -Emoji_Presentation EPres -Extended_Pictographic ExtPict -Extender Ext -Grapheme_Base Gr_Base -Grapheme_Extend Gr_Ext -Hex_Digit Hex -IDS_Binary_Operator IDSB -IDS_Trinary_Operator IDST -ID_Continue IDC -ID_Start IDS -Ideographic Ideo -Join_Control Join_C -Logical_Order_Exception LOE -Lowercase Lower -Math -Noncharacter_Code_Point NChar -Pattern_Syntax Pat_Syn -Pattern_White_Space Pat_WS -Quotation_Mark QMark -Radical -Regional_Indicator RI -Sentence_Terminal STerm -Soft_Dotted SD -Terminal_Punctuation Term -Unified_Ideograph UIdeo -Uppercase Upper -Variation_Selector VS -White_Space space -XID_Continue XIDC -XID_Start XIDS`.split(/\s/).map(e=>[Fl(e),e])),Su=new Map([[`s`,J(383)],[J(383),`s`]]),Cu=new Map([[J(223),J(7838)],[J(107),J(8490)],[J(229),J(8491)],[J(969),J(8486)]]),wu=new Map([Du(453),Du(456),Du(459),Du(498),...Ou(8072,8079),...Ou(8088,8095),...Ou(8104,8111),Du(8124),Du(8140),Du(8188)]),Tu=new Map([[`alnum`,Y`[\p{Alpha}\p{Nd}]`],[`alpha`,Y`\p{Alpha}`],[`ascii`,Y`\p{ASCII}`],[`blank`,Y`[\p{Zs}\t]`],[`cntrl`,Y`\p{Cc}`],[`digit`,Y`\p{Nd}`],[`graph`,Y`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,Y`\p{Lower}`],[`print`,Y`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,Y`[\p{P}\p{S}]`],[`space`,Y`\p{space}`],[`upper`,Y`\p{Upper}`],[`word`,Y`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,Y`\p{AHex}`]]);function Eu(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function Du(e){let t=J(e);return[t.toLowerCase(),t]}function Ou(e,t){return Eu(e,t).map(e=>Du(e))}var ku=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function Au(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};Pu(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:fu(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};Rl(e,ju,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 Rl(e,Mu,a),Rl(e,Nu,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var ju={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=bl();e.body[0].body.push(xl({negate:!0,body:r}),Dl(`Any`));let i=bl();i.body[0].body.push(wl(`greedy`,0,1/0,e)),n(Qu(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\r\n|${i?Y`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(Zu(Dl(`AHex`,{negate:l}),t));else if(c===`newline`)n(Qu(Yu(l?`[^ -]`:`(?>\r -?|[ -\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-${J(e.codePointAt(0)-1)}${J(e.codePointAt(2)+1)}-\u{10FFFF}`),n(Qu(Yu(`[${e}]`),t))}else n(Qu(Xu(Yu(Tu.get(u)),l),t));else if(c===`property`)xu.has(Fl(u))||(e.key=`sc`);else if(c===`space`)n(Zu(Dl(`space`,{negate:l}),t));else if(c===`word`)n(Qu(Xu(Yu(yu),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=bl({flags:c});e.body[0].body=o(),i(Qu(e,t),{traverse:!0})}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&Qc(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(Y`Uses "\K" in a way that's unsupported`);let o=xl({behind:!0});o.body[0].body=a(),i(Qu(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(Qu(xl({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=bl();t.body[0].body.push(e.body),e.body=Qu(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=Wu(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(Y`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!Ju(n)&&(n=Bu(n,t),e.ref=n)}},Mu={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=Zu(Ru(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&du(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;te.type===`Group`&&!!e.flags)),t=e?uu(r.globalFlags,e):r.globalFlags;Fu(t,r.currentFlags)||(l=bl({flags:Hu(t)}),l.body[0].body.push(c))}n(Qu(l,t),{traverse:!s})}},Nu={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=>Iu(t,e));i.length?i.length>1?n(Qu(bl({atomic:!0,body:i.reverse().map(e=>H({body:[fl(e.number)]}))}),t)):e.ref=i[0].number:n(Qu(xl({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{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 Hu({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 Uu(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function Wu(e){let t=e.find(e=>e.kind===`search_start`||qu(e,{negate:!1})||!X(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=Wu(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function Gu(e,t){let n=Uu(e)??[];for(let e of n)if(e===t||Gu(e,t))return!0;return!1}function X({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function Ku(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function qu(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&Qc(e.body[0],{type:`Assertion`,kind:`search_start`})}function Ju(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function Yu(e,t){let n=tl(e,{...t,unicodePropertyMap:xu}).body;return n.length>1||n[0].body.length>1?bl({body:n}):n[0].body[0]}function Xu(e,t){return e.negate=t,e}function Zu(e,t){return e.parent=t,e}function Qu(e,t){return Pu(e),e.parent=t,e}function $u(e,t){let n=gu(t),r=fu(n.target,`ES2024`),i=fu(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];Rl(e,ed,{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,pu(td[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&&du(f._captureTransfers,e.transferTo,[]).push(t)}),f}var ed={"*":{enter({node:e},t){if(pd(e)){let n=t.getCurrentModI();t.pushModI(e.flags?uu({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){pd(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){sd(J(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),cd(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&ku.has(e.value)&&t.setHasCasedChar()}},td={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?Y`\B`:Y`\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=J(e),r=ld(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&sd(n)){let e=bu(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`);cu.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(hd)&&(o=[ml(45),...o.filter(e=>!hd(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||cu.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=bl(),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=H({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`&&!(cu.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=ld(n,i),o=ld(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&ud(cd(e)).forEach(e=>{s.add(Array.isArray(e)?`${ld(e[0],i)}-${ld(e[1],i)}`:ld(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?`.`:`[^]`:Y`[^\n]`;if(e===`digit`)return t?Y`\D`:Y`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&ku.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?Y`\P`:Y`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?Y`\W`:Y`\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=uu(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${dd(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)+fd(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})`:Y`\g<${t}&R=${r}>`}},nd=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),rd=new Set([`-`,`\\`,`]`,`^`,`[`]),id=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),ad=new Map([[9,Y`\t`],[10,Y`\n`],[11,Y`\v`],[12,Y`\f`],[13,Y`\r`],[8232,Y`\u2028`],[8233,Y`\u2029`],[65279,Y`\uFEFF`]]),od=/^\p{Cased}$/u;function sd(e){return od.test(e)}function cd(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=J(e);if(!sd(t))continue;let o=bu(t).filter(e=>{let t=e.codePointAt(0);return ti});if(o.length&&(a.push(...o),n))break}return a}function ld(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(ad.has(e))return ad.get(e);if(e<32||e>126&&e<160||e>262143||t&&md(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?id:rd:nd,a=J(e);return(i.has(a)?`\\`:``)+a}function ud(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e`;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 fd({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 pd({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function md(e){return e>47&&e<58}function hd({type:e,value:t}){return e===`Character`&&t===45}var gd=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=vd(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&&(_d(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{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function vd(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)du(n,t,{}).transferTo=e;return n}function yd(e){let t=/(?\((?:\?<(?![=!])(?[^>]+)>|(?!\?)))|\\?./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 bd(e,t){let n=Z(e,t);return n.options?new gd(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function Z(e,t){let n=gu(t),r=Au(tl(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:xu}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=$u(r,n),a=nu(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=Kl(Yl(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}var xd=4294967295,Sd=class{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}})}regexps;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:xd,end:xd,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;ee[1].index));for(let[t,n,r]of i)if(n.index===e)return a(t,n,r)}return null}};function Cd(e,t){return bd(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function wd(e={}){let t=Object.assign({target:`auto`,cache:new Map},e);return t.regexConstructor||=e=>Cd(e,{target:t.target}),{createScanner(e){return new Sd(e,t)},createString(e){return{content:e}}}}async function Td(e){if(fi())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=si.get(e);if(t!=null)return t;try{let t=ci.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(Os,e)&&(t=Os[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 oi.has(e)||oi.set(e,n),n});return si.set(e,n),await n}finally{si.delete(e)}}function Ed(e){return oi.get(e)??Td(e)}var Dd=new Map,Od=new Map,kd=new Map,Ad=new Set;function jd(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=Dd.get(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,Dd.has(n)||Dd.set(n,e);Ad.has(n)||(Ad.add(n),t.loadThemeSync(e))}}async function Md(e){if(fi())throw Error(`resolveTheme("${e}") cannot be called from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=Od.get(e);if(t!=null)return t;try{let t=kd.get(e)??ks[e];if(t==null)throw Error(`resolveTheme: No valid loader for ${e}`);let n=t().then(t=>Nd(e,`default`in t?t.default:t));Od.set(e,n);let r=await n;if(r.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${r.name}`);return Dd.set(r.name,r),r}finally{Od.delete(e)}}function Nd(e,t){return Dd.get(e)??(t=as(t),Dd.set(e,t),t)}function Q(e){return Dd.get(e)??Md(e)}function Pd(e,t){if(kd.has(e)){console.error(`SharedHighlight.registerCustomTheme: theme name already registered`,e);return}kd.set(e,t)}var $;async function Fd({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){$??=tc({themes:[],langs:[`text`],engine:n===`shiki-wasm`?ec(B(()=>import(`./wasm-CEUrWlVz.js`),[])):wd()});let r=Ld($)?await $:$;$=r;let i=[];for(let e of t){if(e===`text`||e===`ansi`)continue;let t=Ed(e);`then`in t?i.push(t):di(t,r)}let a=[];for(let t of e){let e=Q(t);`then`in e?a.push(e):jd(e,$)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{di(e,r)}),Promise.all(a).then(e=>{jd(e,r)})]),r}function Id(){if($!=null&&!(`then`in $))return $}function Ld(e=$){return e!=null&&`then`in e}Pd(`pierre-dark`,async()=>{let{default:e}=await B(async()=>{let{default:e}=await import(`./pierre-dark-CizZ1Z5z.js`);return{default:e}},[]);return{...e,name:`pierre-dark`}}),Pd(`pierre-light`,async()=>{let{default:e}=await B(async()=>{let{default:e}=await import(`./pierre-light-CHMWfAMe.js`);return{default:e}},[]);return{...e,name:`pierre-light`}});function Rd(e=wt){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}function zd(e){for(let t of Rd(e))if(!Ad.has(t))return!1;return!0}function Bd(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 Vd(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function Hd(e){return M({tagName:`div`,children:[M({tagName:`div`,children:e.annotations?.map(e=>M({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function Ud(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 Wd({fileOrDiff:e,mode:t}){let n=`type`in e?e:void 0,r={"data-diffs-header":t,"data-change-type":n?.type};return M({tagName:`div`,children:[t===`custom`?M({tagName:`slot`,properties:{name:Ct}}):Gd({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:n?.type??`file`}),...t===`custom`?[]:[Kd(n)]],properties:r})}function Gd({name:e,prevName:t,iconType:n}){let r=[M({tagName:`slot`,properties:{name:xt}}),Nt({name:Ud(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(M({tagName:`div`,children:[M({tagName:`bdi`,children:[Mt(t)]})],properties:{"data-prev-name":``}})),r.push(Nt({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(M({tagName:`div`,children:[M({tagName:`bdi`,children:[Mt(e)]})],properties:{"data-title":``}})),M({tagName:`div`,children:r,properties:{"data-header-content":``}})}function Kd(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(M({tagName:`span`,children:[Mt(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(M({tagName:`span`,children:[Mt(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(M({tagName:`slot`,properties:{name:St}})),M({tagName:`div`,children:t,properties:{"data-metadata":``}})}function qd(e){return M({tagName:`pre`,properties:Jd(e)})}function Jd({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,tabIndex:0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}var Yd=new Map,Xd={"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`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function Zd(e){if(Yd.has(e))return Yd.get(e)??`text`;if(Xd[e]!=null)return Xd[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Yd.has(t[1]))return Yd.get(t[1])??`text`;if(Xd[t[1]]!=null)return Xd[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return Yd.has(n)?Yd.get(n)??`text`:Xd[n]??`text`}function Qd(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:Rd(t),preferredHighlighter:n}}function $d(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function ef(e){return e.replace(/\n$|\r\n$/,``)}function tf(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(Mt(` -`)),e}var nf=Symbol(`no-token`),rf=Symbol(`multiple-tokens`);function af(e){let t=of(e);if(t!=null)return t;let n=nf,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`){cf(e,a);for(let t of e.children)sf(t)}else sf(e);r.push(e),i=[],a=void 0;return}for(let e of i)sf(e);r.push(M({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==nf){if(e===rf){n=rf;return}if(n===nf){n=e;return}n!==e&&(n=rf)}};for(let t of e.children){let e=t.type===`element`?af(t):nf;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 of(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function sf(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)sf(t)}}function cf(e,t){e.properties[`data-char`]=t}function lf(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=t+uf(typeof e==`string`?e:a(e))+n;return o=r(o),i.has(o)||i.set(o,typeof e==`string`?e:{...e}),o}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 uf(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t>>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 df(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=Pt(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&af(a),i.push(tf(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(pf,ff),{state:n,transformers:r,toClass:ff}}var ff=lf({classPrefix:`hl-`}),pf={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 mf(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}function hf({theme:e=wt,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e);r+=`color:${i.fg};`,r+=`background-color:${i.bg};`,r+=`${mf(`global`)}fg:${i.fg};`,r+=`${mf(`global`)}bg:${i.bg};`,r+=gf(i,n)}else{let n=t.getTheme(e.dark);r+=`${mf(`global`)}dark:${n.fg};`,r+=`${mf(`global`)}dark-bg:${n.bg};`,r+=gf(n,`dark`),n=t.getTheme(e.light),r+=`${mf(`global`)}light:${n.fg};`,r+=`${mf(`global`)}light-bg:${n.bg};`,r+=gf(n,`light`)}return r}function gf(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${mf(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${mf(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${mf(`global`)}${t}modified-color:${a};`),n}function _f(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}function vf(e,t){return M({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function yf(e){return e.useTokenTransformer===!0||e.onTokenClick!=null||e.onTokenEnter!=null||e.onTokenLeave!=null}var bf=``;function xf(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Sf(e,t){return e==null||t==null?e===t:wf(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 Cf={};function wf(e=Cf,t=Cf){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 Tf(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function Ef(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e}function Df(){let e=document.createElement(`style`);return e.setAttribute(Et,``),e}var Of=`@layer base, theme, rendered, unsafe; - -@layer base { - :host { - --diffs-font-fallback: - 'SF Mono', Monaco, Consolas, 'Ubuntu Mono', 'Liberation Mono', - 'Courier New', monospace; - --diffs-header-font-fallback: - system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', - 'Noto Sans', 'Liberation Sans', Arial, sans-serif; - - --diffs-mixer: light-dark(black, white); - --diffs-gap-fallback: 8px; - - --diffs-added-light: #0dbe4e; - --diffs-added-dark: #5ecc71; - --diffs-modified-light: #009fff; - --diffs-modified-dark: #69b1ff; - --diffs-deleted-light: #ff2e3f; - --diffs-deleted-dark: #ff6762; - - /* - // Available CSS Color Overrides - --diffs-bg-buffer-override - --diffs-bg-hover-override - --diffs-bg-context-override - --diffs-bg-separator-override - - --diffs-fg-number-override - --diffs-fg-number-addition-override - --diffs-fg-number-deletion-override - --diffs-fg-conflict-marker-override - - --diffs-deletion-color-override - --diffs-addition-color-override - --diffs-modified-color-override - - --diffs-bg-deletion-override - --diffs-bg-deletion-number-override - --diffs-bg-deletion-hover-override - --diffs-bg-deletion-emphasis-override - - --diffs-bg-addition-override - --diffs-bg-addition-number-override - --diffs-bg-addition-hover-override - --diffs-bg-addition-emphasis-override - - // Line Selection Color Overrides (for enableLineSelection) - --diffs-selection-color-override - --diffs-bg-selection-override - --diffs-bg-selection-number-override - --diffs-bg-selection-background-override - --diffs-bg-selection-number-background-override - - // Available CSS Layout Overrides - --diffs-gap-inline - --diffs-gap-block - --diffs-gap-style - --diffs-tab-size - */ - - color-scheme: light dark; - display: block; - font-family: var( - --diffs-header-font-family, - var(--diffs-header-font-fallback) - ); - font-size: var(--diffs-font-size, 13px); - line-height: var(--diffs-line-height, 20px); - font-feature-settings: var(--diffs-font-features); - - /* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor - * and vscode use an older build of chrome that appears to have a bug with - * color-mix and 'in oklch', so use 'in lab' instead */ - --diffs-bg: light-dark( - var(--diffs-light-bg, #fff), - var(--diffs-dark-bg, #000) - ); - --diffs-bg-buffer: var( - --diffs-bg-buffer-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)), - color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)) - ) - ); - --diffs-bg-hover: var( - --diffs-bg-hover-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 97%, var(--diffs-mixer)), - color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-mixer)) - ) - ); - - --diffs-bg-context: var( - --diffs-bg-context-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)), - color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer)) - ) - ); - --diffs-bg-context-number: var( - --diffs-bg-context-number-override, - light-dark( - color-mix(in lab, var(--diffs-bg-context) 80%, var(--diffs-bg)), - color-mix(in lab, var(--diffs-bg-context) 60%, var(--diffs-bg)) - ) - ); - --diffs-bg-conflict-marker: var( - --diffs-bg-conflict-marker-override, - light-dark( - color-mix( - in lab, - var(--diffs-bg-context) 88%, - var(--diffs-modified-base) - ), - color-mix( - in lab, - var(--diffs-bg-context) 80%, - var(--diffs-modified-base) - ) - ) - ); - --diffs-bg-conflict-current: var( - --diffs-bg-conflict-current-override, - light-dark(#e5f8ea, #274432) - ); - --diffs-bg-conflict-base: var( - --diffs-bg-conflict-base-override, - light-dark( - color-mix( - in lab, - var(--diffs-bg-context) 90%, - var(--diffs-modified-base) - ), - color-mix( - in lab, - var(--diffs-bg-context) 82%, - var(--diffs-modified-base) - ) - ) - ); - --diffs-bg-conflict-incoming: var( - --diffs-bg-conflict-incoming-override, - light-dark(#e6f1ff, #253b5a) - ); - --diffs-bg-conflict-marker-number: var( - --diffs-bg-conflict-marker-number-override, - light-dark( - color-mix(in lab, var(--diffs-bg-conflict-marker) 72%, var(--diffs-bg)), - color-mix(in lab, var(--diffs-bg-conflict-marker) 54%, var(--diffs-bg)) - ) - ); - --diffs-bg-conflict-current-number: var( - --diffs-bg-conflict-current-number-override, - light-dark(#d7f1de, #30533d) - ); - --diffs-bg-conflict-base-number: var( - --diffs-bg-conflict-base-number-override, - light-dark( - color-mix(in lab, var(--diffs-bg-conflict-base) 72%, var(--diffs-bg)), - color-mix(in lab, var(--diffs-bg-conflict-base) 54%, var(--diffs-bg)) - ) - ); - --diffs-bg-conflict-incoming-number: var( - --diffs-bg-conflict-incoming-number-override, - light-dark(#d8e8ff, #2f4b73) - ); - --conflict-bg-current: var( - --conflict-bg-current-override, - var(--diffs-bg-addition) - ); - --conflict-bg-incoming: var( - --conflict-bg-incoming-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-modified-base)), - color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-modified-base)) - ) - ); - --conflict-bg-current-number: var( - --conflict-bg-current-number-override, - var(--diffs-bg-addition-number) - ); - --conflict-bg-incoming-number: var( - --conflict-bg-incoming-number-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-modified-base)), - color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-modified-base)) - ) - ); - --conflict-bg-current-header: var( - --conflict-bg-current-header-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 78%, var(--diffs-addition-base)), - color-mix(in lab, var(--diffs-bg) 68%, var(--diffs-addition-base)) - ) - ); - --conflict-bg-incoming-header: var( - --conflict-bg-incoming-header-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 78%, var(--diffs-modified-base)), - color-mix(in lab, var(--diffs-bg) 68%, var(--diffs-modified-base)) - ) - ); - --conflict-bg-current-header-number: var( - --conflict-bg-current-header-number-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 72%, var(--diffs-addition-base)), - color-mix(in lab, var(--diffs-bg) 62%, var(--diffs-addition-base)) - ) - ); - --conflict-bg-incoming-header-number: var( - --conflict-bg-incoming-header-number-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 72%, var(--diffs-modified-base)), - color-mix(in lab, var(--diffs-bg) 62%, var(--diffs-modified-base)) - ) - ); - - --diffs-bg-separator: var( - --diffs-bg-separator-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)), - color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer)) - ) - ); - - --diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff)); - --diffs-fg-number: var( - --diffs-fg-number-override, - light-dark( - color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)), - color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)) - ) - ); - --diffs-fg-conflict-marker: var( - --diffs-fg-conflict-marker-override, - var(--diffs-fg-number) - ); - - --diffs-deletion-base: var( - --diffs-deletion-color-override, - light-dark( - var( - --diffs-light-deletion-color, - var(--diffs-deletion-color, var(--diffs-deleted-light)) - ), - var( - --diffs-dark-deletion-color, - var(--diffs-deletion-color, var(--diffs-deleted-dark)) - ) - ) - ); - --diffs-addition-base: var( - --diffs-addition-color-override, - light-dark( - var( - --diffs-light-addition-color, - var(--diffs-addition-color, var(--diffs-added-light)) - ), - var( - --diffs-dark-addition-color, - var(--diffs-addition-color, var(--diffs-added-dark)) - ) - ) - ); - --diffs-modified-base: var( - --diffs-modified-color-override, - light-dark( - var( - --diffs-light-modified-color, - var(--diffs-modified-color, var(--diffs-modified-light)) - ), - var( - --diffs-dark-modified-color, - var(--diffs-modified-color, var(--diffs-modified-dark)) - ) - ) - ); - - /* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor - * and vscode use an older build of chrome that appears to have a bug with - * color-mix and 'in oklch', so use 'in lab' instead */ - --diffs-bg-deletion: var( - --diffs-bg-deletion-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)), - color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base)) - ) - ); - --diffs-bg-deletion-number: var( - --diffs-bg-deletion-number-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-deletion-base)), - color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-deletion-base)) - ) - ); - --diffs-bg-deletion-hover: var( - --diffs-bg-deletion-hover-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base)), - color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-deletion-base)) - ) - ); - --diffs-bg-deletion-emphasis: var( - --diffs-bg-deletion-emphasis-override, - light-dark( - rgb(from var(--diffs-deletion-base) r g b / 0.15), - rgb(from var(--diffs-deletion-base) r g b / 0.2) - ) - ); - - --diffs-bg-addition: var( - --diffs-bg-addition-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)), - color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base)) - ) - ); - --diffs-bg-addition-number: var( - --diffs-bg-addition-number-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 91%, var(--diffs-addition-base)), - color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-addition-base)) - ) - ); - --diffs-bg-addition-hover: var( - --diffs-bg-addition-hover-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base)), - color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-addition-base)) - ) - ); - --diffs-bg-addition-emphasis: var( - --diffs-bg-addition-emphasis-override, - light-dark( - rgb(from var(--diffs-addition-base) r g b / 0.15), - rgb(from var(--diffs-addition-base) r g b / 0.2) - ) - ); - - --diffs-selection-base: var(--diffs-modified-base); - --diffs-selection-number-fg: light-dark( - color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)), - color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)) - ); - --diffs-bg-selection: var( - --diffs-bg-selection-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 82%, var(--diffs-selection-base)), - color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-selection-base)) - ) - ); - --diffs-bg-selection-number: var( - --diffs-bg-selection-number-override, - light-dark( - color-mix(in lab, var(--diffs-bg) 75%, var(--diffs-selection-base)), - color-mix(in lab, var(--diffs-bg) 60%, var(--diffs-selection-base)) - ) - ); - - background-color: var(--diffs-bg); - color: var(--diffs-fg); - } - - /* NOTE(mdo): Some semantic HTML elements (e.g. \`pre\`, \`code\`) have default - * user-agent styles. These must be overridden to use our custom styles. */ - pre, - code, - [data-error-wrapper] { - isolation: isolate; - margin: 0; - padding: 0; - display: block; - outline: none; - font-family: var(--diffs-font-family, var(--diffs-font-fallback)); - } - - pre, - code { - background-color: var(--diffs-bg); - } - - code { - contain: content; - } - - *, - *::before, - *::after { - box-sizing: border-box; - } - - [data-icon-sprite] { - display: none; - } - - /* NOTE(mdo): Headers and separators are within pre/code, so we need to reset - * their font-family explicitly. */ - [data-diffs-header], - [data-separator] { - font-family: var( - --diffs-header-font-family, - var(--diffs-header-font-fallback) - ); - } - - [data-file-info] { - padding: 10px; - font-weight: 700; - color: var(--fg); - /* NOTE(amadeus): we cannot use 'in oklch' because current versions of cursor - * and vscode use an older build of chrome that appears to have a bug with - * color-mix and 'in oklch', so use 'in lab' instead */ - background-color: color-mix(in lab, var(--bg) 98%, var(--fg)); - border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg)); - } - - [data-diff], - [data-file] { - /* This feels a bit crazy to me... so I need to think about it a bit more... */ - --diffs-grid-number-column-width: minmax(min-content, max-content); - --diffs-code-grid: var(--diffs-grid-number-column-width) 1fr; - - &[data-dehydrated] { - --diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr); - } - - &:hover [data-code]::-webkit-scrollbar-thumb { - background-color: var(--diffs-bg-context); - } - } - - [data-line] span { - color: light-dark( - var(--diffs-token-light, var(--diffs-light)), - var(--diffs-token-dark, var(--diffs-dark)) - ); - background-color: light-dark( - var(--diffs-token-light-bg, inherit), - var(--diffs-token-dark-bg, inherit) - ); - font-weight: light-dark( - var(--diffs-token-light-font-weight, inherit), - var(--diffs-token-dark-font-weight, inherit) - ); - font-style: light-dark( - var(--diffs-token-light-font-style, inherit), - var(--diffs-token-dark-font-style, inherit) - ); - -webkit-text-decoration: light-dark( - var(--diffs-token-light-text-decoration, inherit), - var(--diffs-token-dark-text-decoration, inherit) - ); - text-decoration: light-dark( - var(--diffs-token-light-text-decoration, inherit), - var(--diffs-token-dark-text-decoration, inherit) - ); - } - - [data-line], - [data-gutter-buffer], - [data-line-annotation], - [data-no-newline] { - color: var(--diffs-fg); - background-color: var(--diffs-line-bg, var(--diffs-bg)); - } - - [data-no-newline] { - -webkit-user-select: none; - user-select: none; - - span { - opacity: 0.6; - } - } - - [data-diff-type='split'][data-overflow='scroll'] { - display: grid; - grid-template-columns: 1fr 1fr; - - [data-additions] { - border-left: 1px solid var(--diffs-bg); - } - - [data-deletions] { - border-right: 1px solid var(--diffs-bg); - } - } - - [data-code] { - display: grid; - grid-auto-flow: dense; - grid-template-columns: var(--diffs-code-grid); - overflow: scroll clip; - overscroll-behavior-x: none; - tab-size: var(--diffs-tab-size, 2); - align-self: flex-start; - padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback)); - padding-bottom: max( - 0px, - calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) - 6px) - ); - } - - [data-container-size] { - container-type: inline-size; - } - - [data-code]::-webkit-scrollbar { - width: 0; - height: 6px; - } - - [data-code]::-webkit-scrollbar-track { - background: transparent; - } - - [data-code]::-webkit-scrollbar-thumb { - background-color: transparent; - border: 1px solid transparent; - background-clip: content-box; - border-radius: 3px; - } - - [data-code]::-webkit-scrollbar-corner { - background-color: transparent; - } - - /* - * If we apply these rules globally it will mean that webkit will opt into the - * standards compliant version of custom css scrollbars, which we do not want - * because the custom stuff will look better - */ - @supports (-moz-appearance: none) { - [data-code] { - scrollbar-width: thin; - scrollbar-color: var(--diffs-bg-context) transparent; - padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback)); - } - } - - [data-diffs-header] ~ [data-diff], - [data-diffs-header] ~ [data-file] { - [data-code], - &[data-overflow='wrap'] { - padding-top: 0; - } - } - - [data-gutter] { - display: grid; - grid-template-rows: subgrid; - grid-template-columns: subgrid; - grid-column: 1; - z-index: 3; - position: relative; - background-color: var(--diffs-bg); - - [data-gutter-buffer], - [data-column-number] { - border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg)); - } - } - - [data-content] { - display: grid; - grid-template-rows: subgrid; - grid-template-columns: subgrid; - grid-column: 2; - min-width: 0; - } - - [data-diff-type='split'][data-overflow='wrap'] { - display: grid; - grid-auto-flow: dense; - grid-template-columns: repeat(2, var(--diffs-code-grid)); - padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback)); - - [data-deletions] { - display: contents; - - [data-gutter] { - grid-column: 1; - } - - [data-content] { - grid-column: 2; - border-right: 1px solid var(--diffs-bg); - } - } - - [data-additions] { - display: contents; - - [data-gutter] { - grid-column: 3; - border-left: 1px solid var(--diffs-bg); - } - - [data-content] { - grid-column: 4; - } - } - } - - [data-overflow='scroll'] [data-gutter] { - position: sticky; - left: 0; - } - - [data-line-annotation][data-selected-line] { - background-color: unset; - - &::before { - content: ''; - /* FIXME(amadeus): This needs to be audited ... */ - position: sticky; - top: 0; - left: 0; - display: block; - border-right: var(--diffs-gap-style, 1px solid var(--diffs-bg)); - background-color: var(--diffs-bg-selection-number); - } - - [data-annotation-content] { - background-color: var(--diffs-bg-selection); - } - } - - [data-interactive-lines] [data-line] { - cursor: pointer; - } - - [data-content-buffer], - [data-gutter-buffer] { - position: relative; - -webkit-user-select: none; - user-select: none; - min-height: 1lh; - } - - [data-gutter-buffer='annotation'] { - min-height: 0; - } - - [data-gutter-buffer='buffer'] { - background-size: 8px 8px; - background-position: 0 0; - background-origin: border-box; - background-color: var(--diffs-bg); - /* This is incredibley expensive... */ - background-image: repeating-linear-gradient( - -45deg, - transparent, - transparent calc(3px * 1.414), - rgb(from var(--diffs-bg-buffer) r g b / 0.8) calc(3px * 1.414), - rgb(from var(--diffs-bg-buffer) r g b / 0.8) calc(4px * 1.414) - ); - } - - [data-content-buffer] { - grid-column: 1; - /* We multiply by 1.414 (√2) to better approximate the diagonal repeat distance */ - background-size: 8px 8px; - background-position: 5px 0; - background-origin: border-box; - background-color: var(--diffs-bg); - /* This is incredibley expensive... */ - background-image: repeating-linear-gradient( - -45deg, - transparent, - transparent calc(3px * 1.414), - var(--diffs-bg-buffer) calc(3px * 1.414), - var(--diffs-bg-buffer) calc(4px * 1.414) - ); - } - - [data-separator] { - box-sizing: content-box; - background-color: var(--diffs-bg); - } - - [data-separator='simple'] { - min-height: 4px; - } - - [data-separator='line-info'], - [data-separator='line-info-basic'], - [data-separator='metadata'], - [data-separator='simple'] { - background-color: var(--diffs-bg-separator); - } - - [data-separator='line-info'], - [data-separator='line-info-basic'], - [data-separator='metadata'] { - height: 32px; - position: relative; - } - - [data-separator-wrapper] { - -webkit-user-select: none; - user-select: none; - fill: currentColor; - position: absolute; - inset-inline: 0; - display: flex; - align-items: center; - background-color: var(--diffs-bg); - height: 100%; - } - - [data-content] [data-separator-wrapper] { - display: none; - } - - [data-separator='metadata'] [data-separator-wrapper] { - inset-inline: 100% auto; - padding-inline: 1ch; - height: 100%; - background-color: var(--diffs-bg-separator); - color: var(--diffs-fg-number); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - min-width: min-content; - } - - [data-separator='line-info'] { - margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback)); - } - - [data-separator='line-info-basic'], - [data-separator='metadata'] { - margin-block: 0; - } - - [data-separator='line-info'][data-separator-first] { - margin-top: 0; - } - - [data-separator='line-info'][data-separator-last] { - margin-bottom: 0; - } - - [data-expand-index] [data-separator-wrapper] { - display: grid; - grid-template-columns: 32px auto; - } - - [data-expand-index] [data-separator-wrapper][data-separator-multi-button] { - grid-template-columns: 32px 32px auto; - } - - [data-expand-button], - [data-separator-content] { - display: flex; - flex: 0 0 auto; - align-items: center; - background-color: var(--diffs-bg-separator); - } - - [data-expand-index] [data-separator-content]:hover { - text-decoration: underline; - cursor: pointer; - } - - [data-expand-button] { - justify-content: center; - flex-shrink: 0; - cursor: pointer; - min-width: 32px; - align-self: stretch; - color: var(--diffs-fg-number); - border-right: 2px solid var(--diffs-bg); - - &:hover { - color: var(--diffs-fg); - } - - &[data-expand-all-button] { - display: none; - } - } - - [data-expand-down] [data-icon] { - transform: scaleY(-1); - } - - [data-separator-content] { - flex: 1 1 auto; - padding: 0 1ch; - height: 100%; - color: var(--diffs-fg-number); - - overflow: hidden; - justify-content: flex-start; - } - - [data-separator='line-info'], - [data-separator='line-info-basic'] { - [data-separator-content] { - height: 100%; - -webkit-user-select: none; - user-select: none; - overflow: clip; - } - } - - @supports (width: 1cqi) { - [data-unified] { - [data-separator='line-info'] [data-separator-wrapper] { - padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback)); - width: 100cqi; - - [data-separator-content] { - border-radius: 6px; - } - } - - [data-separator='line-info'][data-expand-index] - [data-separator-wrapper] - [data-separator-content] { - border-top-left-radius: unset; - border-bottom-left-radius: unset; - } - } - - [data-gutter] { - [data-separator='line-info'] [data-separator-wrapper] { - padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback)); - } - - [data-separator='line-info'] [data-separator-content] { - border-top-left-radius: 6px; - border-bottom-left-radius: 6px; - } - - [data-separator='line-info'][data-expand-index] [data-separator-content] { - border-top-left-radius: unset; - border-bottom-left-radius: unset; - } - } - - [data-additions] { - [data-content] [data-separator='line-info'] { - background-color: var(--diffs-bg); - - [data-separator-wrapper] { - display: none; - } - } - - [data-gutter] [data-separator='line-info'] [data-separator-wrapper] { - display: block; - height: 100%; - background-color: var(--diffs-bg-separator); - border-top-right-radius: 6px; - border-bottom-right-radius: 6px; - - [data-separator-content], - [data-expand-button] { - display: none; - } - } - } - - [data-overflow='scroll'] - [data-additions] - [data-gutter] - [data-separator='line-info'] - [data-separator-wrapper] { - width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback))); - } - - [data-overflow='wrap'] - [data-additions] - [data-content] - [data-separator='line-info'] - [data-separator-wrapper] { - background-color: var(--diffs-bg-separator); - display: block; - height: 100%; - margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback)); - border-top-right-radius: 6px; - border-bottom-right-radius: 6px; - - [data-separator-content], - [data-expand-button] { - display: none; - } - } - - [data-separator='line-info'] [data-separator-wrapper] { - [data-expand-both], - [data-expand-down], - [data-expand-up] { - border-top-left-radius: 6px; - border-bottom-left-radius: 6px; - } - } - - @media (pointer: fine) { - [data-separator='line-info'] [data-separator-wrapper] { - &[data-separator-multi-button] { - [data-expand-up] { - border-top-left-radius: 6px; - border-bottom-left-radius: unset; - } - - [data-expand-down] { - border-bottom-left-radius: 6px; - border-top-left-radius: unset; - } - } - } - } - } - - @media (pointer: coarse) { - [data-separator='line-info-basic'] - [data-separator-wrapper][data-separator-multi-button] { - grid-template-columns: 34px 34px auto; - - [data-separator-content] { - grid-column: unset; - grid-row: unset; - } - } - - @supports (width: 1cqi) { - [data-separator='line-info'] [data-separator-wrapper] { - [data-expand-both], - [data-expand-down], - [data-expand-up] { - border-top-left-radius: 6px; - border-bottom-left-radius: 6px; - } - - &[data-separator-multi-button] { - [data-expand-up] { - border-top-left-radius: 6px; - border-bottom-left-radius: 6px; - } - - [data-expand-down] { - border-bottom-left-radius: unset; - border-top-left-radius: unset; - } - } - } - } - } - - @media (pointer: fine) { - [data-separator-wrapper][data-separator-multi-button] { - display: grid; - grid-template-rows: 50% 50%; - - [data-separator-content] { - grid-column: 2; - grid-row: 1 / -1; - min-width: min-content; - } - - [data-expand-button] { - grid-column: 1; - } - } - - [data-separator='line-info'] [data-separator-wrapper], - [data-separator='line-info'] - [data-separator-wrapper][data-separator-multi-button] { - grid-template-columns: 34px auto; - } - - [data-separator='line-info-basic'][data-expand-index] - [data-separator-wrapper] { - grid-template-columns: 100% auto; - } - - [data-separator='line-info'], - [data-separator='line-info-basic'] { - [data-separator-multi-button] { - [data-expand-up] { - border-bottom: 1px solid var(--diffs-bg); - border-right: 2px solid var(--diffs-bg); - } - [data-expand-down] { - border-top: 1px solid var(--diffs-bg); - border-right: 2px solid var(--diffs-bg); - } - } - } - } - - [data-additions] [data-gutter] [data-separator-wrapper], - [data-additions] [data-separator='line-info-basic'] [data-separator-wrapper], - [data-content] [data-separator-wrapper] { - display: none; - } - - [data-line-annotation], - [data-gutter-buffer='annotation'] { - --diffs-line-bg: var(--diffs-bg-context); - } - - [data-merge-conflict-actions], - [data-gutter-buffer='merge-conflict-action'] { - --diffs-line-bg: var(--diffs-bg-context); - } - - [data-has-merge-conflict] [data-line-annotation], - [data-has-merge-conflict] [data-gutter-buffer='annotation'] { - --diffs-line-bg: var(--diffs-bg); - } - - [data-has-merge-conflict] [data-gutter-buffer='merge-conflict-action'] { - --diffs-line-bg: var(--diffs-bg); - } - - [data-line-annotation] { - min-height: var(--diffs-annotation-min-height, 0); - z-index: 2; - } - - [data-merge-conflict-actions] { - z-index: 2; - } - - [data-separator='custom'] { - display: grid; - grid-template-columns: subgrid; - } - - [data-line], - [data-column-number], - [data-no-newline] { - position: relative; - padding-inline: 1ch; - } - - [data-indicators='classic'] [data-line] { - padding-inline-start: 2ch; - } - - [data-indicators='classic'] { - [data-line-type='change-addition'], - [data-line-type='change-deletion'] { - &[data-no-newline], - &[data-line] { - &::before { - display: inline-block; - width: 1ch; - height: 1lh; - position: absolute; - top: 0; - left: 0; - -webkit-user-select: none; - user-select: none; - } - } - } - - [data-line-type='change-addition'] { - &[data-line], - &[data-no-newline] { - &::before { - content: '+'; - color: var(--diffs-addition-base); - } - } - } - - [data-line-type='change-deletion'] { - &[data-line], - &[data-no-newline] { - &::before { - content: '-'; - color: var(--diffs-deletion-base); - } - } - } - } - - [data-indicators='bars'] { - [data-line-type='change-deletion'], - [data-line-type='change-addition'] { - &[data-column-number] { - &::before { - content: ''; - display: block; - width: 4px; - height: 100%; - position: absolute; - top: 0; - left: 0; - -webkit-user-select: none; - user-select: none; - contain: strict; - } - } - } - - [data-line-type='change-deletion'] { - &[data-column-number] { - &::before { - background-image: linear-gradient( - 0deg, - var(--diffs-bg-deletion) 50%, - var(--diffs-deletion-base) 50% - ); - background-repeat: repeat; - background-size: 2px 2px; - background-size: calc(1lh / round(1lh / 2px)) - calc(1lh / round(1lh / 2px)); - } - } - } - - [data-line-type='change-addition'] { - &[data-column-number] { - &::before { - background-color: var(--diffs-addition-base); - } - } - } - } - - [data-overflow='wrap'] { - [data-line], - [data-annotation-content] { - white-space: pre-wrap; - word-break: break-word; - } - } - - [data-overflow='scroll'] [data-line] { - white-space: pre; - min-height: 1lh; - } - - [data-column-number] { - box-sizing: content-box; - text-align: right; - -webkit-user-select: none; - user-select: none; - background-color: var(--diffs-bg); - color: var(--diffs-fg-number); - padding-left: 2ch; - } - - [data-line-number-content] { - display: inline-block; - min-width: var( - --diffs-min-number-column-width, - var(--diffs-min-number-column-width-default, 3ch) - ); - } - - [data-disable-line-numbers] { - [data-column-number] { - min-width: 4px; - padding: 0; - } - - [data-line-number-content] { - display: none; - } - - [data-gutter-utility-slot] { - right: unset; - left: 0; - justify-content: flex-start; - } - - &[data-indicators='bars'] [data-gutter-utility-slot] { - /* Using 5px here because theres a 1px separator after the bar */ - left: 5px; - } - } - - [data-file][data-disable-line-numbers] { - [data-gutter-buffer], - [data-column-number] { - min-width: 0; - border-right: 0; - } - } - - [data-interactive-line-numbers] [data-column-number] { - cursor: pointer; - } - - [data-diff-span] { - border-radius: 3px; - -webkit-box-decoration-break: clone; - box-decoration-break: clone; - } - - [data-line-type='change-addition'] { - &[data-column-number] { - color: var( - --diffs-fg-number-addition-override, - var(--diffs-addition-base) - ); - } - - [data-diff-span] { - background-color: var(--diffs-bg-addition-emphasis); - } - } - - [data-line-type='change-deletion'] { - &[data-column-number] { - color: var( - --diffs-fg-number-deletion-override, - var(--diffs-deletion-base) - ); - } - - [data-diff-span] { - background-color: var(--diffs-bg-deletion-emphasis); - } - } - - [data-background] [data-line-type='change-addition'] { - --diffs-line-bg: var(--diffs-bg-addition); - - &[data-column-number] { - background-color: var(--diffs-bg-addition-number); - } - } - - [data-background] [data-line-type='change-deletion'] { - --diffs-line-bg: var(--diffs-bg-deletion); - - &[data-column-number] { - background-color: var(--diffs-bg-deletion-number); - } - } - - [data-merge-conflict='marker-start'], - [data-merge-conflict='marker-base'], - [data-merge-conflict='marker-separator'], - [data-merge-conflict='marker-end'] { - padding-left: 1ch; - color: var(--diffs-fg); - } - - [data-merge-conflict='marker-start'], - [data-merge-conflict='marker-end'] { - display: flex; - align-items: center; - - &::after { - color: var(--diffs-fg-conflict-marker); - font-style: normal; - font-size: 0.75rem; - line-height: 1.25rem; - padding-left: 1ch; - font-family: var( - --diffs-header-font-family, - var(--diffs-header-font-fallback) - ); - } - } - - [data-merge-conflict='marker-start']::after { - content: '(Current Change)'; - } - - [data-merge-conflict='marker-end']::after { - content: '(Incoming Change)'; - } - - [data-merge-conflict='marker-base'], - [data-merge-conflict='marker-end'] { - &[data-line], - &[data-no-newline] { - background-color: var(--diffs-bg-conflict-marker); - } - - &[data-column-number] { - background-color: var(--diffs-bg-conflict-marker-number); - color: var(--diffs-fg-conflict-marker); - - [data-line-number-content] { - color: var(--diffs-fg-conflict-marker); - } - } - } - - [data-merge-conflict='current'] { - &[data-line], - &[data-no-newline] { - background-color: var(--conflict-bg-current); - } - - &[data-column-number] { - background-color: var(--conflict-bg-current-number); - color: var(--diffs-addition-base); - } - } - - [data-gutter-buffer='merge-conflict-marker-start'], - [data-merge-conflict='marker-start'] { - background-color: var(--conflict-bg-current-header); - } - - [data-gutter-buffer='merge-conflict-marker-end'], - [data-merge-conflict='marker-end'] { - background-color: var(--conflict-bg-incoming-header); - } - - [data-merge-conflict='marker-separator'] { - &[data-line], - &[data-no-newline] { - background-color: var(--diffs-bg); - } - - &[data-column-number] { - background-color: var(--diffs-bg); - } - } - - [data-merge-conflict='base'] { - &[data-line], - &[data-no-newline] { - background-color: var(--diffs-bg-conflict-base); - } - - &[data-column-number] { - background-color: var(--diffs-bg-conflict-base-number); - color: var(--diffs-modified-base); - } - } - - [data-merge-conflict='incoming'] { - &[data-line], - &[data-no-newline] { - background-color: var(--conflict-bg-incoming); - } - - &[data-column-number] { - background-color: var(--conflict-bg-incoming-number); - color: var(--diffs-modified-base); - } - } - - @media (pointer: fine) { - [data-column-number], - [data-line] { - &[data-hovered] { - background-color: var(--diffs-bg-hover); - } - } - - [data-background] { - [data-column-number], - [data-line] { - &[data-hovered] { - &[data-line-type='change-deletion'] { - background-color: var(--diffs-bg-deletion-hover); - } - - &[data-line-type='change-addition'] { - background-color: var(--diffs-bg-addition-hover); - } - } - } - } - } - - [data-diffs-header='default'] { - position: relative; - background-color: var(--diffs-bg); - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: center; - gap: var(--diffs-gap-inline, var(--diffs-gap-fallback)); - min-height: calc( - 1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3) - ); - padding-inline: 16px; - top: 0; - z-index: 2; - } - - [data-header-content] { - display: flex; - flex-direction: row; - align-items: center; - gap: var(--diffs-gap-inline, var(--diffs-gap-fallback)); - min-width: 0; - white-space: nowrap; - } - - [data-header-content] [data-prev-name], - [data-header-content] [data-title] { - direction: rtl; - overflow: hidden; - text-overflow: ellipsis; - min-width: 0; - white-space: nowrap; - } - - [data-prev-name] { - opacity: 0.7; - } - - [data-rename-icon] { - fill: currentColor; - flex-shrink: 0; - flex-grow: 0; - } - - [data-diffs-header='default'] [data-metadata] { - display: flex; - align-items: center; - gap: 1ch; - white-space: nowrap; - } - - [data-diffs-header='default'] [data-additions-count] { - font-family: var(--diffs-font-family, var(--diffs-font-fallback)); - color: var(--diffs-addition-base); - } - - [data-diffs-header='default'] [data-deletions-count] { - font-family: var(--diffs-font-family, var(--diffs-font-fallback)); - color: var(--diffs-deletion-base); - } - - [data-annotation-content] { - position: relative; - display: flow-root; - align-self: flex-start; - z-index: 2; - min-width: 0; - isolation: isolate; - } - - [data-merge-conflict-actions-content] { - display: flex; - align-items: center; - gap: 0.25rem; - padding-inline: 0.5rem; - min-height: 1.75rem; - font-family: var( - --diffs-header-font-family, - var(--diffs-header-font-fallback) - ); - font-size: 0.75rem; - line-height: 1.2; - color: var(--diffs-fg); - } - - [data-merge-conflict-action] { - appearance: none; - border: 0; - background: transparent; - color: var(--diffs-fg-number); - font: inherit; - font-style: normal; - cursor: pointer; - padding: 0; - } - - [data-merge-conflict-action]:hover { - color: var(--diffs-fg); - } - - [data-merge-conflict-action='current']:hover { - color: var(--diffs-addition-base); - } - - [data-merge-conflict-action='incoming']:hover { - color: var(--diffs-modified-base); - } - - [data-merge-conflict-action-separator] { - color: var(--diffs-fg-number); - opacity: 0.6; - -webkit-user-select: none; - user-select: none; - } - - /* Sticky positioning has a composite costs, so we should _only_ pay it if we - * need to */ - [data-overflow='scroll'] [data-annotation-content] { - position: sticky; - width: var(--diffs-column-content-width, auto); - left: var(--diffs-column-number-width, 0); - } - - [data-overflow='scroll'] [data-merge-conflict-actions-content] { - position: sticky; - width: var(--diffs-column-content-width, auto); - left: var(--diffs-column-number-width, 0); - } - - /* Undo some of the stuff that the 'pre' tag does */ - [data-annotation-slot] { - text-wrap-mode: wrap; - word-break: normal; - white-space-collapse: collapse; - } - - [data-change-icon] { - fill: currentColor; - flex-shrink: 0; - } - - [data-change-icon='change'], - [data-change-icon='rename-pure'], - [data-change-icon='rename-changed'] { - color: var(--diffs-modified-base); - } - - [data-change-icon='new'] { - color: var(--diffs-addition-base); - } - - [data-change-icon='deleted'] { - color: var(--diffs-deletion-base); - } - - [data-change-icon='file'] { - opacity: 0.6; - } - - /* Line selection highlighting */ - [data-selected-line] { - &[data-gutter-buffer='annotation'], - &[data-column-number] { - color: var(--diffs-selection-number-fg); - background-color: var(--diffs-bg-selection-number); - } - - &[data-line] { - background-color: var(--diffs-bg-selection); - } - } - - [data-line-type='change-addition'], - [data-line-type='change-deletion'] { - &[data-selected-line] { - &[data-line], - &[data-line][data-hovered] { - background-color: light-dark( - color-mix( - in lab, - var(--diffs-line-bg, var(--diffs-bg)) 82%, - var(--diffs-selection-base) - ), - color-mix( - in lab, - var(--diffs-line-bg, var(--diffs-bg)) 75%, - var(--diffs-selection-base) - ) - ); - } - - &[data-column-number], - &[data-column-number][data-hovered] { - color: var(--diffs-selection-number-fg); - background-color: light-dark( - color-mix( - in lab, - var(--diffs-line-bg, var(--diffs-bg)) 75%, - var(--diffs-selection-base) - ), - color-mix( - in lab, - var(--diffs-line-bg, var(--diffs-bg)) 60%, - var(--diffs-selection-base) - ) - ); - } - } - } - - [data-gutter-utility-slot] { - position: absolute; - top: 0; - bottom: 0; - right: 0; - display: flex; - justify-content: flex-end; - } - - [data-unmodified-lines] { - display: block; - overflow: hidden; - min-width: 0; - text-overflow: ellipsis; - white-space: nowrap; - flex: 0 1 auto; - } - - [data-error-wrapper] { - overflow: auto; - padding: var(--diffs-gap-block, var(--diffs-gap-fallback)) - var(--diffs-gap-inline, var(--diffs-gap-fallback)); - max-height: 400px; - scrollbar-width: none; - - [data-error-message] { - font-weight: bold; - font-size: 18px; - color: var(--diffs-deletion-base); - } - - [data-error-stack] { - color: var(--diffs-fg-number); - } - } - - [data-placeholder] { - contain: strict; - } - - [data-utility-button] { - display: flex; - align-items: center; - justify-content: center; - border: none; - appearance: none; - width: 1lh; - height: 1lh; - margin-right: calc((1lh - 1ch) * -1); - padding: 0; - cursor: pointer; - font-size: var(--diffs-font-size, 13px); - line-height: var(--diffs-line-height, 20px); - border-radius: 4px; - background-color: var(--diffs-modified-base); - color: var(--diffs-bg); - fill: currentColor; - position: relative; - z-index: 4; - } -} -`,kf=`@layer base, theme, rendered, unsafe;`;function Af(e){return`${kf} -@layer unsafe { - ${e} -}`}function jf(e,t=`system`){return`${kf} -@layer rendered { - :host {${t===`system`?``:` - color-scheme: ${t};`} - ${e} - } -}`}function Mf({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 Nf(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function Pf(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`);break}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.tabIndex=0,e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}function Ff({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=If(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function If(){let e=document.createElement(`style`);return e.setAttribute(Tt,``),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(Of)),t.adoptedStyleSheets=[e]}}customElements.define(ut,t)}var Lf=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 Rf(e,t){return Vd(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function zf(e){return M({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function Bf(e){return M({tagName:`div`,children:[M({tagName:`span`,children:[Mt(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function Vf(e){return M({tagName:`div`,children:[Nt({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 Hf({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(M({tagName:`div`,children:[Mt(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(Vf(`up`)),s++),o||(e.push(Vf(`down`)),s++)):(e.push(Vf(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(M({tagName:`div`,children:[M({tagName:`span`,children:[Mt(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(M({tagName:`div`,children:[Mt(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(M({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(M({tagName:`slot`,properties:{name:i}})),M({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 Uf(e,t){return`hunk-separator-${e}-${t}`}function Wf(e){let t=e.at(-1);return t==null?0:Math.max(t.additionStart+t.additionCount,t.deletionStart+t.deletionCount)}function Gf(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}var Kf=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}else 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=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+1e.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}},qf=new class extends Kf{};function Jf(e,t,n){return qf.diff(e,t,n)}function Yf(e,t){let n;for(n=0;nt.length&&(n=e.length-t.length);let r=t.length;e.length0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function rp(e){let t;for(t=e.length-1;t>=0&&e[t].match(/\s/);t--);return e.substring(t+1)}function ip(e){let t=e.match(/^\s*/);return t?t[0]:``}var ap=`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}`,op=RegExp(`[${ap}]+|\\s+|[^${ap}]`,`ug`);new class extends Kf{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=[];for(let t of Array.from(r.segment(e))){let e=t.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}}else n=e.match(op)||[];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)&&sp(n,i,r,e),n=e,r=null,i=null)}),(r||i)&&sp(n,i,r,null),e}};function sp(e,t,n,r){if(t&&n){let i=ip(t.value),a=rp(t.value),o=ip(n.value),s=rp(n.value);if(e){let r=Yf(i,o);e.value=Qf(e.value,o,r),t.value=$f(t.value,r),n.value=$f(n.value,r)}if(r){let e=Xf(a,s);r.value=Zf(r.value,s,e),t.value=ep(t.value,e),n.value=ep(n.value,e)}}else if(n){if(e){let e=ip(n.value);n.value=n.value.substring(e.length)}if(r){let e=ip(r.value);r.value=r.value.substring(e.length)}}else if(e&&r){let n=ip(r.value),i=ip(t.value),a=rp(t.value),o=Yf(n,i);t.value=$f(t.value,o);let s=Xf($f(n,o),a);t.value=ep(t.value,s),r.value=Zf(r.value,n,s),e.value=Qf(e.value,n,n.slice(0,n.length-s.length))}else if(r){let e=ip(r.value),n=tp(rp(t.value),e);t.value=ep(t.value,n)}else if(e){let n=tp(rp(e.value),ip(t.value));t.value=$f(t.value,n)}}var cp=new class extends Kf{tokenize(e){let t=RegExp(`(\\r?\\n)|[${ap}]+|[^\\S\\n\\r]+|[^${ap}]`,`ug`);return e.match(t)||[]}};function lp(e,t,n){return cp.diff(e,t,n)}var up=new class extends Kf{constructor(){super(...arguments),this.tokenize=fp}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(` -`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(` -`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(` -`)&&(e=e.slice(0,-1)),t.endsWith(` -`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function dp(e,t,n){return up.diff(e,t,n)}function fp(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,` -`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;et===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(mp(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 mp(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a{e(l(t))}}))}else return l(dp(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;e0?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&&e1&&!t.includeFileHeaders)throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>_p(e,t)).join(` -`)}let n=[];t.includeIndex&&e.oldFileName==e.newFileName&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`),t.includeFileHeaders&&(n.push(`--- `+e.oldFileName+(e.oldHeader===void 0?``:` `+e.oldHeader)),n.push(`+++ `+e.newFileName+(e.newHeader===void 0?``:` `+e.newHeader)));for(let t=0;t{s(e?_p(e,o.headerOptions):void 0)}}))}else{let s=gp(e,t,n,r,i,a,o);return s?_p(s,o?.headerOptions):void 0}}function yp(e){let t=e.endsWith(` -`),n=e.split(` -`).map(e=>e+` -`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function bp({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 xp({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])}function Sp({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s={finalHunk:e.hunks.at(-1),viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:0,unifiedCount:0,shouldBreak(){if(!s.isWindowedHighlight)return!1;let e=s.unifiedCount>=n+r,i=s.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!s.isWindowedHighlight)return!1;let i=s.unifiedCount+e=n-e&&s.unifiedCount=n-e&&s.splitCount{if(r!==s.finalHunk||!wp(e))return;let t=e.additionLines.length-(r.additionLineIndex+r.additionCount),n=e.deletionLines.length-(r.deletionLineIndex+r.deletionCount);if(t!==n)throw Error(`iterateOverDiff: trailing context mismatch (additions=${t}, deletions=${n}) for ${e.name}`);let o=Math.min(t,n);return Cp(e.isPartial,o,i,e.hunks.length,a)})(),l=o.fromStart+o.fromEnd;function u(e,n){return c==null||c.collapsedLines<=0||c.fromStart+c.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?c.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?c.collapsedLines:0}function d(){if(o.collapsedLines===0)return 0;let e=o.collapsedLines;return o.collapsedLines=0,e}if(s.shouldSkip(l,l))s.incrementCounts(l,l),d();else{let e=r.unifiedLineStart-o.rangeSize,t=r.splitLineStart-o.rangeSize,i=r.deletionLineIndex-o.rangeSize,a=r.additionLineIndex-o.rangeSize,c=r.deletionStart-o.rangeSize,l=r.additionStart-o.rangeSize,u=0;for(;u=t;return{fromStart:l?t:o,fromEnd:l?0:s,rangeSize:t,collapsedLines:Math.max(t-c,0)}}function wp(e){let t=e.hunks.at(-1);return t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0?!1:t.additionLineIndex+t.additionCount=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 Ep({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:a=f.deletions?c+(a-f.deletions):void 0:a=f.deletions?u+(a-f.deletions):void 0:a0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=hf({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)??Ap();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)}Sp({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:c?h:!0,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&&kp({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}=jp({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;t0)for(let e of i.additionSegments)for(let t=0;ts||t.length>s))return;let c=o===`char`?Jf(e,t):lp(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?(xp({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),xp({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?xp({item:e,arr:l,enableJoin:d,isLastItem:t}):xp({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(bp({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(bp({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function Ap(){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 jp({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c=wt,...l}}){let u=s??Zd(e.name),d=s??Zd(t.name),{state:f,transformers:p}=df(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:mf(`token`)}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:mf(`token`)};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,_f(i.codeToHast(ef(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,_f(i.codeToHast(ef(t.contents),m)))}}function Mp(e){let t=e.lang??Zd(e.name),n=e.lang??(e.prevName==null?`text`:Zd(e.prevName));return t===`text`&&n===`text`}var Np=-1,Pp=class{__id=`diff-hunks-renderer:${++Np}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;constructor(e={theme:wt},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=zd(e.theme??wt)?Id():void 0)}cleanUp(){this.highlighter=void 0,this.diff=void 0,this.renderCache=void 0,this.workerManager?.cleanUpPendingTasks(this),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.renderCache=void 0,this.workerManager?.cleanUpPendingTasks(this)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let 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.renderCache=void 0),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??Ot}getExpandedHunksMap(){return this.expandedHunks}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)}}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e}}getSplitLineDecoration({side:e,type:t}){return t===`change`?{gutterLineType:e===`deletions`?`change-deletion`:`change-addition`}:{gutterLineType:t}}createAnnotationElement(e){return Hd(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`,theme:m=wt,headerRenderMode:h=`default`,tokenizeMaxLineLength:g=1e3,useTokenTransformer:_=!1,useCSSClasses:v=!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,theme:this.workerManager?.getDiffRenderOptions().theme??m,headerRenderMode:h,tokenizeMaxLineLength:g,useTokenTransformer:_,useCSSClasses:v}}async initializeHighlighter(){return this.highlighter=await Fd(Qd(this.computedLang,this.options)),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=this.workerManager?.getDiffResultCache(e);n!=null&&!Rf(t,n.options)&&(n=void 0),this.renderCache??={diff:e,highlighted:!Mp(e),options:t,result:n?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result??this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLang=e.lang??Zd(e.name),this.initializeHighlighter())}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getDiffRenderOptions();let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:yf(this.options),tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||e!==n.diff||!Rf(t,n.options)?{options:t,forceRender:!0}:{options:t,forceRender:!1}}renderDiff(e=this.renderCache?.diff,t=kt){if(e==null)return;let{expandUnchanged:n=!1,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),i=this.workerManager?.getDiffResultCache(e);i!=null&&this.renderCache==null&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...i});let{options:a,forceRender:o}=this.getRenderOptions(e);if(this.renderCache??={diff:e,highlighted:!1,options:a,result:void 0,renderRange:void 0},this.workerManager?.isWorkingPool()===!0)(this.renderCache.result==null||!this.renderCache.highlighted&&(e!==this.renderCache.diff||!Bd(this.renderCache.renderRange,t)))&&(this.renderCache.diff=e,this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,Gf(t)||n?!0:this.expandedHunks,r),this.renderCache.renderRange=t),t.totalLines>0&&(!this.renderCache.highlighted||o)&&this.workerManager.highlightDiffAST(this,e);else{this.computedLang=e.lang??Zd(e.name);let t=this.highlighter!=null&&zd(a.theme),n=this.highlighter!=null&&ui(this.computedLang);if(this.highlighter!=null&&t&&(o||!this.renderCache.highlighted&&n||this.renderCache.result==null)){let{result:t,options:r}=this.renderDiffWithHighlighter(e,this.highlighter,!n);this.renderCache={diff:e,options:r,highlighted:n,result:t,renderRange:void 0}}(!t||!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,t,n)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=kt){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 qd({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){this.computedLang=e.lang??Zd(e.name);let t=this.highlighter!=null&&zd(this.options.theme??wt),n=this.highlighter!=null&&ui(this.computedLang);return(this.highlighter==null||!t||!n)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults();return{result:Op(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i}),options:r}}onHighlightSuccess(e,t,n){if(this.renderCache==null)return;let r=!this.renderCache.highlighted||!Rf(this.renderCache.options,n)||this.renderCache.diff!==e;this.renderCache={diff:e,options:n,highlighted:!0,result:t,renderRange:void 0},r&&this.onRenderUpdate?.()}onHighlightError(e){console.error(e)}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults();this.diff=e;let d=a===`unified`,f=[],p=[],m=[],h=[],{additionLines:g,deletionLines:_}=n,v={rowCount:0,hunkSeparators:u,additionsContentAST:f,deletionsContentAST:p,unifiedContentAST:m,unifiedGutterAST:Ft(),deletionsGutterAST:Ft(),additionsGutterAST:Ft(),expansionLineCount:c,hunkData:h,incrementRowCount(e=1){v.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:v.unifiedGutterAST.children.push(t);break;case`deletions`:v.deletionsGutterAST.children.push(t);break;case`additions`:v.additionsGutterAST.children.push(t);break}}},y=Vp(e),b={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`?(v.pushToGutter(`additions`,Lt(void 0,`buffer`,this.size)),f?.push(zf(this.size))):(v.pushToGutter(`deletions`,Lt(void 0,`buffer`,this.size)),p?.push(zf(this.size))),this.size=0,this.side=void 0}}},x=(e,t,n,r,i)=>{v.pushToGutter(e,It(t,n,r,i))};function S(e){b.flush(),a===`unified`?zp(`unified`,e,v):(zp(`deletions`,e,v),zp(`additions`,e,v))}Sp({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,d=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&b.flush(),r>0&&S({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:!e.isPartial});let f=a===`unified`?d:l,p={type:c,hunkIndex:t,lineIndex:f,unifiedLineIndex:d,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(p);n?.before!=null&&Ip(n.before,v);let r=s==null?void 0:_[s.lineIndex],i=o==null?void 0:g[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});x(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${d},${l}`,u.gutterProperties),i==null?r!=null&&(r=Bp(r,u.contentProperties)):i=Bp(i,u.contentProperties),Rp({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,f),createAnnotationElement:e=>this.createAnnotationElement(e),context:v}),n?.after!=null&&Ip(n.after,v)}else{let n=this.getSplitInjectedRowsForLine?.(p);n?.before!=null&&Lp(n.before,v,b);let r=s==null?void 0:_[s.lineIndex],i=o==null?void 0:g[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 d=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();if(d!=null){if(b.side!=null&&b.side!==d)throw Error(`DiffHunksRenderer.processDiffResult: iterateOverDiff, invalid pending splits`);b.side=d,b.increment()}let m=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,f);if(m!=null&&b.size>0&&b.flush(),s!=null){let e=Bp(r,a.contentProperties);x(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=Bp(i,u.contentProperties);x(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Rp({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...m,createAnnotationElement:e=>this.createAnnotationElement(e),context:v}),n?.after!=null&&Lp(n.after,v,b)}let m=s?.noEOFCR??!1,h=o?.noEOFCR??!1;if(h||m){if(m){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(v.unifiedContentAST.push(Bf(e)),v.pushToGutter(`unified`,Lt(e,`metadata`,1))):(v.deletionsContentAST.push(Bf(e)),v.pushToGutter(`deletions`,Lt(e,`metadata`,1)),h||(v.pushToGutter(`additions`,Lt(void 0,`buffer`,1)),v.additionsContentAST.push(zf(1))))}if(h){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(v.unifiedContentAST.push(Bf(e)),v.pushToGutter(`unified`,Lt(e,`metadata`,1))):(v.additionsContentAST.push(Bf(e)),v.pushToGutter(`additions`,Lt(e,`metadata`,1)),m||(v.pushToGutter(`deletions`,Lt(void 0,`buffer`,1)),v.deletionsContentAST.push(zf(1))))}v.incrementRowCount(1)}i>0&&u!==`simple`&&S({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:i,rangeSize:y,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:!e.isPartial}),v.incrementRowCount(1)}}),a===`split`&&b.flush();let C=Math.max(Wf(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),w=t.bufferBefore>0||t.bufferAfter>0,ee=!d&&e.type!==`deleted`,T=!d&&e.type!==`new`,te=v.rowCount>0||w;f=ee&&te?f:void 0,p=T&&te?p:void 0,m=d&&te?m:void 0;let ne=this.createPreElement(p!=null&&f!=null,C);return{unifiedGutterAST:d&&te?v.unifiedGutterAST.children:void 0,unifiedContentAST:m,deletionsGutterAST:T&&te?v.deletionsGutterAST.children:void 0,deletionsContentAST:p,additionsGutterAST:ee&&te?v.additionsGutterAST.children:void 0,additionsContentAST:f,hunkData:h,preNode:ne,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:C,rowCount:v.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=Ft(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,vf(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(M({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(M({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(M({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return Hr(this.renderFullAST(e,t))}renderPartialHTML(e,t){return Hr(t==null?e:M({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}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($d(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($d(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}=this.getOptionsWithDefaults();return Wd({fileOrDiff:e,mode:t})}};function Fp(e){return`${e} unmodified line${e>1?`s`:``}`}function Ip(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function Lp(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 Rp({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`,Lt(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`,Lt(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`,Lt(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function zp(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,Hf({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(Hf({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,Hf({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(Hf({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=Uf(e,t),d=r>c.expansionLineCount,f=s?t:void 0;c.pushToGutter(e,Hf({type:c.hunkSeparators,content:Fp(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(Hf({type:c.hunkSeparators,content:Fp(n),expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:n,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function Bp(e,t){return e==null||e.type!==`element`||t==null?e:{...e,properties:{...e.properties,...t}}}function Vp(e){let t=e.hunks.at(-1);if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let n=e.additionLines.length-(t.additionLineIndex+t.additionCount),r=e.deletionLines.length-(t.deletionLineIndex+t.deletionCount);if(n!==r)throw Error(`DiffHunksRenderer.processDiffResult: trailing context mismatch (additions=${n}, deletions=${r}) for ${e.name}`);return Math.min(n,r)}function Hp(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Up(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}function Wp(e){let t=e[0];if(t!==`+`&&t!==`-`&&t!==` `&&t!==`\\`){console.error(`parseLineType: Invalid firstChar: "${t}", full line: "${e}"`);return}let n=e.substring(1);return{line:n===``?` -`:n,type:t===` `?`context`:t===`\\`?`metadata`:t===`+`?`addition`:`deletion`}}function Gp(e,t,n=!1){let r=ft.test(e),i=e.split(r?ft:pt),a,o=[];for(let e of i){if(r&&!ft.test(e)){if(a==null)a=e;else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}else if(!r&&!pt.test(e)){if(a==null)a=e;else if(n)throw Error(`parsePatchContent: unknown file blob`);else console.error(`parsePatchContent: unknown file blob:`,e);continue}let i=Kp(e,{cacheKey:t==null?void 0:`${t}-${o.length}`,isGitDiff:r,throwOnError:n});i!=null&&o.push(i)}return{patchMetadata:a,files:o}}function Kp(e,{cacheKey:t,isGitDiff:n=ft.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=e.split(mt),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=e.split(gt),f=s.shift();if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=f.match(ht),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?i.contents.split(gt):[],deletionLines:!l&&r!=null&&i!=null?r.contents.split(gt):[],cacheKey:t},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0),s.unshift(f);for(let e of s){let t=e.match(n?vt:_t);if(e.startsWith(`diff --git`)){let[,,t,,n]=e.trim().match(yt)??[];c.name=n.trim(),t!==n&&(c.prevName=t.trim())}else if(t!=null){let[,e,n]=t;e===`---`&&n!==`/dev/null`?(c.prevName=n.trim(),c.name=n.trim()):e===`+++`&&n!==`/dev/null`&&(c.name=n.trim())}else if(n){if(e.startsWith(`new mode `)&&(c.mode=e.replace(`new mode`,``).trim()),e.startsWith(`old mode `)&&(c.prevMode=e.replace(`old mode`,``).trim()),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=e.replace(`new file mode`,``).trim()),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=e.replace(`deleted file mode`,``).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(bt)??[];t!=null&&(c.prevObjectId=t),n!=null&&(c.newObjectId=n),r!=null&&(c.mode=r)}e.startsWith(`rename from `)&&(c.prevName=e.replace(`rename from `,``).trim()),e.startsWith(`rename to `)&&(c.name=e.replace(`rename to `,``).trim())}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===` -`||s[s.length-1]===`\r`||s[s.length-1]===`\r -`||s[s.length-1]===``);)s.pop();let v=parseInt(p[3]),y=parseInt(p[1]);u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:parseInt(p[4]??`1`),additionStart:v,additionLines:m,deletionCount:parseInt(p[2]??`1`),deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:p[5],hunkSpecs:f,noEOFCRAdditions:!1,noEOFCRDeletions:!1};if(isNaN(b.additionCount)||isNaN(b.deletionCount)||isNaN(b.additionStart)||isNaN(b.deletionStart)){if(a)throw Error(`parsePatchContent: invalid hunk metadata`);console.error(`parsePatchContent: invalid hunk metadata`,b);continue}for(let e of s){let t=Wp(e);if(t==null){console.error(`processFile: invalid rawLine:`,e);continue}let{type:n,line:r}=t;if(n===`addition`)(g==null||g.type!==`change`)&&(g=Jp(`change`,u,d),b.hunkContent.push(g)),d++,l&&c.additionLines.push(r),g.additions++,m++,_=`addition`;else if(n===`deletion`)(g==null||g.type!==`change`)&&(g=Jp(`change`,u,d),b.hunkContent.push(g)),u++,l&&c.deletionLines.push(r),g.deletions++,h++,_=`deletion`;else if(n===`context`)(g==null||g.type!==`context`)&&(g=Jp(`context`,u,d),b.hunkContent.push(g)),d++,u++,l&&(c.deletionLines.push(r),c.additionLines.push(r)),g.lines++,_=`context`;else if(n===`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]=ef(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=ef(c.deletionLines[e]))}}}b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(b.additionStart-1-o,0),c.hunks.push(b),o=b.additionStart+b.additionCount-1;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(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=e.additionStart+e.additionCount-1,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`:i!=null&&i.contents===``?c.type=`deleted`:r!=null&&r.contents===``&&(c.type=`new`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),c}}function qp(e,t,n=!1){let r=[];for(let i of e.split(dt))try{r.push(Gp(i,t==null?void 0:`${t}-${r.length}`,n))}catch(e){if(n)throw e;console.error(e)}return r}function Jp(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}function Yp(e,t,n,r=!1){let i=Kp(vp(e.name,t.name,e.contents,t.contents,e.header,t.header,n),{cacheKey:(()=>{if(e.cacheKey!=null&&t.cacheKey!=null)return`${e.cacheKey}:${t.cacheKey}`})(),oldFile:e,newFile:t,throwOnError:r});if(i==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);return t.lang!=null&&(i.lang=t.lang),i}var Xp=-1,Zp=class{static LoadedCustomComponent=!0;__id=`file-diff:${++Xp}`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];deletionFile;additionFile;fileDiff;renderRange;appliedPreAttributes;lastRenderedHeaderHTML;lastRowCount;enabled=!0;constructor(e={theme:wt},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new ai,this.scrollSyncManager=new Lf,this.interactionManager=new Gr(`diff`,Kr(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{...e,headerRenderMode:e.renderCustomHeader==null?`default`:`custom`,hunkSeparators:typeof e.hunkSeparators==`function`?`custom`:e.hunkSeparators}}createHunksRenderer(e){return new Pp(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{if(this.fileDiff==null)return;let n=this.fileDiff.hunks.at(-1),r,i;hunkIterator:for(let a of this.fileDiff.hunks){let o=t===`deletions`?a.deletionStart:a.additionStart,s=t===`deletions`?a.deletionCount:a.additionCount,c=a.splitLineStart,l=a.unifiedLineStart;if(e=o+s){if(a===n){let t=e-(o+s);r=l+a.unifiedLineCount+t,i=c+a.splitLineCount+t;break hunkIterator}continue}for(let n of a.hunkContent)if(n.type===`context`)if(ethis.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e){this.interactionManager.setSelection(e)}cleanUp(e=!1){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer?.shadowRoot!=null&&(this.fileContainer.shadowRoot.innerHTML=``),this.fileContainer=void 0,this.pre!=null&&(this.pre.innerHTML=``,this.pre=void 0),this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore=void 0,this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,lineAnnotations:i,oldFile:a,newFile:o,fileDiff:s}=e;this.hydrateElements(t,n),this.pre==null&&this.headerElement==null?this.render({...e,preventEmit:!0}):this.hydrationSetup({fileDiff:s,oldFile:a,newFile:o,lineAnnotations:i}),r||this.emitPostRender()}hydrateElements(e,t){Nf(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.pre!=null||this.headerElement!=null)&&(this.fileContainer=e)}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){let{diffStyle:i=`split`,overflow:a=`scroll`}=this.options;this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!=null&&n!=null?Yp(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,a===`wrap`),a===`scroll`&&i===`split`&&this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions))}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.rerender()};render({oldFile:e,newFile:t,fileDiff:n,forceRender:r=!1,preventEmit:i=!1,lineAnnotations:a,fileContainer:o,containerWrapper:s,renderRange:c}){if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);let{collapsed:l=!1}=this.options,u=l?void 0:c,d=e!=null&&t!=null&&(!xf(e,this.deletionFile)||!xf(t,this.additionFile)),f=n!=null&&n!==this.fileDiff,p=a!=null&&(a.length>0||this.lineAnnotations.length>0)?a!==this.lineAnnotations:!1;if(!l&&Bd(u,this.renderRange)&&!r&&!p&&(n!=null&&n===this.fileDiff||n==null&&!d))return!1;let{renderRange:m}=this;if(this.renderRange=u,this.deletionFile=e,this.additionFile=t,n==null?e!=null&&t!=null&&d&&(f=!0,this.fileDiff=Yp(e,t,this.options.parseDiffOptions)):this.fileDiff=n,a!=null&&this.setLineAnnotations(a),this.fileDiff==null)return!1;this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{diffStyle:h=`split`,disableErrorHandling:g=!1,disableFileHeader:_=!1,overflow:v=`scroll`,themeType:y=`system`}=this.options;if(_&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),o=this.getOrCreateFileContainer(o,s),l){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,At);e!=null&&this.applyThemeState(o,e.themeStyles,y,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,o),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,o)}return i||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(o);if(!(this.canPartiallyRender(r,p,d||f)&&this.applyPartialRender({previousRenderRange:m,renderRange:u}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,u);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(o,t.themeStyles,y,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,o),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,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.interactionManager.setup(e),this.resizeManager.setup(e,v===`wrap`),v===`scroll`&&h===`split`?this.scrollSyncManager.setup(e,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp()}catch(e){if(g)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,o)}return i||this.emitPostRender(),!0}emitPostRender(){this.fileContainer!=null&&this.options.onPostRender?.(this.fileContainer,this)}removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();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.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}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.gutterUtilityContent?.remove(),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.gutterUtilityContent=void 0,this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||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||!Up(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}-${$d(r)}`,a=this.annotationCache.get(i);if(a==null||!Hp(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:Tf($d(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 e=this.options.renderGutterUtility??this.options.renderHoverUtility;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=Ef();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let n=this.fileContainer;if(this.fileContainer=e??this.fileContainer??document.createElement(`diffs-container`),n!=null&&n!==this.fileContainer&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=bf;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t,this.fileContainer.shadowRoot?.appendChild(this.spriteSVG))}return this.fileContainer}getFileContainer(){return this.fileContainer}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return 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&&(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=Hr(e);if(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,renderHeaderMetadata:o}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Ct,e),this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0;return}let s=a?.(n)??void 0,c=o?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,xt,s),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,St,c),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,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??=Df(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Af(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n;this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a||(this.themeCSSStyle=Ff({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:jf(t,a)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{themeStyles:t,themeType:a,baseThemeType:r})}applyHunksToDOM(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);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=Mf({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),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=Mf({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),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=Mf({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),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(`applyPartialRender: failed to trim to overlap`);if(this.lastRowCount{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&&lp)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`)}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=Qp(t[0]),i=Qp(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(;a0||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}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}else throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getCodeColumns(e,t,n,r){function i(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}}if(e===`unified`)return i(t);{let e=i(n),t=i(r);return e!=null||t!=null?[e,t]:void 0}}applyBuffers(e,t){let{disableVirtualizationBuffers:n=!1}=this.options;if(n||t==null){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)}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`?!1:t!=null&&n!=null,totalLines:r,customProperties:i};Sf(u,this.appliedPreAttributes)||(Pf(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper();let n=this.getOrCreatePreNode(t);n.innerHTML=``,n.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let r=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.innerHTML=``,r.appendChild(this.errorWrapper);let i=document.createElement(`div`);i.dataset.errorMessage=``,i.innerText=e.message,this.errorWrapper.appendChild(i);let a=document.createElement(`pre`);a.dataset.errorStack=``,a.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(a)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Qp(e){if(!(e==null||e.type!==`element`))return e.children??[]}function $p({hunkIndex:e,lineIndex:t,conflictIndex:n}){return`merge-conflict-action-${e}-${t}-${n}`}function em(e,t){let n=t.hunks[e.hunkIndex];if(n!=null)return{hunkIndex:e.hunkIndex,lineIndex:tm(n,e.startContentIndex)}}function tm(e,t){let n=e.unifiedLineStart;for(let r=0;rthis.fileContainer==null?!1:(e&&(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer)),this.render());cleanUp(){this.fileContainer!=null&&this.virtualizer.disconnect(this.fileContainer),super.cleanUp()}expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.computeApproximateSize(),this.renderRange=void 0,this.virtualizer.instanceChanged(this)};setVisibility(e){this.fileContainer!=null&&(this.renderRange=void 0,e&&!this.isVisible?(this.top=this.virtualizer.getOffsetInScrollContainer(this.fileContainer),this.isVisible=!0):!e&&this.isVisible&&(this.isVisible=!1,this.rerender()))}computeApproximateSize(){let e=this.height===0;if(this.height=0,this.fileDiff==null)return;let{disableFileHeader:t=!1,expandUnchanged:n=!1,collapsed:r=!1,collapsedContextThreshold:i=1,hunkSeparators:a=`line-info`}=this.options,{diffHeaderHeight:o,fileGap:s,hunkSeparatorHeight:c}=this.metrics,l=this.getDiffStyle(),u=a!==`simple`&&a!==`metadata`&&a!==`line-info-basic`?s:0;if(t?a!==`simple`&&a!==`metadata`&&(this.height+=s):this.height+=o,!r&&(Sp({diff:this.fileDiff,diffStyle:l,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({hunkIndex:e,collapsedBefore:t,collapsedAfter:n,deletionLine:r,additionLine:i})=>{let o=i==null?r.splitLineIndex:i.splitLineIndex,s=i==null?r.unifiedLineIndex:i.unifiedLineIndex,d=(i?.noEOFCR??!1)||(r?.noEOFCR??!1);t>0&&(e>0&&(this.height+=u),this.height+=c+u),this.height+=this.getLineHeight(l===`split`?o:s,d),n>0&&a!==`simple`&&(this.height+=u+c)}}),this.fileDiff.hunks.length>0&&(this.height+=s),this.fileContainer!=null&&this.virtualizer.config.resizeDebugging&&!e)){let e=this.fileContainer.getBoundingClientRect();e.height===this.height?console.log(`VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT`):console.log(`VirtualizedFileDiff.computeApproximateSize: computed height doesnt match`,{name:this.fileDiff.name,elementHeight:e.height,computedHeight:this.height})}}render({fileContainer:e,oldFile:t,newFile:n,fileDiff:r,...i}={}){let a=this.fileContainer==null;if(this.fileDiff??=r??(t!=null&&n!=null?Yp(t,n,this.options.parseDiffOptions):void 0),e=this.getOrCreateFileContainer(e),this.fileDiff==null)return console.error(`VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data`),!1;if(a?(this.computeApproximateSize(),this.virtualizer.connect(e,this),this.top??=this.virtualizer.getOffsetInScrollContainer(e),this.isVisible=this.virtualizer.isInstanceVisible(this.top,this.height)):this.top??=this.virtualizer.getOffsetInScrollContainer(e),!this.isVisible)return this.renderPlaceholder(this.height);let o=this.virtualizer.getWindowSpecs(),s=this.computeRenderRangeFromWindow(this.fileDiff,this.top,o);return super.render({fileDiff:this.fileDiff,fileContainer:e,renderRange:s,oldFile:t,newFile:n,...i})}getDiffStyle(){return this.options.diffStyle??`split`}getExpandedRegion(e,t,n){if(n<=0||e)return{fromStart:0,fromEnd:0,collapsedLines:Math.max(n,0),renderAll:!1};let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;if(r||n<=i)return{fromStart:n,fromEnd:0,collapsedLines:0,renderAll:!0};let a=this.hunksRenderer.getExpandedHunk(t),o=Math.min(Math.max(a.fromStart,0),n),s=Math.min(Math.max(a.fromEnd,0),n),c=o+s,l=c>=n;return{fromStart:o,fromEnd:s,collapsedLines:Math.max(n-c,0),renderAll:l}}getExpandedLineCount(e,t){let n=0;if(e.isPartial){for(let r of e.hunks)n+=t===`split`?r.splitLineCount:r.unifiedLineCount;return n}for(let[r,i]of e.hunks.entries()){let a=t===`split`?i.splitLineCount:i.unifiedLineCount;n+=a;let o=Math.max(i.collapsedBefore,0),{fromStart:s,fromEnd:c,renderAll:l}=this.getExpandedRegion(e.isPartial,r,o);o>0&&(n+=l?o:s+c)}let r=e.hunks.at(-1);if(r!=null&&om(e)){let t=e.additionLines.length-(r.additionLineIndex+r.additionCount),i=e.deletionLines.length-(r.deletionLineIndex+r.deletionCount);if(r!=null&&t!==i)throw Error(`VirtualizedFileDiff: trailing context mismatch (additions=${t}, deletions=${i}) for ${e.name}`);let a=Math.min(t,i);if(r!=null&&a>0){let{fromStart:t,renderAll:r}=this.getExpandedRegion(e.isPartial,e.hunks.length,a);n+=r?a:t}}return n}computeRenderRangeFromWindow(e,t,{top:n,bottom:r}){let{disableFileHeader:i=!1,expandUnchanged:a=!1,collapsedContextThreshold:o=1,hunkSeparators:s=`line-info`}=this.options,{diffHeaderHeight:c,fileGap:l,hunkLineCount:u,hunkSeparatorHeight:d,lineHeight:f}=this.metrics,p=this.getDiffStyle(),m=this.height,h=this.getExpandedLineCount(e,p),g=i?l:c;if(tr)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:m-g-l};if(h<=u||e.hunks.length===0)return{startingLine:0,totalLines:u,bufferBefore:0,bufferAfter:0};let _=Math.ceil(Math.max(r-n,0)/f),v=Math.ceil(_/u)*u+u,y=v/u,b=y,x=[],S=(n+r)/2,C=s===`simple`||s===`metadata`||s===`line-info-basic`?0:l,w=t+g,ee=0,T,te,ne;if(Sp({diff:e,diffStyle:p,expandedHunks:a?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:o,callback:({hunkIndex:e,collapsedBefore:i,collapsedAfter:a,deletionLine:o,additionLine:c})=>{let l=c==null?o.splitLineIndex:c.splitLineIndex,f=c==null?o.unifiedLineIndex:c.unifiedLineIndex,m=(c?.noEOFCR??!1)||(o?.noEOFCR??!1),h=i>0?d+C+(e>0?C:0):0;e===0&&s===`simple`&&(h=0),w+=h;let _=ee%u===0;if(_&&(x.push(w-(t+g+h)),ne!=null)){if(ne<=0)return!0;ne--}let v=this.getLineHeight(p===`split`?l:f,m),y=Math.floor(ee/u);return w>n-v&&wS&&(te=y),ne==null&&w>=r&&_&&(ne=b),ee++,w+=v,a>0&&s!==`simple`&&(w+=d+C),!1}}),T==null)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:m-g-l};let re=x.length;te??=T;let ie=Math.round(te-y/2),ae=Math.max(0,re-y),oe=Math.max(0,Math.min(ie,ae)),se=oe*u,ce=ie<0?v+ie*u:v,le=x[oe]??0,E=oe+ce/u;return{startingLine:se,totalLines:ce,bufferBefore:le,bufferAfter:E`u`&&t!=null?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,j.jsx)(j.Fragment,{children:e})}var hm=(0,A.createContext)(void 0);function gm(){return(0,A.useContext)(hm)}var _m=(0,A.createContext)(void 0);function vm(e){let t=(0,A.useRef)(e);return(0,A.useInsertionEffect)(()=>void(t.current=e)),(0,A.useCallback)((...e)=>t.current(...e),[])}function ym({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderMetadata:i,renderAnnotation:a,renderGutterUtility:o,renderHoverUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d}){let f=o??s,p=n?.(e),m=r?.(e),h=i?.(e);return(0,j.jsxs)(j.Fragment,{children:[p==null?(0,j.jsxs)(j.Fragment,{children:[m!=null&&(0,j.jsx)(`div`,{slot:`header-prefix`,children:m}),h!=null&&(0,j.jsx)(`div`,{slot:`header-metadata`,children:h})]}):(0,j.jsx)(`div`,{slot:Ct,children:p}),a!=null&&l?.map((e,t)=>(0,j.jsx)(`div`,{slot:$d(e),children:a(e)},t)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=bm(t,e);return(0,j.jsx)(`div`,{slot:n,style:fm,children:c(t,d)},n)}),f!=null&&(0,j.jsx)(`div`,{slot:`gutter-utility-slot`,style:dm,children:f(u)})]})}function bm(e,t){let n=em(e,t);return n==null?void 0:$p({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}var xm=typeof window>`u`?A.useEffect:A.useLayoutEffect;function Sm({fileDiff:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i,metrics:a,hasGutterRenderUtility:o,hasCustomHeader:s,disableWorkerPool:c}){let l=gm(),u=(0,A.useContext)(_m),d=(0,A.useRef)(null),f=vm(r=>{if(r!=null){if(d.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);l==null?d.current=new Zp(Cm({hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c?void 0:u,!0):d.current=new am(Cm({hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),l,a,c?void 0:u,!0),d.current.hydrate({fileDiff:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:i})}else{if(d.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);d.current.cleanUp(),d.current=null}});return xm(()=>{let{current:i}=d;if(i==null)return;let a=Cm({hasCustomHeader:s,hasGutterRenderUtility:o,options:t}),c=!lm(i.options,a);i.setOptions(a),i.render({forceRender:c,fileDiff:e,lineAnnotations:n}),r!==void 0&&i.setSelectedLines(r)}),{ref:f,getHoveredLine:(0,A.useCallback)(()=>d.current?.getHoveredLine(),[])}}function Cm({options:e,hasCustomHeader:t,hasGutterRenderUtility:n}){return n||t?{...e,renderCustomHeader:t?pm:void 0,renderGutterUtility:n?pm:void 0}:e}function wm({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,className:a,style:o,prerenderedHTML:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderMetadata:d,renderGutterUtility:f,renderHoverUtility:p,disableWorkerPool:m=!1}){let{ref:h,getHoveredLine:g}=Sm({fileDiff:e,options:t,metrics:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:s,hasGutterRenderUtility:f!=null||p!=null,hasCustomHeader:l!=null,disableWorkerPool:m});return(0,j.jsx)(ut,{ref:h,className:a,style:o,children:mm(ym({fileDiff:e,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderMetadata:d,renderAnnotation:c,renderGutterUtility:f,lineAnnotations:r,renderHoverUtility:p,getHoveredLine:g}),s)})}var Tm=[{prefix:`#`},{prefix:`//`},{prefix:``},{prefix:`/*`,suffix:`*/`},{prefix:`--`},{prefix:`%`},{prefix:`;`},{prefix:`"`}],Em=``,Dm=``;function Om(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function km(e,t){let n=Om(e.prefix),r=e.suffix?`(?:\\s*${Om(e.suffix)})?`:``;return`${n}\\s*${Om(t)}${r}`}function Am(e,t){let n=e.map(e=>km(e,t)).join(`|`);return RegExp(`^\\s*(?:${n})\\s*$`)}var jm=Am(Tm,Em),Mm=Am(Tm,Dm),Nm=new Ue;async function Pm(e,t={method:`GET`}){let n=await fetch(e,{method:t.method,headers:t.body===void 0?void 0:{"Content-Type":`application/json`},body:t.body===void 0?void 0:JSON.stringify(t.body)});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error??`Request failed (${n.status})`)}return n.json()}var Fm=`(min-width: 1060px)`;function Im(){return(0,A.useSyncExternalStore)(e=>{let t=window.matchMedia(Fm);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>window.matchMedia(Fm).matches)}function Lm(e=1500){let[t,n]=(0,A.useState)(null),r=(0,A.useRef)(void 0),i=(0,A.useRef)(0);return{toast:t,showToast:(0,A.useCallback)(t=>{clearTimeout(r.current),n({content:t,key:++i.current}),r.current=setTimeout(()=>n(null),e)},[e])}}function Rm(e,t){let n=[];for(let r of e.hunks){let i=null;for(let a=0;at&&r.topVm(t)&&n.topt.some(t=>e>=t.start&&e<=t.end);for(let e of Array.from(r.children)){if(!(e instanceof HTMLElement)||!e.hasAttribute(`data-code`)||e.hasAttribute(`data-deletions`))continue;let t=e.querySelector(`[data-gutter]`),n=e.querySelector(`[data-content]`);if(!(!t||!n))for(let e=0;e{o.current?.focus()},[]);let s=()=>{let t=i.trim();!t||n||e(t)};return(0,j.jsxs)(`div`,{className:`comment-form`,onClick:e=>e.stopPropagation(),children:[(0,j.jsx)(`textarea`,{ref:o,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),s()),e.key===`Escape`&&t()},placeholder:`Leave a review comment... (Cmd+Enter to submit)`,rows:3,disabled:n}),(0,j.jsxs)(`div`,{className:`comment-form-actions`,children:[r&&(0,j.jsx)(`div`,{className:`comment-form-error`,children:r}),(0,j.jsx)(Jm,{onClick:t,disabled:n,children:`Cancel`}),(0,j.jsx)(Jm,{variant:`primary`,disabled:!i.trim()||n,onClick:s,children:`Comment`})]})]})}var Xm=20,Zm=!1,Qm=(0,A.memo)(function({fileDiff:e,diffStyle:t,lineAnnotations:n,renderAnnotation:r,onGutterUtilityClick:i,commentsEnabled:a}){return(0,j.jsx)(`div`,{ref:(0,A.useCallback)(n=>{Zm||!n||requestAnimationFrame(()=>{let r=t===`split`?e.splitLineCount:e.unifiedLineCount;r>0&&n.offsetHeight>0&&(Xm=n.offsetHeight/r,Zm=!0)})},[e,t]),children:(0,j.jsx)(wm,{fileDiff:e,options:{theme:`github-dark-default`,diffStyle:t,diffIndicators:`classic`,hunkSeparators:`line-info-basic`,overflow:`wrap`,disableFileHeader:!0,enableGutterUtility:a,onGutterUtilityClick:i},lineAnnotations:n,renderAnnotation:r})})},(e,t)=>e.fileDiff===t.fileDiff&&e.diffStyle===t.diffStyle&&e.lineAnnotations===t.lineAnnotations);function $m({fileDiff:e,isViewed:t,isStale:n,diffStyle:r,collapsed:i,composing:a,focused:o,onToggleCollapse:s,onToggleViewed:c,onStartComment:l,onSubmitComment:u,onResolveComment:d,onCancelComment:f,commentsEnabled:p,submitting:m,submitError:h}){let{additions:g,deletions:_}=zm(e),v=e.name,y=(0,A.useMemo)(()=>{if(!p)return[];let t=Rm(e,v);return a&&t.push({side:`additions`,lineNumber:a.line,metadata:{type:`composing`,file:v}}),t},[e,v,a,p]),b=(0,A.useCallback)(e=>{let t=e.metadata;return t.type===`review`?(0,j.jsx)(`div`,{className:`review-annotation`,children:(0,j.jsx)(Jm,{onClick:()=>d(t.startLine),children:`Resolve comment`})}):t.type===`composing`?(0,j.jsx)(Ym,{onSubmit:t=>u(e.lineNumber,t),onCancel:f,submitting:m,error:h}):null},[d,u,f,m,h]),x=(0,A.useCallback)(e=>{!p||e.side!==`additions`||y.some(t=>t.metadata.type===`review`&&e.start>=t.metadata.startLine&&e.start<=t.metadata.endLine)||l(e.start)},[l,p,y]),S=(0,A.useRef)(null),[C,w]=(0,A.useState)(!1);(0,A.useEffect)(()=>{let e=S.current;if(!e)return;let t=new IntersectionObserver(e=>{e[0]?.isIntersecting&&(w(!0),t.disconnect())},{rootMargin:`2000px`});return t.observe(e),()=>t.disconnect()},[]);let ee=C&&!i;(0,A.useEffect)(()=>{if(!ee)return;let e=S.current;if(!e)return;let t=y.flatMap(e=>e.metadata.type===`review`?[{start:e.metadata.startLine,end:e.metadata.endLine}]:[]),n=0,r=null,i=0,a=()=>qm(e,t),o=()=>{let t=(e.querySelector(`diffs-container`)?.shadowRoot)?.querySelector(`pre`);if(!t){i++<60&&(n=requestAnimationFrame(o));return}a(),r=new MutationObserver(a),r.observe(t,{childList:!0,subtree:!0})};return n=requestAnimationFrame(o),()=>{cancelAnimationFrame(n),r?.disconnect()}},[y,ee,r,e]);let T=(r===`split`?e.splitLineCount:e.unifiedLineCount)*Xm;return(0,j.jsxs)(`div`,{ref:S,className:`file-card`+(o?` focused`:``),children:[(0,j.jsxs)(`div`,{className:`file-header`,onClick:s,children:[(0,j.jsx)(`span`,{className:`collapse-chevron`+(i?` collapsed`:``),children:`▶`}),(0,j.jsx)(`span`,{className:`file-header-name`,children:v}),(0,j.jsxs)(`span`,{className:`file-header-stats`,children:[g>0&&(0,j.jsxs)(`span`,{className:`stat-add`,children:[`+`,g]}),_>0&&(0,j.jsxs)(`span`,{className:`stat-del`,children:[`-`,_]})]}),(0,j.jsxs)(`button`,{type:`button`,className:`viewed-button`+(n?` stale`:``)+(t?` checked`:``),onClick:e=>{e.stopPropagation(),c()},children:[(0,j.jsx)(`input`,{type:`checkbox`,className:`viewed-checkbox`+(n?` stale`:``),checked:t,readOnly:!0,tabIndex:-1}),n?`Changed`:`Viewed`]})]}),ee?(0,j.jsx)(Qm,{fileDiff:e,diffStyle:r,lineAnnotations:y,renderAnnotation:b,onGutterUtilityClick:x,commentsEnabled:p}):!i&&(0,j.jsx)(`div`,{style:{height:T}})]})}function eh({fileHashes:e,viewed:t}){let n=Object.keys(e).length,r=Object.entries(e).filter(([e,n])=>t[e]===n).length;return n===0?null:(0,j.jsxs)(`div`,{className:`progress-bar`,children:[(0,j.jsxs)(`span`,{children:[r,`/`,n,` files viewed`]}),(0,j.jsx)(`div`,{className:`progress-track`,children:(0,j.jsx)(`div`,{className:`progress-fill`,style:{width:`${r/n*100}%`}})})]})}function th({onClose:e,children:t}){let n=(0,A.useRef)(null);return(0,A.useEffect)(()=>n.current?.showModal(),[]),(0,j.jsx)(`dialog`,{ref:n,className:`help-modal`,onClose:e,onClick:e=>{e.target===e.currentTarget&&n.current?.close()},children:t})}var nh=[[`j / k`,`Next / previous line`],[`n / p`,`Next / previous file`],[`v`,`Toggle viewed`],[`e / E`,`Toggle collapse file / all files`],[`s`,`Toggle split mode (responsive / unified)`],[`c`,`Comment on line`],[`Esc`,`Close / cancel`],[`?`,`Toggle this help`]];function rh({onClose:e}){return(0,j.jsxs)(th,{onClose:e,children:[(0,j.jsx)(`h3`,{children:`Keyboard Shortcuts`}),(0,j.jsx)(`table`,{children:(0,j.jsx)(`tbody`,{children:nh.map(([e,t])=>(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`td`,{children:e.split(` / `).map((e,t)=>(0,j.jsxs)(`span`,{children:[t>0&&` / `,(0,j.jsx)(`kbd`,{children:e})]},e))}),(0,j.jsx)(`td`,{children:t})]},e))})})]})}function ih({onClose:e,vcs:t}){return(0,j.jsxs)(th,{onClose:e,children:[(0,j.jsxs)(`p`,{children:[`Comments work by inserting lines into the code. This can only work if the`,` `,t===`jj`?(0,j.jsxs)(j.Fragment,{children:[`revset includes `,(0,j.jsx)(`code`,{children:`@`})]}):`commit range includes the working copy`,`. Otherwise, the inserted lines will land in`,` `,t===`jj`?(0,j.jsx)(`code`,{children:`@`}):`the working copy`,` but not in the diff being viewed.`]}),t===`jj`?(0,j.jsxs)(`p`,{children:[`The easiest way to get a diff with comments enabled is to run with the`,` `,(0,j.jsx)(`code`,{children:`-f`}),` flag to get a diff that starts at some revision and ends at`,` `,(0,j.jsx)(`code`,{children:`@`}),`.`]}):(0,j.jsxs)(`p`,{children:[`The easiest way to get a diff with comments enabled is to run with `,(0,j.jsx)(`code`,{children:`-f`}),` `,`only (no `,(0,j.jsx)(`code`,{children:`-t`}),`), so the diff goes from a commit to the working tree.`]})]})}function ah({onLearnMore:e,vcs:t}){return(0,j.jsxs)(`div`,{className:`comments-disabled-banner`,children:[t===`jj`?(0,j.jsxs)(j.Fragment,{children:[`Comments are disabled because the revset does not include `,(0,j.jsx)(`code`,{children:`@`}),`.`]}):`Comments are disabled because the commit range does not end at the working copy.`,` `,(0,j.jsx)(`a`,{href:`#`,onClick:t=>{t.preventDefault(),e()},children:`Learn more`})]})}var oh=[`responsive`,`unified`];function sh(){let e=Im(),[t,n]=(0,A.useState)(`responsive`),r=t===`responsive`&&e?`split`:`unified`,{toast:i,showToast:a}=Lm(),[o,s]=(0,A.useState)({}),[c,l]=(0,A.useState)(null),u=(0,A.useRef)(!1),{data:d,error:f,isLoading:p}=ct({queryKey:[`diff`],queryFn:()=>Pm(`/api/diff`)});(0,A.useEffect)(()=>{d?.revset&&(document.title=`skepsis | ${d.revset}`)},[d?.revset]),(0,A.useEffect)(()=>{if(u.current||!d?.fileHashes)return;u.current=!0;let e={};for(let[t,n]of Object.entries(d.fileHashes))d.viewed[t]===n&&(e[t]=!0);s(e)},[d]);let m=qe(),h=lt({mutationFn:({file:e,hash:t,mark:n})=>Pm(`/api/viewed`,{method:n?`POST`:`DELETE`,body:{file:e,hash:t}}),onSettled:()=>m.invalidateQueries({queryKey:[`diff`]})}),g=lt({mutationFn:({file:e,afterLine:t,text:n})=>Pm(`/api/comment`,{method:`POST`,body:{file:e,afterLine:t,text:n}}),onSuccess:()=>l(null),onSettled:()=>m.invalidateQueries({queryKey:[`diff`]})}),_=lt({mutationFn:({file:e,line:t})=>Pm(`/api/comment`,{method:`DELETE`,body:{file:e,line:t}}),onSettled:()=>m.invalidateQueries({queryKey:[`diff`]})}),v=d?.patch,y=(0,A.useMemo)(()=>v?qp(v).flatMap(e=>e.files):[],[v]),b=(0,A.useMemo)(()=>{let e={...d?.viewed};if(h.isPending&&h.variables){let{file:t,hash:n,mark:r}=h.variables;r?e[t]=n:delete e[t]}return e},[d,h.isPending,h.variables]),[x,S]=(0,A.useState)(0),[C,w]=(0,A.useState)(0),[ee,T]=(0,A.useState)(!1),[te,ne]=(0,A.useState)(!1),re=(0,A.useRef)(null),ie=(0,A.useRef)(0),ae=(0,A.useRef)({focusedFileIdx:0,cursorIdx:0,showHelp:!1,composing:null,files:[],collapsed:{},fileHashes:{},viewed:{},markMutate:h.mutate});ae.current={focusedFileIdx:x,cursorIdx:C,showHelp:ee,composing:c,files:y,collapsed:o,fileHashes:d?.fileHashes??{},viewed:b,markMutate:h.mutate},(0,A.useLayoutEffect)(()=>{Wm();let e=re.current;re.current=null,e===`file`&&document.querySelectorAll(`.file-card`)[x]?.scrollIntoView({block:`start`});let t=y[x];if(!t||(o[t.name]??!1))return;let n=Bm(x),r=n[Math.min(C,Math.max(n.length-1,0))];if(!r)return;let i=r.gutterEl.getRootNode();i instanceof ShadowRoot&&Gm(i),r.gutterEl.setAttribute(`data-selected-line`,`single`),r.contentEl.setAttribute(`data-selected-line`,`single`),e===`line`&&r.contentEl.scrollIntoView({block:`nearest`})},[x,C,v,c,o,y]),(0,A.useEffect)(()=>{function e(e){if(e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLInputElement||e.ctrlKey||e.metaKey||e.altKey)return;let t=ae.current;switch(e.key){case`?`:e.preventDefault(),T(e=>!e);break;case`Escape`:t.showHelp?(e.preventDefault(),T(!1)):t.composing&&(e.preventDefault(),l(null));break;case`n`:case`p`:{if(t.showHelp||t.composing)break;e.preventDefault();let n=e.key===`n`?1:-1,r=Math.max(0,Math.min(t.focusedFileIdx+n,t.files.length-1));r!==t.focusedFileIdx&&(ie.current=Date.now(),S(r),w(0),re.current=`file`);break}case`j`:case`k`:{if(t.showHelp||t.composing)break;e.preventDefault();let n=t.files[t.focusedFileIdx]?.name;if(!n||(t.collapsed[n]??!1))break;let r=Bm(t.focusedFileIdx);if(r.length===0)break;let i=t.cursorIdx,a=r[Math.min(i,r.length-1)];if(a&&!Um(a.contentEl,t.focusedFileIdx)){let e=Hm(t.focusedFileIdx);e>=0&&(i=e)}let o=Math.max(0,Math.min(i+(e.key===`j`?1:-1),r.length-1));o!==t.cursorIdx&&(ie.current=Date.now(),w(o),re.current=`line`);break}case`v`:{if(t.showHelp||t.composing)break;e.preventDefault();let n=t.files[t.focusedFileIdx];if(!n)break;let r=t.fileHashes[n.name];if(!r)break;let i=t.viewed[n.name]!==r;s(e=>({...e,[n.name]:i})),t.markMutate({file:n.name,hash:r,mark:i});break}case`e`:{if(t.showHelp||t.composing)break;e.preventDefault();let n=t.files[t.focusedFileIdx];if(!n)break;ie.current=Date.now(),s(e=>({...e,[n.name]:!(e[n.name]??!1)}));break}case`E`:{if(t.showHelp||t.composing)break;e.preventDefault(),ie.current=Date.now();let n=t.files.some(e=>!(t.collapsed[e.name]??!1));s(Object.fromEntries(t.files.map(e=>[e.name,n])));break}case`s`:if(t.showHelp||t.composing)break;e.preventDefault(),n(e=>{let t=oh[(oh.indexOf(e)+1)%oh.length];return a((0,j.jsxs)(j.Fragment,{children:[`Split mode: `,(0,j.jsx)(`code`,{children:t})]})),t});break;case`c`:{if(!d?.commentsEnabled||t.showHelp||t.composing)break;e.preventDefault();let n=t.files[t.focusedFileIdx];if(!n||(t.collapsed[n.name]??!1))break;let r=Bm(t.focusedFileIdx)[t.cursorIdx];if(!r||r.lineType===`change-deletion`)break;l({file:n.name,line:r.lineNumber});break}}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a,d?.commentsEnabled]);let oe=(0,A.useRef)(new Set);if((0,A.useEffect)(()=>{oe.current.clear();let e=new IntersectionObserver(e=>{for(let t of e){let e=Number(t.target.dataset.fileIdx);t.isIntersecting?oe.current.add(e):oe.current.delete(e)}if(Date.now()-ie.current<150||oe.current.size===0)return;let t=Math.min(...oe.current),n=ae.current;if(t!==n.focusedFileIdx){S(t);let e=n.files[t];if(e&&!(n.collapsed[e.name]??!1)){let e=Hm(t);e>=0&&w(e)}}},{threshold:0});return document.querySelectorAll(`.file-card`).forEach((t,n)=>{t.dataset.fileIdx=String(n),e.observe(t)}),()=>e.disconnect()},[y]),p||!d)return(0,j.jsx)(`div`,{className:`empty-diff`,children:`Loading...`});if(f)return(0,j.jsx)(`pre`,{style:{color:`red`,padding:20},children:String(f)});if(d.error)return(0,j.jsx)(`pre`,{style:{color:`red`,padding:20},children:d.error});if(!v)return(0,j.jsxs)(`div`,{className:`empty-diff`,children:[(0,j.jsx)(`code`,{children:d.revset}),` is empty`]});let{fileHashes:se}=d;return(0,j.jsxs)(j.Fragment,{children:[!d.commentsEnabled&&(0,j.jsx)(ah,{vcs:d.vcs,onLearnMore:()=>ne(!0)}),(0,j.jsxs)(`div`,{className:`diff-container`,children:[(0,j.jsx)(eh,{fileHashes:se,viewed:b}),ee&&(0,j.jsx)(rh,{onClose:()=>T(!1)}),te&&(0,j.jsx)(ih,{vcs:d.vcs,onClose:()=>ne(!1)}),i&&(0,j.jsx)(`div`,{className:`toast`,children:i.content},i.key),y.map((e,t)=>{let n=e.name,i=se[n],a=b[n],u=i!=null&&a===i,f=a!=null&&i!=null&&a!==i,p=o[n]??!1;return(0,j.jsx)($m,{fileDiff:e,isViewed:u,isStale:f,diffStyle:r,collapsed:p,composing:c?.file===n?{line:c.line}:null,focused:t===x,onToggleCollapse:()=>s(e=>({...e,[n]:!p})),onToggleViewed:()=>{if(i){let e=!u;s(t=>({...t,[n]:e})),h.mutate({file:n,hash:i,mark:e})}},onStartComment:e=>{g.reset(),l({file:n,line:e})},onSubmitComment:(e,t)=>g.mutate({file:n,afterLine:e,text:t}),onResolveComment:e=>_.mutate({file:n,line:e}),onCancelComment:()=>l(null),commentsEnabled:d.commentsEnabled,submitting:g.isPending&&g.variables?.file===n,submitError:g.variables?.file===n&&g.error?g.error.message:null},n??t)})]})]})}function ch(){return(0,j.jsx)(Je,{client:Nm,children:(0,j.jsx)(sh,{})})}(0,u.createRoot)(document.getElementById(`root`)).render((0,j.jsx)(ch,{})); \ No newline at end of file diff --git a/dist/index.html b/dist/index.html index 6cfceb1..7b80220 100644 --- a/dist/index.html +++ b/dist/index.html @@ -12,7 +12,7 @@ skepsis - + diff --git a/src/App.tsx b/src/App.tsx index 3003134..d432e68 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -25,7 +25,7 @@ import { } from 'react' import { parsePatchFiles } from '@pierre/diffs' import { FileDiff } from '@pierre/diffs/react' -import type { DiffLineAnnotation, FileDiffMetadata } from '@pierre/diffs' +import type { DiffLineAnnotation, FileDiffMetadata, SelectedLineRange } from '@pierre/diffs' import type { DiffResponse, ErrorResponse, ViewedMap, FileHashes } from '../shared/types.ts' import { REVIEW_CLOSE_PATTERN, REVIEW_OPEN_PATTERN } from '../shared/reviewComments.ts' @@ -123,6 +123,35 @@ function getFileStats(fileDiff: FileDiffMetadata) { return { additions, deletions } } +// --- Line anchors (file + side + line number, GitHub-style deeplinks) --- + +/** A selected line: a file, a side, and a line number on that side. */ +type SelectedLine = { file: string; line: number; side: 'additions' | 'deletions' } + +/** Serialize a selection to a URL hash fragment, e.g. `src/App.tsxR76`. + * `R` = additions (right) side, `L` = deletions (left) side — matching GitHub. + * Slashes are kept literal for readability (they're valid in a fragment); + * everything else is percent-encoded so spaces, `#`, `%`, etc. stay safe. */ +function buildAnchor(sel: SelectedLine): string { + const path = encodeURIComponent(sel.file).replace(/%2F/g, '/') + return `${path}${sel.side === 'additions' ? 'R' : 'L'}${sel.line}` +} + +/** Parse a URL hash fragment back into a selection, or null if it isn't one. */ +function parseAnchor(hash: string): SelectedLine | null { + const raw = hash.replace(/^#/, '') + if (!raw) return null + // Greedy `.+` so the final R/L+digits is taken as the marker even when the + // (encoded) file path itself contains an R or L. + const m = /^(.+)([RL])(\d+)$/.exec(raw) + if (!m) return null + return { + file: decodeURIComponent(m[1]!), + side: m[2] === 'R' ? 'additions' : 'deletions', + line: parseInt(m[3]!, 10), + } +} + // --- Keyboard navigation helpers --- /** Query shadow DOM for navigable diff lines in a file card */ @@ -196,21 +225,42 @@ function clearCursorHighlight() { for (const container of document.querySelectorAll('.file-card diffs-container')) { const sr = (container as HTMLElement).shadowRoot if (!sr) continue - for (const el of sr.querySelectorAll('[data-selected-line]')) { - el.removeAttribute('data-selected-line') + for (const el of sr.querySelectorAll('[data-cursor-line]')) { + el.removeAttribute('data-cursor-line') } } } -/** Inject cursor-line CSS into a shadow root (idempotent) */ +/** Inject cursor-line CSS into a shadow root (idempotent). + * The keyboard cursor uses its own attribute (not the library's + * `data-selected-line`, which is reserved for the native `selectedLines` + * anchor selection) so the two highlights never clobber each other. */ function ensureCursorStyles(sr: ShadowRoot) { if (sr.querySelector('style[data-cursor-css]')) return const style = document.createElement('style') style.setAttribute('data-cursor-css', '') - // The library only styles change lines with data-selected-line; - // this covers context lines too. - style.textContent = - '[data-selected-line][data-line] { background-color: var(--diffs-bg-selection); }' + // Explicit neutral (not var(--diffs-bg-selection), which derives from + // --diffs-selection-base) so the cursor stays distinct from the amber anchor. + style.textContent = '[data-cursor-line] { background-color: rgba(110, 118, 129, 0.18); }' + sr.appendChild(style) +} + +/** Re-theme the native `selectedLines` anchor highlight amber (GitHub-style), + * injected into a shadow root (idempotent). The library tags the deeplinked + * line with `data-selected-line` and keeps it painted across virtualization; + * we only restyle it (its `*-override` CSS vars are registered non-inheriting, + * so they can't reach the shadow DOM from the host — a scoped style can). */ +function ensureSelectionStyles(sr: ShadowRoot) { + if (sr.querySelector('style[data-anchor-css]')) return + const style = document.createElement('style') + style.setAttribute('data-anchor-css', '') + style.textContent = ` + [data-selected-line][data-line] { background-color: rgba(187, 128, 9, 0.16) !important; } + [data-selected-line][data-column-number] { + background-color: rgba(187, 128, 9, 0.42) !important; + color: #e3b341 !important; + } + ` sr.appendChild(style) } @@ -234,6 +284,33 @@ function ensureReviewStyles(sr: ShadowRoot) { sr.appendChild(style) } +type LineCellInfo = { lineNumber: number; lineType: string; isDeletionsCol: boolean } + +/** Walk every gutter/content cell pair in a rendered diff's

. */
+function forEachLineCell(
+  pre: Element,
+  cb: (gutter: HTMLElement, content: HTMLElement, info: LineCellInfo) => void,
+): void {
+  for (const col of Array.from(pre.children)) {
+    if (!(col instanceof HTMLElement) || !col.hasAttribute('data-code')) continue
+    const isDeletionsCol = col.hasAttribute('data-deletions')
+    const gutter = col.querySelector('[data-gutter]')
+    const content = col.querySelector('[data-content]')
+    if (!gutter || !content) continue
+    for (let i = 0; i < gutter.children.length && i < content.children.length; i++) {
+      const g = gutter.children[i] as HTMLElement
+      const c = content.children[i] as HTMLElement
+      const numAttr = g.getAttribute('data-column-number')
+      if (!numAttr) continue
+      cb(g, c, {
+        lineNumber: parseInt(numAttr, 10),
+        lineType: g.getAttribute('data-line-type') || '',
+        isDeletionsCol,
+      })
+    }
+  }
+}
+
 /** Apply data-review-comment attribute to line elements within review block ranges. */
 function applyReviewHighlights(
   cardEl: HTMLElement,
@@ -254,25 +331,40 @@ function applyReviewHighlights(
 
   const inRange = (n: number) => ranges.some((r) => n >= r.start && n <= r.end)
 
-  for (const col of Array.from(pre.children)) {
-    if (!(col instanceof HTMLElement) || !col.hasAttribute('data-code')) continue
-    if (col.hasAttribute('data-deletions')) continue
-    const gutter = col.querySelector('[data-gutter]')
-    const content = col.querySelector('[data-content]')
-    if (!gutter || !content) continue
-    for (let i = 0; i < gutter.children.length && i < content.children.length; i++) {
-      const g = gutter.children[i] as HTMLElement
-      const c = content.children[i] as HTMLElement
-      if (g.getAttribute('data-line-type') !== 'change-addition') continue
-      const numAttr = g.getAttribute('data-column-number')
-      if (!numAttr) continue
-      const lineNum = parseInt(numAttr, 10)
-      if (inRange(lineNum)) {
-        g.setAttribute('data-review-comment', '')
-        c.setAttribute('data-review-comment', '')
-      }
+  forEachLineCell(pre, (g, c, info) => {
+    if (info.isDeletionsCol || info.lineType !== 'change-addition') return
+    if (inRange(info.lineNumber)) {
+      g.setAttribute('data-review-comment', '')
+      c.setAttribute('data-review-comment', '')
     }
+  })
+}
+
+/** Does this cell correspond to the selected line on the selected side?
+ *  Additions side matches the new-file column (skipping deletion rows);
+ *  deletions side matches deletion rows or the split deletions column. */
+function anchorCellMatches(info: LineCellInfo, sel: SelectedLine): boolean {
+  if (info.lineNumber !== sel.line) return false
+  if (sel.side === 'additions') {
+    return !info.isDeletionsCol && info.lineType !== 'change-deletion'
   }
+  return (
+    info.lineType === 'change-deletion' ||
+    (info.isDeletionsCol && info.lineType !== 'change-addition')
+  )
+}
+
+/** Find the content element for a selected line, for scroll-into-view. */
+function getAnchorLineEl(fileIdx: number, sel: SelectedLine): HTMLElement | null {
+  const card = document.querySelectorAll('.file-card')[fileIdx]
+  const container = card?.querySelector('diffs-container')
+  const pre = (container as HTMLElement | null)?.shadowRoot?.querySelector('pre')
+  if (!pre) return null
+  let found: HTMLElement | null = null
+  forEachLineCell(pre, (_g, c, info) => {
+    if (!found && anchorCellMatches(info, sel)) found = c
+  })
+  return found
 }
 
 type ButtonProps = {
@@ -364,15 +456,19 @@ const MemoizedFileDiff = memo(
     fileDiff,
     diffStyle,
     lineAnnotations,
+    selectedLines,
     renderAnnotation,
     onGutterUtilityClick,
+    onLineNumberClick,
     commentsEnabled,
   }: {
     fileDiff: FileDiffMetadata
     diffStyle: 'split' | 'unified'
     lineAnnotations: DiffLineAnnotation[]
+    selectedLines: SelectedLineRange | null
     renderAnnotation: (a: DiffLineAnnotation) => React.ReactNode
     onGutterUtilityClick: (range: { start: number; end: number; side?: string }) => void
+    onLineNumberClick: (line: number, side: 'additions' | 'deletions') => void
     commentsEnabled: boolean
   }) {
     const measureRef = useCallback(
@@ -403,8 +499,12 @@ const MemoizedFileDiff = memo(
             disableFileHeader: true,
             enableGutterUtility: commentsEnabled,
             onGutterUtilityClick,
+            lineHoverHighlight: 'number',
+            onLineNumberClick: (props) =>
+              onLineNumberClick(props.lineNumber, props.annotationSide),
           }}
           lineAnnotations={lineAnnotations}
+          selectedLines={selectedLines}
           renderAnnotation={renderAnnotation}
         />
       
@@ -413,7 +513,8 @@ const MemoizedFileDiff = memo(
   (prev, next) =>
     prev.fileDiff === next.fileDiff &&
     prev.diffStyle === next.diffStyle &&
-    prev.lineAnnotations === next.lineAnnotations,
+    prev.lineAnnotations === next.lineAnnotations &&
+    prev.selectedLines === next.selectedLines,
 )
 
 // --- FileCard ---
@@ -432,6 +533,8 @@ function FileCard({
   onSubmitComment,
   onResolveComment,
   onCancelComment,
+  onSelectLine,
+  anchor,
   commentsEnabled,
   submitting,
   submitError,
@@ -449,6 +552,8 @@ function FileCard({
   onSubmitComment: (line: number, text: string) => void
   onResolveComment: (line: number) => void
   onCancelComment: () => void
+  onSelectLine: (line: number, side: 'additions' | 'deletions') => void
+  anchor: SelectedLine | null
   commentsEnabled: boolean
   submitting: boolean
   submitError: string | null
@@ -470,6 +575,12 @@ function FileCard({
     return annotations
   }, [fileDiff, name, composing, commentsEnabled])
 
+  // The library's native single-line selection highlight (virtualization-safe).
+  const selectedLines = useMemo(
+    () => (anchor ? { start: anchor.line, end: anchor.line, side: anchor.side } : null),
+    [anchor],
+  )
+
   const renderAnnotation = useCallback(
     (annotation: DiffLineAnnotation) => {
       const meta = annotation.metadata
@@ -557,10 +668,11 @@ function FileCard({
     const attach = () => {
       const sr = (cardEl.querySelector('diffs-container') as HTMLElement | null)?.shadowRoot
       const pre = sr?.querySelector('pre')
-      if (!pre) {
+      if (!sr || !pre) {
         if (attempts++ < 60) raf = requestAnimationFrame(attach)
         return
       }
+      ensureSelectionStyles(sr)
       apply()
       observer = new MutationObserver(apply)
       observer.observe(pre, { childList: true, subtree: true })
@@ -613,8 +725,10 @@ function FileCard({
           fileDiff={fileDiff}
           diffStyle={diffStyle}
           lineAnnotations={lineAnnotations}
+          selectedLines={selectedLines}
           renderAnnotation={renderAnnotation}
           onGutterUtilityClick={onGutterUtilityClick}
+          onLineNumberClick={onSelectLine}
           commentsEnabled={commentsEnabled}
         />
       ) : (
@@ -779,6 +893,7 @@ function DiffView() {
   const { toast, showToast } = useToast()
   const [collapsed, setCollapsed] = useState>({})
   const [composing, setComposing] = useState<{ file: string; line: number } | null>(null)
+  const [selected, setSelected] = useState(null)
   const seededFromInitialLoad = useRef(false)
   const { data, error, isLoading } = useQuery({
     queryKey: ['diff'],
@@ -872,6 +987,7 @@ function DiffView() {
     cursorIdx: 0,
     showHelp: false,
     composing: null as typeof composing,
+    selected: null as SelectedLine | null,
     files: [] as FileDiffMetadata[],
     collapsed: {} as Record,
     fileHashes: {} as Record,
@@ -883,6 +999,7 @@ function DiffView() {
     cursorIdx,
     showHelp,
     composing,
+    selected,
     files,
     collapsed,
     fileHashes: data?.fileHashes ?? {},
@@ -890,6 +1007,72 @@ function DiffView() {
     markMutate: markMutation.mutate,
   }
 
+  // --- Line anchor selection (GitHub-style file+line deeplinks) ---
+
+  // Select (or, if already selected, deselect) a line and reflect it in the URL.
+  // Stable across renders (reads navRef) so the FileDiff's click handler never goes stale.
+  const selectLine = useCallback(
+    (file: string, line: number, side: 'additions' | 'deletions') => {
+      const cur = navRef.current.selected
+      if (cur && cur.file === file && cur.line === line && cur.side === side) {
+        setSelected(null)
+        history.replaceState(null, '', location.pathname + location.search)
+        return
+      }
+      const sel: SelectedLine = { file, line, side }
+      setSelected(sel)
+      history.replaceState(null, '', '#' + buildAnchor(sel))
+      const idx = navRef.current.files.findIndex((f) => f.name === file)
+      if (idx >= 0) setFocusedFileIdx(idx)
+    },
+    [],
+  )
+
+  // Expand the target file, bring its card into view (triggering lazy mount),
+  // then poll for the specific line element and center it. Two-phase because the
+  // library has no scroll-to-line API for an off-screen virtualized row; if
+  // pierrecomputer/pierre#452 lands this collapses to a single scrollToLine call.
+  const scrollToAnchor = useCallback((sel: SelectedLine) => {
+    const idx = navRef.current.files.findIndex((f) => f.name === sel.file)
+    if (idx < 0) return
+    setFocusedFileIdx(idx)
+    setCollapsed((prev) => (prev[sel.file] ? { ...prev, [sel.file]: false } : prev))
+    document.querySelectorAll('.file-card')[idx]?.scrollIntoView({ block: 'start' })
+    let attempts = 0
+    const tryScroll = () => {
+      const el = getAnchorLineEl(idx, sel)
+      if (el) {
+        el.scrollIntoView({ block: 'center' })
+        return
+      }
+      if (attempts++ < 120) requestAnimationFrame(tryScroll)
+    }
+    requestAnimationFrame(tryScroll)
+  }, [])
+
+  // Apply the anchor from the initial URL once files are available.
+  const appliedInitialAnchor = useRef(false)
+  useEffect(() => {
+    if (appliedInitialAnchor.current || files.length === 0) return
+    appliedInitialAnchor.current = true
+    const sel = parseAnchor(location.hash)
+    if (sel) {
+      setSelected(sel)
+      scrollToAnchor(sel)
+    }
+  }, [files, scrollToAnchor])
+
+  // React to URL changes (shared link pasted into the bar, back/forward).
+  useEffect(() => {
+    const onHashChange = () => {
+      const sel = parseAnchor(location.hash)
+      setSelected(sel)
+      if (sel) scrollToAnchor(sel)
+    }
+    window.addEventListener('hashchange', onHashChange)
+    return () => window.removeEventListener('hashchange', onHashChange)
+  }, [scrollToAnchor])
+
   // Apply cursor highlight after state or DOM changes
   useLayoutEffect(() => {
     clearCursorHighlight()
@@ -914,8 +1097,8 @@ function DiffView() {
     const sr = line.gutterEl.getRootNode() as ShadowRoot
     if (sr instanceof ShadowRoot) ensureCursorStyles(sr)
 
-    line.gutterEl.setAttribute('data-selected-line', 'single')
-    line.contentEl.setAttribute('data-selected-line', 'single')
+    line.gutterEl.setAttribute('data-cursor-line', '')
+    line.contentEl.setAttribute('data-cursor-line', '')
 
     if (target === 'line') {
       line.contentEl.scrollIntoView({ block: 'nearest' })
@@ -1132,6 +1315,7 @@ function DiffView() {
           const isStale = viewedHash != null && hash != null && viewedHash !== hash
           const isCollapsed = collapsed[name] ?? false
           const fileComposing = composing?.file === name ? { line: composing.line } : null
+          const fileAnchor = selected?.file === name ? selected : null
 
           return (
             
                 setCollapsed((prev) => ({ ...prev, [name]: !isCollapsed }))
@@ -1162,6 +1347,7 @@ function DiffView() {
               }
               onResolveComment={(line) => resolveMutation.mutate({ file: name, line })}
               onCancelComment={() => setComposing(null)}
+              onSelectLine={(line, side) => selectLine(name, line, side)}
               commentsEnabled={data.commentsEnabled}
               submitting={
                 commentMutation.isPending && commentMutation.variables?.file === name