diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..646ac51 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +node_modules/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..29392cd --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 MarkEdit.app + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..9cda105 --- /dev/null +++ b/README.md @@ -0,0 +1,49 @@ +# MarkEdit-version-browser + +Browse, compare, and restore saved versions of the current document. Local versions can also be deleted. + +## Installation + +Install this extension from the [MarkEdit Extension Registry](https://markedit-app.github.io/extensions/#markedit-version-browser). + +## How to Use + +Open **Extensions > Browse Versions** in MarkEdit. Select a saved version to compare it with the current document, then switch between unified and split layouts as needed. Unchanged sections can be expanded directly in the diff. + +Local delete operations require confirmation. The browser refreshes automatically after a version is deleted. + +## Settings + +In [settings.json](https://github.com/MarkEdit-app/MarkEdit/wiki/Customization#advanced-settings), define a settings node named `extension.markeditVersionBrowser`. The default settings are: + +```json +{ + "extension.markeditVersionBrowser": { + "wrapLines": true, + "showLineNumbers": true, + "diffIndicators": "classic", + "lineDiff": "word-alt", + "hunkSeparators": "line-info", + "expandUnchanged": false, + "expansionLineCount": 20 + } +} +``` + +- `wrapLines`: Wrap long lines instead of scrolling horizontally. +- `showLineNumbers`: Show line numbers in the diff gutter. +- `diffIndicators`: Line indicators: `classic`, `bars`, or `none`. +- `lineDiff`: Changed-text granularity: `word-alt`, `word`, `char`, or `none`. +- `hunkSeparators`: Hunk separator style: `simple`, `metadata`, `line-info`, or `line-info-basic`. +- `expandUnchanged`: Expand unchanged sections by default. +- `expansionLineCount`: Number of unchanged lines to reveal at a time, clamped from 1 to 100. + +## Building + +``` +yarn install +yarn test +yarn build +``` + +`yarn build` also deploys the extension to your local MarkEdit installation. diff --git a/assets/browser.css b/assets/browser.css new file mode 100644 index 0000000..18472b5 --- /dev/null +++ b/assets/browser.css @@ -0,0 +1,380 @@ +.markedit-version-browser { + --browser-color: #202124; + --browser-muted: #6b6d72; + --browser-background: #f7f7f8; + --browser-toolbar: #ffffff; + --browser-border: #d7d7da; + --browser-pressed: #e4e4e7; + --browser-accent: #1473e6; + --browser-destructive: #cf222e; + --browser-destructive-pressed: #ffebe9; + --browser-diff-background: #ffffff; + position: fixed; + z-index: 1000; + display: grid; + grid-template-rows: 44px minmax(0, 1fr); + overflow: hidden; + opacity: 0; + color: var(--browser-color); + background: var(--browser-background); + font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif; + transition: opacity 160ms ease-out; +} + +.markedit-version-browser.is-visible { + opacity: 1; +} + +.markedit-version-browser:focus { + outline: none; +} + +.version-browser-header { + display: grid; + grid-template-columns: auto minmax(160px, 220px) minmax(220px, 1fr); + align-items: center; + gap: 12px; + padding: 0 10px 0 14px; + border-bottom: 1px solid var(--browser-border); + background: var(--browser-toolbar); +} + +.version-browser-select-wrapper { + display: flex; + align-items: center; + gap: 6px; + width: 100%; + min-width: 0; +} + +.version-browser-select-control { + position: relative; + flex: 1; + min-width: 0; +} + +.version-browser-select { + box-sizing: border-box; + width: 100%; + height: 24px; + border: 1px solid var(--browser-border); + border-radius: 5px; + color: inherit; + background-color: var(--browser-toolbar); + font: inherit; + font-size: 13px; + letter-spacing: 0; +} + +.version-browser-select-placeholder { + position: absolute; + inset: 0; + display: flex; + align-items: center; + justify-content: center; + pointer-events: none; + font-size: 13px; +} + +.version-browser-select[aria-busy='false'] + .version-browser-select-placeholder { + display: none; +} + +.version-browser-view, +.version-browser-actions { + display: flex; + align-items: center; +} + +.version-browser-view { + box-sizing: border-box; + width: max-content; + height: 24px; + justify-self: center; + padding: 1px; + gap: 2px; + border: 0; + border-radius: 6px; + background: rgb(0 0 0 / 7%); +} + +.version-browser-actions { + justify-content: flex-end; + gap: 6px; +} + +.version-browser-restore-wrapper, +.version-browser-delete-wrapper { + display: inline-flex; +} + +.version-browser-visually-hidden { + position: absolute; + width: 1px; + height: 1px; + overflow: hidden; + clip-path: inset(50%); + white-space: nowrap; +} + +.version-browser-nonlocal { + position: relative; + display: inline-block; + width: 20px; + height: 14px; + flex: none; + visibility: hidden; + color: var(--browser-muted); +} + +.version-browser-nonlocal.is-visible { + visibility: visible; +} + +.version-browser-cloud { + position: absolute; + inset: 0; + display: flex; + align-items: center; + justify-content: center; + opacity: 0; + transform: scale(0.75); + transition: opacity 160ms ease-out, transform 180ms ease-out; +} + +.version-browser-cloud-download, +.version-browser-nonlocal.is-downloaded .version-browser-cloud-downloaded { + opacity: 1; + transform: scale(1); +} + +.version-browser-nonlocal.is-downloaded .version-browser-cloud-download { + opacity: 0; + transform: scale(0.75); +} + +.version-browser-cloud svg { + height: auto; + max-height: 14px; + fill: currentColor; +} + +.version-browser-cloud-download svg { + width: 16px; +} + +.version-browser-cloud-downloaded svg { + width: 18px; +} + +.version-browser-select, +.version-browser-header button { + user-select: none; + -webkit-user-select: none; +} + +.version-browser-header button { + height: 27px; + padding: 0 10px; + border: 1px solid var(--browser-border); + border-radius: 5px; + color: inherit; + background: var(--browser-toolbar); + font: inherit; + font-size: 12px; + font-weight: 500; + letter-spacing: 0; + cursor: default; +} + +.version-browser-view button { + appearance: none; + flex: none; + box-sizing: border-box; + width: 68px; + height: 100%; + padding: 0 6px; + border: 0; + border-radius: 4px; + color: rgb(0 0 0 / 85%); + background: transparent; +} + +.version-browser-view button:active:not(.active):not(:disabled) { + background: rgb(0 0 0 / 4%); +} + +.version-browser-view button.active { + color: #000000; + background: #ffffff; + box-shadow: 0 1px 2px rgb(0 0 0 / 12%); +} + +.version-browser-actions button:active:not(:disabled):not([aria-disabled='true']) { + background: var(--browser-pressed); +} + +.version-browser-header button[data-action='restore'] { + border-color: var(--browser-accent); + color: #ffffff; + background: var(--browser-accent); +} + +.version-browser-actions button[data-action='restore']:active:not(:disabled):not([aria-disabled='true']) { + background: #0867d1; +} + +.version-browser-header button[data-action='delete'] { + color: var(--browser-destructive); +} + +.version-browser-actions button[data-action='delete']:active:not(:disabled):not([aria-disabled='true']) { + background: var(--browser-destructive-pressed); +} + +.version-browser-header button:disabled, +.version-browser-header button[aria-disabled='true'] { + opacity: 0.45; +} + +.version-browser-header button:focus-visible { + outline: 2px solid var(--browser-accent); + outline-offset: 2px; +} + +.version-browser-select:focus { + outline: none; +} + +.markedit-version-browser.is-keyboard-navigation .version-browser-select:focus { + outline: 2px solid var(--browser-accent); + outline-offset: 2px; +} + +.version-browser-body { + display: grid; + grid-template-rows: minmax(0, 1fr); + min-height: 0; + overflow: hidden; +} + +.version-browser-content { + position: relative; + display: grid; + grid-template-rows: minmax(0, 1fr); + min-width: 0; + min-height: 0; + overflow: hidden; +} + +.version-browser-status { + position: absolute; + inset: 0; + display: flex; + transform: translateY(-20px); + align-items: center; + justify-content: center; + gap: 9px; + padding: 24px; + color: var(--browser-muted); + font-size: 13px; + text-align: center; +} + +.version-browser-status[hidden], +.version-browser-diff[hidden] { + display: none; +} + +.version-browser-spinner { + width: 18px; + height: 18px; + box-sizing: border-box; + border: 2px solid var(--browser-border); + border-top-color: var(--browser-accent); + border-radius: 50%; + animation: version-browser-spin 700ms linear infinite; +} + +.version-browser-diff { + min-height: 0; + height: 100%; + overflow: auto; + background: var(--browser-diff-background); + --diffs-font-family: ui-monospace, SFMono-Regular, Menlo, monospace; + --diffs-font-size: 12px; + --diffs-line-height: 1.55; + --diffs-header-font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif; +} + +.version-browser-diff > diffs-container { + display: block; + width: calc(100% - 10px); + min-height: 100%; +} + +@keyframes version-browser-spin { + to { + transform: rotate(360deg); + } +} + +@media (max-width: 620px) { + .version-browser-header { + grid-template-columns: 1fr auto; + } + + .version-browser-select-wrapper { + display: none; + } + + .version-browser-view { + justify-self: start; + } +} + +@media (prefers-reduced-motion: reduce) { + .markedit-version-browser { + transition: none; + } + + .version-browser-cloud { + transition: none; + } + + .version-browser-spinner { + animation-duration: 1400ms; + } +} + +@media (prefers-color-scheme: dark) { + .markedit-version-browser { + --browser-color: #f2f2f4; + --browser-muted: #a7a7ad; + --browser-background: #1c1c1e; + --browser-toolbar: #262628; + --browser-border: #3d3d40; + --browser-pressed: #353538; + --browser-destructive: #ff7b72; + --browser-destructive-pressed: #442426; + --browser-diff-background: #0d1117; + } + + .version-browser-view { + background: rgb(255 255 255 / 8%); + } + + .version-browser-view button { + color: rgb(255 255 255 / 80%); + } + + .version-browser-view button:active:not(.active):not(:disabled) { + background: rgb(255 255 255 / 5%); + } + + .version-browser-view button.active { + color: #ffffff; + background: rgb(255 255 255 / 12%); + box-shadow: 0 1px 2px rgb(0 0 0 / 30%); + } +} diff --git a/assets/browser.html b/assets/browser.html new file mode 100644 index 0000000..50a0342 --- /dev/null +++ b/assets/browser.html @@ -0,0 +1,34 @@ +
+
+ + +
+
+
+ + +
+ +
+
+ + + The selected version is identical to the current document. + + + + Versions stored in iCloud cannot be deleted. + + +
+
+
+
+
+ Loading versions... +
+ +
+
diff --git a/assets/cloud.svg b/assets/cloud.svg new file mode 100644 index 0000000..adf524c --- /dev/null +++ b/assets/cloud.svg @@ -0,0 +1 @@ + diff --git a/assets/downloaded.svg b/assets/downloaded.svg new file mode 100644 index 0000000..8730510 --- /dev/null +++ b/assets/downloaded.svg @@ -0,0 +1 @@ + diff --git a/dist/markedit-version-browser.js b/dist/markedit-version-browser.js new file mode 100644 index 0000000..88765ab --- /dev/null +++ b/dist/markedit-version-browser.js @@ -0,0 +1,1566 @@ +var e=Object.defineProperty,t=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};let r=require("markedit-api");function i(){let e=0;return{begin(){return e+=1,e},invalidate(){e+=1},isCurrent(t){return t===e}}}function a(e,t){let{versionSelect:n,nonlocalIndicator:r,restoreWrapper:i,deleteWrapper:a,restoreDescription:o,deleteDescription:s,restoreButton:c,deleteButton:l,layoutButtons:u}=e,d=t.busy||t.selectedVersion===void 0,f=t.selectedVersion?.isLocal===!1,p=!d&&t.hasDifferences===!1;r.classList.toggle(`is-visible`,f),r.setAttribute(`aria-hidden`,String(!f)),r.classList.toggle(`is-downloaded`,t.isDownloaded),r.title=t.isDownloaded?`Downloaded from iCloud`:`Stored in iCloud`,r.setAttribute(`aria-label`,r.title),c.disabled=d||t.hasDifferences===void 0,p?(c.setAttribute(`aria-disabled`,`true`),c.setAttribute(`aria-describedby`,o.id)):(c.removeAttribute(`aria-disabled`),c.removeAttribute(`aria-describedby`)),i.title=p?`The selected version is identical to the current document.`:``,l.disabled=d,f?(l.setAttribute(`aria-disabled`,`true`),l.setAttribute(`aria-describedby`,s.id)):(l.removeAttribute(`aria-disabled`),l.removeAttribute(`aria-describedby`)),a.title=f?`Versions stored in iCloud cannot be deleted.`:``,u.forEach(e=>e.disabled=d),n.disabled=t.busy||!t.hasVersions}function o(e,t){let n=Array.from(e.querySelectorAll(`button:not(:disabled), select:not(:disabled), [href], [tabindex]:not([tabindex="-1"])`)),r=n[0],i=n.at(-1);if(r===void 0||i===void 0){t.preventDefault(),e.focus();return}let a=document.activeElement,o=a===e||!e.contains(a);t.shiftKey&&(a===r||o)?(t.preventDefault(),i.focus()):!t.shiftKey&&(a===i||o)&&(t.preventDefault(),r.focus())}var s=300,c=200;function l(e,t,n){let r=0,i,a,o=()=>{r+=1,window.clearTimeout(i),i=void 0,a=void 0};return{show(c,l=!1){o();let u=r;return e.replaceChildren(),e.append(c),l?(e.hidden=!0,i=window.setTimeout(()=>{if(i=void 0,!n()&&u===r){let t=document.createElement(`span`);t.className=`version-browser-spinner`,e.prepend(t),e.hidden=!1,a=performance.now()}},s)):e.hidden=!1,t.hidden=!0,u},hide(){o(),e.hidden=!0},async settle(e){if(e!==r)return;window.clearTimeout(i),i=void 0;let t=a;if(t===void 0)return;let n=c-(performance.now()-t);n>0&&await new Promise(e=>window.setTimeout(e,n)),e===r&&a===t&&(a=void 0)},dispose:o}}var u=`.markedit-version-browser{--browser-color:#202124;--browser-muted:#6b6d72;--browser-background:#f7f7f8;--browser-toolbar:#fff;--browser-border:#d7d7da;--browser-pressed:#e4e4e7;--browser-accent:#1473e6;--browser-destructive:#cf222e;--browser-destructive-pressed:#ffebe9;--browser-diff-background:#fff;z-index:1000;opacity:0;color:var(--browser-color);background:var(--browser-background);grid-template-rows:44px minmax(0,1fr);font-family:ui-sans-serif,-apple-system,BlinkMacSystemFont,sans-serif;transition:opacity .16s ease-out;display:grid;position:fixed;overflow:hidden}.markedit-version-browser.is-visible{opacity:1}.markedit-version-browser:focus{outline:none}.version-browser-header{border-bottom:1px solid var(--browser-border);background:var(--browser-toolbar);grid-template-columns:auto minmax(160px,220px) minmax(220px,1fr);align-items:center;gap:12px;padding:0 10px 0 14px;display:grid}.version-browser-select-wrapper{align-items:center;gap:6px;width:100%;min-width:0;display:flex}.version-browser-select-control{flex:1;min-width:0;position:relative}.version-browser-select{box-sizing:border-box;border:1px solid var(--browser-border);width:100%;height:24px;color:inherit;background-color:var(--browser-toolbar);font:inherit;letter-spacing:0;border-radius:5px;font-size:13px}.version-browser-select-placeholder{pointer-events:none;justify-content:center;align-items:center;font-size:13px;display:flex;position:absolute;inset:0}.version-browser-select[aria-busy=false]+.version-browser-select-placeholder{display:none}.version-browser-view,.version-browser-actions{align-items:center;display:flex}.version-browser-view{box-sizing:border-box;background:#00000012;border:0;border-radius:6px;justify-self:center;gap:2px;width:max-content;height:24px;padding:1px}.version-browser-actions{justify-content:flex-end;gap:6px}.version-browser-restore-wrapper,.version-browser-delete-wrapper{display:inline-flex}.version-browser-visually-hidden{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.version-browser-nonlocal{visibility:hidden;width:20px;height:14px;color:var(--browser-muted);flex:none;display:inline-block;position:relative}.version-browser-nonlocal.is-visible{visibility:visible}.version-browser-cloud{opacity:0;justify-content:center;align-items:center;transition:opacity .16s ease-out,transform .18s ease-out;display:flex;position:absolute;inset:0;transform:scale(.75)}.version-browser-cloud-download,.version-browser-nonlocal.is-downloaded .version-browser-cloud-downloaded{opacity:1;transform:scale(1)}.version-browser-nonlocal.is-downloaded .version-browser-cloud-download{opacity:0;transform:scale(.75)}.version-browser-cloud svg{fill:currentColor;height:auto;max-height:14px}.version-browser-cloud-download svg{width:16px}.version-browser-cloud-downloaded svg{width:18px}.version-browser-select,.version-browser-header button{-webkit-user-select:none;user-select:none}.version-browser-header button{border:1px solid var(--browser-border);height:27px;color:inherit;background:var(--browser-toolbar);font:inherit;letter-spacing:0;cursor:default;border-radius:5px;padding:0 10px;font-size:12px;font-weight:500}.version-browser-view button{appearance:none;box-sizing:border-box;color:#000000d9;background:0 0;border:0;border-radius:4px;flex:none;width:68px;height:100%;padding:0 6px}.version-browser-view button:active:not(.active):not(:disabled){background:#0000000a}.version-browser-view button.active{color:#000;background:#fff;box-shadow:0 1px 2px #0000001f}.version-browser-actions button:active:not(:disabled):not([aria-disabled=true]){background:var(--browser-pressed)}.version-browser-header button[data-action=restore]{border-color:var(--browser-accent);color:#fff;background:var(--browser-accent)}.version-browser-actions button[data-action=restore]:active:not(:disabled):not([aria-disabled=true]){background:#0867d1}.version-browser-header button[data-action=delete]{color:var(--browser-destructive)}.version-browser-actions button[data-action=delete]:active:not(:disabled):not([aria-disabled=true]){background:var(--browser-destructive-pressed)}.version-browser-header button:disabled,.version-browser-header button[aria-disabled=true]{opacity:.45}.version-browser-header button:focus-visible{outline:2px solid var(--browser-accent);outline-offset:2px}.version-browser-select:focus{outline:none}.markedit-version-browser.is-keyboard-navigation .version-browser-select:focus{outline:2px solid var(--browser-accent);outline-offset:2px}.version-browser-body{grid-template-rows:minmax(0,1fr);min-height:0;display:grid;overflow:hidden}.version-browser-content{grid-template-rows:minmax(0,1fr);min-width:0;min-height:0;display:grid;position:relative;overflow:hidden}.version-browser-status{color:var(--browser-muted);text-align:center;justify-content:center;align-items:center;gap:9px;padding:24px;font-size:13px;display:flex;position:absolute;inset:0;transform:translateY(-20px)}.version-browser-status[hidden],.version-browser-diff[hidden]{display:none}.version-browser-spinner{box-sizing:border-box;border:2px solid var(--browser-border);border-top-color:var(--browser-accent);border-radius:50%;width:18px;height:18px;animation:.7s linear infinite version-browser-spin}.version-browser-diff{background:var(--browser-diff-background);--diffs-font-family:ui-monospace, SFMono-Regular, Menlo, monospace;--diffs-font-size:12px;--diffs-line-height:1.55;--diffs-header-font-family:ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif;height:100%;min-height:0;overflow:auto}.version-browser-diff>diffs-container{width:calc(100% - 10px);min-height:100%;display:block}@keyframes version-browser-spin{to{transform:rotate(360deg)}}@media (width<=620px){.version-browser-header{grid-template-columns:1fr auto}.version-browser-select-wrapper{display:none}.version-browser-view{justify-self:start}}@media (prefers-reduced-motion:reduce){.markedit-version-browser,.version-browser-cloud{transition:none}.version-browser-spinner{animation-duration:1.4s}}@media (prefers-color-scheme:dark){.markedit-version-browser{--browser-color:#f2f2f4;--browser-muted:#a7a7ad;--browser-background:#1c1c1e;--browser-toolbar:#262628;--browser-border:#3d3d40;--browser-pressed:#353538;--browser-destructive:#ff7b72;--browser-destructive-pressed:#442426;--browser-diff-background:#0d1117}.version-browser-view{background:#ffffff14}.version-browser-view button{color:#fffc}.version-browser-view button:active:not(.active):not(:disabled){background:#ffffff0d}.version-browser-view button.active{color:#fff;background:#ffffff1f;box-shadow:0 1px 2px #0000004d}}`,d=`
+
+ + +
+
+
+ + +
+ +
+
+ + + The selected version is identical to the current document. + + + + Versions stored in iCloud cannot be deleted. + + +
+
+
+
+
+ Loading versions... +
+ +
+
+`,f=` +`,p=` +`,m=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}),h=0;function g(e){let t=document.createElement(`section`);t.className=`markedit-version-browser`,t.tabIndex=-1,t.setAttribute(`aria-label`,`Version browser`),t.setAttribute(`aria-modal`,`true`),t.setAttribute(`role`,`dialog`),t.innerHTML=d;let n=t.querySelector(`.version-browser-select`),r=t.querySelector(`.version-browser-status`),i=t.querySelector(`.version-browser-diff`),a=t.querySelector(`.version-browser-nonlocal`),o=t.querySelector(`.version-browser-restore-wrapper`),s=t.querySelector(`.version-browser-delete-wrapper`),c=t.querySelector(`.version-browser-restore-description`),l=t.querySelector(`.version-browser-delete-description`),u=t.querySelector(`[data-action="restore"]`),m=t.querySelector(`[data-action="delete"]`),g=t.querySelector(`[data-action="close"]`);if(n===null||r===null||i===null||a===null||o===null||s===null||c===null||l===null||u===null||m===null||g===null)return;h+=1,c.id=`version-browser-restore-description-${h}`,l.id=`version-browser-delete-description-${h}`;let _=Array.from(t.querySelectorAll(`[data-style]`));return v(_,e),a.innerHTML=` + ${f} + ${p} + `,{overlay:t,versionSelect:n,status:r,diffContainer:i,nonlocalIndicator:a,restoreWrapper:o,deleteWrapper:s,restoreDescription:c,deleteDescription:l,restoreButton:u,deleteButton:m,closeButton:g,layoutButtons:_}}function _(e,t){let n=t.map(e=>new Option(m.format(new Date(e.modificationDate)),e.id));e.replaceChildren(...n)}function v(e,t){e.forEach(e=>{let n=e.dataset.style===t;e.classList.toggle(`active`,n),e.setAttribute(`aria-pressed`,String(n))})}function y(){let e=document.createElement(`style`);return e.textContent=u,document.head.appendChild(e),e}var b=`diffs-container`;(()=>{try{return process.env.NODE_ENV===`development`}catch{return!1}})();var x=/(?=^diff --git)/gm,S=/(?<=\n)/,C=/^(---|\+\+\+)\s+([^\t\r\n]+)/,w=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,T=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,E=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,ee=`header-prefix`,D=`header-filename-suffix`,O=`header-metadata`,te=`header-custom`,k={dark:`pierre-dark`,light:`pierre-light`},ne=`data-theme-css`,re=`data-unsafe-css`,ie=`data-diffs-scrollbar-measure`,A=`--diffs-scrollbar-gutter-measured`,ae=1e5,oe=Object.freeze({fromStart:0,fromEnd:0}),se={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},ce={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},le=new Set,ue=null;function de(e){le.add(e),ue??=requestAnimationFrame(pe)}function fe(e){le.delete(e)&&le.size===0&&ue!=null&&(cancelAnimationFrame(ue),ue=null)}function pe(e){let t=new Set(le);le.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}ue=le.size>0?requestAnimationFrame(pe):null}function me(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function he(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function ge(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var _e=new TextEncoder,ve=new TextDecoder(`utf-8`,{ignoreBOM:!0}),ye=/[\uD800-\uDFFF]/,be=1024,xe=new Uint8Array(be);function Se(){xe.length!==be&&(xe=new Uint8Array(be))}function j(e){if(e.length===0)return e;if(ye.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;xe.length0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;ewe)return null;let c=[];for(let t=0;tn,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;nf&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var ke=/\s+/g;function Ae(e){return e.replace(ke,``)}function je(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i0&&(s[s.length-1]===` +`||s[s.length-1]===`\r`||s[s.length-1]===`\r +`||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:Ue(p.hunkContext),hunkSpecs:j(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(a&&Ie(t)&&!Le(t))throw Error(`parsePatchContent: hunk has more lines than expected`);break}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=We(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=Ge(t);(g==null||g.type!==`change`)&&(g=Ke(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=Ge(t);(g==null||g.type!==`change`)&&(g=Ke(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=Ge(t);(g==null||g.type!==`context`)&&(g=Ke(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=ge(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=ge(c.deletionLines[e]))}}}if(a&&(x!==b.additionCount||S!==b.deletionCount))throw Error(`parsePatchContent: hunk line count mismatch`);b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(Ce(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=M(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=M(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),Ee(c),c}}function Pe(e){let t=Fe(e);for(let e=0;e9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function Be(e){return e.endsWith(`\r +`)?e.slice(0,-2):e.endsWith(` +`)?e.slice(0,-1):e}function Ve(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:He(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=He(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function He(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function Ue(e){return e==null?e:j(e)}function We(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function Ge(e){let t=e.slice(1);return j(t===``?` +`:t)}function Ke(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var qe=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e=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}},Je=new class extends qe{};function Ye(e,t,n){return Je.diff(e,t,n)}function Xe(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 it(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function at(e,t){if(t)return st(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function ot(e,t){if(t)return st(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function st(e,t){if(!t)return[ot(e),at(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=it(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var ct=`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}`,lt=RegExp(`[${ct}]+|\\s+|[^${ct}]`,`ug`);new class extends qe{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=it(e,r)}else n=e.match(lt)||[];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)&&ut(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&ut(n,i,r,null,t.intlSegmenter),e}};function ut(e,t,n,r,i){if(t&&n){let[a,o]=st(t.value,i),[s,c]=st(n.value,i);if(e){let r=Xe(a,s);e.value=$e(e.value,s,r),t.value=et(t.value,r),n.value=et(n.value,r)}if(r){let e=Ze(o,c);r.value=Qe(r.value,c,e),t.value=tt(t.value,e),n.value=tt(n.value,e)}}else if(n){if(e){let e=ot(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=ot(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=ot(r.value,i),[a,o]=st(t.value,i),s=Xe(n,a);t.value=et(t.value,s);let c=Ze(et(n,s),o);t.value=tt(t.value,c),r.value=Qe(r.value,n,c),e.value=$e(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=ot(r.value,i),n=nt(at(t.value,i),e);t.value=tt(t.value,n)}else if(e){let n=nt(at(e.value,i),ot(t.value,i));t.value=et(t.value,n)}}var dt=new class extends qe{tokenize(e){let t=RegExp(`(\\r?\\n)|[${ct}]+|[^\\S\\n\\r]+|[^${ct}]`,`ug`);return e.match(t)||[]}};function ft(e,t,n){return dt.diff(e,t,n)}var pt=new class extends qe{constructor(){super(...arguments),this.tokenize=ht}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 mt(e,t,n){return pt.diff(e,t,n)}function ht(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(_t(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 _t(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function yt(e){if(!vt(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var bt={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function xt(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;mt(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(mt(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&&!e.every(e=>e.isGit))throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>St(e,t)).join(` +`)}let n=[];if(e.isGit){if(t=bt,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+yt(r)+` `+yt(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+yt((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+yt((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+yt((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+yt((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+yt(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+yt(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t{s(e?St(e,o.headerOptions):void 0)}}))}else{let s=xt(e,t,n,r,i,a,o);return s?St(s,o?.headerOptions):void 0}}function wt(e){let t=e.endsWith(` +`),n=e.split(` +`).map(e=>e+` +`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var Tt=`/dev/null`;function Et(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??Dt(),a=t??Dt(),o=Me(Ct(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey??e?.name,r=t?.cacheKey??t?.name;return n!=null&&r!=null?n+`:`+r:n??r})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function Dt(){return{name:Tt,contents:``}}function Ot(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function kt(e){return{type:`text`,value:e}}function N({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function At({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 jt(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 Mt(e){return N({tagName:`div`,properties:{"data-gutter":``},children:e})}function Nt(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:[kt(`${t}`)]})]})}function P(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 Pt(){return N({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[At({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function Ft(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function It(e){for(let t of e)if(t instanceof HTMLElement&&(t.hasAttribute(`data-utility-button`)||t.hasAttribute(`data-gutter-utility-slot`)||t.getAttribute(`slot`)===`gutter-utility-slot`||t.getAttribute(`name`)===`gutter-utility-slot`))return!0;return!1}var Lt,Rt=t((()=>{Lt=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]})),zt,Bt=t((()=>{zt=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}},zt.prototype.normal={},zt.prototype.property={},zt.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 zt(n,r,t)}var Ht=t((()=>{Bt()}));function Ut(e){return e.toLowerCase()}var Wt=t((()=>{})),F,Gt=t((()=>{F=class{constructor(e,t){this.attribute=t,this.property=e}},F.prototype.attribute=``,F.prototype.booleanish=!1,F.prototype.boolean=!1,F.prototype.commaOrSpaceSeparated=!1,F.prototype.commaSeparated=!1,F.prototype.defined=!1,F.prototype.mustUseProperty=!1,F.prototype.number=!1,F.prototype.overloadedBoolean=!1,F.prototype.property=``,F.prototype.spaceSeparated=!1,F.prototype.space=void 0})),Kt=n({boolean:()=>I,booleanish:()=>L,commaOrSpaceSeparated:()=>B,commaSeparated:()=>Xt,number:()=>R,overloadedBoolean:()=>Yt,spaceSeparated:()=>z});function qt(){return 2**++Jt}var Jt,I,L,Yt,R,z,Xt,B,Zt=t((()=>{Jt=0,I=qt(),L=qt(),Yt=qt(),R=qt(),z=qt(),Xt=qt(),B=qt()}));function Qt(e,t,n){n&&(e[t]=n)}var $t,en,tn=t((()=>{Gt(),Zt(),$t=Object.keys(Kt),en=class extends F{constructor(e,t,n,r){let i=-1;if(super(e,t),Qt(this,`space`,r),typeof n==`number`)for(;++i<$t.length;){let e=$t[i];Qt(this,$t[i],(n&Kt[e])===Kt[e])}}},en.prototype.defined=!0}));function nn(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new en(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Ut(r)]=r,n[Ut(a.attribute)]=r}return new zt(t,n,e.space)}var rn=t((()=>{Wt(),tn(),Bt()})),an,on=t((()=>{rn(),Zt(),an=nn({properties:{ariaActiveDescendant:null,ariaAtomic:L,ariaAutoComplete:null,ariaBusy:L,ariaChecked:L,ariaColCount:R,ariaColIndex:R,ariaColSpan:R,ariaControls:z,ariaCurrent:null,ariaDescribedBy:z,ariaDetails:null,ariaDisabled:L,ariaDropEffect:z,ariaErrorMessage:null,ariaExpanded:L,ariaFlowTo:z,ariaGrabbed:L,ariaHasPopup:null,ariaHidden:L,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:z,ariaLevel:R,ariaLive:null,ariaModal:L,ariaMultiLine:L,ariaMultiSelectable:L,ariaOrientation:null,ariaOwns:z,ariaPlaceholder:null,ariaPosInSet:R,ariaPressed:L,ariaReadOnly:L,ariaRelevant:null,ariaRequired:L,ariaRoleDescription:z,ariaRowCount:R,ariaRowIndex:R,ariaRowSpan:R,ariaSelected:L,ariaSetSize:R,ariaSort:null,ariaValueMax:R,ariaValueMin:R,ariaValueNow:R,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}})}));function sn(e,t){return t in e?e[t]:t}var cn=t((()=>{}));function ln(e,t){return sn(e,t.toLowerCase())}var un=t((()=>{cn()})),dn,fn=t((()=>{un(),rn(),Zt(),dn=nn({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Xt,acceptCharset:z,accessKey:z,action:null,allow:null,allowFullScreen:I,allowPaymentRequest:I,allowUserMedia:I,alpha:I,alt:null,as:null,async:I,autoCapitalize:null,autoComplete:z,autoFocus:I,autoPlay:I,blocking:z,capture:null,charSet:null,checked:I,cite:null,className:z,closedBy:null,colorSpace:null,cols:R,colSpan:R,command:null,commandFor:null,content:null,contentEditable:L,controls:I,controlsList:z,coords:R|Xt,crossOrigin:null,data:null,dateTime:null,decoding:null,default:I,defer:I,dir:null,dirName:null,disabled:I,download:Yt,draggable:L,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:I,formTarget:null,headers:z,height:R,hidden:Yt,high:R,href:null,hrefLang:null,htmlFor:z,httpEquiv:z,id:null,imageSizes:null,imageSrcSet:null,inert:I,inputMode:null,integrity:null,is:null,isMap:I,itemId:null,itemProp:z,itemRef:z,itemScope:I,itemType:z,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:I,low:R,manifest:null,max:null,maxLength:R,media:null,method:null,min:null,minLength:R,multiple:I,muted:I,name:null,nonce:null,noModule:I,noValidate:I,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:I,optimum:R,pattern:null,ping:z,placeholder:null,playsInline:I,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:I,referrerPolicy:null,rel:z,required:I,reversed:I,rows:R,rowSpan:R,sandbox:z,scope:null,scoped:I,seamless:I,selected:I,shadowRootClonable:I,shadowRootCustomElementRegistry:I,shadowRootDelegatesFocus:I,shadowRootMode:null,shadowRootSerializable:I,shape:null,size:R,sizes:null,slot:null,span:R,spellCheck:L,src:null,srcDoc:null,srcLang:null,srcSet:null,start:R,step:null,style:null,tabIndex:R,target:null,title:null,translate:null,type:null,typeMustMatch:I,useMap:null,value:L,width:R,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:z,axis:null,background:null,bgColor:null,border:R,borderColor:null,bottomMargin:R,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:I,declare:I,event:null,face:null,frame:null,frameBorder:null,hSpace:R,leftMargin:R,link:null,longDesc:null,lowSrc:null,marginHeight:R,marginWidth:R,noResize:I,noHref:I,noShade:I,noWrap:I,object:null,profile:null,prompt:null,rev:null,rightMargin:R,rules:null,scheme:null,scrolling:L,standby:null,summary:null,text:null,topMargin:R,valueType:null,version:null,vAlign:null,vLink:null,vSpace:R,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:I,disablePictureInPicture:I,disableRemotePlayback:I,exportParts:Xt,part:z,prefix:null,property:null,results:R,security:null,unselectable:null},space:`html`,transform:ln})})),pn,mn=t((()=>{cn(),rn(),Zt(),pn=nn({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:B,accentHeight:R,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:R,amplitude:R,arabicForm:null,ascent:R,attributeName:null,attributeType:null,azimuth:R,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:R,by:null,calcMode:null,capHeight:R,className:z,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:R,diffuseConstant:R,direction:null,display:null,dur:null,divisor:R,dominantBaseline:null,download:I,dx:null,dy:null,edgeMode:null,editable:null,elevation:R,enableBackground:null,end:null,event:null,exponent:R,externalResourcesRequired:null,fill:null,fillOpacity:R,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Xt,g2:Xt,glyphName:Xt,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:R,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:R,horizOriginX:R,horizOriginY:R,id:null,ideographic:R,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:R,k:R,k1:R,k2:R,k3:R,k4:R,kernelMatrix:B,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:R,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:R,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:R,overlineThickness:R,paintOrder:null,panose1:null,path:null,pathLength:R,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:z,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:R,pointsAtY:R,pointsAtZ:R,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:B,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:B,rev:B,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:B,requiredFeatures:B,requiredFonts:B,requiredFormats:B,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:R,specularExponent:R,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:R,strikethroughThickness:R,string:null,stroke:null,strokeDashArray:B,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:R,strokeOpacity:R,strokeWidth:null,style:null,surfaceScale:R,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:B,tabIndex:R,tableValues:null,target:null,targetX:R,targetY:R,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:B,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:R,underlineThickness:R,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:R,values:null,vAlphabetic:R,vMathematical:R,vectorEffect:null,vHanging:R,vIdeographic:R,version:null,vertAdvY:R,vertOriginX:R,vertOriginY:R,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:R,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:sn})})),hn,gn=t((()=>{rn(),hn=nn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}})})),_n,vn=t((()=>{rn(),un(),_n=nn({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:ln})})),yn,bn=t((()=>{rn(),yn=nn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}})}));function xn(e,t){let n=Ut(t),r=t,i=F;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&En.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Tn,Cn);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Tn.test(e)){let n=e.replace(wn,Sn);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=en}return new i(r,t)}function Sn(e){return`-`+e.toLowerCase()}function Cn(e){return e.charAt(1).toUpperCase()}var wn,Tn,En,Dn=t((()=>{tn(),Gt(),Wt(),wn=/[A-Z]/g,Tn=/-[a-z]/g,En=/^data[-\w.:]+$/i})),On,kn,An=t((()=>{Ht(),on(),fn(),mn(),gn(),vn(),bn(),Dn(),On=Vt([an,dn,hn,_n,yn],`html`),kn=Vt([an,pn,hn,_n,yn],`svg`)}));function jn(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&Mn.call(t,e)){let n=String(t[e]);i=Mn.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 Mn,Nn=t((()=>{Mn={}.hasOwnProperty}));function Pn(e,t){if(e=e.replace(t.subset?Fn(t.subset):Ln,r),t.subset||t.escapeOnly)return e;return e.replace(Rn,n).replace(zn,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 Fn(e){let t=Vn.get(e);return t||(t=In(e),Vn.set(e,t)),t}function In(e){let t=[],n=-1;for(;++n{Ln=/["&'<>`]/g,Rn=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,zn=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Bn=/[|\\{}()[\]^$+*?.]/g,Vn=new WeakMap}));function Un(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!Wn.test(String.fromCharCode(t))?r:r+`;`}var Wn,Gn=t((()=>{Wn=/[\dA-Fa-f]/}));function Kn(e,t,n){let r=`&#`+String(e);return n&&t&&!qn.test(String.fromCharCode(t))?r:r+`;`}var qn,Jn=t((()=>{qn=/\d/})),Yn,Xn=t((()=>{Yn=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`)})),Zn,Qn=t((()=>{Zn={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:`­`,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:`‌`,zwj:`‍`,lrm:`‎`,rlm:`‏`,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`}})),$n,er=t((()=>{$n=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`]}));function tr(e,t,n,r){let i=String.fromCharCode(e);if(nr.call(rr,i)){let e=rr[i],a=`&`+e;return n&&Yn.includes(e)&&!$n.includes(e)&&(!r||t&&t!==61&&ar.test(String.fromCharCode(t)))?a:a+`;`}return``}var nr,rr,ir,ar,or=t((()=>{for(ir in Xn(),Qn(),er(),nr={}.hasOwnProperty,rr={},Zn)nr.call(Zn,ir)&&(rr[Zn[ir]]=ir);ar=/[^\dA-Za-z]/}));function sr(e,t,n){let r=Un(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=tr(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=Kn(e,t,n.omitOptionalSemicolons);i.length{Gn(),Jn(),or()}));function lr(e,t){return Pn(e,Object.assign({format:sr},t))}var ur=t((()=>{Hn(),cr()})),dr=t((()=>{ur()}));function fr(e,t,n,r){return r.settings.bogusComments?``:``;function i(e){return lr(e,Object.assign({},r.settings.characterReferences,{subset:hr}))}}var pr,mr,hr,gr=t((()=>{dr(),pr=/^>|^->||--!>|`],hr=[`<`,`>`]}));function _r(e,t,n,r){return``}var vr=t((()=>{}));function yr(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}var br=t((()=>{}));function xr(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Sr=t((()=>{}));function Cr(e){return e.join(` `).trim()}var wr=t((()=>{}));function Tr(e){return typeof e==`object`?e.type===`text`&&Er(e.value):Er(e)}function Er(e){return e.replace(Dr,``)===``}var Dr,Or=t((()=>{Dr=/[ \t\n\f\r]/g})),kr=t((()=>{Or()}));function Ar(e){return t;function t(t,n,r){let i=t?t.children:Mr,a=(n||0)+e,o=i[a];if(!r)for(;o&&Tr(o);)a+=e,o=i[a];return o}}var V,jr,Mr,Nr=t((()=>{kr(),V=Ar(1),jr=Ar(-1),Mr=[]}));function Pr(e){return t;function t(t,n,r){return Fr.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var Fr,Ir=t((()=>{Fr={}.hasOwnProperty}));function Lr(e,t,n){let r=V(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&Tr(r.value.charAt(0)))}function Rr(e,t,n){let r=V(n,t);return!r||r.type!==`comment`}function zr(e,t,n){let r=V(n,t);return!r||r.type!==`comment`}function Br(e,t,n){let r=V(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 Vr(e,t,n){let r=V(n,t);return!r||r.type===`element`&&r.tagName===`li`}function Hr(e,t,n){let r=V(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function Ur(e,t,n){let r=V(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function Wr(e,t,n){let r=V(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function Gr(e,t,n){let r=V(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function Kr(e,t,n){let r=V(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function qr(e,t,n){let r=V(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function Jr(e,t,n){let r=V(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function Yr(e,t,n){return!V(n,t)}function Xr(e,t,n){let r=V(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function Zr(e,t,n){let r=V(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var Qr,$r=t((()=>{kr(),Nr(),Ir(),Qr=Pr({body:zr,caption:Lr,colgroup:Lr,dd:Ur,dt:Hr,head:Lr,html:Rr,li:Vr,optgroup:Gr,option:Kr,p:Br,rp:Wr,rt:Wr,tbody:Jr,td:Zr,tfoot:Yr,th:Zr,thead:qr,tr:Xr})}));function ei(e){let t=V(e,-1);return!t||t.type!==`comment`}function ti(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 ni(e){let t=V(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&Tr(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function ri(e,t,n){let r=jr(n,t),i=V(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&Qr(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function ii(e,t,n){let r=jr(n,t),i=V(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&Qr(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var ai,oi=t((()=>{kr(),Nr(),$r(),Ir(),ai=Pr({body:ni,colgroup:ri,head:ti,html:ei,tbody:ii})}));function si(e,t,n,r){let i=r.schema,a=i.space!==`svg`&&r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=kn);let l=ci(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!ai(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||!Qr(e,t,n))&&s.push(``),s.join(``)}function ci(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=li(e,i,t[i]);r&&n.push(r)}}for(;++ryr(n,e.alternative)&&(o=e.alternative),s=o+lr(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?ui.single:ui.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var ui,di=t((()=>{br(),Sr(),An(),wr(),dr(),$r(),oi(),ui={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 fi(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:lr(e.value,Object.assign({},r.settings.characterReferences,{subset:pi}))}var pi,mi=t((()=>{dr(),pi=[`<`,`&`]}));function hi(e,t,n,r){return r.settings.allowDangerousHtml?e.value:fi(e,t,n,r)}var gi=t((()=>{mi()}));function _i(e,t,n,r){return r.all(e)}var vi=t((()=>{}));function yi(e){throw Error("Expected node, not `"+e+"`")}function bi(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var xi,Si=t((()=>{Nn(),gr(),vr(),di(),gi(),vi(),mi(),xi=jn(`type`,{invalid:yi,unknown:bi,handlers:{comment:fr,doctype:_r,element:si,raw:hi,root:_i,text:fi}})}));function H(e,t){let n=t||Ti,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Ci,all:wi,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||Lt,characterReferences:n.characterReferences||Ei,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?kn:On,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function Ci(e,t,n){return xi(e,t,n,this)}function wi(e){let t=[],n=e&&e.children||Di,r=-1;for(;++r{Rt(),An(),Si(),Ti={},Ei={},Di=[]})),ki=t((()=>{Oi()}));ki();var Ai=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener(`click`,this.handlePointerClick),this.pre?.removeEventListener(`pointerdown`,this.handlePointerDown),this.pre?.removeEventListener(`pointermove`,this.handlePointerMove),this.pre?.removeEventListener(`pointerleave`,this.handlePointerLeave),this.pre?.removeAttribute(`data-interactive-lines`),this.pre?.removeAttribute(`data-interactive-line-numbers`),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),fe(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode===`gutterSelecting`&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){let n=!(e===this.selectedRange||he(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!n&&!i||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!r&&!i||(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode===`diff`&&e.type===`diff-line`)return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode===`file`&&e.type===`line`)return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&It(e.composedPath())||(Yi(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;t===`disabled`&&!o&&n==null&&r==null&&i==null&&a==null||(Yi(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(Yi(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){Yi(t,`move`,`FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token`);return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();Yi(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);Yi(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=Fi(i)&&this.hoveredLine?.lineElement===i.lineElement;Pi(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),Pi(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Fi(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(Li(i)&&p!=null){p(i);break}if(Ii(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!Fi(i))break;Pi(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,Yi(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})()),Yi(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),Yi(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();It(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionPoint(e,{source:`coordinates-first`});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case`selecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case`pendingSingleLineUnselect`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(Ft(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case`pendingSingleLineUnselect`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case`selecting`:if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:case`selecting`:case`pendingSingleLineUnselect`:if(`pointerId`in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{lineHoverHighlight:t=`disabled`}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!==`disabled`&&((t===`both`||t===`line`)&&this.hoveredLine.lineElement.setAttribute(`data-hovered`,``),(t===`both`||t===`number`)&&this.hoveredLine.numberElement.setAttribute(`data-hovered`,``))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer??(this.gutterUtilityContainer=document.createElement(`div`),this.gutterUtilityContainer.setAttribute(`data-gutter-utility-slot`,``)),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot??(this.gutterUtilitySlot=document.createElement(`slot`),this.gutterUtilitySlot.name=`gutter-utility-slot`),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){let e=document.createElement(`div`);e.innerHTML=H(Pt());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);Ni(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(Bi(t));if(Ni(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(Ni(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(Ni(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&It(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=Bi(e);if(t&&It(n))return;let r=Vi(e);return r==null?this.pathFromAnnotationSlot(e):Bi(r)}pathFromAnnotationSlot(e){let t=Ui(Hi(e));if(t==null)return;let n=this.targetForSelectionPoint(t);return n==null?void 0:Bi(n.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=Wi(t)?t:Wi(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}he(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,de(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{fe(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!Ki(this.renderedSelectedLinesState,n),i=!Ki(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;ec)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode===`file`?{type:`line`,lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:`diff-line`,annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);Ri(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=Ji(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=Ji(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:zi(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:zi(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:qi(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:qi(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function ji({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:Mi({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function Mi({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function Ni(e){return e!=null&&`kind`in e&&e.kind===`line`}function Pi(e){return e!=null&&`kind`in e&&e.kind===`token`}function Fi(e){return Ni(e)||Pi(e)}function Ii(e){return`type`in e&&e.type===`line-info`}function Li(e){return`kind`in e&&e.kind===`merge-conflict-action`}function Ri(e){return e===`current`||e===`incoming`||e===`both`}function zi(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Bi(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function Vi(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function Hi(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function Ui(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function Wi(e){return e!=null&&typeof e.elementFromPoint==`function`}function Gi(e,t){return e===t||he(e??void 0,t??void 0)}function Ki(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&Gi(e?.range??null,t.range)}function qi(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function Ji(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 Yi(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}console.log(...n)}var Xi=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),$i(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?na(t):ra(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:Zi(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:Qi(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;!i&&!a||(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&ea(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function Zi(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function Qi(e){return Math.max(Math.ceil(e),0)}function $i(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?ea(e,{codeWidthChanged:!0,numberWidthChanged:!0}):ta(e))}function ea(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function ta(e){e.codeElement.style.removeProperty(`--diffs-column-content-width`),e.codeElement.style.removeProperty(`--diffs-column-number-width`),e.codeElement.style.removeProperty(`--diffs-column-width`)}function na(e){e.codeElement.isConnected&&ta(e)}function ra(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty(`--diffs-annotation-min-height`),e.column2.container.isConnected&&e.column2.container.style.removeProperty(`--diffs-annotation-min-height`)}var ia=new Map,aa=new Map,oa=new Map,sa=new Set;function ca(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!sa.has(t))return!1;return!0}function la(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(sa.has(n.name))continue;let e=ia.get(n.name);e??(e=n,ia.set(n.name,e)),sa.add(e.name),t.loadLanguageSync(e.data)}}function ua(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var U,da=t((()=>{U=class extends Error{constructor(e){super(e),this.name=`ShikiError`}}}));function fa(e){return pa(e)}function pa(e){return Array.isArray(e)?ma(e):e instanceof RegExp?e:typeof e==`object`?ha(e):e}function ma(e){let t=[];for(let n=0,r=e.length;n{for(let n in t)e[n]=t[n]}),e}function _a(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?_a(e.substring(0,e.length-1)):e.substr(~t+1)}function va(e,t){return et)}function ya(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Ca(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Ca(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}function wa(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 ao(l,u,e,o,s,c)}}return n}function Ta(e,t){e.sort((e,t)=>{let n=va(e.scope,t.scope);return n!==0||(n=ya(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 oo(t),o=new io(n,a.getId(r),a.getId(i)),s=new lo(new co(0,null,-1,0,0),[]);for(let t=0,n=e.length;t!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(ka(i)){let e=[];do e.push(i),i=r.next();while(ka(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 ka(e){return!!e&&!!e.match(/[\w\.:]+/)}function Aa(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 ja(e){typeof e.dispose==`function`&&e.dispose()}function Ma(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 fo?Pa({baseGrammar:a,selfGrammar:i},r):Na(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 fo(e))}function Na(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];Fa([r],t,n)}}function Pa(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Fa(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Fa(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Fa(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?ga({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&Fa(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=Ia(i);switch(a.kind){case 0:Pa({...t,selfGrammar:t.baseGrammar},n);break;case 1:Pa(t,n);break;case 2:Na(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?Na(a.ruleName,i,n):Pa(i,n)}else a.kind===4?n.add(new po(a.scopeName,a.ruleName)):n.add(new fo(a.scopeName))}}}function Ia(e){if(e===`$base`)return new go;if(e===`$self`)return new _o;let t=e.indexOf(`#`);return t===-1?new yo(e):t===0?new vo(e.substring(1)):new bo(e.substring(0,t),e.substring(t+1))}function La(e){return e}function Ra(e){return e}function za(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Ba(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 zo(i,!0);f()}return new zo(i,!1);function f(){let o=Va(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===Co){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),qa(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 ko){let r=o;qa(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 Ao){let r=o;qa(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(qa(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 Ba(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 Ao&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=Ga(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==wo){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),qa(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 Va(e,t,n,r,i,a){let o=Ha(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Ua(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 Wa(e,t,n,r,i){return Ro?{ruleScanner:e.compile(t,n),findOptions:Ka(r,i)}:{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Ga(e,t,n,r,i){return Ro?{ruleScanner:e.compileWhile(t,n),findOptions:Ka(r,i)}:{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Ka(e,t){let n=0;return e||(n|=1),t||(n|=4),n}function qa(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));za(e,p,n&&d.start===0,d.start,f,i,!1,0),ja(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 Bo(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}function Ja(e,t,n,r,i,a,o,s){return new Vo(e,t,n,r,i,a,o,s)}function Ya(e,t,n,r,i){let a=Oa(t,Xa),o=jo.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 Xa(e,t){if(t.length{for(let r=n;rn&&e.substr(0,n)===t&&e[n]===`.`}function Qa(e,t){return e=fa(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 $a,eo,to,no,ro,io,ao,W,oo,so,co,lo,uo,fo,po,mo,ho,go,_o,vo,yo,bo,xo,So,Co,wo,To,Eo,Do,Oo,ko,Ao,jo,Mo,No,Po,Fo,Io,Lo,Ro,zo,Bo,Vo,Ho,Uo,Wo,Go,Ko,qo,Jo,Yo=t((()=>{$a=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,eo=class{static hasCaptures(e){return e!==null&&($a.lastIndex=0,$a.test(e))}static replaceCaptures(e,t,n){return e.replace($a,(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})}},to=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},no=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(wa(e),t)}static createFromParsedTheme(e,t){return Ta(e,t)}_cachedMatchRoot=new to(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>Sa(e.parent,t.parentScopes));return n?new io(n.fontStyle,n.foreground,n.background):null}},ro=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(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))(W||{}),oo=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;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)}},lo=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(),co.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)}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=Da(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}},fo=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},po=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},mo=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))}},ho=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new fo(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new mo;for(let n of e)Ma(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof fo){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)}}},go=class{kind=0},_o=class{kind=1},vo=class{constructor(e){this.ruleName=e}kind=2},yo=class{constructor(e){this.scopeName=e}kind=3},bo=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4},xo=/\\(\d+)/,So=/\\(\d+)/g,Co=-1,wo=-2,To=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=eo.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=eo.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${_a(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:eo.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:eo.replaceCaptures(this._contentName,e,t)}},Eo=class extends To{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!`)}},Do=class extends To{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new Mo(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 No,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Oo=class extends To{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 No,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ko=class extends To{_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 Mo(i,this.id),this.beginCaptures=a,this._end=new Mo(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 No;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}},Ao=class extends To{_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 Mo(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new Mo(o,wo),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 No;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 No,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||`￿`),this._cachedCompiledWhilePatterns}},jo=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new Eo(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new Do(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=ga({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new Oo(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new Ao(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 ko(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 So.lastIndex=0,this.source.replace(So,(e,t)=>xa(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 Po(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 Po(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},Po=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 Fo(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/},Lo=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])=>xa(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`&&process.env.VSCODE_TEXTMATE_DEBUG,Ro=!1,zo=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}},Bo=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}},Vo=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new Io(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Qa(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Oa(e,Xa);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)Ya(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&&Ya(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[Ra(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]=Qa(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=jo.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Uo.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=uo.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?Ho.createRootAndLookUpScopeName(a,r,this):Ho.createRoot(`unknown`,r),t=new Uo(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 Go(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=za(this,a,i,0,t,s,!0,r);return ja(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}},Ho=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=ro.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new ro(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new ro(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),uo.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},Uo=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?Ho.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:Ra(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=Ho.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,La(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Ho.fromExtension(r,n.contentNameScopesList))}},Wo=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Oa(e,Xa).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Oa(e,Xa).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}},Go=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=uo.set(n,0,Ea(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=uo.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)}},Jo=Uo.NULL}));function Xo(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 Zo(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Qo(e){return Array.isArray(e)?e:[e]}async function $o(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function es(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function ts(e){return e===`ansi`||es(e)}function ns(e){return e===`none`}function rs(e){return ns(e)}function is(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(Es),r=0,i=[];for(let e=0;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`?Ds.light:Ds.dark,n||=t.type===`light`?Os.light:Os.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,ks,{enumerable:!1,writable:!1,value:!0}),t}async function os(e){return[...new Set((await Promise.all(e.filter(e=>!ts(e)).map(async e=>await $o(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function ss(e){return(await Promise.all(e.map(async e=>rs(e)?null:as(await $o(e))))).filter(e=>!!e)}function cs(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 U(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}function ls(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 U("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(as),i=new As(new js(e.engine,n),r,n,e.langAlias),a;function o(t){return cs(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new U(`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 U(`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 U(`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 us(e){e.engine||console.warn("`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 ls({...e,themes:t,langs:n,engine:r})}function ds(e,t){Ns.set(e,t)}function fs(e){return Ns.get(e)}function ps(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 ms(e,t){if(!(e instanceof Ps))throw new U(`Invalid grammar state`);return e.getInternalStack(t)}function hs(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(es(e.resolveLangAlias(n.lang||`text`))||ns(r))return is(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:i,colorMap:a}=e.setTheme(r),o=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new U(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new U(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return _s(t,o,i,a,n)}function gs(...e){if(e.length===2)return fs(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(es(i)||ns(a))throw new U(`Plain language does not have grammar state`);if(i===`ansi`)throw new U(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new Ps(vs(n,c,o,s,r).stateStack,c.name,o.name)}function _s(e,t,n,r,i){let a=vs(e,t,n,r,i),o=new Ps(a.stateStack,t.name,n.name);return ds(a.tokens,o),a.tokens}function vs(e,t,n,r,i){let a=Xo(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=is(e),u=i.grammarState?ms(i.grammarState,n.name)??Jo:i.grammarContextCode==null?Jo:vs(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,d=[],f=[];for(let e=0,i=l.length;e0&&i.length>=o){d=[],f.push([{content:i,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;c&&c!==`tokenType`&&(m=t.tokenizeLine(i,u,s),h=m.tokens,g=0);let _=t.tokenizeLine2(i,u,s),v=_.tokens.length/2;for(let e=0;ee.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(Is))})}f.explanation=[];let r=0;for(;t+r({scopeName:e}))}function bs(e,t){let n=[];for(let r=0,i=t.length;r=0&&i>=0;)xs(e[r],n[i])&&--r,--i;return r===-1}function Cs(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(Ss(e,t,n)){r.push(a);break}return r}function ws(e,t,n,r=hs){let i=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),a=i.map(i=>{let a=r(e,t,{...n,theme:i.theme});return{tokens:a,state:fs(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=Ts(...a.map(e=>e.tokens)),s=o[0].map((e,t)=>e.map((e,r)=>{let a={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(a.explanation=e.explanation),o.forEach((e,n)=>{let{content:o,explanation:s,offset:c,...l}=e[t][r];a.variants[i[n].color]=l}),a})),c=a[0].state?new Ps(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&ds(s,c),s}function Ts(...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;t{da(),Yo(),da(),Es=/(\r?\n)/g,Ds={light:`#333333`,dark:`#bbbbbb`},Os={light:`#fffffe`,dark:`#1e1e1e`},ks=`__shiki_resolved`,As=class extends qo{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=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=no.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=cs(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new U(`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))}},js=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,Ns=new WeakMap,Ps=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(Qo(n).map(e=>[e,Jo])),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 ps(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}},Fs=/,/,Is=/ /}));function Rs(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(hc)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(hc);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function zs(e){let t=is(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(rn&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n>1);e[i]<=t?n=i+1:r=i}return n}function Hs(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=e.offset+e.content.length,r=Vs(n,e.offset),i=r;for(;iWs(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&&gc.includes(a)){if(r===`light-dark()`&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new U('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let u=o[e][a]||`inherit`,d=o[r][a]||`inherit`;c[a]=`light-dark(${u}, ${d})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s}else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function Ws(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&W.Italic&&(t[`font-style`]=`italic`),e.fontStyle&W.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&W.Underline&&n.push(`underline`),e.fontStyle&W.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function Gs(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function Ks(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let r=zs(t.source);function n(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new U(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...r.indexToPos(e),offset:e}}{let t=r.lines[e.line];if(t===void 0)throw new U(`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 U(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:n,offset:r.posToIndex(e.line,n)}}}let i=(t.options.decorations||[]).map(e=>({...e,start:n(e.start),end:n(e.end)}));qs(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 Hs(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=[...e.children].filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new U(`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&&Rs(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 qs(e){for(let t=0;tn.end.offset)throw new U(`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}}if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function $s(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)yc[r]&&t.push({type:`setDecoration`,value:yc[r]});else if(r<=29){let e=yc[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:vc[r-30]}});else if(r===38){let n=Qs(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:vc[r-40]}});else if(r===48){let n=Qs(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:vc[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:vc[r-100+8]}})}}return t}function ec(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=Zs(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=$s(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]||Cc[t]]}))),o=ec();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=Zo(i,r),o=Zo(o,r),n.decorations.has(`dim`)&&(i=rc(i));let s=W.None;return n.decorations.has(`bold`)&&(s|=W.Bold),n.decorations.has(`italic`)&&(s|=W.Italic),n.decorations.has(`underline`)&&(s|=W.Underline),n.decorations.has(`strikethrough`)&&(s|=W.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function rc(e){let t=e.match(xc);if(t){let e=t[1];if(e.length===8){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,`0`);return`#${e.slice(0,6)}${t}`}if(e.length===6)return`#${e}80`;if(e.length===4){let t=e[0],n=e[1],r=e[2],i=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,`0`)}`}if(e.length===3){let t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}let n=e.match(Sc);return n?`var(${n[1]}-dim)`:e}function ic(e,t,n={}){let r=e.resolveLangAlias(n.lang||`text`),{theme:i=e.getLoadedThemes()[0]}=n;if(!es(r)&&!ns(i)&&r===`ansi`){let{theme:r}=e.setTheme(i);return nc(r,t,n)}return hs(e,t,n)}function ac(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:+(t.color===l));if(f.length===0)throw new U("`themes` option must not be empty");let p=ws(e,t,n,ic);if(c=fs(p),l&&l!==`light-dark()`&&!f.some(e=>e.color===l))throw new U(`\`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=>Us(e,h,u,l,d))),c&&ds(a,c);let g=f.map(e=>Xo(e.theme,n));i=oc(f,m,g,u,l,`fg`,d),r=oc(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=Xo(n.theme,n);a=ic(e,t,n);let l=e.getTheme(n.theme);r=Zo(l.bg,s),i=Zo(l.fg,s),o=l.name,c=fs(a)}else throw new U("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function oc(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=Zo(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===`light-dark()`&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new U('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Zo(t[r][a],n[r])||`inherit`}, ${Zo(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}function sc(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>sc(e,t,n),codeToTokens:(t,n)=>ac(e,t,n)}){let i=t;for(let e of Ys(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=ac(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=lc(a):d===`never`&&(a=uc(a)),f&&(a=dc(a));let p={...r,get source(){return i}};for(let e of Ys(n))a=e.tokens?.call(p,a)||a;return cc(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function cc(e,t,n,r=fs(e)){let i=Ys(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(l.style=t.rootStyle==null?`background-color:${t.bg};color:${t.fg}`:t.rootStyle),c!==!1&&c!=null&&(l.tabindex=c.toString());for(let[e,n]of Object.entries(t.meta||{}))e.startsWith(`_`)||(l[e]=n);let u={type:`element`,tagName:`pre`,properties:l,children:[],data:t.data},d={type:`element`,tagName:`code`,properties:{},children:a},f=[],p={...n,structure:s,addClassToHast:Rs,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=Gs(a.htmlStyle||Ws(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&&ds(m,r),m}function lc(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&W.Underline||i.fontStyle&W.Strikethrough));o&&wc.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function uc(e){return e.map(e=>e.flatMap(e=>{if(wc.test(e.content))return e;let t=e.content.match(Tc);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 dc(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=Gs(e.htmlStyle||Ws(e)),i=Gs(n.htmlStyle||Ws(n)),a=e.fontStyle&&(e.fontStyle&W.Underline||e.fontStyle&W.Strikethrough),o=n.fontStyle&&(n.fontStyle&W.Underline||n.fontStyle&W.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}function fc(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>sc(e,t,n),codeToTokens:(t,n)=>ac(e,t,n)},i=Ec(sc(e,t,n,r));for(let e of Ys(n))i=e.postprocess?.call(r,i,n)||i;return i}async function pc(e){let t=await us(e);return{getLastGrammarState:(...e)=>gs(t,...e),codeToTokensBase:(e,n)=>ic(t,e,n),codeToTokensWithThemes:(e,n)=>ws(t,e,n),codeToTokens:(e,n)=>ac(t,e,n),codeToHast:(e,n)=>sc(t,e,n),codeToHtml:(e,n)=>fc(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function mc(e={}){let{name:t=`css-variables`,variablePrefix:n=`--shiki-`,fontStyle:r=!0}=e,i=t=>e.variableDefaults?.[t]?`var(${n}${t}, ${e.variableDefaults[t]})`:`var(${n}${t})`,a={name:t,type:`dark`,colors:{"editor.foreground":i(`foreground`),"editor.background":i(`background`),"terminal.ansiBlack":i(`ansi-black`),"terminal.ansiRed":i(`ansi-red`),"terminal.ansiGreen":i(`ansi-green`),"terminal.ansiYellow":i(`ansi-yellow`),"terminal.ansiBlue":i(`ansi-blue`),"terminal.ansiMagenta":i(`ansi-magenta`),"terminal.ansiCyan":i(`ansi-cyan`),"terminal.ansiWhite":i(`ansi-white`),"terminal.ansiBrightBlack":i(`ansi-bright-black`),"terminal.ansiBrightRed":i(`ansi-bright-red`),"terminal.ansiBrightGreen":i(`ansi-bright-green`),"terminal.ansiBrightYellow":i(`ansi-bright-yellow`),"terminal.ansiBrightBlue":i(`ansi-bright-blue`),"terminal.ansiBrightMagenta":i(`ansi-bright-magenta`),"terminal.ansiBrightCyan":i(`ansi-bright-cyan`),"terminal.ansiBrightWhite":i(`ansi-bright-white`)},tokenColors:[{scope:[`keyword.operator.accessor`,`meta.group.braces.round.function.arguments`,`meta.template.expression`,`markup.fenced_code meta.embedded.block`],settings:{foreground:i(`foreground`)}},{scope:`emphasis`,settings:{fontStyle:`italic`}},{scope:[`strong`,`markup.heading.markdown`,`markup.bold.markdown`],settings:{fontStyle:`bold`}},{scope:[`markup.italic.markdown`],settings:{fontStyle:`italic`}},{scope:`meta.link.inline.markdown`,settings:{fontStyle:`underline`,foreground:i(`token-link`)}},{scope:[`string`,`markup.fenced_code`,`markup.inline`],settings:{foreground:i(`token-string`)}},{scope:[`comment`,`string.quoted.docstring.multi`],settings:{foreground:i(`token-comment`)}},{scope:[`constant.numeric`,`constant.language`,`constant.other.placeholder`,`constant.character.format.placeholder`,`variable.language.this`,`variable.other.object`,`variable.other.class`,`variable.other.constant`,`meta.property-name`,`meta.property-value`,`support`],settings:{foreground:i(`token-constant`)}},{scope:[`keyword`,`storage.modifier`,`storage.type`,`storage.control.clojure`,`entity.name.function.clojure`,`entity.name.tag.yaml`,`support.function.node`,`support.type.property-name.json`,`punctuation.separator.key-value`,`punctuation.definition.template-expression`],settings:{foreground:i(`token-keyword`)}},{scope:`variable.parameter.function`,settings:{foreground:i(`token-parameter`)}},{scope:[`support.function`,`entity.name.type`,`entity.other.inherited-class`,`meta.function-call`,`meta.instance.constructor`,`entity.other.attribute-name`,`entity.name.function`,`constant.keyword.clojure`],settings:{foreground:i(`token-function`)}},{scope:[`entity.name.tag`,`string.quoted`,`string.regexp`,`string.interpolated`,`string.template`,`string.unquoted.plain.out.yaml`,`keyword.other.template`],settings:{foreground:i(`token-string-expression`)}},{scope:[`punctuation.definition.arguments`,`punctuation.definition.dict`,`punctuation.separator`,`meta.function-call.arguments`],settings:{foreground:i(`token-punctuation`)}},{scope:[`markup.underline.link`,`punctuation.definition.metadata.markdown`],settings:{foreground:i(`token-link`)}},{scope:[`beginning.punctuation.definition.list.markdown`],settings:{foreground:i(`token-string`)}},{scope:[`punctuation.definition.string.begin.markdown`,`punctuation.definition.string.end.markdown`,`string.other.link.title.markdown`,`string.other.link.description.markdown`],settings:{foreground:i(`token-keyword`)}},{scope:[`markup.inserted`,`meta.diff.header.to-file`,`punctuation.definition.inserted`],settings:{foreground:i(`token-inserted`)}},{scope:[`markup.deleted`,`meta.diff.header.from-file`,`punctuation.definition.deleted`],settings:{foreground:i(`token-deleted`)}},{scope:[`markup.changed`,`punctuation.definition.changed`],settings:{foreground:i(`token-changed`)}}]};return r||(a.tokenColors=a.tokenColors?.map(e=>(e.settings?.fontStyle&&delete e.settings.fontStyle,e))),a}var hc,gc,_c,vc,yc,bc,xc,Sc,Cc,wc,Tc,Ec,Dc=t((()=>{da(),Ls(),Yo(),ki(),da(),hc=/\s+/g,gc=[`color`,`background-color`],_c=[Ks()],vc=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],yc={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`},bc={black:`#000000`,red:`#bb0000`,green:`#00bb00`,yellow:`#bbbb00`,blue:`#0000bb`,magenta:`#ff00ff`,cyan:`#00bbbb`,white:`#eeeeee`,brightBlack:`#555555`,brightRed:`#ff5555`,brightGreen:`#00ff00`,brightYellow:`#ffff55`,brightBlue:`#5555ff`,brightMagenta:`#ff55ff`,brightCyan:`#55ffff`,brightWhite:`#ffffff`},xc=/#([0-9a-f]{3,8})/i,Sc=/var\((--[\w-]+-ansi-[\w-]+)\)/,Cc={black:`#000000`,red:`#cd3131`,green:`#0DBC79`,yellow:`#E5E510`,blue:`#2472C8`,magenta:`#BC3FBC`,cyan:`#11A8CD`,white:`#E5E5E5`,brightBlack:`#666666`,brightRed:`#F14C4C`,brightGreen:`#23D18B`,brightYellow:`#F5F543`,brightBlue:`#3B8EEA`,brightMagenta:`#D670D6`,brightCyan:`#29B8DB`,brightWhite:`#FFFFFF`},wc=/^\s+$/,Tc=/^(\s*)(.*?)(\s*)$/,Ec=H})),Oc=t((()=>{Dc()})),kc,Ac,jc=t((()=>{kc=4294967295,Ac=class{patterns;options;regexps;constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}})}findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=[];function a(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>e==null?{start:kc,end:kc,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 Mc(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function Nc(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function Pc(e,t){if(e==null)throw Error(t??`Value expected`);return e}var Fc,G,Ic=t((()=>{Fc=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),G=String.raw}));function Lc(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=dl(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(vl.lastIndex=0;s=vl.exec(e);){let t=Rc(a,e,s[0],vl.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(vl.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`?pl(e,u):e).flat(),flags:r}}function Rc(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=zc(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:Uc(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:rl(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:Wc(n)}}if(a===`K`)return{token:Zc(`keep`,n)};if(a===`N`||a===`R`)return{token:Xc(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:Xc(`any`,n)};if(a===`X`)return{token:Xc(`text_segment`,n)};let e=Vc(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:ol(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:al(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:el(`group`,n)};if(n===`(?>`)return{token:el(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:el(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:el(`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:$c(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:Xc(`dot`,n)}:n===`^`||n===`$`?{token:Uc(e.singleline?{"^":G`\A`,$:G`\Z`}[n]:n,n)}:n===`|`?{token:Hc(n)}:_l.test(n)?{tokens:ml(n)}:{token:Gc(Mc(n),n)}}function zc(e,t,n){let r=[Yc(t[1]===`^`,t)],i=1,a;for(yl.lastIndex=n;a=yl.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(Yc(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(Gc(93,e));else if(i--,r.push(Kc(e)),!i)break}else{let t=Bc(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:yl.lastIndex||e.length}}function Bc(e){if(e[0]===`\\`)return Vc(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?\^?)(?[a-z]+):\]/.exec(e);if(!t||!Fc.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return Xc(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?qc(e):e===`&&`?Jc(e):Gc(Mc(e),e)}function Vc(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return il(e);if(`dDhHsSwW`.includes(n))return cl(e);if(e.startsWith(G`\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 ll(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 Gc(Mc(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return Gc(fl(e),e);if(xl.has(n))return Gc(xl.get(n),e);if(/\d/.test(n))return Qc(t,e);if(e===`\\`)throw Error(G`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return Gc(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function Hc(e){return{type:`Alternator`,raw:e}}function Uc(e,t){return{type:`Assertion`,kind:e,raw:t}}function Wc(e){return{type:`Backreference`,raw:e}}function Gc(e,t){return{type:`Character`,value:e,raw:t}}function Kc(e){return{type:`CharacterClassClose`,raw:e}}function qc(e){return{type:`CharacterClassHyphen`,raw:e}}function Jc(e){return{type:`CharacterClassIntersector`,raw:e}}function Yc(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function Xc(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function Zc(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:Pc(n.flags),raw:t}}function Qc(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function $c(e){return{type:`GroupClose`,raw:e}}function el(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function tl(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function nl(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function rl(e){return{type:`Subroutine`,raw:e}}function il(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return Gc(Mc(t.toUpperCase())-64,e)}function al(e,t){let{on:n,off:r}=/^\(\?(?[imx]*)(?:-(?[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=ul(n),o=ul(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),Zc(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,el(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function ol(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=bl.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 tl(l,r??null,i?.split(`,`)??null,e)}function sl(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 nl(t,n,r,e)}function cl(e){let t=e[1].toLowerCase();return Xc({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function ll(e){let{p:t,neg:n,value:r}=/^\\(?

[pP])\{(?\^?)(?[^}]+)/.exec(e).groups;return Xc(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function ul(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 dl(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 pl(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[Wc(n)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e127)throw Error(G`Octal encoded byte above 177 unsupported "${n}"`)}else r=Mc(t);a.push(Gc(r,(e===0?`\\`:``)+t))}return a}function ml(e){let t=[],n=new RegExp(_l,`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(sl(e.slice(0,-1)));continue}}}t.push(sl(e))}return t}var hl,gl,_l,vl,yl,bl,xl,Sl=t((()=>{Ic(),hl=G`\[\^?`,gl=`c.? | C(?:-.?)?|${G`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${G`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${G`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${G`o\{[^\}]*\}?`}|${G`\d{1,3}`}`,_l=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,vl=new RegExp(G` + \\ (?: + ${gl} + | [gk]<[^>]*>? + | [gk]'[^']*'? + | . + ) + | \( (?: + \? (?: + [:=!>({] + | <[=!] + | <[^>]*> + | '[^']*' + | ~\|? + | #(?:[^)\\]|\\.?)* + | [^:)]*[:)] + )? + | \*[^\)]*\)? + )? + | (?:${_l.source})+ + | ${hl} + | . +`.replace(/\s+/g,``),`gsu`),yl=new RegExp(G` + \\ (?: + ${gl} + | . + ) + | \[:(?:\^?\p{Alpha}+|\^):\] + | ${hl} + | && + | . +`.replace(/\s+/g,``),`gsu`),bl=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),xl=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]])}));function Cl(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 wl(e){return Tl.has(e.type)}var Tl,El=t((()=>{Tl=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`])}));function Dl(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=Lc(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 Ll();case`Assertion`:return Ol(n);case`Backreference`:return kl(n,a);case`Character`:return Vl(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return Al(n,a,t);case`CharacterClassOpen`:return jl(n,a,t);case`CharacterSet`:return Ml(n,a);case`Directive`:return Gl(n.kind,{flags:n.flags});case`GroupOpen`:return Nl(n,a,t);case`NamedCallout`:return Yl(n.kind,n.tag,n.arguments);case`Quantifier`:return Pl(n,a);case`Subroutine`:return Fl(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=Ql(Kl(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(G`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(G`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function Ol({kind:e}){return Rl(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===G`\B`||e===G`\Y`})}function kl({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,zl(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 zl(r)}return i(+r)}function Al(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(),Ul(o,e);throw Error(`Invalid character class range`)}return Vl(Mc(`-`))}function jl({negate:e},t,n){let{tokens:r,walk:i}=t,a=[Hl()],o=r[t.nextIndex],s=lu(o);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)a.push(Hl()),t.nextIndex++;else{let e=a.at(-1);e.body.push(i(e,n))}s=lu(r[t.nextIndex],o)}let c=Hl({negate:e});return a.length===1?c.body=a[0].body:(c.kind=`intersection`,c.body=a.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function Ml({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=cu(n);if(Fc.has(r)&&!o?.has(r))e=`posix`,n=r;else return eu(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?Xl(n,{negate:t}):Wl(e,{negate:t})}function Nl(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=tu(e),l=c.type===`AbsenceFunction`,u=au(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&Nc(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=uu(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push(Ll()),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(iu(t)||t.type===`CapturingGroup`)throw Error(e)}else if(iu(t)||au(t)&&t.negate)throw Error(e)}}f=uu(r[t.nextIndex])}return t.nextIndex++,c}function Pl({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!wl(a))throw Error(`Quantifier requires a repeatable token`);let o=Zl(e,t,n,a);return i.body.pop(),o}function Fl({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=$l(i);return r.push(o),o}function Il(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:nu(t?.body)}}function Ll(e){return{type:`Alternative`,body:ru(e?.body)}}function Rl(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function zl(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function Bl(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!ou(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:nu(t?.body)}}function Vl(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:ru(e?.body)}}function Ul(e,t){if(t.valuen)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function Ql(e,t){return{type:`Regex`,body:nu(t?.body),flags:e}}function $l(e){return{type:`Subroutine`,ref:e}}function eu(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(cu(e));if(!r){if(n.normalizeUnknownPropertyNames)r=su(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(G`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function tu({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return Il(`repeater`);case`atomic`:return ql({atomic:!0});case`capturing`:return Bl(i,{name:n});case`group`:return ql({flags:e});case`lookahead`:case`lookbehind`:return Jl({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function nu(e){if(e===void 0)e=[Ll()];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 ru(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 iu(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function au(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function ou(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function su(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 cu(e){return e.replace(/[- _]+/g,``).toLowerCase()}function lu(e,t){let n=t;return Pc(e,`Unclosed character class${n?.type===`Character`&&n.value===93&&n.raw===`]`?` (started with "]")`:``}`)}function uu(e){return Pc(e,`Unclosed group`)}var du=t((()=>{Sl(),Ic(),El()}));function fu(e,t,n=null){function r(e,t){for(let n=0;n{Ic()}));function gu(e,t){for(let n=0;n=t&&e[n]++}function _u(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var vu,yu=t((()=>{vu=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`}));function bu(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 xu(e,t,n,r){bu(e,t,n,r)}function Su(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 Cu(e,t,n){return!!Su(e,t,0,n)}function wu(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 K,Tu=t((()=>{K=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`})}));function Eu(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(Ou.lastIndex=Number.isNaN(c)?0:c+7;f=Ou.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),gu(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=bu(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}}function Du(e){if(!RegExp(`${ku}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(Au.lastIndex=0;o=Au.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=_u(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}Au.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var Ou,ku,Au,ju=t((()=>{yu(),Tu(),Ou=new RegExp(String.raw`(?${vu})|(?\((?:\?<[^>]+>)?)|\\?.`,`gsu`),ku=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Au=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\) + ))? +| (?${ku})(?[?+]?)(?[?*+\{]?) +| \\?. +`.replace(/\s+/g,``),`gsu`)})),Mu=t((()=>{ju()}));function Nu(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(zu,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&Cu(e,q`\(\?\(DEFINE\)`,K.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=Cu(e,q`\\[1-9]`,K.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(Hu.lastIndex=0;f=Hu.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(Pu(m),l)throw Error(Uu);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(Hu.lastIndex);if(Cu(s,zu,K.DEFAULT))throw Error(Uu);let c=m-1;e=Fu(t,s,c,!1,n,a,d),i=Ru(i,t,c,a.length,0,d);break}if(h){Pu(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(Uu);break}if(!u)throw Error(q`Recursive \g cannot be used outside the referenced group "${r===`external`?h:q`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=wu(e,p);if(o&&Cu(m,q`${Bu}|\((?!\?)`,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=Fu(_,v,b,!0,n,a,d);i=Ru(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,Hu.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),Hu.lastIndex),s.set(p,Hu.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),Hu.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function Pu(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 Fu(e,t,n,r,i,a,o){let s=new Set;r&&xu(e+t,Bu,({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),Lu(i,n),s?e:`(?<${t}${l}>`}return q`\k<${c}${l}>`},K.DEFAULT)}return c}function Lu(e,t){for(let n=0;n=t&&e[n]++}function Ru(e,t,n,r,i,a){if(e.size&&r){let o=0;xu(t,Vu,()=>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 q,zu,Bu,Vu,Hu,Uu,Wu=t((()=>{Tu(),q=String.raw,zu=q`\(\?R=(?[^\)]+)\)|${q`\\g<(?[^>&]+)&R=(?[^>]+)>`}`,Bu=q`\(\?<(?![=!])(?[^>]+)>`,Vu=q`${Bu}|(?\()(?!\?)`,Hu=new RegExp(q`${Bu}|${zu}|\(\?|\\?.`,`gsu`),Uu=`Cannot use multiple overlapping recursions`}));function Gu(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function Ku(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function qu(e,t){return Id[e]>=Id[t]}function Ju(e,t){if(e==null)throw Error(t??`Value expected`);return e}function Yu(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!Ld[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=Z.flagGroups?`ES2025`:Z.unicodeSets?`ES2024`:`ES2018`),t}function Xu(e){if(zd.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=Wd.get(n),a=Hd.get(n),o=Ud.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]}function Zu(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function Qu(e){let t=Y(e);return[t.toLowerCase(),t]}function $u(e,t){return Zu(e,t).map(e=>Qu(e))}function ed(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};td(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:qu(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};fu(e,qd,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};fu(e,Jd,a);let o={groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer};return fu(e,Yd,o),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}function td(e){fu(e,{"*"({node:e,parent:t}){e.parent=t}})}function nd(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function rd(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=ud(n.parent);for(let r of t){if(r===n)break;if(r===e||fd(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function id(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=id(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function ad(e){let t=$l(e);return t.isRecursive=!0,t}function od(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function sd(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function cd(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function ld({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 ud(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function dd(e){let t=e.find(e=>e.kind===`search_start`||hd(e,{negate:!1})||!pd(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=dd(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function fd(e,t){let n=ud(e)??[];for(let e of n)if(e===t||fd(e,t))return!0;return!1}function pd({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function md(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function hd(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&Cl(e.body[0],{type:`Assertion`,kind:`search_start`})}function gd(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function _d(e,t){let n=Dl(e,{...t,unicodePropertyMap:Vd}).body;return n.length>1||n[0].body.length>1?ql({body:n}):n[0].body[0]}function vd(e,t){return e.negate=t,e}function yd(e,t){return e.parent=t,e}function J(e,t){return td(e),e.parent=t,e}function bd(e,t){let n=Yu(t),r=qu(n.target,`ES2024`),i=qu(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];fu(e,Xd,{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,Ju(Zd[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&&Ku(f._captureTransfers,e.transferTo,[]).push(t)}),f}function xd(e){return nf.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(!xd(t))continue;let o=Xu(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(tf.has(e))return tf.get(e);if(e<32||e>126&&e<160||e>262143||t&&Od(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?ef:$d:Qd,a=Y(e);return(i.has(a)?`\\`:``)+a}function wd(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 Ed({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 Dd({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function Od(e){return e>47&&e<58}function kd({type:e,value:t}){return e===`Character`&&t===45}function Ad(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function jd(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)Ku(n,t,{}).transferTo=e;return n}function Md(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 Nd(e,t){let n=Pd(e,t);return n.options?new rf(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function Pd(e,t){let n=Yu(t),r=ed(Dl(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Vd}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=bd(r,n),a=Nu(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=Eu(Du(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 Y,X,Z,Fd,Id,Ld,Rd,zd,Bd,Vd,Hd,Ud,Wd,Gd,Kd,qd,Jd,Yd,Xd,Zd,Qd,$d,ef,tf,nf,rf,af=t((()=>{du(),hu(),Mu(),Wu(),Y=String.fromCodePoint,X=String.raw,Z={},Fd=globalThis.RegExp,Z.flagGroups=(()=>{try{new Fd(`(?i:)`)}catch{return!1}return!0})(),Z.unicodeSets=(()=>{try{new Fd(`[[]]`,`v`)}catch{return!1}return!0})(),Z.bugFlagVLiteralHyphenIsRange=Z.unicodeSets?(()=>{try{new Fd(X`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,Z.bugNestedClassIgnoresNegation=Z.unicodeSets&&new Fd(`[[^a]]`,`v`).test(`a`),Id={ES2025:2025,ES2024:2024,ES2018:2018},Ld={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`},Rd=`[ -\r ]`,zd=new Set([Y(304),Y(305)]),Bd=X`[\p{L}\p{M}\p{N}\p{Pc}]`,Vd=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=>[cu(e),e])),Hd=new Map([[`s`,Y(383)],[Y(383),`s`]]),Ud=new Map([[Y(223),Y(7838)],[Y(107),Y(8490)],[Y(229),Y(8491)],[Y(969),Y(8486)]]),Wd=new Map([Qu(453),Qu(456),Qu(459),Qu(498),...$u(8072,8079),...$u(8088,8095),...$u(8104,8111),Qu(8124),Qu(8140),Qu(8188)]),Gd=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}`]]),Kd=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]),qd={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=ql();e.body[0].body.push(Jl({negate:!0,body:r}),eu(`Any`));let i=ql();i.body[0].body.push(Zl(`greedy`,0,1/0,e)),n(J(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(yd(eu(`AHex`,{negate:l}),t));else if(c===`newline`)n(J(_d(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(J(_d(`[${e}]`),t))}else n(J(vd(_d(Gd.get(u)),l),t))}else if(c===`property`)Vd.has(cu(u))||(e.key=`sc`);else if(c===`space`)n(yd(eu(`space`,{negate:l}),t));else if(c===`word`)n(J(vd(_d(Bd),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=ql({flags:c});e.body[0].body=o(),i(J(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&Cl(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=Jl({behind:!0});o.body[0].body=a(),i(J(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(J(Jl({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=ql();t.body[0].body.push(e.body),e.body=J(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=dd(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`&&!gd(n)&&(n=sd(n,t),e.ref=n)}},Jd={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=yd(ad(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&Ku(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;te.type===`Group`&&!!e.flags)),t=e?Gu(r.globalFlags,e):r.globalFlags;nd(t,r.currentFlags)||(l=ql({flags:ld(t)}),l.body[0].body.push(c))}n(J(l,t),{traverse:!s})}},Yd={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=>rd(t,e));i.length?i.length>1?n(J(ql({atomic:!0,body:i.reverse().map(e=>Ll({body:[zl(e.number)]}))}),t)):e.ref=i[0].number:n(J(Jl({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;ts.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&&xd(n)){let e=Xu(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`);Z.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(kd)&&(o=[Vl(45),...o.filter(e=>!kd(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||Z.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=ql(),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=Ll({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`&&!(Z.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&&wd(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&&Kd.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=Gu(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${Td(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)+Ed(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}>`}},Qd=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),$d=new Set([`-`,`\\`,`]`,`^`,`[`]),ef=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),tf=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`]]),nf=/^\p{Cased}$/u,rf=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=jd(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(Ad(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;eof(e,{target:t.target}),{createScanner(e){return new Ac(e,t)},createString(e){return{content:e}}}}var cf=t((()=>{jc(),af()})),lf=t((()=>{cf()})),uf=t((()=>{lf()})),df=n({default:()=>pf}),ff,pf,mf=t((()=>{ff=Object.freeze(JSON.parse('{"displayName":"Markdown","name":"markdown","patterns":[{"include":"#frontMatter"},{"include":"#block"}],"repository":{"ampersand":{"match":"&(?!([0-9A-Za-z]+|#[0-9]+|#x\\\\h+);)","name":"meta.other.valid-ampersand.markdown"},"block":{"patterns":[{"include":"#separator"},{"include":"#heading"},{"include":"#blockquote"},{"include":"#lists"},{"include":"#fenced_code_block"},{"include":"#raw_block"},{"include":"#link-def"},{"include":"#html"},{"include":"#table"},{"include":"#paragraph"}]},"blockquote":{"begin":"(^|\\\\G) {0,3}(>) ?","captures":{"2":{"name":"punctuation.definition.quote.begin.markdown"}},"name":"markup.quote.markdown","patterns":[{"include":"#block"}],"while":"(^|\\\\G)\\\\s*(>) ?"},"bold":{"begin":"(?(\\\\*\\\\*(?=\\\\w)|(?]*+>|(?`+)([^`]|(?!(?(?!`))`)*+\\\\k|\\\\\\\\[-\\\\]!#(-+.>\\\\[\\\\\\\\_`{}]?+|\\\\[((?[^]\\\\[\\\\\\\\]|\\\\\\\\.|\\\\[\\\\g*+])*+](( ?\\\\[[^]]*+])|(\\\\([\\\\t ]*+?[\\\\t ]*+((?[\\"\'])(.*?)\\\\k<title>)?\\\\))))|(?!(?<=\\\\S)\\\\k<open>).)++(?<=\\\\S)(?=__\\\\b|\\\\*\\\\*)\\\\k<open>)","captures":{"1":{"name":"punctuation.definition.bold.markdown"}},"end":"(?<=\\\\S)(\\\\1)","name":"markup.bold.markdown","patterns":[{"applyEndPatternLast":1,"begin":"(?=<[^>]*?>)","end":"(?<=>)","patterns":[{"include":"text.html.derivative"}]},{"include":"#escape"},{"include":"#ampersand"},{"include":"#bracket"},{"include":"#raw"},{"include":"#bold"},{"include":"#italic"},{"include":"#image-inline"},{"include":"#link-inline"},{"include":"#link-inet"},{"include":"#link-email"},{"include":"#image-ref"},{"include":"#link-ref-literal"},{"include":"#link-ref"},{"include":"#link-ref-shortcut"},{"include":"#strikethrough"}]},"bracket":{"match":"<(?![!$/?A-Za-z])","name":"meta.other.valid-bracket.markdown"},"escape":{"match":"\\\\\\\\[-\\\\]!#(-+.>\\\\[\\\\\\\\_`{}]","name":"constant.character.escape.markdown"},"fenced_code_block":{"patterns":[{"include":"#fenced_code_block_css"},{"include":"#fenced_code_block_basic"},{"include":"#fenced_code_block_ini"},{"include":"#fenced_code_block_java"},{"include":"#fenced_code_block_lua"},{"include":"#fenced_code_block_makefile"},{"include":"#fenced_code_block_perl"},{"include":"#fenced_code_block_r"},{"include":"#fenced_code_block_ruby"},{"include":"#fenced_code_block_php"},{"include":"#fenced_code_block_sql"},{"include":"#fenced_code_block_vs_net"},{"include":"#fenced_code_block_xml"},{"include":"#fenced_code_block_xsl"},{"include":"#fenced_code_block_yaml"},{"include":"#fenced_code_block_dosbatch"},{"include":"#fenced_code_block_clojure"},{"include":"#fenced_code_block_coffee"},{"include":"#fenced_code_block_c"},{"include":"#fenced_code_block_cpp"},{"include":"#fenced_code_block_diff"},{"include":"#fenced_code_block_dockerfile"},{"include":"#fenced_code_block_git_commit"},{"include":"#fenced_code_block_git_rebase"},{"include":"#fenced_code_block_go"},{"include":"#fenced_code_block_groovy"},{"include":"#fenced_code_block_pug"},{"include":"#fenced_code_block_ignore"},{"include":"#fenced_code_block_js"},{"include":"#fenced_code_block_js_regexp"},{"include":"#fenced_code_block_json"},{"include":"#fenced_code_block_jsonc"},{"include":"#fenced_code_block_jsonl"},{"include":"#fenced_code_block_less"},{"include":"#fenced_code_block_objc"},{"include":"#fenced_code_block_swift"},{"include":"#fenced_code_block_scss"},{"include":"#fenced_code_block_perl6"},{"include":"#fenced_code_block_powershell"},{"include":"#fenced_code_block_python"},{"include":"#fenced_code_block_julia"},{"include":"#fenced_code_block_regexp_python"},{"include":"#fenced_code_block_rust"},{"include":"#fenced_code_block_scala"},{"include":"#fenced_code_block_shell"},{"include":"#fenced_code_block_ts"},{"include":"#fenced_code_block_tsx"},{"include":"#fenced_code_block_csharp"},{"include":"#fenced_code_block_fsharp"},{"include":"#fenced_code_block_dart"},{"include":"#fenced_code_block_handlebars"},{"include":"#fenced_code_block_markdown"},{"include":"#fenced_code_block_log"},{"include":"#fenced_code_block_erlang"},{"include":"#fenced_code_block_elixir"},{"include":"#fenced_code_block_latex"},{"include":"#fenced_code_block_bibtex"},{"include":"#fenced_code_block_twig"},{"include":"#fenced_code_block_yang"},{"include":"#fenced_code_block_abap"},{"include":"#fenced_code_block_restructuredtext"},{"include":"#fenced_code_block_unknown"}]},"fenced_code_block_abap":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(abap)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.abap","patterns":[{"include":"source.abap"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_basic":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(html?|shtml|xhtml|inc|tmpl|tpl)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.html","patterns":[{"include":"text.html.basic"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_bibtex":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(bibtex)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.bibtex","patterns":[{"include":"text.bibtex"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_c":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:([ch])((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.c","patterns":[{"include":"source.c"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_clojure":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(cl(?:js??|ojure))((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.clojure","patterns":[{"include":"source.clojure"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_coffee":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(coffee|Cakefile|coffee.erb)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.coffee","patterns":[{"include":"source.coffee"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_cpp":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(c(?:pp|\\\\+\\\\+|xx))((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.cpp source.cpp","patterns":[{"include":"source.cpp"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_csharp":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(c(?:s|sharp|#))((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.csharp","patterns":[{"include":"source.cs"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_css":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(css(?:|.erb))((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.css","patterns":[{"include":"source.css"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_dart":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(dart)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.dart","patterns":[{"include":"source.dart"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_diff":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(patch|diff|rej)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.diff","patterns":[{"include":"source.diff"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_dockerfile":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:([Dd]ockerfile)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.dockerfile","patterns":[{"include":"source.dockerfile"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_dosbatch":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(bat(?:|ch))((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.dosbatch","patterns":[{"include":"source.batchfile"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_elixir":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(elixir)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.elixir","patterns":[{"include":"source.elixir"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_erlang":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(erlang)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.erlang","patterns":[{"include":"source.erlang"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_fsharp":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(f(?:s|sharp|#))((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.fsharp","patterns":[{"include":"source.fsharp"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_git_commit":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:((?:COMMIT_EDIT|MERGE_)MSG)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.git_commit","patterns":[{"include":"text.git-commit"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_git_rebase":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(git-rebase-todo)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.git_rebase","patterns":[{"include":"text.git-rebase"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_go":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(go(?:|lang))((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.go","patterns":[{"include":"source.go"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_groovy":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(g(?:roovy|vy))((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.groovy","patterns":[{"include":"source.groovy"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_handlebars":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(h(?:andlebars|bs))((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.handlebars","patterns":[{"include":"text.html.handlebars"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_ignore":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:((?:git|)ignore)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.ignore","patterns":[{"include":"source.ignore"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_ini":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(ini|conf)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.ini","patterns":[{"include":"source.ini"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_java":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(java|bsh)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.java","patterns":[{"include":"source.java"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_js":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(jsx??|javascript|es6|mjs|cjs|dataviewjs|\\\\{\\\\.js.+?})((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.javascript","patterns":[{"include":"source.js"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_js_regexp":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(regexp)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.js_regexp","patterns":[{"include":"source.js.regexp"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_json":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(json5??|sublime-settings|sublime-menu|sublime-keymap|sublime-mousemap|sublime-theme|sublime-build|sublime-project|sublime-completions)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.json","patterns":[{"include":"source.json"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_jsonc":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(jsonc)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.jsonc","patterns":[{"include":"source.json.comments"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_jsonl":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(jsonl(?:|ines))((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.jsonl","patterns":[{"include":"source.json.lines"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_julia":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(julia|\\\\{\\\\.julia.+?})((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.julia","patterns":[{"include":"source.julia"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_latex":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:((?:la|)tex)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.latex","patterns":[{"include":"text.tex.latex"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_less":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(less)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.less","patterns":[{"include":"source.css.less"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_log":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(log)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.log","patterns":[{"include":"text.log"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_lua":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(lua)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.lua","patterns":[{"include":"source.lua"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_makefile":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:((?:[Mm]|GNUm|OCamlM)akefile)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.makefile","patterns":[{"include":"source.makefile"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_markdown":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(m(?:arkdown|d))((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.markdown","patterns":[{"include":"text.html.markdown"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_objc":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(objectivec|objective-c|mm|objc|obj-c|[hm])((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.objc","patterns":[{"include":"source.objc"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_perl":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(perl|pl|pm|pod|t|PL|psgi|vcl)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.perl","patterns":[{"include":"source.perl"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_perl6":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(perl6|p6|pl6|pm6|nqp)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.perl6","patterns":[{"include":"source.perl.6"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_php":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(php3??|php4|php5|phpt|phtml|aw|ctp)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.php","patterns":[{"include":"text.html.basic"},{"include":"source.php"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_powershell":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(p(?:owershell|s1|sm1|sd1|wsh))((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.powershell","patterns":[{"include":"source.powershell"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_pug":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(jade|pug)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.pug","patterns":[{"include":"text.pug"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_python":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(python|py3??|rpy|pyw|cpy|SConstruct|Sconstruct|sconstruct|SConscript|gypi??|\\\\{\\\\.python.+?})((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.python","patterns":[{"include":"source.python"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_r":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:([RSrs]|Rprofile|\\\\{\\\\.r.+?})((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.r","patterns":[{"include":"source.r"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_regexp_python":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(re)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.regexp_python","patterns":[{"include":"source.regexp.python"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_restructuredtext":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(r(?:estructuredtext|st))((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.restructuredtext","patterns":[{"include":"source.rst"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_ruby":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(ruby|rbx??|rjs|Rakefile|rake|cgi|fcgi|gemspec|irbrc|Capfile|ru|prawn|Cheffile|Gemfile|Guardfile|Hobofile|Vagrantfile|Appraisals|Rantfile|Berksfile|Berksfile.lock|Thorfile|Puppetfile)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.ruby","patterns":[{"include":"source.ruby"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_rust":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(rust|rs|\\\\{\\\\.rust.+?})((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.rust","patterns":[{"include":"source.rust"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_scala":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(s(?:cala|bt))((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.scala","patterns":[{"include":"source.scala"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_scss":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(scss)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.scss","patterns":[{"include":"source.css.scss"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_shell":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(shell|sh|bash|zsh|bashrc|bash_profile|bash_login|profile|bash_logout|.textmate_init|\\\\{\\\\.bash.+?})((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.shellscript","patterns":[{"include":"source.shell"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_sql":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(sql|ddl|dml)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.sql","patterns":[{"include":"source.sql"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_swift":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(swift)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.swift","patterns":[{"include":"source.swift"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_ts":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(t(?:ypescript|s))((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.typescript","patterns":[{"include":"source.ts"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_tsx":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(tsx)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.typescriptreact","patterns":[{"include":"source.tsx"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_twig":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(twig)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.twig","patterns":[{"include":"source.twig"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_unknown":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?=([^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown"},"fenced_code_block_vs_net":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(vb)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.vs_net","patterns":[{"include":"source.asp.vb.net"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_xml":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(xml|xsd|tld|jsp|pt|cpt|dtml|rss|opml)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.xml","patterns":[{"include":"text.xml"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_xsl":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(xslt??)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.xsl","patterns":[{"include":"text.xml.xsl"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_yaml":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(ya?ml)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.yaml","patterns":[{"include":"source.yaml"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"fenced_code_block_yang":{"begin":"(^|\\\\G)(\\\\s*)(`{3,}|~{3,})\\\\s*(?i:(yang)((\\\\s+|[,:?{])[^`]*)?$)","beginCaptures":{"3":{"name":"punctuation.definition.markdown"},"4":{"name":"fenced_code.block.language.markdown"},"5":{"name":"fenced_code.block.language.attributes.markdown"}},"end":"(^|\\\\G)(\\\\2|\\\\s{0,3})(\\\\3)\\\\s*$","endCaptures":{"3":{"name":"punctuation.definition.markdown"}},"name":"markup.fenced_code.block.markdown","patterns":[{"begin":"(^|\\\\G)(\\\\s*)(.*)","contentName":"meta.embedded.block.yang","patterns":[{"include":"source.yang"}],"while":"(^|\\\\G)(?!\\\\s*([`~]{3,})\\\\s*$)"}]},"frontMatter":{"applyEndPatternLast":1,"begin":"\\\\A(?=(-{3,}))","end":"^(?: {0,3}\\\\1-*[\\\\t ]*|[\\\\t ]*\\\\.{3})$","endCaptures":{"0":{"name":"punctuation.definition.end.frontmatter"}},"patterns":[{"begin":"\\\\A(-{3,})(.*)$","beginCaptures":{"1":{"name":"punctuation.definition.begin.frontmatter"},"2":{"name":"comment.frontmatter"}},"contentName":"meta.embedded.block.frontmatter","patterns":[{"include":"source.yaml"}],"while":"^(?!(?: {0,3}\\\\1-*[\\\\t ]*|[\\\\t ]*\\\\.{3})$)"}]},"heading":{"captures":{"1":{"patterns":[{"captures":{"1":{"name":"punctuation.definition.heading.markdown"},"2":{"name":"entity.name.section.markdown","patterns":[{"include":"#inline"},{"include":"text.html.derivative"}]},"3":{"name":"punctuation.definition.heading.markdown"}},"match":"(#{6})\\\\s+(.*?)(?:\\\\s+(#+))?\\\\s*$","name":"heading.6.markdown"},{"captures":{"1":{"name":"punctuation.definition.heading.markdown"},"2":{"name":"entity.name.section.markdown","patterns":[{"include":"#inline"},{"include":"text.html.derivative"}]},"3":{"name":"punctuation.definition.heading.markdown"}},"match":"(#{5})\\\\s+(.*?)(?:\\\\s+(#+))?\\\\s*$","name":"heading.5.markdown"},{"captures":{"1":{"name":"punctuation.definition.heading.markdown"},"2":{"name":"entity.name.section.markdown","patterns":[{"include":"#inline"},{"include":"text.html.derivative"}]},"3":{"name":"punctuation.definition.heading.markdown"}},"match":"(#{4})\\\\s+(.*?)(?:\\\\s+(#+))?\\\\s*$","name":"heading.4.markdown"},{"captures":{"1":{"name":"punctuation.definition.heading.markdown"},"2":{"name":"entity.name.section.markdown","patterns":[{"include":"#inline"},{"include":"text.html.derivative"}]},"3":{"name":"punctuation.definition.heading.markdown"}},"match":"(#{3})\\\\s+(.*?)(?:\\\\s+(#+))?\\\\s*$","name":"heading.3.markdown"},{"captures":{"1":{"name":"punctuation.definition.heading.markdown"},"2":{"name":"entity.name.section.markdown","patterns":[{"include":"#inline"},{"include":"text.html.derivative"}]},"3":{"name":"punctuation.definition.heading.markdown"}},"match":"(#{2})\\\\s+(.*?)(?:\\\\s+(#+))?\\\\s*$","name":"heading.2.markdown"},{"captures":{"1":{"name":"punctuation.definition.heading.markdown"},"2":{"name":"entity.name.section.markdown","patterns":[{"include":"#inline"},{"include":"text.html.derivative"}]},"3":{"name":"punctuation.definition.heading.markdown"}},"match":"(#{1})\\\\s+(.*?)(?:\\\\s+(#+))?\\\\s*$","name":"heading.1.markdown"}]}},"match":"(?:^|\\\\G) {0,3}(#{1,6}\\\\s+(.*?)(\\\\s+#{1,6})?\\\\s*)$","name":"markup.heading.markdown"},"heading-setext":{"patterns":[{"match":"^(={3,})(?=[\\\\t ]*$\\\\n?)","name":"markup.heading.setext.1.markdown"},{"match":"^(-{3,})(?=[\\\\t ]*$\\\\n?)","name":"markup.heading.setext.2.markdown"}]},"html":{"patterns":[{"begin":"(^|\\\\G)\\\\s*(<!--)","captures":{"1":{"name":"punctuation.definition.comment.html"},"2":{"name":"punctuation.definition.comment.html"}},"end":"(-->)","name":"comment.block.html"},{"begin":"(?i)(^|\\\\G)\\\\s*(?=<(script|style|pre)(\\\\s|$|>)(?!.*?</(script|style|pre)>))","end":"(?i)(.*)((</)(script|style|pre)(>))","endCaptures":{"1":{"patterns":[{"include":"text.html.derivative"}]},"2":{"name":"meta.tag.structure.$4.end.html"},"3":{"name":"punctuation.definition.tag.begin.html"},"4":{"name":"entity.name.tag.html"},"5":{"name":"punctuation.definition.tag.end.html"}},"patterns":[{"begin":"(\\\\s*|$)","patterns":[{"include":"text.html.derivative"}],"while":"(?i)^(?!.*</(script|style|pre)>)"}]},{"begin":"(?i)(^|\\\\G)\\\\s*(?=</?[A-Za-z]+[^\\\\&/;gt\\\\s]*(\\\\s|$|/?>))","patterns":[{"include":"text.html.derivative"}],"while":"^(?!\\\\s*$)"},{"begin":"(^|\\\\G)\\\\s*(?=(<(?:[-0-9A-Za-z](/?>|\\\\s.*?>)|/[-0-9A-Za-z]>))\\\\s*$)","patterns":[{"include":"text.html.derivative"}],"while":"^(?!\\\\s*$)"}]},"image-inline":{"captures":{"1":{"name":"punctuation.definition.link.description.begin.markdown"},"2":{"name":"string.other.link.description.markdown"},"4":{"name":"punctuation.definition.link.description.end.markdown"},"5":{"name":"punctuation.definition.metadata.markdown"},"7":{"name":"punctuation.definition.link.markdown"},"8":{"name":"markup.underline.link.image.markdown"},"9":{"name":"punctuation.definition.link.markdown"},"10":{"name":"markup.underline.link.image.markdown"},"12":{"name":"string.other.link.description.title.markdown"},"13":{"name":"punctuation.definition.string.begin.markdown"},"14":{"name":"punctuation.definition.string.end.markdown"},"15":{"name":"string.other.link.description.title.markdown"},"16":{"name":"punctuation.definition.string.begin.markdown"},"17":{"name":"punctuation.definition.string.end.markdown"},"18":{"name":"string.other.link.description.title.markdown"},"19":{"name":"punctuation.definition.string.begin.markdown"},"20":{"name":"punctuation.definition.string.end.markdown"},"21":{"name":"punctuation.definition.metadata.markdown"}},"match":"(!\\\\[)((?<square>[^]\\\\[\\\\\\\\]|\\\\\\\\.|\\\\[\\\\g<square>*+])*+)(])(\\\\()[\\\\t ]*((<)((?:\\\\\\\\[<>]|[^\\\\n<>])*)(>)|((?<url>(?>[^()\\\\s]+)|\\\\(\\\\g<url>*\\\\))*))[\\\\t ]*(?:((\\\\().+?(\\\\)))|((\\").+?(\\"))|((\').+?(\')))?\\\\s*(\\\\))","name":"meta.image.inline.markdown"},"image-ref":{"captures":{"1":{"name":"punctuation.definition.link.description.begin.markdown"},"2":{"name":"string.other.link.description.markdown"},"4":{"name":"punctuation.definition.link.description.end.markdown"},"5":{"name":"punctuation.definition.constant.markdown"},"6":{"name":"constant.other.reference.link.markdown"},"7":{"name":"punctuation.definition.constant.markdown"}},"match":"(!\\\\[)((?<square>[^]\\\\[\\\\\\\\]|\\\\\\\\.|\\\\[\\\\g<square>*+])*+)(]) ?(\\\\[)(.*?)(])","name":"meta.image.reference.markdown"},"inline":{"patterns":[{"include":"#ampersand"},{"include":"#bracket"},{"include":"#bold"},{"include":"#italic"},{"include":"#raw"},{"include":"#strikethrough"},{"include":"#escape"},{"include":"#image-inline"},{"include":"#image-ref"},{"include":"#link-email"},{"include":"#link-inet"},{"include":"#link-inline"},{"include":"#link-ref"},{"include":"#link-ref-literal"},{"include":"#link-ref-shortcut"}]},"italic":{"begin":"(?<open>(\\\\*(?=\\\\w)|(?<!\\\\w)\\\\*|(?<!\\\\w)\\\\b_))(?=\\\\S)(?=(<[^>]*+>|(?<raw>`+)([^`]|(?!(?<!`)\\\\k<raw>(?!`))`)*+\\\\k<raw>|\\\\\\\\[-\\\\]!#(-+.>\\\\[\\\\\\\\_`{}]?+|\\\\[((?<square>[^]\\\\[\\\\\\\\]|\\\\\\\\.|\\\\[\\\\g<square>*+])*+](( ?\\\\[[^]]*+])|(\\\\([\\\\t ]*+<?(.*?)>?[\\\\t ]*+((?<title>[\\"\'])(.*?)\\\\k<title>)?\\\\))))|\\\\k<open>\\\\k<open>|(?!(?<=\\\\S)\\\\k<open>).)++(?<=\\\\S)(?=_\\\\b|\\\\*)\\\\k<open>)","captures":{"1":{"name":"punctuation.definition.italic.markdown"}},"end":"(?<=\\\\S)(\\\\1)((?!\\\\1)|(?=\\\\1\\\\1))","name":"markup.italic.markdown","patterns":[{"applyEndPatternLast":1,"begin":"(?=<[^>]*?>)","end":"(?<=>)","patterns":[{"include":"text.html.derivative"}]},{"include":"#escape"},{"include":"#ampersand"},{"include":"#bracket"},{"include":"#raw"},{"include":"#bold"},{"include":"#image-inline"},{"include":"#link-inline"},{"include":"#link-inet"},{"include":"#link-email"},{"include":"#image-ref"},{"include":"#link-ref-literal"},{"include":"#link-ref"},{"include":"#link-ref-shortcut"},{"include":"#strikethrough"}]},"link-def":{"captures":{"1":{"name":"punctuation.definition.constant.markdown"},"2":{"name":"constant.other.reference.link.markdown"},"3":{"name":"punctuation.definition.constant.markdown"},"4":{"name":"punctuation.separator.key-value.markdown"},"5":{"name":"punctuation.definition.link.markdown"},"6":{"name":"markup.underline.link.markdown"},"7":{"name":"punctuation.definition.link.markdown"},"8":{"name":"markup.underline.link.markdown"},"9":{"name":"string.other.link.description.title.markdown"},"10":{"name":"punctuation.definition.string.begin.markdown"},"11":{"name":"punctuation.definition.string.end.markdown"},"12":{"name":"string.other.link.description.title.markdown"},"13":{"name":"punctuation.definition.string.begin.markdown"},"14":{"name":"punctuation.definition.string.end.markdown"},"15":{"name":"string.other.link.description.title.markdown"},"16":{"name":"punctuation.definition.string.begin.markdown"},"17":{"name":"punctuation.definition.string.end.markdown"}},"match":"\\\\s*(\\\\[)([^]]+?)(])(:)[\\\\t ]*(?:(<)((?:\\\\\\\\[<>]|[^\\\\n<>])*)(>)|(\\\\S+?))[\\\\t ]*(?:((\\\\().+?(\\\\)))|((\\").+?(\\"))|((\').+?(\')))?\\\\s*$","name":"meta.link.reference.def.markdown"},"link-email":{"captures":{"1":{"name":"punctuation.definition.link.markdown"},"2":{"name":"markup.underline.link.markdown"},"4":{"name":"punctuation.definition.link.markdown"}},"match":"(<)((?:mailto:)?[!#-\'*+\\\\--9=?A-Z^-~]+@[-0-9A-Za-z]+(?:\\\\.[-0-9A-Za-z]+)*)(>)","name":"meta.link.email.lt-gt.markdown"},"link-inet":{"captures":{"1":{"name":"punctuation.definition.link.markdown"},"2":{"name":"markup.underline.link.markdown"},"3":{"name":"punctuation.definition.link.markdown"}},"match":"(<)((?:https?|ftp)://.*?)(>)","name":"meta.link.inet.markdown"},"link-inline":{"captures":{"1":{"name":"punctuation.definition.link.title.begin.markdown"},"2":{"name":"string.other.link.title.markdown","patterns":[{"include":"#raw"},{"include":"#bold"},{"include":"#italic"},{"include":"#strikethrough"},{"include":"#image-inline"}]},"4":{"name":"punctuation.definition.link.title.end.markdown"},"5":{"name":"punctuation.definition.metadata.markdown"},"7":{"name":"punctuation.definition.link.markdown"},"8":{"name":"markup.underline.link.markdown"},"9":{"name":"punctuation.definition.link.markdown"},"10":{"name":"markup.underline.link.markdown"},"12":{"name":"string.other.link.description.title.markdown"},"13":{"name":"punctuation.definition.string.begin.markdown"},"14":{"name":"punctuation.definition.string.end.markdown"},"15":{"name":"string.other.link.description.title.markdown"},"16":{"name":"punctuation.definition.string.begin.markdown"},"17":{"name":"punctuation.definition.string.end.markdown"},"18":{"name":"string.other.link.description.title.markdown"},"19":{"name":"punctuation.definition.string.begin.markdown"},"20":{"name":"punctuation.definition.string.end.markdown"},"21":{"name":"punctuation.definition.metadata.markdown"}},"match":"(\\\\[)((?<square>[^]\\\\[\\\\\\\\]|\\\\\\\\.|\\\\[\\\\g<square>*+])*+)(])(\\\\()[\\\\t ]*((<)((?:\\\\\\\\[<>]|[^\\\\n<>])*)(>)|((?<url>(?>[^()\\\\s]+)|\\\\(\\\\g<url>*\\\\))*))[\\\\t ]*(?:((\\\\()[^()]*(\\\\)))|((\\")[^\\"]*(\\"))|((\')[^\']*(\')))?\\\\s*(\\\\))","name":"meta.link.inline.markdown"},"link-ref":{"captures":{"1":{"name":"punctuation.definition.link.title.begin.markdown"},"2":{"name":"string.other.link.title.markdown","patterns":[{"include":"#raw"},{"include":"#bold"},{"include":"#italic"},{"include":"#strikethrough"},{"include":"#image-inline"}]},"4":{"name":"punctuation.definition.link.title.end.markdown"},"5":{"name":"punctuation.definition.constant.begin.markdown"},"6":{"name":"constant.other.reference.link.markdown"},"7":{"name":"punctuation.definition.constant.end.markdown"}},"match":"(?<![]\\\\\\\\])(\\\\[)((?<square>[^]\\\\[\\\\\\\\]|\\\\\\\\.|\\\\[\\\\g<square>*+])*+)(])(\\\\[)([^]]*+)(])","name":"meta.link.reference.markdown"},"link-ref-literal":{"captures":{"1":{"name":"punctuation.definition.link.title.begin.markdown"},"2":{"name":"string.other.link.title.markdown"},"4":{"name":"punctuation.definition.link.title.end.markdown"},"5":{"name":"punctuation.definition.constant.begin.markdown"},"6":{"name":"punctuation.definition.constant.end.markdown"}},"match":"(?<![]\\\\\\\\])(\\\\[)((?<square>[^]\\\\[\\\\\\\\]|\\\\\\\\.|\\\\[\\\\g<square>*+])*+)(]) ?(\\\\[)(])","name":"meta.link.reference.literal.markdown"},"link-ref-shortcut":{"captures":{"1":{"name":"punctuation.definition.link.title.begin.markdown"},"2":{"name":"string.other.link.title.markdown"},"3":{"name":"punctuation.definition.link.title.end.markdown"}},"match":"(?<![]\\\\\\\\])(\\\\[)((?:[^]\\\\[\\\\\\\\\\\\s]|\\\\\\\\[]\\\\[])+?)((?<!\\\\\\\\)])","name":"meta.link.reference.markdown"},"list_paragraph":{"begin":"(^|\\\\G)(?=\\\\S)(?![*->]\\\\s|[0-9]+\\\\.\\\\s)","name":"meta.paragraph.markdown","patterns":[{"include":"#inline"},{"include":"text.html.derivative"},{"include":"#heading-setext"}],"while":"(^|\\\\G)(?!\\\\s*$|#| {0,3}([-*>_] {2,}){3,}[\\\\t ]*$\\\\n?| {0,3}[*->]| {0,3}[0-9]+\\\\.)"},"lists":{"patterns":[{"begin":"(^|\\\\G)( {0,3})([-*+])([\\\\t ])","beginCaptures":{"3":{"name":"punctuation.definition.list.begin.markdown"}},"name":"markup.list.unnumbered.markdown","patterns":[{"include":"#block"},{"include":"#list_paragraph"}],"while":"((^|\\\\G)( {2,4}|\\\\t))|^([\\\\t ]*)$"},{"begin":"(^|\\\\G)( {0,3})([0-9]+[).])([\\\\t ])","beginCaptures":{"3":{"name":"punctuation.definition.list.begin.markdown"}},"name":"markup.list.numbered.markdown","patterns":[{"include":"#block"},{"include":"#list_paragraph"}],"while":"((^|\\\\G)( {2,4}|\\\\t))|^([\\\\t ]*)$"}]},"paragraph":{"begin":"(^|\\\\G) {0,3}(?=[^\\\\t\\\\n ])","name":"meta.paragraph.markdown","patterns":[{"include":"#inline"},{"include":"text.html.derivative"},{"include":"#heading-setext"}],"while":"(^|\\\\G)((?=\\\\s*[-=]{3,}\\\\s*$)| {4,}(?=[^\\\\t\\\\n ]))"},"raw":{"captures":{"1":{"name":"punctuation.definition.raw.markdown"},"3":{"name":"punctuation.definition.raw.markdown"}},"match":"(`+)((?:[^`]|(?!(?<!`)\\\\1(?!`))`)*+)(\\\\1)","name":"markup.inline.raw.string.markdown"},"raw_block":{"begin":"(^|\\\\G)( {4}|\\\\t)","name":"markup.raw.block.markdown","while":"(^|\\\\G)( {4}|\\\\t)"},"separator":{"match":"(^|\\\\G) {0,3}([-*_])( {0,2}\\\\2){2,}[\\\\t ]*$\\\\n?","name":"meta.separator.markdown"},"strikethrough":{"captures":{"1":{"name":"punctuation.definition.strikethrough.markdown"},"2":{"patterns":[{"applyEndPatternLast":1,"begin":"(?=<[^>]*?>)","end":"(?<=>)","patterns":[{"include":"text.html.derivative"}]},{"include":"#escape"},{"include":"#ampersand"},{"include":"#bracket"},{"include":"#raw"},{"include":"#bold"},{"include":"#italic"},{"include":"#image-inline"},{"include":"#link-inline"},{"include":"#link-inet"},{"include":"#link-email"},{"include":"#image-ref"},{"include":"#link-ref-literal"},{"include":"#link-ref"},{"include":"#link-ref-shortcut"}]},"3":{"name":"punctuation.definition.strikethrough.markdown"}},"match":"(?<!\\\\\\\\)(~{2,})(?!(?<=\\\\w~~)_)((?:[^~]|(?!(?<![\\\\\\\\~])\\\\1(?!~))~)*+)(\\\\1)(?!(?<=_\\\\1)\\\\w)","name":"markup.strikethrough.markdown"},"table":{"begin":"(^|\\\\G)(\\\\|)(?=[^|].+\\\\|\\\\s*$)","beginCaptures":{"2":{"name":"punctuation.definition.table.markdown"}},"name":"markup.table.markdown","patterns":[{"match":"\\\\|","name":"punctuation.definition.table.markdown"},{"captures":{"1":{"name":"punctuation.separator.table.markdown"}},"match":"(?<=\\\\|)\\\\s*(:?-+:?)\\\\s*(?=\\\\|)"},{"captures":{"1":{"patterns":[{"include":"#inline"}]}},"match":"(?<=\\\\|)\\\\s*(?=\\\\S)((\\\\\\\\\\\\||[^|])+)(?<=\\\\S)\\\\s*(?=\\\\|)"}],"while":"(^|\\\\G)(?=\\\\|)"}},"scopeName":"text.html.markdown","embeddedLangs":[],"aliases":["md"],"embeddedLangsLazy":["css","html","ini","java","lua","make","perl","r","ruby","php","sql","vb","xml","xsl","yaml","bat","clojure","coffee","c","cpp","diff","docker","git-commit","git-rebase","go","groovy","pug","javascript","json","jsonc","jsonl","less","objective-c","swift","scss","raku","powershell","python","julia","regexp","rust","scala","shellscript","typescript","tsx","csharp","fsharp","dart","handlebars","log","erlang","elixir","latex","bibtex","abap","rst","html-derivative"]}')),pf=[ff]})),hf=n({bundledLanguages:()=>_f,codeToHtml:()=>fc,createCssVariablesTheme:()=>mc,createHighlighter:()=>pc,createJavaScriptRegexEngine:()=>sf,createOnigurumaEngine:()=>gf,getTokenStyleObject:()=>Ws,stringifyTokenStyle:()=>Gs});function gf(){throw Error(`The Oniguruma highlighter is not bundled.`)}var _f,vf=t((()=>{Oc(),uf(),_f={markdown:()=>Promise.resolve().then(()=>(mf(),df))}}));vf();async function yf(e){if(ua())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=aa.get(e);if(t!=null)return t;try{let t=oa.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(_f,e)&&(t=_f[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 ia.has(e)||ia.set(e,n),n});return aa.set(e,n),await n}finally{aa.delete(e)}}function bf(e){return ia.get(e)??yf(e)}var xf=new Set;function Sf(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var Cf=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},wf=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},Tf=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function Ef(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new Cf(t);e.set(t,n)}function a(t,n){return!e.has(t)&&(e.set(t,n),!0)}function o(t){return e.has(t)}function s(i){let a=t.get(i);if(a!==void 0)return Promise.resolve(a);let o=n.get(i);if(o!==void 0)return o;let s=e.get(i);if(s===void 0)return Promise.reject(new wf(i));let c=r,l=s().then(e=>{let a=Sf(e);return c===r&&t.set(i,a),n.get(i)===l&&n.delete(i),a}).catch(e=>{throw n.get(i)===l&&n.delete(i),e});return n.set(i,l),l}function c(e){return Promise.all(e.map(e=>s(e)))}function l(e,n){t.set(e,n)}function u(e){for(let[t,n]of e)l(t,n)}function d(e){return t.get(e)}function f(e){let n=[];for(let r of e){let e=t.get(r);if(e===void 0)throw new Tf(r);n.push(e)}return n}function p(e){return t.has(e)}function m(e){for(let n of e)if(!t.has(n))return!1;return!0}function h(e){let n=t.get(e);return n===void 0?s(e):n}function g(){r++,t.clear(),n.clear()}return{clearResolvedThemes:g,getResolvedOrResolveTheme:h,getResolvedTheme:d,getResolvedThemes:f,hasRegisteredTheme:o,hasResolvedTheme:p,hasResolvedThemes:m,registerTheme:i,registerThemeIfAbsent:a,resolveTheme:s,resolveThemes:c,seedResolvedTheme:l,seedResolvedThemes:u}}var Df=Ef();function Of(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=Df.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,Df.getResolvedTheme(n)??Df.seedResolvedTheme(n,e);xf.has(n)||(xf.add(n),t.loadThemeSync(e))}}var kf=n({default:()=>Af}),Af,jf=t((()=>{Af=Object.freeze(JSON.parse(`{"colors":{"activityBar.activeBorder":"#fd8c73","activityBar.background":"#ffffff","activityBar.border":"#d0d7de","activityBar.foreground":"#1f2328","activityBar.inactiveForeground":"#656d76","activityBarBadge.background":"#0969da","activityBarBadge.foreground":"#ffffff","badge.background":"#0969da","badge.foreground":"#ffffff","breadcrumb.activeSelectionForeground":"#656d76","breadcrumb.focusForeground":"#1f2328","breadcrumb.foreground":"#656d76","breadcrumbPicker.background":"#ffffff","button.background":"#1f883d","button.foreground":"#ffffff","button.hoverBackground":"#1a7f37","button.secondaryBackground":"#ebecf0","button.secondaryForeground":"#24292f","button.secondaryHoverBackground":"#f3f4f6","checkbox.background":"#f6f8fa","checkbox.border":"#d0d7de","debugConsole.errorForeground":"#cf222e","debugConsole.infoForeground":"#57606a","debugConsole.sourceForeground":"#9a6700","debugConsole.warningForeground":"#7d4e00","debugConsoleInputIcon.foreground":"#6639ba","debugIcon.breakpointForeground":"#cf222e","debugTokenExpression.boolean":"#116329","debugTokenExpression.error":"#a40e26","debugTokenExpression.name":"#0550ae","debugTokenExpression.number":"#116329","debugTokenExpression.string":"#0a3069","debugTokenExpression.value":"#0a3069","debugToolBar.background":"#ffffff","descriptionForeground":"#656d76","diffEditor.insertedLineBackground":"#aceebb4d","diffEditor.insertedTextBackground":"#6fdd8b80","diffEditor.removedLineBackground":"#ffcecb4d","diffEditor.removedTextBackground":"#ff818266","dropdown.background":"#ffffff","dropdown.border":"#d0d7de","dropdown.foreground":"#1f2328","dropdown.listBackground":"#ffffff","editor.background":"#ffffff","editor.findMatchBackground":"#bf8700","editor.findMatchHighlightBackground":"#fae17d80","editor.focusedStackFrameHighlightBackground":"#4ac26b66","editor.foldBackground":"#6e77811a","editor.foreground":"#1f2328","editor.lineHighlightBackground":"#eaeef280","editor.linkedEditingBackground":"#0969da12","editor.selectionHighlightBackground":"#4ac26b40","editor.stackFrameHighlightBackground":"#d4a72c66","editor.wordHighlightBackground":"#eaeef280","editor.wordHighlightBorder":"#afb8c199","editor.wordHighlightStrongBackground":"#afb8c14d","editor.wordHighlightStrongBorder":"#afb8c199","editorBracketHighlight.foreground1":"#0969da","editorBracketHighlight.foreground2":"#1a7f37","editorBracketHighlight.foreground3":"#9a6700","editorBracketHighlight.foreground4":"#cf222e","editorBracketHighlight.foreground5":"#bf3989","editorBracketHighlight.foreground6":"#8250df","editorBracketHighlight.unexpectedBracket.foreground":"#656d76","editorBracketMatch.background":"#4ac26b40","editorBracketMatch.border":"#4ac26b99","editorCursor.foreground":"#0969da","editorGroup.border":"#d0d7de","editorGroupHeader.tabsBackground":"#f6f8fa","editorGroupHeader.tabsBorder":"#d0d7de","editorGutter.addedBackground":"#4ac26b66","editorGutter.deletedBackground":"#ff818266","editorGutter.modifiedBackground":"#d4a72c66","editorIndentGuide.activeBackground":"#1f23283d","editorIndentGuide.background":"#1f23281f","editorInlayHint.background":"#afb8c133","editorInlayHint.foreground":"#656d76","editorInlayHint.paramBackground":"#afb8c133","editorInlayHint.paramForeground":"#656d76","editorInlayHint.typeBackground":"#afb8c133","editorInlayHint.typeForeground":"#656d76","editorLineNumber.activeForeground":"#1f2328","editorLineNumber.foreground":"#8c959f","editorOverviewRuler.border":"#ffffff","editorWhitespace.foreground":"#afb8c1","editorWidget.background":"#ffffff","errorForeground":"#cf222e","focusBorder":"#0969da","foreground":"#1f2328","gitDecoration.addedResourceForeground":"#1a7f37","gitDecoration.conflictingResourceForeground":"#bc4c00","gitDecoration.deletedResourceForeground":"#cf222e","gitDecoration.ignoredResourceForeground":"#6e7781","gitDecoration.modifiedResourceForeground":"#9a6700","gitDecoration.submoduleResourceForeground":"#656d76","gitDecoration.untrackedResourceForeground":"#1a7f37","icon.foreground":"#656d76","input.background":"#ffffff","input.border":"#d0d7de","input.foreground":"#1f2328","input.placeholderForeground":"#6e7781","keybindingLabel.foreground":"#1f2328","list.activeSelectionBackground":"#afb8c133","list.activeSelectionForeground":"#1f2328","list.focusBackground":"#ddf4ff","list.focusForeground":"#1f2328","list.highlightForeground":"#0969da","list.hoverBackground":"#eaeef280","list.hoverForeground":"#1f2328","list.inactiveFocusBackground":"#ddf4ff","list.inactiveSelectionBackground":"#afb8c133","list.inactiveSelectionForeground":"#1f2328","minimapSlider.activeBackground":"#8c959f47","minimapSlider.background":"#8c959f33","minimapSlider.hoverBackground":"#8c959f3d","notificationCenterHeader.background":"#f6f8fa","notificationCenterHeader.foreground":"#656d76","notifications.background":"#ffffff","notifications.border":"#d0d7de","notifications.foreground":"#1f2328","notificationsErrorIcon.foreground":"#cf222e","notificationsInfoIcon.foreground":"#0969da","notificationsWarningIcon.foreground":"#9a6700","panel.background":"#f6f8fa","panel.border":"#d0d7de","panelInput.border":"#d0d7de","panelTitle.activeBorder":"#fd8c73","panelTitle.activeForeground":"#1f2328","panelTitle.inactiveForeground":"#656d76","pickerGroup.border":"#d0d7de","pickerGroup.foreground":"#656d76","progressBar.background":"#0969da","quickInput.background":"#ffffff","quickInput.foreground":"#1f2328","scrollbar.shadow":"#6e778133","scrollbarSlider.activeBackground":"#8c959f47","scrollbarSlider.background":"#8c959f33","scrollbarSlider.hoverBackground":"#8c959f3d","settings.headerForeground":"#1f2328","settings.modifiedItemIndicator":"#d4a72c66","sideBar.background":"#f6f8fa","sideBar.border":"#d0d7de","sideBar.foreground":"#1f2328","sideBarSectionHeader.background":"#f6f8fa","sideBarSectionHeader.border":"#d0d7de","sideBarSectionHeader.foreground":"#1f2328","sideBarTitle.foreground":"#1f2328","statusBar.background":"#ffffff","statusBar.border":"#d0d7de","statusBar.debuggingBackground":"#cf222e","statusBar.debuggingForeground":"#ffffff","statusBar.focusBorder":"#0969da80","statusBar.foreground":"#656d76","statusBar.noFolderBackground":"#ffffff","statusBarItem.activeBackground":"#1f23281f","statusBarItem.focusBorder":"#0969da","statusBarItem.hoverBackground":"#1f232814","statusBarItem.prominentBackground":"#afb8c133","statusBarItem.remoteBackground":"#eaeef2","statusBarItem.remoteForeground":"#1f2328","symbolIcon.arrayForeground":"#953800","symbolIcon.booleanForeground":"#0550ae","symbolIcon.classForeground":"#953800","symbolIcon.colorForeground":"#0a3069","symbolIcon.constantForeground":"#116329","symbolIcon.constructorForeground":"#3e1f79","symbolIcon.enumeratorForeground":"#953800","symbolIcon.enumeratorMemberForeground":"#0550ae","symbolIcon.eventForeground":"#57606a","symbolIcon.fieldForeground":"#953800","symbolIcon.fileForeground":"#7d4e00","symbolIcon.folderForeground":"#7d4e00","symbolIcon.functionForeground":"#6639ba","symbolIcon.interfaceForeground":"#953800","symbolIcon.keyForeground":"#0550ae","symbolIcon.keywordForeground":"#a40e26","symbolIcon.methodForeground":"#6639ba","symbolIcon.moduleForeground":"#a40e26","symbolIcon.namespaceForeground":"#a40e26","symbolIcon.nullForeground":"#0550ae","symbolIcon.numberForeground":"#116329","symbolIcon.objectForeground":"#953800","symbolIcon.operatorForeground":"#0a3069","symbolIcon.packageForeground":"#953800","symbolIcon.propertyForeground":"#953800","symbolIcon.referenceForeground":"#0550ae","symbolIcon.snippetForeground":"#0550ae","symbolIcon.stringForeground":"#0a3069","symbolIcon.structForeground":"#953800","symbolIcon.textForeground":"#0a3069","symbolIcon.typeParameterForeground":"#0a3069","symbolIcon.unitForeground":"#0550ae","symbolIcon.variableForeground":"#953800","tab.activeBackground":"#ffffff","tab.activeBorder":"#ffffff","tab.activeBorderTop":"#fd8c73","tab.activeForeground":"#1f2328","tab.border":"#d0d7de","tab.hoverBackground":"#ffffff","tab.inactiveBackground":"#f6f8fa","tab.inactiveForeground":"#656d76","tab.unfocusedActiveBorder":"#ffffff","tab.unfocusedActiveBorderTop":"#d0d7de","tab.unfocusedHoverBackground":"#eaeef280","terminal.ansiBlack":"#24292f","terminal.ansiBlue":"#0969da","terminal.ansiBrightBlack":"#57606a","terminal.ansiBrightBlue":"#218bff","terminal.ansiBrightCyan":"#3192aa","terminal.ansiBrightGreen":"#1a7f37","terminal.ansiBrightMagenta":"#a475f9","terminal.ansiBrightRed":"#a40e26","terminal.ansiBrightWhite":"#8c959f","terminal.ansiBrightYellow":"#633c01","terminal.ansiCyan":"#1b7c83","terminal.ansiGreen":"#116329","terminal.ansiMagenta":"#8250df","terminal.ansiRed":"#cf222e","terminal.ansiWhite":"#6e7781","terminal.ansiYellow":"#4d2d00","terminal.foreground":"#1f2328","textBlockQuote.background":"#f6f8fa","textBlockQuote.border":"#d0d7de","textCodeBlock.background":"#afb8c133","textLink.activeForeground":"#0969da","textLink.foreground":"#0969da","textPreformat.background":"#afb8c133","textPreformat.foreground":"#656d76","textSeparator.foreground":"#d8dee4","titleBar.activeBackground":"#ffffff","titleBar.activeForeground":"#656d76","titleBar.border":"#d0d7de","titleBar.inactiveBackground":"#f6f8fa","titleBar.inactiveForeground":"#656d76","tree.indentGuidesStroke":"#d8dee4","welcomePage.buttonBackground":"#f6f8fa","welcomePage.buttonHoverBackground":"#f3f4f6"},"displayName":"GitHub Light Default","name":"github-light-default","semanticHighlighting":true,"tokenColors":[{"scope":["comment","punctuation.definition.comment","string.comment"],"settings":{"foreground":"#6e7781"}},{"scope":["constant.other.placeholder","constant.character"],"settings":{"foreground":"#cf222e"}},{"scope":["constant","entity.name.constant","variable.other.constant","variable.other.enummember","variable.language","entity"],"settings":{"foreground":"#0550ae"}},{"scope":["entity.name","meta.export.default","meta.definition.variable"],"settings":{"foreground":"#953800"}},{"scope":["variable.parameter.function","meta.jsx.children","meta.block","meta.tag.attributes","entity.name.constant","meta.object.member","meta.embedded.expression"],"settings":{"foreground":"#1f2328"}},{"scope":"entity.name.function","settings":{"foreground":"#8250df"}},{"scope":["entity.name.tag","support.class.component"],"settings":{"foreground":"#116329"}},{"scope":"keyword","settings":{"foreground":"#cf222e"}},{"scope":["storage","storage.type"],"settings":{"foreground":"#cf222e"}},{"scope":["storage.modifier.package","storage.modifier.import","storage.type.java"],"settings":{"foreground":"#1f2328"}},{"scope":["string","string punctuation.section.embedded source"],"settings":{"foreground":"#0a3069"}},{"scope":"support","settings":{"foreground":"#0550ae"}},{"scope":"meta.property-name","settings":{"foreground":"#0550ae"}},{"scope":"variable","settings":{"foreground":"#953800"}},{"scope":"variable.other","settings":{"foreground":"#1f2328"}},{"scope":"invalid.broken","settings":{"fontStyle":"italic","foreground":"#82071e"}},{"scope":"invalid.deprecated","settings":{"fontStyle":"italic","foreground":"#82071e"}},{"scope":"invalid.illegal","settings":{"fontStyle":"italic","foreground":"#82071e"}},{"scope":"invalid.unimplemented","settings":{"fontStyle":"italic","foreground":"#82071e"}},{"scope":"carriage-return","settings":{"background":"#cf222e","content":"^M","fontStyle":"italic underline","foreground":"#f6f8fa"}},{"scope":"message.error","settings":{"foreground":"#82071e"}},{"scope":"string variable","settings":{"foreground":"#0550ae"}},{"scope":["source.regexp","string.regexp"],"settings":{"foreground":"#0a3069"}},{"scope":["string.regexp.character-class","string.regexp constant.character.escape","string.regexp source.ruby.embedded","string.regexp string.regexp.arbitrary-repitition"],"settings":{"foreground":"#0a3069"}},{"scope":"string.regexp constant.character.escape","settings":{"fontStyle":"bold","foreground":"#116329"}},{"scope":"support.constant","settings":{"foreground":"#0550ae"}},{"scope":"support.variable","settings":{"foreground":"#0550ae"}},{"scope":"support.type.property-name.json","settings":{"foreground":"#116329"}},{"scope":"meta.module-reference","settings":{"foreground":"#0550ae"}},{"scope":"punctuation.definition.list.begin.markdown","settings":{"foreground":"#953800"}},{"scope":["markup.heading","markup.heading entity.name"],"settings":{"fontStyle":"bold","foreground":"#0550ae"}},{"scope":"markup.quote","settings":{"foreground":"#116329"}},{"scope":"markup.italic","settings":{"fontStyle":"italic","foreground":"#1f2328"}},{"scope":"markup.bold","settings":{"fontStyle":"bold","foreground":"#1f2328"}},{"scope":["markup.underline"],"settings":{"fontStyle":"underline"}},{"scope":["markup.strikethrough"],"settings":{"fontStyle":"strikethrough"}},{"scope":"markup.inline.raw","settings":{"foreground":"#0550ae"}},{"scope":["markup.deleted","meta.diff.header.from-file","punctuation.definition.deleted"],"settings":{"background":"#ffebe9","foreground":"#82071e"}},{"scope":["punctuation.section.embedded"],"settings":{"foreground":"#cf222e"}},{"scope":["markup.inserted","meta.diff.header.to-file","punctuation.definition.inserted"],"settings":{"background":"#dafbe1","foreground":"#116329"}},{"scope":["markup.changed","punctuation.definition.changed"],"settings":{"background":"#ffd8b5","foreground":"#953800"}},{"scope":["markup.ignored","markup.untracked"],"settings":{"background":"#0550ae","foreground":"#eaeef2"}},{"scope":"meta.diff.range","settings":{"fontStyle":"bold","foreground":"#8250df"}},{"scope":"meta.diff.header","settings":{"foreground":"#0550ae"}},{"scope":"meta.separator","settings":{"fontStyle":"bold","foreground":"#0550ae"}},{"scope":"meta.output","settings":{"foreground":"#0550ae"}},{"scope":["brackethighlighter.tag","brackethighlighter.curly","brackethighlighter.round","brackethighlighter.square","brackethighlighter.angle","brackethighlighter.quote"],"settings":{"foreground":"#57606a"}},{"scope":"brackethighlighter.unmatched","settings":{"foreground":"#82071e"}},{"scope":["constant.other.reference.link","string.other.link"],"settings":{"foreground":"#0a3069"}}],"type":"light"}`))})),Mf=n({default:()=>Nf}),Nf,Pf=t((()=>{Nf=Object.freeze(JSON.parse(`{"colors":{"activityBar.activeBorder":"#f78166","activityBar.background":"#0d1117","activityBar.border":"#30363d","activityBar.foreground":"#e6edf3","activityBar.inactiveForeground":"#7d8590","activityBarBadge.background":"#1f6feb","activityBarBadge.foreground":"#ffffff","badge.background":"#1f6feb","badge.foreground":"#ffffff","breadcrumb.activeSelectionForeground":"#7d8590","breadcrumb.focusForeground":"#e6edf3","breadcrumb.foreground":"#7d8590","breadcrumbPicker.background":"#161b22","button.background":"#238636","button.foreground":"#ffffff","button.hoverBackground":"#2ea043","button.secondaryBackground":"#282e33","button.secondaryForeground":"#c9d1d9","button.secondaryHoverBackground":"#30363d","checkbox.background":"#161b22","checkbox.border":"#30363d","debugConsole.errorForeground":"#ffa198","debugConsole.infoForeground":"#8b949e","debugConsole.sourceForeground":"#e3b341","debugConsole.warningForeground":"#d29922","debugConsoleInputIcon.foreground":"#bc8cff","debugIcon.breakpointForeground":"#f85149","debugTokenExpression.boolean":"#56d364","debugTokenExpression.error":"#ffa198","debugTokenExpression.name":"#79c0ff","debugTokenExpression.number":"#56d364","debugTokenExpression.string":"#a5d6ff","debugTokenExpression.value":"#a5d6ff","debugToolBar.background":"#161b22","descriptionForeground":"#7d8590","diffEditor.insertedLineBackground":"#23863626","diffEditor.insertedTextBackground":"#3fb9504d","diffEditor.removedLineBackground":"#da363326","diffEditor.removedTextBackground":"#ff7b724d","dropdown.background":"#161b22","dropdown.border":"#30363d","dropdown.foreground":"#e6edf3","dropdown.listBackground":"#161b22","editor.background":"#0d1117","editor.findMatchBackground":"#9e6a03","editor.findMatchHighlightBackground":"#f2cc6080","editor.focusedStackFrameHighlightBackground":"#2ea04366","editor.foldBackground":"#6e76811a","editor.foreground":"#e6edf3","editor.lineHighlightBackground":"#6e76811a","editor.linkedEditingBackground":"#2f81f712","editor.selectionHighlightBackground":"#3fb95040","editor.stackFrameHighlightBackground":"#bb800966","editor.wordHighlightBackground":"#6e768180","editor.wordHighlightBorder":"#6e768199","editor.wordHighlightStrongBackground":"#6e76814d","editor.wordHighlightStrongBorder":"#6e768199","editorBracketHighlight.foreground1":"#79c0ff","editorBracketHighlight.foreground2":"#56d364","editorBracketHighlight.foreground3":"#e3b341","editorBracketHighlight.foreground4":"#ffa198","editorBracketHighlight.foreground5":"#ff9bce","editorBracketHighlight.foreground6":"#d2a8ff","editorBracketHighlight.unexpectedBracket.foreground":"#7d8590","editorBracketMatch.background":"#3fb95040","editorBracketMatch.border":"#3fb95099","editorCursor.foreground":"#2f81f7","editorGroup.border":"#30363d","editorGroupHeader.tabsBackground":"#010409","editorGroupHeader.tabsBorder":"#30363d","editorGutter.addedBackground":"#2ea04366","editorGutter.deletedBackground":"#f8514966","editorGutter.modifiedBackground":"#bb800966","editorIndentGuide.activeBackground":"#e6edf33d","editorIndentGuide.background":"#e6edf31f","editorInlayHint.background":"#8b949e33","editorInlayHint.foreground":"#7d8590","editorInlayHint.paramBackground":"#8b949e33","editorInlayHint.paramForeground":"#7d8590","editorInlayHint.typeBackground":"#8b949e33","editorInlayHint.typeForeground":"#7d8590","editorLineNumber.activeForeground":"#e6edf3","editorLineNumber.foreground":"#6e7681","editorOverviewRuler.border":"#010409","editorWhitespace.foreground":"#484f58","editorWidget.background":"#161b22","errorForeground":"#f85149","focusBorder":"#1f6feb","foreground":"#e6edf3","gitDecoration.addedResourceForeground":"#3fb950","gitDecoration.conflictingResourceForeground":"#db6d28","gitDecoration.deletedResourceForeground":"#f85149","gitDecoration.ignoredResourceForeground":"#6e7681","gitDecoration.modifiedResourceForeground":"#d29922","gitDecoration.submoduleResourceForeground":"#7d8590","gitDecoration.untrackedResourceForeground":"#3fb950","icon.foreground":"#7d8590","input.background":"#0d1117","input.border":"#30363d","input.foreground":"#e6edf3","input.placeholderForeground":"#6e7681","keybindingLabel.foreground":"#e6edf3","list.activeSelectionBackground":"#6e768166","list.activeSelectionForeground":"#e6edf3","list.focusBackground":"#388bfd26","list.focusForeground":"#e6edf3","list.highlightForeground":"#2f81f7","list.hoverBackground":"#6e76811a","list.hoverForeground":"#e6edf3","list.inactiveFocusBackground":"#388bfd26","list.inactiveSelectionBackground":"#6e768166","list.inactiveSelectionForeground":"#e6edf3","minimapSlider.activeBackground":"#8b949e47","minimapSlider.background":"#8b949e33","minimapSlider.hoverBackground":"#8b949e3d","notificationCenterHeader.background":"#161b22","notificationCenterHeader.foreground":"#7d8590","notifications.background":"#161b22","notifications.border":"#30363d","notifications.foreground":"#e6edf3","notificationsErrorIcon.foreground":"#f85149","notificationsInfoIcon.foreground":"#2f81f7","notificationsWarningIcon.foreground":"#d29922","panel.background":"#010409","panel.border":"#30363d","panelInput.border":"#30363d","panelTitle.activeBorder":"#f78166","panelTitle.activeForeground":"#e6edf3","panelTitle.inactiveForeground":"#7d8590","peekViewEditor.background":"#6e76811a","peekViewEditor.matchHighlightBackground":"#bb800966","peekViewResult.background":"#0d1117","peekViewResult.matchHighlightBackground":"#bb800966","pickerGroup.border":"#30363d","pickerGroup.foreground":"#7d8590","progressBar.background":"#1f6feb","quickInput.background":"#161b22","quickInput.foreground":"#e6edf3","scrollbar.shadow":"#484f5833","scrollbarSlider.activeBackground":"#8b949e47","scrollbarSlider.background":"#8b949e33","scrollbarSlider.hoverBackground":"#8b949e3d","settings.headerForeground":"#e6edf3","settings.modifiedItemIndicator":"#bb800966","sideBar.background":"#010409","sideBar.border":"#30363d","sideBar.foreground":"#e6edf3","sideBarSectionHeader.background":"#010409","sideBarSectionHeader.border":"#30363d","sideBarSectionHeader.foreground":"#e6edf3","sideBarTitle.foreground":"#e6edf3","statusBar.background":"#0d1117","statusBar.border":"#30363d","statusBar.debuggingBackground":"#da3633","statusBar.debuggingForeground":"#ffffff","statusBar.focusBorder":"#1f6feb80","statusBar.foreground":"#7d8590","statusBar.noFolderBackground":"#0d1117","statusBarItem.activeBackground":"#e6edf31f","statusBarItem.focusBorder":"#1f6feb","statusBarItem.hoverBackground":"#e6edf314","statusBarItem.prominentBackground":"#6e768166","statusBarItem.remoteBackground":"#30363d","statusBarItem.remoteForeground":"#e6edf3","symbolIcon.arrayForeground":"#f0883e","symbolIcon.booleanForeground":"#58a6ff","symbolIcon.classForeground":"#f0883e","symbolIcon.colorForeground":"#79c0ff","symbolIcon.constantForeground":["#aff5b4","#7ee787","#56d364","#3fb950","#2ea043","#238636","#196c2e","#0f5323","#033a16","#04260f"],"symbolIcon.constructorForeground":"#d2a8ff","symbolIcon.enumeratorForeground":"#f0883e","symbolIcon.enumeratorMemberForeground":"#58a6ff","symbolIcon.eventForeground":"#6e7681","symbolIcon.fieldForeground":"#f0883e","symbolIcon.fileForeground":"#d29922","symbolIcon.folderForeground":"#d29922","symbolIcon.functionForeground":"#bc8cff","symbolIcon.interfaceForeground":"#f0883e","symbolIcon.keyForeground":"#58a6ff","symbolIcon.keywordForeground":"#ff7b72","symbolIcon.methodForeground":"#bc8cff","symbolIcon.moduleForeground":"#ff7b72","symbolIcon.namespaceForeground":"#ff7b72","symbolIcon.nullForeground":"#58a6ff","symbolIcon.numberForeground":"#3fb950","symbolIcon.objectForeground":"#f0883e","symbolIcon.operatorForeground":"#79c0ff","symbolIcon.packageForeground":"#f0883e","symbolIcon.propertyForeground":"#f0883e","symbolIcon.referenceForeground":"#58a6ff","symbolIcon.snippetForeground":"#58a6ff","symbolIcon.stringForeground":"#79c0ff","symbolIcon.structForeground":"#f0883e","symbolIcon.textForeground":"#79c0ff","symbolIcon.typeParameterForeground":"#79c0ff","symbolIcon.unitForeground":"#58a6ff","symbolIcon.variableForeground":"#f0883e","tab.activeBackground":"#0d1117","tab.activeBorder":"#0d1117","tab.activeBorderTop":"#f78166","tab.activeForeground":"#e6edf3","tab.border":"#30363d","tab.hoverBackground":"#0d1117","tab.inactiveBackground":"#010409","tab.inactiveForeground":"#7d8590","tab.unfocusedActiveBorder":"#0d1117","tab.unfocusedActiveBorderTop":"#30363d","tab.unfocusedHoverBackground":"#6e76811a","terminal.ansiBlack":"#484f58","terminal.ansiBlue":"#58a6ff","terminal.ansiBrightBlack":"#6e7681","terminal.ansiBrightBlue":"#79c0ff","terminal.ansiBrightCyan":"#56d4dd","terminal.ansiBrightGreen":"#56d364","terminal.ansiBrightMagenta":"#d2a8ff","terminal.ansiBrightRed":"#ffa198","terminal.ansiBrightWhite":"#ffffff","terminal.ansiBrightYellow":"#e3b341","terminal.ansiCyan":"#39c5cf","terminal.ansiGreen":"#3fb950","terminal.ansiMagenta":"#bc8cff","terminal.ansiRed":"#ff7b72","terminal.ansiWhite":"#b1bac4","terminal.ansiYellow":"#d29922","terminal.foreground":"#e6edf3","textBlockQuote.background":"#010409","textBlockQuote.border":"#30363d","textCodeBlock.background":"#6e768166","textLink.activeForeground":"#2f81f7","textLink.foreground":"#2f81f7","textPreformat.background":"#6e768166","textPreformat.foreground":"#7d8590","textSeparator.foreground":"#21262d","titleBar.activeBackground":"#0d1117","titleBar.activeForeground":"#7d8590","titleBar.border":"#30363d","titleBar.inactiveBackground":"#010409","titleBar.inactiveForeground":"#7d8590","tree.indentGuidesStroke":"#21262d","welcomePage.buttonBackground":"#21262d","welcomePage.buttonHoverBackground":"#30363d"},"displayName":"GitHub Dark Default","name":"github-dark-default","semanticHighlighting":true,"tokenColors":[{"scope":["comment","punctuation.definition.comment","string.comment"],"settings":{"foreground":"#8b949e"}},{"scope":["constant.other.placeholder","constant.character"],"settings":{"foreground":"#ff7b72"}},{"scope":["constant","entity.name.constant","variable.other.constant","variable.other.enummember","variable.language","entity"],"settings":{"foreground":"#79c0ff"}},{"scope":["entity.name","meta.export.default","meta.definition.variable"],"settings":{"foreground":"#ffa657"}},{"scope":["variable.parameter.function","meta.jsx.children","meta.block","meta.tag.attributes","entity.name.constant","meta.object.member","meta.embedded.expression"],"settings":{"foreground":"#e6edf3"}},{"scope":"entity.name.function","settings":{"foreground":"#d2a8ff"}},{"scope":["entity.name.tag","support.class.component"],"settings":{"foreground":"#7ee787"}},{"scope":"keyword","settings":{"foreground":"#ff7b72"}},{"scope":["storage","storage.type"],"settings":{"foreground":"#ff7b72"}},{"scope":["storage.modifier.package","storage.modifier.import","storage.type.java"],"settings":{"foreground":"#e6edf3"}},{"scope":["string","string punctuation.section.embedded source"],"settings":{"foreground":"#a5d6ff"}},{"scope":"support","settings":{"foreground":"#79c0ff"}},{"scope":"meta.property-name","settings":{"foreground":"#79c0ff"}},{"scope":"variable","settings":{"foreground":"#ffa657"}},{"scope":"variable.other","settings":{"foreground":"#e6edf3"}},{"scope":"invalid.broken","settings":{"fontStyle":"italic","foreground":"#ffa198"}},{"scope":"invalid.deprecated","settings":{"fontStyle":"italic","foreground":"#ffa198"}},{"scope":"invalid.illegal","settings":{"fontStyle":"italic","foreground":"#ffa198"}},{"scope":"invalid.unimplemented","settings":{"fontStyle":"italic","foreground":"#ffa198"}},{"scope":"carriage-return","settings":{"background":"#ff7b72","content":"^M","fontStyle":"italic underline","foreground":"#f0f6fc"}},{"scope":"message.error","settings":{"foreground":"#ffa198"}},{"scope":"string variable","settings":{"foreground":"#79c0ff"}},{"scope":["source.regexp","string.regexp"],"settings":{"foreground":"#a5d6ff"}},{"scope":["string.regexp.character-class","string.regexp constant.character.escape","string.regexp source.ruby.embedded","string.regexp string.regexp.arbitrary-repitition"],"settings":{"foreground":"#a5d6ff"}},{"scope":"string.regexp constant.character.escape","settings":{"fontStyle":"bold","foreground":"#7ee787"}},{"scope":"support.constant","settings":{"foreground":"#79c0ff"}},{"scope":"support.variable","settings":{"foreground":"#79c0ff"}},{"scope":"support.type.property-name.json","settings":{"foreground":"#7ee787"}},{"scope":"meta.module-reference","settings":{"foreground":"#79c0ff"}},{"scope":"punctuation.definition.list.begin.markdown","settings":{"foreground":"#ffa657"}},{"scope":["markup.heading","markup.heading entity.name"],"settings":{"fontStyle":"bold","foreground":"#79c0ff"}},{"scope":"markup.quote","settings":{"foreground":"#7ee787"}},{"scope":"markup.italic","settings":{"fontStyle":"italic","foreground":"#e6edf3"}},{"scope":"markup.bold","settings":{"fontStyle":"bold","foreground":"#e6edf3"}},{"scope":["markup.underline"],"settings":{"fontStyle":"underline"}},{"scope":["markup.strikethrough"],"settings":{"fontStyle":"strikethrough"}},{"scope":"markup.inline.raw","settings":{"foreground":"#79c0ff"}},{"scope":["markup.deleted","meta.diff.header.from-file","punctuation.definition.deleted"],"settings":{"background":"#490202","foreground":"#ffa198"}},{"scope":["punctuation.section.embedded"],"settings":{"foreground":"#ff7b72"}},{"scope":["markup.inserted","meta.diff.header.to-file","punctuation.definition.inserted"],"settings":{"background":"#04260f","foreground":"#7ee787"}},{"scope":["markup.changed","punctuation.definition.changed"],"settings":{"background":"#5a1e02","foreground":"#ffa657"}},{"scope":["markup.ignored","markup.untracked"],"settings":{"background":"#79c0ff","foreground":"#161b22"}},{"scope":"meta.diff.range","settings":{"fontStyle":"bold","foreground":"#d2a8ff"}},{"scope":"meta.diff.header","settings":{"foreground":"#79c0ff"}},{"scope":"meta.separator","settings":{"fontStyle":"bold","foreground":"#79c0ff"}},{"scope":"meta.output","settings":{"foreground":"#79c0ff"}},{"scope":["brackethighlighter.tag","brackethighlighter.curly","brackethighlighter.round","brackethighlighter.square","brackethighlighter.angle","brackethighlighter.quote"],"settings":{"foreground":"#8b949e"}},{"scope":"brackethighlighter.unmatched","settings":{"foreground":"#ffa198"}},{"scope":["constant.other.reference.link","string.other.link"],"settings":{"foreground":"#a5d6ff"}}],"type":"dark"}`))}));Oc();function Ff(e){return{...e,load:async()=>as((await e.load()).default)}}var If=[Ff({name:`github-light-default`,colorScheme:`light`,collection:`github`,displayName:`GitHub Light Default`,load:()=>Promise.resolve().then(()=>(jf(),kf))}),Ff({name:`github-dark-default`,colorScheme:`dark`,collection:`github`,displayName:`GitHub Dark Default`,load:()=>Promise.resolve().then(()=>(Pf(),Mf))})],Lf={getTheme:e=>If.find(t=>t.name===e),getThemes:()=>If},Rf={getTheme:()=>void 0,getThemes:()=>[]};function zf(e){if(ua())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(Df.hasRegisteredTheme(e))return;let t=Rf.getTheme(e);if(t!=null){Df.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function Bf(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function Vf(e){zf(e);let t=await Df.resolveTheme(e);return Bf(e,t),t}function Hf(e){return Df.getResolvedTheme(e)??Vf(e)}vf();var Uf;async function Wf({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){Uf??=pc({themes:[],langs:[`text`],engine:n===`shiki-wasm`?gf(Promise.resolve().then(()=>(vf(),hf))):sf()});let r=Kf(Uf)?await Uf:Uf;Uf=r;let i=[];for(let e of t){if(e===`text`||e===`ansi`)continue;let t=bf(e);`then`in t?i.push(t):la(t,r)}let a=[];for(let t of e){let e=Hf(t);`then`in e?a.push(e):Of(e,Uf)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{la(e,r)}),Promise.all(a).then(e=>{Of(e,r)})]),r}function Gf(){if(Uf!=null&&!(`then`in Uf))return Uf}function Kf(e=Uf){return e!=null&&`then`in e}for(let e of Lf.getThemes())Df.registerThemeIfAbsent(e.name,e.load);function qf(e=k){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}function Jf(e){for(let t of qf(e))if(!xf.has(t))return!1;return!0}function Yf(e){return Df.hasResolvedThemes(e)}function Xf(e,t){return me(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function Zf(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 Qf(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 $f(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 ep({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return N({tagName:`div`,children:[t===`custom`?N({tagName:`slot`,properties:{name:te}}):tp({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[np(r)]],properties:i})}function tp({name:e,prevName:t,iconType:n}){let r=[N({tagName:`slot`,properties:{name:ee}}),At({name:$f(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(N({tagName:`div`,children:[N({tagName:`bdi`,children:[kt(t)]})],properties:{"data-prev-name":``}})),r.push(At({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(N({tagName:`div`,children:[N({tagName:`bdi`,children:[kt(e)]})],properties:{"data-title":``}})),r.push(N({tagName:`slot`,properties:{name:D}})),N({tagName:`div`,children:r,properties:{"data-header-content":``}})}function np(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:[kt(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(N({tagName:`span`,children:[kt(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(N({tagName:`slot`,properties:{name:O}})),N({tagName:`div`,children:t,properties:{"data-metadata":``}})}function rp(e){return N({tagName:`pre`,properties:ip(e)})}function ip({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}var ap=new Map,op={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function Q(e){if(ap.has(e))return ap.get(e)??`text`;if(op[e]!=null)return op[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(ap.has(t[1]))return ap.get(t[1])??`text`;if(op[t[1]]!=null)return op[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return ap.has(n)?ap.get(n)??`text`:op[n]??`text`}function sp(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:qf(t),preferredHighlighter:n}}function cp(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function lp(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(kt(` +`)),e}var up=Symbol(`no-token`),dp=Symbol(`multiple-tokens`);function fp(e){let t=pp(e);if(t!=null)return t;let n=up,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`){hp(e,a);for(let t of e.children)mp(t)}else mp(e);r.push(e),i=[],a=void 0;return}for(let e of i)mp(e);r.push(N({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==up){if(e===dp){n=dp;return}if(n===up){n=e;return}n!==e&&(n=dp)}};for(let t of e.children){let e=t.type===`element`?fp(t):up;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 pp(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function mp(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)mp(t)}}function hp(e,t){e.properties[`data-char`]=t}function gp(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=typeof e==`string`?e:a(e),s=t+_p(o)+n;return s=r(s),i.has(s)||i.set(s,typeof e==`string`?e:{...e}),s}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function _p(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}function vp(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=jt(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&fp(a),i.push(lp(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(bp,yp),e&&r.push({line:e=>(e.type===`element`&&e.children.length===0&&e.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),e)}),{state:n,transformers:r,toClass:yp}}var yp=gp({classPrefix:`hl-`}),bp={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 $(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var xp=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,Sp=/^0(?:\.0+)?%?$/;function Cp(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function wp(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let n=t[1],r,i=1;return n.length===3?r=n.split(``).map(e=>e+e).join(``):n.length===6?r=n:(r=n.slice(0,6),i=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),i]}function Tp(e){if(e==null)return null;let t=wp(e);if(t==null)return null;let n=t[0]/255,r=t[1]/255,i=t[2]/255,a=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*a(n)+.7152*a(r)+.0722*a(i)}function Ep(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||xp.test(t))return!0;let n=Cp(t);return n!=null&&Sp.test(n)}function Dp(e,t,n){if(t==null||n==null)return!1;let r=Tp(e),i=Tp(t),a=Tp(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var Op=new WeakMap;function kp(e){let t=Op.get(e);if(t!=null)return t;let n=e.colors??{},r={...n},i=n[`editor.background`]??e.bg,a=n[`editor.foreground`]??e.fg,o=n[`sideBar.background`]??i,s=n[`sideBar.foreground`]??a;Ap(r,`editor.background`,i),Ap(r,`editor.foreground`,a),Ap(r,`sideBar.background`,o),Ap(r,`sideBar.foreground`,s),Ap(r,`input.background`,n[`input.background`]??o),Ap(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),Ap(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),Ap(r,`gitDecoration.addedResourceForeground`,jp(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),Ap(r,`gitDecoration.modifiedResourceForeground`,jp(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),Ap(r,`gitDecoration.deletedResourceForeground`,jp(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(Ep(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(Ep(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(Mp(l,o)||Dp(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return Op.set(e,u),u}function Ap(e,t,n){n!=null&&n!==``&&(e[t]=n)}function jp(...e){for(let t of e)if(t!=null&&t!==``)return t}function Mp(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function Np({theme:e=k,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=kp(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${$(`global`)}fg:${a.fg};`,r+=`${$(`global`)}bg:${a.bg};`,r+=Pp(i,n)}else{let n=t.getTheme(e.dark),i=kp(n);r+=`${$(`global`)}dark:${i.fg};`,r+=`${$(`global`)}dark-bg:${i.bg};`,r+=Pp(n,`dark`),n=t.getTheme(e.light),i=kp(n),r+=`${$(`global`)}light:${i.fg};`,r+=`${$(`global`)}light-bg:${i.bg};`,r+=Pp(n,`light`)}return r}function Pp(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${$(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${$(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${$(`global`)}${t}modified-color:${a};`),n}function Fp(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}var Ip=10,Lp=13,Rp=4,zp=40;function Bp(e){let t=[0],n=e.indexOf(`\r`),r=e.indexOf(` +`),i=0,a=0;for(;n!==-1||r!==-1;){let o;if(n!==-1&&(r===-1||n<r)?r===n+1?(o=r+1,n=e.indexOf(`\r`,o),r=e.indexOf(` +`,o)):(o=n+1,n=e.indexOf(`\r`,o)):(o=r+1,r=e.indexOf(` +`,o)),t.push(o),++a===Rp){if(o-i<=zp){for(let n=o;n<e.length;n++){let r=e.charCodeAt(n);(r===Ip||r===Lp)&&(r===Lp&&n+1<e.length&&e.charCodeAt(n+1)===Ip&&n++,t.push(n+1))}return t}i=o,a=0}}return t}function Vp(e){let t=Bp(e);return Array.from({length:t.length},(n,r)=>{let i=t[r],a=t[r+1]??e.length;return e.slice(i,a)})}var Hp={forcePlainText:!1};function Up(e,t,{theme:n=k,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,startingLine:o,totalLines:s,lines:c}=Hp){a?(o??=0,s??=1/0):(o=0,s=1/0);let l=o>0||s<1/0,{state:u,transformers:d}=vp(i),f=a?`text`:e.lang??Q(e.name),p=typeof n==`string`?t.getTheme(n).type:void 0,m=Np({theme:n,highlighter:t});u.lineInfo=e=>({type:`context`,lineIndex:e-1+o,lineNumber:e+o});let h=typeof n==`string`?{lang:f,theme:n,transformers:d,defaultColor:!1,cssVariablePrefix:$(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:d,defaultColor:!1,cssVariablePrefix:$(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},g=Fp(t.codeToHast(l?Wp(c??Vp(e.contents),o,s):e.contents,h)),_=l?Array(o):g;return l&&_.push(...g),{code:_,themeStyles:m,baseThemeType:p}}function Wp(e,t,n){if(e.length===0)return``;let r=Math.min(t+n,e.length);return e.slice(t,r).join(``)}function Gp(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function Kp(e){return e.startingLine===0&&e.totalLines>0}function qp(e,t){return e.endsWith(`\r +`)?t+`\r +`:e.endsWith(`\r`)?t+`\r`:e.endsWith(` +`)?t+` +`:t}function Jp(e,t){return N({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}function Yp(e){return(e.lang??Q(e.name))===`text`}ki();function Xp(e,t){return t.cacheKey==null?e.file===t&&e.sourceContents===t.contents:e.cacheKey===t.cacheKey}var Zp=-1,Qp=class{options;onRenderUpdate;workerManager;__id=`file-renderer:${++Zp}`;highlighter;renderCache;computedLang=`text`;lineAnnotations={};lineCache;pendingStructuralRows;textDocumentCache=new WeakMap;editSessionActive=!1;constructor(e={theme:k},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Jf(e.theme??k)?Gf():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}beginEditSession(){this.editSessionActive=!0}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0,this.endEditSession(),this.textDocumentCache=new WeakMap}syncEditedContentsToFile(){let{renderCache:e,lineCache:t}=this;e?.isDirty!==!0||t==null||!Xp(t,e.file)||(e.file.contents=t.lines.join(``))}hasUnkeyedFileContentsChanged(e){let{lineCache:t}=this;return e.cacheKey==null&&t!=null&&t.file===e&&t.sourceContents!==e.contents}invalidateChangedUnkeyedFile(e){this.hasUnkeyedFileContentsChanged(e)&&(this.workerManager?.cleanUpTasks(this),this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap)}clearRenderCache(){this.syncEditedContentsToFile(),this.pendingStructuralRows=void 0;let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.file.cacheKey!=null&&this.workerManager?.evictFileFromCache(e.file.cacheKey)}hydrate(e){let{options:t}=this.getRenderOptions(e),n=$p(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength()),r=this.workerManager?.getFileResultCache(e);r!=null&&!Xf(t,r.options)&&(r=void 0),this.renderCache??={file:e,options:t,highlighted:!n&&!Yp(e),result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter??(this.computedLang=e.lang??Q(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getFileRenderOptions().theme??this.options.theme??k}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getFileRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getFileRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{tokenizeMaxLineLength:e=1e3}=this.options;return{theme:this.getLocalHighlightTheme(),useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:e}})(),{renderCache:n}=this;return n?.result==null||!Ot(e,n.file)||!Xf(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getOrCreateLineCache(e){this.invalidateChangedUnkeyedFile(e);let{lineCache:t}=this;return(t==null||!Xp(t,e))&&(t={cacheKey:e.cacheKey,file:e,sourceContents:e.contents,lines:Vp(e.contents)}),this.lineCache=t,t.lines}getLineCount(e){let t=this.getOrCreateLineCache(e);return this.textDocumentCache.get(e)?.lineCount??t.length}updateRenderCache(e,t,n=!1){if(this.pendingStructuralRows=void 0,this.renderCache==null)return;let{file:r,result:i}=this.renderCache;if(i==null)return;let a=n?new Map:void 0;this.pendingStructuralRows=a;let o=this.lineCache!=null&&Xp(this.lineCache,r)?this.lineCache:void 0;for(let[t,n]of e){if(a===void 0&&o!=null&&t<o.lines.length){let e=n.map(e=>e[2]).join(``);o.lines[t]=qp(o.lines[t]??``,e)}let e={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})};a===void 0?i.code[t]=e:a.set(t,e)}i.baseThemeType=t,this.renderCache.isDirty=!0}applyDocumentChange(e){let t=this.pendingStructuralRows;if(this.pendingStructuralRows=void 0,this.renderCache==null)return;let{file:n,result:r}=this.renderCache;if(r==null)return;let i=this.lineCache!=null&&Xp(this.lineCache,n)?this.lineCache.lines:Vp(n.contents),a=Vp(e.getText());if(i.length!==a.length){let n=Math.min(i.length,a.length),o=0;for(;o<n&&i[o]===a[o];)o++;let s=0;for(;s<n-o&&i[i.length-1-s]===a[a.length-1-s];)s++;let c=r.code;r.code=Array(a.length);for(let e=0;e<o;e++)r.code[e]=c[e];for(let e=0;e<s;e++)r.code[a.length-1-e]=c[i.length-1-e];if(t!==void 0)for(let[e,n]of t)e<a.length&&(r.code[e]=n);for(let t=o;t<a.length-s;t++)r.code[t]??={type:`element`,tagName:`div`,properties:{"data-line":t+1,"data-line-type":`context`,"data-line-index":t},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:e.getLineText(t)}]}]};for(let e=0;e<r.code.length;e++){let t=r.code[e];t?.type===`element`&&(t.properties[`data-line`]=e+1,t.properties[`data-line-index`]=e)}this.renderCache.isDirty=!0}this.lineCache={cacheKey:n.cacheKey,file:n,sourceContents:n.contents,lines:a},this.textDocumentCache.set(n,e)}renderFile(e=this.renderCache?.file,t=se){if(e==null)return;this.invalidateChangedUnkeyedFile(e),this.renderCache?.isDirty===!0&&!Ot(e,this.renderCache.file)&&(this.clearRenderCache(),this.lineCache=void 0,this.textDocumentCache=new WeakMap);let{options:n,forceHighlight:r}=this.getRenderOptions(e);this.renderCache?.isDirty===!0&&!Xf(n,this.renderCache.options)&&this.clearRenderCache();let i=this.getMatchingWorkerResultCache(e,n);i!=null&&!this.hasHighlightedRenderCache(e,n)&&(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...i},r=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};let a=this.getOrCreateLineCache(e),o=e.contents.length>0,s=!o||Yp(e)||$p(a.length,this.getTokenizeMaxLength()),c=!Ot(e,this.renderCache.file),l=!Zf(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0)(s||this.renderCache.result==null||!this.renderCache.highlighted&&(c||l))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||c||l||r)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,a)),this.renderCache.renderRange=t),!s&&o&&(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??Q(e.name);let t=this.highlighter!=null&&Jf(n.theme),i=this.highlighter!=null&&ca(this.computedLang),a=!s&&i;if(this.highlighter!=null&&t&&(r||s||!this.renderCache.highlighted&&a||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,s||!i);this.renderCache={file:e,options:n,highlighted:a,result:t,renderRange:void 0}}(!t||!s&&!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.applyHighlightResult(e,t,n,!s)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,t,this.renderCache.result)}async asyncRender(e,t=se){let{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){let t=$p(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Q(e.name);let n=this.highlighter!=null&&Yf(qf(this.getLocalHighlightTheme())),r=t||this.highlighter!=null&&ca(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:Up(e,t,r,{forcePlainText:n}),options:r}}processFileResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let a=this.getLineCount(e),{disableFileHeader:o=!1}=this.options,s=[],c=Mt(),l=Math.min(t.startingLine+t.totalLines,a),u=0,d=Kp(t)?Gp(this.lineAnnotations):void 0;d!=null&&(c.children.push(P(`context`,`annotation`,1)),s.push(Qf({type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:d.map(e=>cp(e))})),u++);for(let r=t.startingLine;r<l;r++){let t=r+1,i=n[r];if(i==null){let n=`FileRenderer.processFileResult: Line doesnt exist`;throw console.error(n,{name:e.name,lineIndex:r,lineNumber:t}),Error(n)}c.children.push(Nt(`context`,t,`${r}`)),s.push(i),u++;let a=this.lineAnnotations[t];a!=null&&(c.children.push(P(`context`,`annotation`,1)),s.push(Qf({type:`annotation`,hunkIndex:0,lineIndex:t,annotations:a.map(e=>cp(e))})),u++)}return c.properties.style=`grid-row: span ${u}`,{gutterAST:c.children??[],contentAST:s,preAST:this.createPreElement(a),headerAST:o?void 0:this.renderHeader(e),totalLines:a,rowCount:u,themeStyles:r,baseThemeType:i,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderHeader(e){let{headerRenderMode:t=`default`,stickyHeader:n=!1}=this.options;return ep({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return H(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(N({tagName:`code`,children:this.renderCodeAST(e),properties:{"data-code":``}})),{...e.preAST,children:t}}renderCodeAST(e){let t=Mt();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,Jp(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return H(t?N({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await Wf(sp(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){if(this.renderCache==null)return;let i=!Ot(e,this.renderCache.file)||!this.renderCache.highlighted||!Xf(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getFileResultCache(e);if(!(n==null||!Xf(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Ot(e,n.file)&&Xf(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){let{disableLineNumbers:t=!1,overflow:n=`scroll`}=this.options;return rp({type:`file`,diffIndicators:`none`,disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function $p(e,t){return e>t}var em=`<svg data-icon-sprite aria-hidden="true" width="0" height="0"> + <symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16"> + <path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/> + </symbol> + <symbol id="diffs-icon-brand-github" viewBox="0 0 16 16"> + <path d="M8 0c4.42 0 8 3.58 8 8a8.01 8.01 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27s-1.36.09-2 .27c-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8"/> + </symbol> + <symbol id="diffs-icon-chevron" viewBox="0 0 16 16"> + <path d="M1.47 4.47a.75.75 0 0 1 1.06 0L8 9.94l5.47-5.47a.75.75 0 1 1 1.06 1.06l-6 6a.75.75 0 0 1-1.06 0l-6-6a.75.75 0 0 1 0-1.06"/> + </symbol> + <symbol id="diffs-icon-chevrons-narrow" viewBox="0 0 10 16"> + <path d="M4.47 2.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1-1.06 1.06L5 3.81 2.28 6.53a.75.75 0 0 1-1.06-1.06zM1.22 9.47a.75.75 0 0 1 1.06 0L5 12.19l2.72-2.72a.75.75 0 0 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 0 1 0-1.06"/> + </symbol> + <symbol id="diffs-icon-diff-split" viewBox="0 0 16 16"> + <path d="M14 0H8.5v16H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2m-1.5 6.5v1h1a.5.5 0 0 1 0 1h-1v1a.5.5 0 0 1-1 0v-1h-1a.5.5 0 0 1 0-1h1v-1a.5.5 0 0 1 1 0"/><path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h5.5V0zm.5 7.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1" opacity=".3"/> + </symbol> + <symbol id="diffs-icon-diff-unified" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8.5h16zm-8-4a.5.5 0 0 0-.5.5v1h-1a.5.5 0 0 0 0 1h1v1a.5.5 0 0 0 1 0v-1h1a.5.5 0 0 0 0-1h-1v-1A.5.5 0 0 0 8 10" clip-rule="evenodd"/><path fill-rule="evenodd" d="M14 0a2 2 0 0 1 2 2v5.5H0V2a2 2 0 0 1 2-2zM6.5 3.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1z" clip-rule="evenodd" opacity=".4"/> + </symbol> + <symbol id="diffs-icon-expand" viewBox="0 0 16 16"> + <path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06"/> + </symbol> + <symbol id="diffs-icon-expand-all" viewBox="0 0 16 16"> + <path d="M11.47 9.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06L8 12.94zM7.526 1.418a.75.75 0 0 1 1.004.052l4 4a.75.75 0 1 1-1.06 1.06L8 3.06 4.53 6.53a.75.75 0 1 1-1.06-1.06l4-4z"/> + </symbol> + <symbol id="diffs-icon-file-code" viewBox="0 0 16 16"> + <path d="M10.75 0c.199 0 .39.08.53.22l3.5 3.5c.14.14.22.331.22.53v9A2.75 2.75 0 0 1 12.25 16h-8.5A2.75 2.75 0 0 1 1 13.25V2.75A2.75 2.75 0 0 1 3.75 0zm-7 1.5c-.69 0-1.25.56-1.25 1.25v10.5c0 .69.56 1.25 1.25 1.25h8.5c.69 0 1.25-.56 1.25-1.25V5h-1.25A2.25 2.25 0 0 1 10 2.75V1.5z"/><path d="M7.248 6.19a.75.75 0 0 1 .063 1.058L5.753 9l1.558 1.752a.75.75 0 0 1-1.122.996l-2-2.25a.75.75 0 0 1 0-.996l2-2.25a.75.75 0 0 1 1.06-.063M8.69 7.248a.75.75 0 1 1 1.12-.996l2 2.25a.75.75 0 0 1 0 .996l-2 2.25a.75.75 0 1 1-1.12-.996L10.245 9z"/> + </symbol> + <symbol id="diffs-icon-plus" viewBox="0 0 16 16"> + <path d="M8 3a.75.75 0 0 1 .75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5A.75.75 0 0 1 8 3"/> + </symbol> + <symbol id="diffs-icon-symbol-added" viewBox="0 0 16 16"> + <path d="M8 4a.75.75 0 0 1 .75.75v2.5h2.5a.75.75 0 0 1 0 1.5h-2.5v2.5a.75.75 0 0 1-1.5 0v-2.5h-2.5a.75.75 0 0 1 0-1.5h2.5v-2.5A.75.75 0 0 1 8 4"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/> + </symbol> + <symbol id="diffs-icon-symbol-deleted" viewBox="0 0 16 16"> + <path d="M4 8a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5A.75.75 0 0 1 4 8"/><path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/> + </symbol> + <symbol id="diffs-icon-symbol-diffstat" viewBox="0 0 16 16"> + <path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.75 4.296a.75.75 0 0 0-1.5 0V6.25h-2a.75.75 0 0 0 0 1.5h2v1.5h1.5v-1.5h2a.75.75 0 0 0 0-1.5h-2zM5.25 10a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 0-1.5z"/> + </symbol> + <symbol id="diffs-icon-symbol-ignored" viewBox="0 0 16 16"> + <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m11.53-2.47a.75.75 0 0 0-1.06-1.06l-6 6a.75.75 0 1 0 1.06 1.06z"/> + </symbol> + <symbol id="diffs-icon-symbol-modified" viewBox="0 0 16 16"> + <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706s.826.607 1.706.802c.898.2 2.091.288 3.704.288s2.806-.088 3.704-.288c.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5s-2.806.088-3.704.288c-.88.196-1.381.478-1.706.802s-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8M0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m8 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6"/> + </symbol> + <symbol id="diffs-icon-symbol-moved" viewBox="0 0 16 16"> + <path d="M1.788 4.296c.196-.88.478-1.381.802-1.706s.826-.606 1.706-.802C5.194 1.588 6.387 1.5 8 1.5s2.806.088 3.704.288c.88.196 1.381.478 1.706.802s.607.826.802 1.706c.2.898.288 2.091.288 3.704s-.088 2.806-.288 3.704c-.195.88-.478 1.381-.802 1.706s-.826.607-1.706.802c-.898.2-2.091.288-3.704.288s-2.806-.088-3.704-.288c-.88-.195-1.381-.478-1.706-.802s-.606-.826-.802-1.706C1.588 10.806 1.5 9.613 1.5 8s.088-2.806.288-3.704M8 0C1.412 0 0 1.412 0 8s1.412 8 8 8 8-1.412 8-8-1.412-8-8-8"/><path d="M8.495 4.695a.75.75 0 0 0-.05 1.06L10.486 8l-2.041 2.246a.75.75 0 0 0 1.11 1.008l2.5-2.75a.75.75 0 0 0 0-1.008l-2.5-2.75a.75.75 0 0 0-1.06-.051m-4 0a.75.75 0 0 0-.05 1.06l2.044 2.248-1.796 1.995a.75.75 0 0 0 1.114 1.004l2.25-2.5a.75.75 0 0 0-.002-1.007l-2.5-2.75a.75.75 0 0 0-1.06-.05"/> + </symbol> + <symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16"> + <path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706.286.286.71.54 1.41.73V1.86c-.7.19-1.124.444-1.41.73-.324.325-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8m4 6.397c.697.07 1.522.103 2.5.103 1.613 0 2.806-.088 3.704-.288.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5c-.978 0-1.803.033-2.5.103zM0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m7-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"/> + </symbol> +</svg>`;function tm(e,t){return e.lineNumber===t.lineNumber&&e.metadata===t.metadata}function nm(e,t){return e==null||t==null?e===t:im(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 rm={};function im(e=rm,t=rm){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 am(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function om(){let e=document.createElement(`div`);return e.slot=`gutter-utility-slot`,e.style.position=`absolute`,e.style.top=`0`,e.style.bottom=`0`,e.style.textAlign=`center`,e.style.whiteSpace=`normal`,e.style.touchAction=`none`,e}function sm(){let e=document.createElement(`style`);return e.setAttribute(re,``),e}var cm=`@layer base { + :host { + --diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", + "Courier New", monospace; + --diffs-header-font-fallback: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", + "Noto Sans", "Liberation Sans", Arial, sans-serif; + --diffs-mixer: light-dark(#000, #fff); + --diffs-gap-fallback: 8px; + --diffs-scrollbar-gutter-fallback: 6px; + --diffs-scrollbar-gutter: var(--diffs-scrollbar-gutter-override, var(--diffs-scrollbar-gutter-measured, var(--diffs-scrollbar-gutter-fallback))); + --diffs-added-light: #0dbe4e; + --diffs-added-dark: #5ecc71; + --diffs-modified-light: #009fff; + --diffs-modified-dark: #69b1ff; + --diffs-deleted-light: #ff2e3f; + --diffs-deleted-dark: #ff6762; + --diffs-warning-light: #d5a910; + --diffs-warning-dark: #ffd452; + color-scheme: light dark; + font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback)); + font-size: var(--diffs-font-size, 13px); + line-height: var(--diffs-line-height, 20px); + font-feature-settings: var(--diffs-font-features); + --diffs-bg: light-dark(var(--diffs-light-bg, #fff), var(--diffs-dark-bg, #000)); + --diffs-bg-buffer: var(--diffs-bg-buffer-override, light-dark(color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)))); + --diffs-bg-context: var(--diffs-bg-context-override, light-dark(color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer)))); + --diffs-bg-context-gutter: var(--diffs-bg-context-gutter-override, light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)), color-mix(in lab, var(--diffs-bg-context) 45%, var(--diffs-bg)))); + --diffs-bg-separator: var(--diffs-bg-separator-override, light-dark(color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer)))); + --diffs-fg: light-dark(var(--diffs-light, #000), var(--diffs-dark, #fff)); + --diffs-fg-number: var(--diffs-fg-number-override, light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)))); + --diffs-fg-conflict-marker: var(--diffs-fg-conflict-marker-override, var(--diffs-fg-number)); + --diffs-deletion-base: var(--diffs-deletion-color-override, light-dark(var(--diffs-light-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-light))), var(--diffs-dark-deletion-color, var(--diffs-deletion-color, var(--diffs-deleted-dark))))); + --diffs-addition-base: var(--diffs-addition-color-override, light-dark(var(--diffs-light-addition-color, var(--diffs-addition-color, var(--diffs-added-light))), var(--diffs-dark-addition-color, var(--diffs-addition-color, var(--diffs-added-dark))))); + --diffs-modified-base: var(--diffs-modified-color-override, light-dark(var(--diffs-light-modified-color, var(--diffs-modified-color, var(--diffs-modified-light))), var(--diffs-dark-modified-color, var(--diffs-modified-color, var(--diffs-modified-dark))))); + --diffs-bg-deletion: var(--diffs-bg-deletion-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base)))); + --diffs-bg-deletion-emphasis: var(--diffs-bg-deletion-emphasis-override, light-dark(rgb(from var(--diffs-deletion-base) r g b / .15), rgb(from var(--diffs-deletion-base) r g b / .2))); + --diffs-bg-addition: var(--diffs-bg-addition-override, light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)), color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base)))); + --diffs-bg-addition-emphasis: var(--diffs-bg-addition-emphasis-override, light-dark(rgb(from var(--diffs-addition-base) r g b / .15), rgb(from var(--diffs-addition-base) r g b / .2))); + --diffs-selection-base: var(--diffs-modified-base); + --diffs-selection-number-fg: light-dark(color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)), color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer))); + background-color: var(--diffs-bg); + color: var(--diffs-fg); + display: block; + } + + pre, code, [data-error-wrapper] { + isolation: isolate; + font-family: var(--diffs-font-family, var(--diffs-font-fallback)); + outline: none; + margin: 0; + padding: 0; + display: block; + } + + pre, code { + background-color: var(--diffs-bg); + } + + code { + contain: content; + } + + input, button { + font-family: inherit; + font-size: inherit; + line-height: inherit; + } + + *, :before, :after { + box-sizing: border-box; + } + + [data-icon-sprite] { + display: none; + } + + [data-diffs-header], [data-separator] { + font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback)); + } + + [data-diffs-header][data-sticky] { + z-index: 1; + background-color: var(--diffs-bg); + position: sticky; + top: 0; + } + + [data-file-info] { + color: var(--fg); + background-color: color-mix(in lab, var(--bg) 98%, var(--fg)); + border-block: 1px solid color-mix(in lab, var(--bg) 95%, var(--fg)); + padding: 10px; + font-weight: 700; + } + + [data-diff], [data-file] { + --diffs-grid-number-column-width: minmax(min-content, max-content); + --diffs-code-grid: var(--diffs-grid-number-column-width) 1fr; + + &[data-dehydrated] { + --diffs-code-grid: var(--diffs-grid-number-column-width) minmax(0, 1fr); + } + + &:hover [data-code]::-webkit-scrollbar-thumb { + background-color: var(--diffs-bg-context); + } + } + + @supports (-webkit-touch-callout: none) { + :host { + --diffs-scrollbar-gutter-fallback: 0px; + } + } + + [data-line] span { + 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)); + text-decoration: light-dark(var(--diffs-token-light-text-decoration, inherit), var(--diffs-token-dark-text-decoration, inherit)); + } + + [data-line], [data-gutter-buffer], [data-column-number], [data-line-annotation], [data-no-newline], [data-merge-conflict], [data-merge-conflict-actions], [data-editor-overlay] { + --diffs-computed-decoration-bg: var(--diffs-bg); + --diffs-computed-diff-line-bg: var(--diffs-computed-decoration-bg); + --diffs-computed-selected-line-bg: var(--diffs-computed-diff-line-bg); + --diffs-computed-editor-active-line-bg: var(--diffs-computed-selected-line-bg); + --diffs-computed-hovered-line-bg: var(--diffs-computed-editor-active-line-bg); + --diffs-hover-mix-target: var(--diffs-bg-hover-override, var(--diffs-mixer)); + --diffs-line-bg: var(--diffs-computed-hovered-line-bg); + color: var(--diffs-fg); + background-color: var(--diffs-line-bg, var(--diffs-bg)); + } + + [data-line], [data-no-newline] { + &[data-decoration-bg] { + --mix-deco-light: 92%; + --mix-deco-dark: 85%; + + &[data-decoration-bg-depth="2"] { + --mix-deco-light: 88%; + --mix-deco-dark: 80%; + } + + &[data-decoration-bg-depth="3"] { + --mix-deco-light: 85%; + --mix-deco-dark: 78%; + } + + --diffs-hover-mix-target: var(--diffs-decoration-bg); + --diffs-computed-decoration-bg: light-dark(color-mix(in lab, + var(--diffs-bg) var(--mix-deco-light), + var(--diffs-decoration-bg)), color-mix(in lab, + var(--diffs-bg) var(--mix-deco-dark), + var(--diffs-decoration-bg))); + } + } + + [data-line-annotation], [data-gutter-buffer="annotation"] { + --diffs-annotation-bg: var(--diffs-bg-context); + --diffs-computed-decoration-bg: var(--diffs-annotation-bg); + --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg); + } + + [data-merge-conflict-actions], [data-gutter-buffer="merge-conflict-action"], [data-gutter-buffer="merge-conflict-marker-base"], [data-gutter-buffer="merge-conflict-marker-separator"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"] { + --diffs-computed-decoration-bg: var(--diffs-bg-context); + --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg); + } + + [data-gutter-buffer="merge-conflict-marker-start"], [data-merge-conflict="marker-start"] { + --diffs-computed-decoration-bg: light-dark(color-mix(in lab, + var(--diffs-bg) 78%, + var(--conflict-bg-current-header-override, var(--diffs-addition-base))), color-mix(in lab, + var(--diffs-bg) 68%, + var(--conflict-bg-current-header-override, var(--diffs-addition-base)))); + --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg); + } + + [data-gutter-buffer="merge-conflict-marker-end"], [data-merge-conflict="marker-end"] { + --diffs-computed-decoration-bg: light-dark(color-mix(in lab, + var(--diffs-bg) 78%, + var(--conflict-bg-incoming-header-override, var(--diffs-modified-base))), color-mix(in lab, + var(--diffs-bg) 68%, + var(--conflict-bg-incoming-header-override, var(--diffs-modified-base)))); + --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg); + } + + [data-has-merge-conflict] [data-line-annotation], [data-has-merge-conflict] [data-gutter-buffer="annotation"] { + --diffs-computed-decoration-bg: var(--diffs-bg); + --diffs-hover-mix-target: var(--diffs-computed-editor-active-line-bg); + } + + :where([data-background]) { + & [data-gutter-buffer], & [data-column-number] { + --mix-light: 91%; + --mix-dark: 85%; + } + + & [data-line], & [data-no-newline] { + --mix-light: 88%; + --mix-dark: 80%; + } + + & [data-gutter-buffer], & [data-column-number], & [data-line], & [data-no-newline] { + --diffs-diff-line-mix-target: var(--diffs-bg); + + &[data-line-type="change-deletion"] { + --diffs-diff-line-mix-target: var(--diffs-bg-deletion-override, var(--diffs-deletion-base)); + --diffs-hover-mix-target: var(--diffs-diff-line-mix-target); + + &:where([data-gutter-buffer], [data-column-number]) { + color: var(--diffs-fg-number-deletion-override, var(--diffs-deletion-base)); + --diffs-diff-line-mix-target: var(--diffs-bg-deletion-number-override, var(--diffs-deletion-base)); + } + + --diffs-computed-diff-line-bg: light-dark(color-mix(in lab, + var(--diffs-computed-decoration-bg) var(--mix-light), + var(--diffs-diff-line-mix-target)), color-mix(in lab, + var(--diffs-computed-decoration-bg) var(--mix-dark), + var(--diffs-diff-line-mix-target))); + } + + &[data-line-type="change-addition"] { + --diffs-diff-line-mix-target: var(--diffs-bg-addition-override, var(--diffs-addition-base)); + --diffs-hover-mix-target: var(--diffs-diff-line-mix-target); + + &:where([data-gutter-buffer], [data-column-number]) { + color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base)); + --diffs-diff-line-mix-target: var(--diffs-bg-addition-number-override, var(--diffs-addition-base)); + } + + --diffs-computed-diff-line-bg: light-dark(color-mix(in lab, + var(--diffs-computed-decoration-bg) var(--mix-light), + var(--diffs-diff-line-mix-target)), color-mix(in lab, + var(--diffs-computed-decoration-bg) var(--mix-dark), + var(--diffs-diff-line-mix-target))); + } + + &[data-merge-conflict="current"] { + --diffs-diff-line-mix-target: var(--conflict-bg-current-override, var(--diffs-addition-base)); + --diffs-hover-mix-target: var(--diffs-diff-line-mix-target); + + &:where([data-gutter-buffer], [data-column-number]) { + color: var(--diffs-fg-number-addition-override, var(--diffs-addition-base)); + --diffs-diff-line-mix-target: var(--conflict-bg-current-number-override, var(--diffs-addition-base)); + } + + --diffs-computed-diff-line-bg: light-dark(color-mix(in lab, + var(--diffs-computed-decoration-bg) var(--mix-light), + var(--diffs-diff-line-mix-target)), color-mix(in lab, + var(--diffs-computed-decoration-bg) var(--mix-dark), + var(--diffs-diff-line-mix-target))); + } + + &[data-merge-conflict="incoming"] { + --diffs-diff-line-mix-target: var(--conflict-bg-incoming-override, var(--diffs-modified-base)); + --diffs-hover-mix-target: var(--diffs-diff-line-mix-target); + + &:where([data-gutter-buffer], [data-column-number]) { + color: var(--diffs-modified-base); + --diffs-diff-line-mix-target: var(--conflict-bg-incoming-number-override, var(--diffs-modified-base)); + } + + --diffs-computed-diff-line-bg: light-dark(color-mix(in lab, + var(--diffs-computed-decoration-bg) var(--mix-light), + var(--diffs-diff-line-mix-target)), color-mix(in lab, + var(--diffs-computed-decoration-bg) var(--mix-dark), + var(--diffs-diff-line-mix-target))); + } + } + } + + [data-gutter-buffer], [data-column-number], [data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline], [data-editor-overlay] { + --diffs-selection-mix-target: var(--diffs-bg-selection-override, var(--diffs-selection-base)); + --diffs-selection-emphasis-mix-target: var(--diffs-selection-mix-target); + + &:where([data-editor-overlay]), &:where([data-line], [data-line-annotation], [data-merge-conflict], [data-merge-conflict-actions], [data-no-newline])[data-selected-line] { + --mix-selection-light: 82%; + --mix-selection-dark: 75%; + --diffs-hover-mix-target: var(--diffs-selection-mix-target); + } + + &:where([data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line])) { + --mix-selection-light: 75%; + --mix-selection-dark: 60%; + --diffs-selection-mix-target: var(--diffs-bg-selection-number-override, var(--diffs-selection-base)); + --diffs-hover-mix-target: var(--diffs-selection-mix-target); + } + + &:where([data-line][data-selected-line]):is([data-line-type="change-addition"], [data-line-type="change-deletion"]) { + --diffs-selection-emphasis-mix-target: light-dark(color-mix(in lab, + var(--diffs-diff-line-mix-target, var(--diffs-selection-mix-target)) + var(--mix-selection-light), + var(--diffs-selection-mix-target)), var(--diffs-selection-mix-target)); + } + + &:where([data-editor-overlay]), &[data-selected-line] { + --diffs-computed-selected-line-bg: light-dark(color-mix(in lab, + var(--diffs-computed-diff-line-bg) var(--mix-selection-light), + var(--diffs-selection-mix-target)), color-mix(in lab, + var(--diffs-computed-diff-line-bg) var(--mix-selection-dark), + var(--diffs-selection-mix-target))); + } + } + + [data-line][data-editor-active-line], [data-column-number][data-editor-active-line] { + --diffs-computed-editor-active-line-bg: color-mix(in lab, + var(--diffs-computed-selected-line-bg) + var(--diffs-editor-active-line-source-mix, 100%), + var(--diffs-selection-emphasis-mix-target)); + } + + @media (pointer: fine) { + [data-line][data-hovered], [data-gutter-buffer][data-hovered], [data-column-number][data-hovered], [data-line-annotation][data-hovered], [data-no-newline][data-hovered], [data-merge-conflict][data-hovered], [data-merge-conflict-actions][data-hovered], [data-editor-overlay][data-hovered] { + --diffs-computed-hovered-line-bg: light-dark(color-mix(in lab, + var(--diffs-computed-editor-active-line-bg) 97%, + var(--diffs-hover-mix-target)), color-mix(in lab, + var(--diffs-computed-editor-active-line-bg) 91%, + var(--diffs-hover-mix-target))); + } + } + + [data-gutter-buffer][data-selected-line], [data-column-number]:is([data-selected-line], [data-editor-active-line]) { + color: var(--diffs-selection-number-fg); + } + + [data-no-newline] { + user-select: none; + + & span { + opacity: .6; + } + } + + [data-diff-type="split"][data-overflow="scroll"] { + grid-template-columns: 1fr 1fr; + display: grid; + + & [data-additions] { + border-left: 1px solid var(--diffs-bg); + } + + & [data-deletions] { + border-right: 1px solid var(--diffs-bg); + } + } + + [data-code] { + grid-auto-flow: dense; + grid-template-columns: var(--diffs-code-grid); + overflow: var(--diffs-overflow-override, scroll) clip; + overscroll-behavior-x: none; + tab-size: var(--diffs-tab-size, 2); + padding-top: var(--diffs-gap-block, var(--diffs-gap-fallback)); + padding-bottom: max(0px, + calc(var(--diffs-gap-block, var(--diffs-gap-fallback)) - + var(--diffs-scrollbar-gutter))); + scrollbar-gutter: stable; + align-self: flex-start; + display: grid; + } + + [data-diffs-scrollbar-measure] { + opacity: 0; + pointer-events: none; + scrollbar-gutter: auto; + grid-template-columns: none; + width: 100px; + height: 100px; + padding: 0; + position: absolute; + top: -200px; + left: -200px; + } + + [data-container-size] { + container-type: inline-size; + } + + [data-code]::-webkit-scrollbar { + width: 0; + height: var(--diffs-scrollbar-gutter); + } + + [data-code]::-webkit-scrollbar-track { + background: none; + } + + [data-code]::-webkit-scrollbar-thumb { + background-color: #0000; + background-clip: content-box; + border: 1px solid #0000; + border-radius: 3px; + } + + [data-code]::-webkit-scrollbar-corner { + background-color: #0000; + } + + @supports ((-moz-appearance: none)) { + [data-code] { + scrollbar-width: thin; + scrollbar-color: var(--diffs-bg-context) transparent; + padding-bottom: var(--diffs-gap-block, var(--diffs-gap-fallback)); + } + } + + [data-diffs-header] ~ [data-diff], [data-diffs-header] ~ [data-file] { + & [data-code], &[data-overflow="wrap"], &[data-dehydrated][data-diff-type="split"][data-overflow="scroll"] { + padding-top: 0; + } + } + + [data-gutter] { + grid-template-rows: subgrid; + grid-template-columns: subgrid; + z-index: 3; + background-color: var(--diffs-bg); + grid-column: 1; + display: grid; + position: relative; + + & [data-gutter-buffer], & [data-column-number] { + border-right: var(--diffs-gap-style, 2px solid var(--diffs-bg)); + } + } + + [data-content] { + grid-template-rows: subgrid; + grid-template-columns: subgrid; + background-color: var(--diffs-bg); + grid-column: 2; + min-width: 0; + display: grid; + } + + [data-diff-type="split"][data-overflow="wrap"], [data-dehydrated][data-diff-type="split"][data-overflow="scroll"] { + grid-auto-flow: dense; + grid-template-columns: repeat(2, var(--diffs-code-grid)); + padding-block: var(--diffs-gap-block, var(--diffs-gap-fallback)); + display: grid; + + & [data-code] { + display: contents; + } + + & [data-deletions] { + & [data-gutter] { + grid-column: 1; + } + + & [data-content] { + border-right: 1px solid var(--diffs-bg); + grid-column: 2; + } + } + + & [data-additions] { + & [data-gutter] { + border-left: 1px solid var(--diffs-bg); + grid-column: 3; + } + + & [data-content] { + grid-column: 4; + } + } + } + + [data-dehydrated][data-diff-type="split"][data-overflow="scroll"] [data-content] { + overflow: clip; + } + + [data-overflow="scroll"] [data-gutter] { + position: sticky; + left: 0; + } + + [data-interactive-lines] [data-line] { + cursor: pointer; + } + + [data-interactive-line-numbers] [data-column-number] { + cursor: pointer; + touch-action: none; + } + + [data-content-buffer], [data-gutter-buffer] { + user-select: none; + min-height: 1lh; + position: relative; + } + + [data-gutter-buffer] { + padding-left: 2ch; + padding-right: 1ch; + + &:before { + content: ""; + min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch)); + display: block; + } + } + + [data-gutter-buffer="annotation"] { + --diffs-annotation-bg: var(--diffs-bg-context-gutter); + min-height: 0; + } + + [data-gutter-buffer="buffer"] { + --diffs-line-bg: var(--diffs-bg-context-gutter); + } + + [data-content-buffer] { + background-position: 5px 0; + background-size: 8px 8px; + background-origin: border-box; + background-image: repeating-linear-gradient(-45deg, + transparent, + transparent calc(3px * 1.414), + var(--diffs-bg-buffer) calc(3px * 1.414), + var(--diffs-bg-buffer) calc(4px * 1.414)); + grid-column: 1; + } + + [data-separator] { + box-sizing: content-box; + background-color: var(--diffs-bg); + } + + [data-separator="simple"] { + min-height: 4px; + } + + [data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"], [data-separator="simple"] { + background-color: var(--diffs-bg-separator); + } + + [data-separator="line-info"], [data-separator="line-info-basic"], [data-separator="metadata"] { + height: 32px; + position: relative; + } + + [data-separator-wrapper] { + user-select: none; + fill: currentColor; + background-color: var(--diffs-bg); + align-items: center; + height: 100%; + display: flex; + position: absolute; + inset-inline: 0; + } + + [data-content] [data-separator-wrapper] { + display: none; + } + + [data-separator="metadata"] [data-separator-wrapper] { + background-color: var(--diffs-bg-separator); + height: 100%; + color: var(--diffs-fg-number); + white-space: nowrap; + text-overflow: ellipsis; + min-width: min-content; + padding-inline: 1ch; + inset-inline: 100% auto; + overflow: hidden; + } + + [data-separator="line-info"] { + margin-block: var(--diffs-gap-block, var(--diffs-gap-fallback)); + + & [data-separator-wrapper] { + min-width: 16px; + } + } + + [data-separator="line-info-basic"], [data-separator="metadata"] { + margin-block: 0; + } + + [data-separator="line-info"][data-separator-first] { + margin-top: 0; + } + + [data-separator="line-info"][data-separator-last] { + margin-bottom: 0; + } + + [data-expand-index] [data-separator-wrapper] { + grid-template-columns: 32px auto; + display: grid; + } + + [data-expand-index] [data-separator-wrapper][data-separator-multi-button] { + grid-template-columns: 32px 32px auto; + } + + [data-expand-button], [data-separator-content] { + background-color: var(--diffs-bg-separator); + flex: none; + align-items: center; + display: flex; + } + + [data-expand-index] [data-separator-content]:hover { + cursor: pointer; + text-decoration: underline; + } + + [data-expand-button] { + cursor: pointer; + min-width: 32px; + color: var(--diffs-fg-number); + border-right: 2px solid var(--diffs-bg); + flex-shrink: 0; + justify-content: center; + align-self: stretch; + + &:hover { + color: var(--diffs-fg); + } + + &[data-expand-all-button] { + display: none; + } + } + + [data-expand-down] [data-icon] { + transform: scaleY(-1); + } + + [data-separator-content] { + height: 100%; + color: var(--diffs-fg-number); + flex: auto; + justify-content: flex-start; + padding: 0 1ch; + overflow: hidden; + } + + [data-separator="line-info"], [data-separator="line-info-basic"] { + & [data-separator-content] { + user-select: none; + height: 100%; + overflow: clip; + } + } + + [data-unmodified-lines] { + text-overflow: ellipsis; + white-space: nowrap; + flex: 0 auto; + min-width: 0; + display: block; + overflow: hidden; + } + + @supports (width: 1cqi) { + [data-unified] { + & [data-separator="line-info"] [data-separator-wrapper] { + padding-inline: var(--diffs-gap-inline, var(--diffs-gap-fallback)); + width: 100cqi; + + & [data-separator-content] { + border-radius: 6px; + } + } + + & [data-separator="line-info"][data-expand-index] [data-separator-wrapper] [data-separator-content] { + border-top-left-radius: unset; + border-bottom-left-radius: unset; + } + } + + [data-gutter] { + & [data-separator="line-info"] [data-separator-wrapper] { + padding-left: var(--diffs-gap-inline, var(--diffs-gap-fallback)); + } + + & [data-separator="line-info"] [data-separator-content] { + border-top-left-radius: 6px; + border-bottom-left-radius: 6px; + } + + & [data-separator="line-info"][data-expand-index] [data-separator-content] { + border-top-left-radius: unset; + border-bottom-left-radius: unset; + } + } + + [data-additions] { + & [data-content] [data-separator="line-info"] { + background-color: var(--diffs-bg); + + & [data-separator-wrapper] { + display: none; + } + } + + & [data-gutter] [data-separator="line-info"] [data-separator-wrapper] { + background-color: var(--diffs-bg-separator); + border-top-right-radius: 6px; + border-bottom-right-radius: 6px; + height: 100%; + display: block; + + & [data-separator-content], & [data-expand-button] { + display: none; + } + } + } + + [data-overflow="scroll"] [data-additions] [data-gutter] [data-separator="line-info"] [data-separator-wrapper] { + width: calc(100cqi - var(--diffs-gap-inline, var(--diffs-gap-fallback))); + } + + [data-overflow="wrap"] [data-additions] [data-content] [data-separator="line-info"] [data-separator-wrapper] { + background-color: var(--diffs-bg-separator); + height: 100%; + margin-right: var(--diffs-gap-inline, var(--diffs-gap-fallback)); + border-top-right-radius: 6px; + border-bottom-right-radius: 6px; + display: block; + + & [data-separator-content], & [data-expand-button] { + display: none; + } + } + + [data-separator="line-info"] [data-separator-wrapper] { + & [data-expand-both], & [data-expand-down], & [data-expand-up] { + border-top-left-radius: 6px; + border-bottom-left-radius: 6px; + } + } + + @media (pointer: fine) { + [data-separator="line-info"] [data-separator-wrapper] { + &[data-separator-multi-button] { + & [data-expand-up] { + border-top-left-radius: 6px; + border-bottom-left-radius: unset; + } + + & [data-expand-down] { + border-bottom-left-radius: 6px; + border-top-left-radius: unset; + } + } + } + } + } + + @media (pointer: coarse) { + [data-separator="line-info-basic"] [data-separator-wrapper][data-separator-multi-button] { + grid-template-columns: 34px 34px auto; + + & [data-separator-content] { + grid-column: unset; + grid-row: unset; + } + } + + @supports (width: 1cqi) { + [data-separator="line-info"] [data-separator-wrapper] { + & [data-expand-both], & [data-expand-down], & [data-expand-up] { + border-top-left-radius: 6px; + border-bottom-left-radius: 6px; + } + + &[data-separator-multi-button] { + & [data-expand-up] { + border-top-left-radius: 6px; + border-bottom-left-radius: 6px; + } + + & [data-expand-down] { + border-bottom-left-radius: unset; + border-top-left-radius: unset; + } + } + } + } + } + + @media (pointer: fine) { + [data-separator-wrapper][data-separator-multi-button] { + grid-template-rows: 50% 50%; + display: grid; + + & [data-separator-content] { + grid-area: 1 / 2 / -1; + min-width: min-content; + } + + & [data-expand-button] { + grid-column: 1; + } + } + + [data-separator="line-info"] [data-separator-wrapper], [data-separator="line-info"] [data-separator-wrapper][data-separator-multi-button] { + grid-template-columns: 34px auto; + } + + [data-separator="line-info-basic"][data-expand-index] [data-separator-wrapper] { + grid-template-columns: 100% auto; + } + + [data-separator="line-info"], [data-separator="line-info-basic"] { + & [data-separator-multi-button] { + & [data-expand-up] { + border-bottom: 1px solid var(--diffs-bg); + border-right: 2px solid var(--diffs-bg); + } + + & [data-expand-down] { + border-top: 1px solid var(--diffs-bg); + border-right: 2px solid var(--diffs-bg); + } + } + } + } + + [data-additions] [data-gutter] [data-separator-wrapper], [data-additions] [data-separator="line-info-basic"] [data-separator-wrapper], [data-content] [data-separator-wrapper] { + display: none; + } + + [data-line-annotation] { + min-height: var(--diffs-annotation-min-height, 0); + z-index: 2; + } + + [data-merge-conflict-actions] { + z-index: 2; + } + + [data-separator="custom"] { + grid-template-columns: subgrid; + display: grid; + } + + [data-line], [data-column-number], [data-no-newline] { + padding-inline: 1ch; + position: relative; + } + + [data-indicators="classic"] [data-line] { + padding-inline-start: 2ch; + } + + [data-indicators="classic"] { + & [data-line-type="change-addition"], & [data-line-type="change-deletion"] { + &[data-no-newline], &[data-line] { + &:before { + user-select: none; + width: 1ch; + height: 1lh; + display: inline-block; + position: absolute; + top: 0; + left: 0; + } + } + } + + & [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: ""; + user-select: none; + contain: strict; + width: 4px; + height: 100%; + display: block; + position: absolute; + top: 0; + left: 0; + } + } + } + + & [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] { + white-space: pre-wrap; + word-break: break-word; + } + + & [data-annotation-content] { + word-break: break-word; + } + } + + [data-overflow="scroll"] [data-line] { + white-space: pre; + min-height: 1lh; + } + + [data-column-number] { + box-sizing: content-box; + text-align: right; + user-select: none; + color: var(--diffs-fg-number); + padding-left: 2ch; + } + + [data-line-number-content] { + min-width: var(--diffs-min-number-column-width, var(--diffs-min-number-column-width-default, 3ch)); + z-index: 1; + display: inline-block; + position: relative; + } + + [data-disable-line-numbers] { + & [data-gutter-buffer], & [data-column-number] { + min-width: 4px; + padding: 0; + + &:before { + min-width: 0; + } + } + + & [data-line-number-content] { + display: none; + } + + & [data-gutter-utility-slot] { + right: unset; + justify-content: flex-start; + left: 0; + } + + &[data-indicators="bars"] [data-gutter-utility-slot] { + left: 6px; + } + } + + [data-file][data-disable-line-numbers] { + & [data-gutter-buffer], & [data-column-number] { + border-right: 0; + min-width: 0; + } + } + + [data-diff-span] { + box-decoration-break: clone; + border-radius: 3px; + } + + [data-line-type="change-addition"] [data-diff-span] { + background-color: var(--diffs-bg-addition-emphasis); + } + + [data-line-type="change-deletion"] [data-diff-span] { + background-color: var(--diffs-bg-deletion-emphasis); + } + + [data-merge-conflict="marker-start"], [data-merge-conflict="marker-base"], [data-merge-conflict="marker-separator"], [data-merge-conflict="marker-end"] { + color: var(--diffs-fg); + padding-left: 1ch; + } + + [data-merge-conflict="marker-start"], [data-merge-conflict="marker-end"] { + align-items: center; + display: flex; + + &:after { + color: var(--diffs-fg-conflict-marker); + font-size: .75rem; + font-style: normal; + line-height: 1.25rem; + font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback)); + padding-left: 1ch; + } + } + + [data-merge-conflict="marker-start"]:after { + content: "(Current Change)"; + } + + [data-merge-conflict="marker-end"]:after { + content: "(Incoming Change)"; + } + + [data-merge-conflict-actions-content] { + min-height: 1.75rem; + font-family: var(--diffs-header-font-family, var(--diffs-header-font-fallback)); + color: var(--diffs-fg); + align-items: center; + gap: .25rem; + padding-inline: .5rem; + font-size: .75rem; + line-height: 1.2; + display: flex; + } + + [data-merge-conflict-action] { + appearance: none; + color: var(--diffs-fg-number); + font: inherit; + cursor: pointer; + background: none; + border: 0; + padding: 0; + font-style: normal; + } + + [data-merge-conflict-action]:hover { + color: var(--diffs-fg); + } + + [data-merge-conflict-action="current"]:hover { + color: var(--diffs-addition-base); + } + + [data-merge-conflict-action="incoming"]:hover { + color: var(--diffs-modified-base); + } + + [data-merge-conflict-action-separator] { + color: var(--diffs-fg-number); + opacity: .6; + user-select: none; + } + + [data-diffs-header="default"] { + background-color: var(--diffs-bg); + justify-content: space-between; + align-items: center; + gap: var(--diffs-gap-inline, var(--diffs-gap-fallback)); + min-height: calc(1lh + (var(--diffs-gap-block, var(--diffs-gap-fallback)) * 3)); + z-index: 2; + flex-direction: row; + padding-inline: 16px; + display: flex; + position: relative; + top: 0; + } + + [data-header-content] { + align-items: center; + gap: var(--diffs-gap-inline, var(--diffs-gap-fallback)); + white-space: nowrap; + flex-direction: row; + min-width: 0; + display: flex; + } + + [data-header-content] [data-prev-name], [data-header-content] [data-title] { + text-overflow: ellipsis; + white-space: nowrap; + direction: rtl; + min-width: 0; + overflow: hidden; + } + + [data-prev-name] { + opacity: .7; + } + + [data-rename-icon] { + fill: currentColor; + flex-grow: 0; + flex-shrink: 0; + } + + [data-diffs-header="default"] [data-metadata] { + white-space: nowrap; + align-items: center; + gap: 1ch; + display: flex; + } + + [data-diffs-header="default"] [data-additions-count] { + font-family: var(--diffs-font-family, var(--diffs-font-fallback)); + color: var(--diffs-addition-base); + } + + [data-diffs-header="default"] [data-deletions-count] { + font-family: var(--diffs-font-family, var(--diffs-font-fallback)); + color: var(--diffs-deletion-base); + } + + [data-change-icon] { + fill: currentColor; + flex-shrink: 0; + } + + [data-change-icon="change"], [data-change-icon="rename-pure"], [data-change-icon="rename-changed"] { + color: var(--diffs-modified-base); + } + + [data-change-icon="new"] { + color: var(--diffs-addition-base); + } + + [data-change-icon="deleted"] { + color: var(--diffs-deletion-base); + } + + [data-change-icon="file"] { + opacity: .6; + } + + [data-annotation-content] { + z-index: 2; + isolation: isolate; + white-space: normal; + align-self: flex-start; + min-width: 0; + display: flow-root; + position: relative; + } + + [data-overflow="scroll"] [data-annotation-content], [data-overflow="scroll"] [data-merge-conflict-actions-content] { + width: var(--diffs-column-content-width, auto); + left: var(--diffs-column-number-width, 0); + position: sticky; + } + + [data-annotation-slot] { + text-wrap-mode: wrap; + word-break: normal; + white-space-collapse: collapse; + } + + [data-gutter-utility-slot] { + touch-action: none; + justify-content: flex-end; + display: flex; + position: absolute; + top: 0; + bottom: 0; + right: 0; + } + + [data-utility-button] { + appearance: none; + cursor: pointer; + width: 1lh; + height: 1lh; + font-size: var(--diffs-font-size, 13px); + line-height: var(--diffs-line-height, 20px); + background-color: var(--diffs-modified-base); + color: var(--diffs-bg); + fill: currentColor; + z-index: 4; + touch-action: none; + border: none; + border-radius: 4px; + justify-content: center; + align-items: center; + margin-right: calc(-1lh + 1ch); + padding: 0; + display: flex; + position: relative; + + &:before { + content: ""; + display: block; + position: absolute; + inset: 0 0 0 -4px; + } + } + + [data-decoration-bar-stack] { + pointer-events: none; + isolation: isolate; + z-index: 1; + background-color: var(--diffs-decoration-bar-color, transparent); + box-sizing: content-box; + border-left: 2px solid var(--diffs-bg); + border-right: 2px solid var(--diffs-bg); + width: 6px; + position: absolute; + top: 0; + bottom: 0; + right: -2px; + + [data-decoration-bar-depth="1"] & { + background-color: color-mix(in lab, + var(--diffs-bg) 20%, + var(--diffs-decoration-bar-color, transparent)); + } + + [data-decoration-bar-depth="2"] & { + background-color: color-mix(in lab, + var(--diffs-bg) 45%, + var(--diffs-decoration-bar-color, transparent)); + } + + [data-decoration-bar-depth="3"] & { + background-color: color-mix(in lab, + var(--diffs-bg) 65%, + var(--diffs-decoration-bar-color, transparent)); + } + + [data-decoration-bar-start] & { + border-top-left-radius: 5px; + border-top-right-radius: 5px; + } + + [data-decoration-bar-end] & { + z-index: 3; + border-bottom-right-radius: 5px; + border-bottom-left-radius: 5px; + } + } + + [data-placeholder] { + contain: strict; + } + + [data-error-wrapper] { + padding: var(--diffs-gap-block, var(--diffs-gap-fallback)) + var(--diffs-gap-inline, var(--diffs-gap-fallback)); + scrollbar-width: none; + max-height: 400px; + overflow: auto; + + & [data-error-message] { + color: var(--diffs-deletion-base); + font-size: 18px; + font-weight: bold; + } + + & [data-error-stack] { + color: var(--diffs-fg-number); + } + } +} + +@layer theme, rendered, unsafe; +`,lm;function um(e){if(lm!=null)return lm;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(ie,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),lm=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),lm}function dm(e){return`${A}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var fm=`@layer base, theme, rendered, unsafe;`,pm=RegExp(`${_m(A)}\\s*:\\s*[^;]+;`);function mm(e){return`${fm} +@layer unsafe { + ${e} +}`}function hm(e,t=`system`,n){return`${fm} +@layer rendered { + :host {${t===`system`?``:` + color-scheme: ${t};`} + ${dm(n)} + ${e} + } +}`}function gm(e,t){let n=dm(t);return e.replace(pm,n)}function _m(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function vm({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 ym(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function bm(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}function xm(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function Sm(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function Cm(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,themeType:e?.themeType,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Sm(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,unsafeCSS:e?.unsafeCSS,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}function wm(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function Tm({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=Em(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function Em(){let e=document.createElement(`style`);return e.setAttribute(ne,``),e}var Dm=void 0;function Om(){return Dm??=`safari`in window&&`pushNotification`in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}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(cm)),t.adoptedStyleSheets=[e]}connectedCallback(){um(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(b,t)}ki();var km=[``],Am=-1,jm=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file:${++Am}`;type=`file`;fileContainer;spriteSVG;pre;code;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;errorWrapper;placeHolder;lastRenderedHeaderHTML;cachedHeaderHTML;appliedPreAttributes;lastRowCount;mounted=!1;headerElement;headerCustom;headerPrefix;headerFilenameSuffix;headerMetadata;fileRenderer;resizeManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;file;renderRange;enabled=!0;editor;constructor(e={theme:k},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new Qp(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new Xi,this.interactionManager=new Ai(`file`,ji(e)),this.workerManager?.subscribeToThemeChanges(this)}handleHighlightRender=()=>{this.rerender()};rerender(){!this.enabled||this.file==null||this.render({file:this.file,forceRender:!0,renderRange:this.renderRange})}__getCurrentFile(){return this.file}onThemeChange(){this.fileRenderer.clearRenderCache(),this.rerender()}setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(ji(this.options))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!me(this.appliedThemeCSS.theme,this.options.theme??k)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}setSelectedLines(e,t){this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}getCodeScrollLeft(){return this.code?.scrollLeft??0}setCodeScrollLeft(e){this.code!=null&&(this.code.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.fileRenderer.getEffectiveCodeOptions()}}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{overflow:e=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:e===`wrap`,columnVariables:this.shouldApplyColumnVariables(e)?`apply`:`measure`}),this.managersDirty=!1}shouldApplyColumnVariables(e){return e===`scroll`&&this.lineAnnotations.length>0}cleanUp(e=!1){this.emitPostRender(!0),this.editor?.cleanUp(e),this.editor=void 0,this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.pre=void 0,this.code=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,e?this.fileRenderer.recycle():(this.fileRenderer.cleanUp(),this.workerManager=void 0,this.file=void 0),this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate(e){let{fileContainer:t,prerenderedHTML:n,preventEmit:r=!1,file:i,lineAnnotations:a}=e;if(!this.enabled)throw Error(`File.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`File.hydrate: hydrate can only be called before the instance has rendered or hydrated`);this.hydrateElements(t,n),Mm(this.pre,i,this.options.collapsed)||Nm(this.headerElement,i,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):this.hydrationSetup({file:i,lineAnnotations:a}),r||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),ym(e,t);for(let t of Array.from(e.shadowRoot?.children??[])){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t,this.appliedPreAttributes=void 0;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}if(`diffsHeader`in t.dataset){this.headerElement=t,this.lastRenderedHeaderHTML=void 0;continue}}}this.pre!=null&&(this.syncCodeNodeFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({file:e,lineAnnotations:t}){this.lineAnnotations=t??this.lineAnnotations,this.file=e,this.fileRenderer.setOptions(Cm(this.options)),this.syncInteractionOptions(),this.pre!=null&&(this.fileRenderer.hydrate(e),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}getOrCreateLineCache(e=this.file){return e==null?km:this.fileRenderer.getOrCreateLineCache(e)}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.file,r=this.lineAnnotations,i=this.renderRange;e!=null&&t!=null&&n!=null&&this.fileRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.file!==n||e.__syncRenderView(a,t,n,r,i)})}attachEditor(e){this.editor?.cleanUp(),this.editor=e,this.fileRenderer.beginEditSession();let t=this.file==null?void 0:e.__prepareFile?.(this.file);return t!==void 0&&t!==this.file?this.renderPreparedFile({file:t,forceRender:!0,preventEmit:!0,renderRange:this.renderRange}):this.fileRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),()=>{this.editor=void 0,this.fileRenderer.endEditSession()}}applyDocumentChange(e,t){this.fileRenderer.applyDocumentChange(e),t!=null&&t!==this.lineAnnotations&&this.file!=null&&(this.setLineAnnotations(t),this.fileRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations())}updateRenderCache(e,t,n){this.fileRenderer.updateRenderCache(e,t,n?.lineCountChangeInFlight)}render(e){if(!this.enabled)throw Error(`File.render: attempting to call render after cleaned up`);let t=this.editor?.__prepareFile?.(e.file)??e.file;return this.renderPreparedFile(t===e.file?e:{...e,file:t})}renderPreparedFile({file:e,fileContainer:t,forceRender:n=!1,preventEmit:r=!1,containerWrapper:i,deferManagers:a=!1,lineAnnotations:o,renderRange:s}){this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:c=!1,themeType:l=`system`}=this.options,u=c?void 0:s,d=this.renderRange,f=this.hasThemeChanged(),p=o!=null&&(o.length>0||this.lineAnnotations.length>0)&&o!==this.lineAnnotations,m=!Ot(this.file,e)||this.fileRenderer.hasUnkeyedFileContentsChanged(e);if(!c&&!n&&Zf(u,this.renderRange)&&!m&&!p&&!f)return this.applyCachedThemeState(l);this.renderRange=u,m&&(this.cachedHeaderHTML=void 0),this.file=e,this.fileRenderer.setOptions(Cm(this.options)),this.syncInteractionOptions(),o!=null&&this.setLineAnnotations(o),this.fileRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:h=!1,disableFileHeader:g=!1}=this.options;if(g&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),t=this.getOrCreateFileContainerNode(t,i),this.applyCachedThemeState(l),c){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let n=this.fileRenderer.renderFile(e,ce);n!=null&&this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n?.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.injectUnsafeCSS()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}try{let r=this.getOrCreatePreNode(t);if(!this.canPartiallyRender(n,p,m||f)||!this.applyPartialRender(d,u)){let n=this.fileRenderer.renderFile(e,u);if(n==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(t,n.themeStyles,l,n.baseThemeType),n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t),this.applyFullRender(n,r)}this.applyBuffers(r,u),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,a||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(h)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;n?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}removeRenderedCode(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.code?.remove(),this.code=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}canPartiallyRender(e,t,n){return!(e||t||n)}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.file){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||Yp(e))return;let n=this.options.tokenizeMaxLength??1e5;this.fileRenderer.getOrCreateLineCache(e).length>n||await t.primeFileHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.code?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.code=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${cp(r)}`,a=this.annotationCache.get(i);if(a==null||!tm(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:am(cp(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=om();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=sm(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=mm(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??k,s=typeof o==`string`?o:{...o},c=um(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=Tm({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:hm(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=gm(this.themeCSSStyle.textContent??``,um(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&Om()}applyFullRender(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e);let n=this.code=vm({code:this.code}),r=this.fileRenderer.renderCodeAST(e);this.editor?.__captureFocusForDOMReplacement();let i=()=>{if(n.childElementCount>=2)for(let e=0;e<2;e++){let t=n.children[e],i=r[e];t.innerHTML=H(i.children),t.style.cssText=i.properties.style}else n.innerHTML=H(r);t.contains(n)||t.replaceChildren(n)};this.shouldGuardRebuildScroll()?wm(t,i):i(),this.lastRowCount=e.rowCount}applyPartialRender(e,t){if(e==null||t==null)return!1;let{file:n,code:r}=this,i=r==null?void 0:this.getColumns(r);if(n==null||r==null||i==null)return!1;let a=e.startingLine,o=t.startingLine,s=e.totalLines===1/0?1/0:a+e.totalLines,c=t.totalLines===1/0?1/0:o+t.totalLines,l=Math.max(a,o),u=Math.min(s,c);if(u<=l)return!1;if(!this.trimDOMToOverlap(i.gutter,l,u)||!this.trimDOMToOverlap(i.content,l,u))throw Error(`File.applyPartialRender: failed to trim to overlap`);let{length:d}=i.content.children,f=(e,t)=>{if(!(t<=0))return this.fileRenderer.renderFile(n,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},p=o<l?f(o,l-o):void 0;if(p===void 0&&o<l)return!1;let m=c===1/0?1/0:Math.max(0,c-u),h=c>u?f(u,m):void 0;return h===void 0&&c>u?!1:(this.cleanupErrorWrapper(),p!=null&&(i.gutter.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.gutterAST)),i.content.insertAdjacentHTML(`afterbegin`,this.fileRenderer.renderPartialHTML(p.contentAST)),d+=p.rowCount),h!=null&&(i.gutter.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.gutterAST)),i.content.insertAdjacentHTML(`beforeend`,this.fileRenderer.renderPartialHTML(h.contentAST)),d+=h.rowCount),this.lastRowCount!==d&&(i.gutter.style.setProperty(`grid-row`,`span ${d}`),i.content.style.setProperty(`grid-row`,`span ${d}`),this.lastRowCount=d),!0)}getColumns(e){let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}trimDOMToOverlap(e,t,n){let r=this.getDOMBoundaryIndices(e,[t,n]),i=r.get(t)??e.children.length,a=r.get(n)??e.children.length;if(i>a)return!1;for(let t=e.children.length-1;t>=a;--t)e.children[t]?.remove();for(let t=i-1;t>=0;--t)e.children[t]?.remove();return!0}getDOMBoundaryIndices(e,t){let n=[...new Set(t)].sort((e,t)=>e-t),r=new Map;if(n.length===0)return r;let i=0,a=n[i],{children:o}=e;a===0&&(r.set(0,0),i+=1,a=n[i]);for(let e=0;e<o.length;e+=1){let t=o[e];if(!(t instanceof HTMLElement))continue;let s=this.getLineIndexFromDOMNode(t);if(s!=null){for(;a!=null&&s>=a;)r.set(a,e),i+=1,a=n[i];if(i>=n.length)break}}for(let e of n)r.has(e)||r.set(e,o.length);return r}getLineIndexFromDOMNode(e){let t=e.dataset.lineIndex;if(t==null)return;let n=Number(t);return Number.isNaN(n)?void 0:n}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyHeaderToDOM(e,t){let{file:n}=this;if(n==null)return;this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let r=this.cachedHeaderHTML??H(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged)return;let{renderHeaderPrefix:i,renderHeaderFilenameSuffix:a,renderCustomHeader:o,renderHeaderMetadata:s}=this.options;if(o!=null){let e=o(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,te,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0}else{let e=i?.(n)??void 0,r=a?.(n)??void 0,o=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,ee,e),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,D,r),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,O,o),this.headerCustom?.remove(),this.headerCustom=void 0}}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}getOrCreateFileContainerNode(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:xm(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):xm(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=em;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.code=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),e.shadowRoot?.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodeFromPre(e){this.code=void 0;for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.hasAttribute(`data-code`)){this.code=t;return}}applyPreNodeAttributes(e,{totalLines:t}){let{overflow:n=`scroll`,disableLineNumbers:r=!1}=this.options,i={type:`file`,split:!1,overflow:n,disableLineNumbers:r,diffIndicators:`none`,disableBackground:!0,totalLines:t};nm(i,this.appliedPreAttributes)||(bm(e,i),this.appliedPreAttributes=i)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Mm(e,t,n=!1){return!n&&e==null&&t!=null}function Nm(e,t,n=!1){return e==null&&t!=null&&!n}function Pm(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}function Fm(e){return{...e,hunks:e.hunks.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))})),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function Im(e){return e===``?[]:e.split(S)}function Lm(e,t,n){let r=e===`clone`?Fm(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return Rm(r,Bm(r,n),Vm(r,n));case`rename-pure`:{let e=Vm(r,n);Hm(r,n);let t=Im(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,Wm(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function Rm(e,t,n){let r=Im(t.contents),i=Im(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=zm(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,Wm(e,t,n),e}function zm(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent){if(e.type===`context`){p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines;continue}p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let m=Math.max(Ce(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=M(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=M(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function Bm(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function Vm(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function Hm(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function Um(e,t,n){return e.cacheKey==null?Gm(t,n):`${e.cacheKey}:hydrated`}function Wm(e,t,n){let r=Um(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function Gm(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?`${e.cacheKey}:${t.cacheKey}`:void 0:e?.cacheKey??t?.cacheKey}var Km=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 qm(e,t){return me(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Jm(e){return N({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function Ym(e){return N({tagName:`div`,children:[N({tagName:`span`,children:[kt(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function Xm(e){return N({tagName:`div`,children:[At({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 Zm({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:[kt(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(Xm(`up`)),s++),o||(e.push(Xm(`down`)),s++)):(e.push(Xm(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(N({tagName:`div`,children:[N({tagName:`span`,children:[kt(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(N({tagName:`div`,children:[kt(`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 Qm(e,t){return`hunk-separator-${e}-${t}`}function $m(e){let t=e.at(-1);return t==null?0:Math.max(M(t.additionStart,t.additionCount),M(t.deletionStart,t.deletionCount))}function eh(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function th({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 nh({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 rh(e){return[Ce(e.additionStart,e.additionCount)+1,M(e.additionStart,e.additionCount)+1]}function ih({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function ah(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-M(t.additionStart,t.additionCount),r=e.deletionLines.length-M(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function oh({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-M(n.additionStart,n.additionCount),i=e.deletionLines.length-M(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function sh({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=oh({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function ch({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=rh(a);if(t<o){let s=ih({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=sh({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=rh(a);return t<o+i.fromStart||t>=o+i.rangeSize}function lh({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=rh(n),l=ih({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=sh({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function uh({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=dh({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=Ce(r.deletionStart,r.deletionCount),s=Ce(r.additionStart,r.additionCount),d=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,f=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,p=ih({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),m=n===c.finalHunkIndex?sh({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,h=p.fromStart+p.fromEnd;function l(e,n){return m==null||m.collapsedLines<=0||m.fromStart+m.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?m.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?m.collapsedLines:0}let g=p.collapsedLines===0;function u(){return g?0:(g=!0,p.collapsedLines)}if(c.shouldSkip(h,h))c.incrementCounts(h,h),u();else{let e=r.unifiedLineStart-p.rangeSize,i=r.splitLineStart-p.rangeSize,a=d-p.rangeSize,l=f-p.rangeSize,m=o+1-p.rangeSize,h=s+1-p.rangeSize;if(mh(c,p.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:m+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:l+t,lineNumber:h+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-p.fromEnd,i=r.splitLineStart-p.fromEnd,a=d-p.fromEnd,l=f-p.fromEnd,m=o+1-p.fromEnd,h=s+1-p.fromEnd,mh(c,p.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:u(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:m+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:l+t,lineNumber:h+t,noEOFCR:!1}}),()=>{u()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=d,b=f,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),u();else if(mh(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:u(),collapsedAfter:l(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{u()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=hh(c,e,t);(s[0]?.[0]??0)>0&&u();for(let[d,f]of s)for(let s=d;s<f;s++){let d=l(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(gh({hunkIndex:n,hunk:r,collapsedBefore:u(),collapsedAfter:d,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}u(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(m!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=m,a=r+i;if(mh(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function dh({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=fh({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function fh({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=ih({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?sh({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function ph(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function mh(e,t,n,r,i,a){let[o,s]=ph(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function hh(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function gh({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}var _h={forcePlainText:!1};function vh(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=_h){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=Np({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)??bh();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)}uh({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&yh({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}=xh({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else f.deletionLines.push(...s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else f.additionLines.push(...c)}return{code:f,themeStyles:u,baseThemeType:l}}function yh({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=ge(e),t=ge(t),e.length>s||t.length>s))return;let c=o===`char`?Ye(e,t):ft(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?(nh({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),nh({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?nh({item:e,arr:l,enableJoin:d,isLastItem:t}):nh({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(th({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(th({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function bh(){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 xh({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c=k,...l}}){let u=s??Q(e.name),d=s??Q(t.name),{state:f,transformers:p}=vp(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:$(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:$(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,Fp(i.codeToHast(ge(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,Fp(i.codeToHast(ge(t.contents),m)))}}function Sh(e,t){let n=Et({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function Ch(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function wh(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function Th(e,t){return t.length>0&&t.length<e.deletionLines.length&&wh(t)}function Eh(e,t,n){let r=e.deletionLines.join(``),i=Ch(t.length,r),a=Et({name:e.prevName??e.name,contents:r},{name:e.name,contents:i,lang:e.lang},n);return{hunks:a.hunks,splitLineCount:a.splitLineCount,unifiedLineCount:a.unifiedLineCount,additionLines:t,deletionLines:a.deletionLines,type:a.type}}function Dh(e,t){return Eh(e,[``],t)}function Oh(e,t){if(e.additionLines.length===0)return Dh(e,t);if(Th(e,e.additionLines))return Eh(e,e.additionLines,t);let n=e.additionLines,r=Sh(e,t);return Ah(r,n),r}function kh(e){return e.length>1&&e.at(-1)===``}function Ah(e,t){if(!kh(t))return;let n=t.length-e.additionLines.length;if(n<=0)return;let r=e.additionLines.length,i=e.hunks.at(-1);if(i!=null&&M(i.additionStart,i.additionCount)===r){for(let a of i.hunkContent)if(a.type===`change`&&a.additions<a.deletions&&a.additionLineIndex+a.additions===r){e.additionLines=t,a.additions+=n,i.additionCount+=n,i.additionLines+=n,Bh(e);return}}}function jh(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return Mh(e,Sh(e,n));let r=Array.from(t);if(r.length===0)return Mh(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||ge(r)===ge(i))return Mh(e,Sh(e,n))}let i=Nh(e,r);if(i.size===0)return Mh(e,Sh(e,n));for(let t of i)if(!Fh(e,t,n))return Mh(e,Sh(e,n));return Bh(e),ah(e)?Mh(e,Sh(e,n)):Mh(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function Mh(e,t){return Object.assign(e,t),t}function Nh(e,t){let n=new Set;for(let r of t){let t=Ph(e,r);if(t==null)return new Set;n.add(t)}return n}function Ph(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function Fh(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=Et({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:(Lh(r,s),Ih(e,t),!0)}function Ih(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(` +`),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(` +`)}function Lh(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>Rh(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,zh(e)}function Rh(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function zh(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function Bh(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(Ce(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,zh(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=M(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-M(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var Vh=new WeakMap;function Hh(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function Uh(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function Wh(e,t){let n=e.hunks,r=e.additionLines,i=Hh(r),a=i===r?e:{...e,additionLines:i},o=eg(n,$h(a,t),e.deletionLines.length),s=rg(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,pg(e),Ah(e,r),og(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function Gh(e,t,n,r){let i=Array.from(new Set(t)).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(i.length===0)return;let{hunks:a}=e,o,s=0;for(let t of i){for(;s<a.length;){let e=a[s];if(t<lg(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:lg(r);if(i==null||t<i||o!=null&&o!==s)return Wh(e,n);o=s}if(o!=null){if(Kh(e,i,o,r,n)){e.editSessionDirty=!0;return}return Wh(e,n)}}function Kh(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=qh(e),o=e.hunks[n];if(o.hunkContent.some(Jh))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function qh(e){let t=Vh.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return Vh.set(e,{lines:e.deletionLines,set:n}),n}function Jh(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function Yh(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function Xh(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=ih({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=ug(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=sh({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=ug(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function Zh(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=ug(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,ug(i)+i.deletionCount,e.deletionLines.length),n}function Qh(e,t){return e.editSessionDirty===!0&&(e.editSessionDirty=void 0,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?Sh(e,t):Oh(e,t)),!0)}function $h(e,t){if(Uh(e.deletionLines,e.additionLines)==null)return[];let n=Et({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),r=[],i=0,a=0;for(let e of n.hunks){let t=e.additionCount>0?e.additionLineIndex-i:e.deletionLineIndex-a;i+=t,a+=t;for(let t of e.hunkContent){if(t.type===`context`){i+=t.lines,a+=t.lines;continue}let e=Rh(t,0,0);e.additions===0&&(e.additionLineIndex=i),e.deletions===0&&(e.deletionLineIndex=a),r.push(e),i+=e.additions,a+=e.deletions}}return r}function eg(e,t,n){let r=e.map((e,t)=>{let n=ug(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&tg(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=ng(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function tg(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function ng(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function rg(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);ag(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);ag(s,c,i,r),r+=c,i+=c,n.push(ig(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function ig(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:dg(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:fg(t.additionStart,r),deletionStart:dg(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:fg(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${dg(t.deletionStart,i)},${i} +${dg(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return zh(s),s}function ag(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function og(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(ug(r)!==ug(i)||r.deletionCount!==i.deletionCount||lg(r)!==lg(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!sg(r,i))return!0}return!1}function sg(e,t){let n=cg(e),r=cg(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*cg(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function lg(e){return Ce(e.additionStart,e.additionCount)}function ug(e){return Ce(e.deletionStart,e.deletionCount)}function dg(e,t){return t===0?e:e+1}function fg(e,t){return t===0?e-1:e}function pg(e){Bh(e);for(let t=0;t<e.hunks.length;t++)Ih(e,t)}function mg(e){let t=e.lang??Q(e.name),n=e.lang??(e.prevName==null?`text`:Q(e.prevName));return t===`text`&&n===`text`}ki();var hg=-1,gg=class{options;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++hg}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;editSessionActive=!1;constructor(e={theme:k},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Jf(e.theme??k)?Gf():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(){this.editSessionActive=!0;let e=this.diffCache;e!=null&&!e.isPartial&&e.additionLines.length===0&&(Object.assign(e,Dh(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache())}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{renderCache:e}=this;if(e==null||mg(e.diff)||jg(e.diff,this.getTokenizeMaxLength()))return Promise.resolve();let{diff:t}=e,{workerManager:n}=this;return!this.editSessionActive&&n?.isWorkingPool()===!0&&t.cacheKey!=null?(n.evictDiffFromCache(t.cacheKey),n.primeDiffHighlightCache(t).then(()=>{this.applyRefreshedResult(t,n.getDiffResultCache(t))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(t).then(e=>this.applyRefreshedResult(t,e)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){if(t==null||this.renderCache==null||this.renderCache.diff!==e||this.editSessionActive)return;let{options:n}=this.getRenderOptions(e);qm(n,t.options)&&(this.renderCache={diff:e,options:t.options,highlighted:!0,result:t.result,renderRange:void 0},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.diff.cacheKey!=null&&this.workerManager?.evictDiffFromCache(e.diff.cacheKey)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??oe}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){if(this.renderCache==null)return!1;let{result:r,diff:i}=this.renderCache;if(r==null)return!1;if(i.isPartial)throw Error(`Could not update render cache for partial diff`);let a=r.code.additionLines,o=[],s=new Map;for(let[t,n]of e){let e=a[t]?.properties??{},r=n.map(e=>e[2]).join(``),c=t<i.additionLines.length,l=c?i.additionLines[t]??``:``,u=ge(l);c&&(i.additionLines[t]=qp(l,r),u!==r&&(o.push(t),s.set(t,l))),a[t]={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})}}let c=!1;if(o.length>0){if(this.editSessionActive&&!i.isPartial){if(!n){if(i.additionLines.length<=1&&i.additionLines.join(``)===``)Object.assign(i,Dh(i,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else if(Th(i,i.additionLines))Object.assign(i,Eh(i,i.additionLines,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else{let e=Gh(i,o,this.options.parseDiffOptions,s);this.applyExpansionRemap(e),c=e!=null}}}else Object.assign(i,jh(i,o,this.options.parseDiffOptions))}return r.baseThemeType=t,this.renderCache.isDirty=!0,c}applyExpansionRemap(e){e!=null&&(this.expandedHunks=Yh(this.expandedHunks,e))}applyDocumentChange(e){if(this.renderCache==null)return;let{diff:t,result:n}=this.renderCache;if(n==null)return;if(t.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:r}=t;t.additionLines=Og(e,r),n.code.additionLines=Eg(r,t.additionLines,n.code.additionLines,e),t.additionLines.length<=1&&t.additionLines.join(``)===``?(Object.assign(t,Dh(t,this.options.parseDiffOptions)),n.code.additionLines[0]=Dg(0,e.getLineText(0)),this.markEditSessionPass(t)):this.editSessionActive?this.applySessionDocumentChange(t):Object.assign(t,Oh(t,this.options.parseDiffOptions)),this.renderCache.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(Th(e,n)){Object.assign(e,Eh(e,n,t)),this.markEditSessionPass(e);return}this.applyExpansionRemap(Wh(e,t))}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>Qf(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=k,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=ae,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await Wf(sp(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=jg(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!qm(t,r.options)&&(r=void 0),this.renderCache??={diff:e,highlighted:!n&&!mg(e),options:t,result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLang=e.lang??Q(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??k}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!Pm(e,n.diff)||!qm(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=se){if(e==null)return;let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getMatchingWorkerResultCache(e,i);o!=null&&!this.hasHighlightedRenderCache(e,i)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...o},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||mg(e)||jg(e,this.getTokenizeMaxLength()),l=!Pm(e,this.renderCache.diff),u=!Zf(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!l&&eh(t);o&&(this.renderCache.highlightPending=!0),!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,eh(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLang=e.lang??Q(e.name);let t=this.highlighter!=null&&Jf(i.theme),n=this.highlighter!=null&&ca(this.computedLang),r=!c&&n;if(this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=se){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 rp({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=jg(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Q(e.name);let n=this.highlighter!=null&&Jf(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&ca(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=vh(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(uh({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=Dg(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){if(this.renderCache==null)return;let i=this.renderCache.highlightPending===!0||!this.renderCache.highlighted||!qm(this.renderCache.options,n)||!Pm(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!qm(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&Pm(e,n.diff)&&qm(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1;this.diff=e;let f=a===`unified`,p=Mg(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:Mt(),deletionsGutterAST:Mt(),additionsGutterAST:Mt(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=oh({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(x.pushToGutter(`additions`,P(void 0,`buffer`,this.size)),h?.push(Jm(this.size))):(x.pushToGutter(`deletions`,P(void 0,`buffer`,this.size)),g?.push(Jm(this.size))),this.size=0,this.side=void 0}}},w=(e,t,n,r,i)=>{x.pushToGutter(e,Nt(t,n,r,i))};function T(e){C.flush(),a===`unified`?Cg(`unified`,e,x):(Cg(`deletions`,e,x),Cg(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),uh({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&T({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&bg(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});w(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=wg(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=wg(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),Sg({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&bg(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&xg(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=wg(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);w(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=wg(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);w(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}Sg({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&xg(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),E=_?n.noEOFCRDeletions:!1,ee=_?n.noEOFCRAdditions:!1,D=(s?.noEOFCR??!1)||E,O=(o?.noEOFCR??!1)||ee;if(O||D){if(a===`split`&&C.flush(),D){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(Ym(e)),x.pushToGutter(`unified`,P(e,`metadata`,1))):(x.deletionsContentAST.push(Ym(e)),x.pushToGutter(`deletions`,P(e,`metadata`,1)),O||(x.pushToGutter(`additions`,P(void 0,`buffer`,1)),x.additionsContentAST.push(Jm(1))))}if(O){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(Ym(e)),x.pushToGutter(`unified`,P(e,`metadata`,1))):(x.additionsContentAST.push(Ym(e)),x.pushToGutter(`additions`,P(e,`metadata`,1)),D||(x.pushToGutter(`deletions`,P(void 0,`buffer`,1)),x.deletionsContentAST.push(Jm(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&T({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let E=Math.max($m(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),ee=t.bufferBefore>0||t.bufferAfter>0,D=!f&&e.type!==`deleted`,O=!f&&e.type!==`new`,te=x.rowCount>0||ee;h=D&&te?h:void 0,g=O&&te?g:void 0,_=f&&te?_:void 0;let k=this.createPreElement(g!=null&&h!=null,E);return{unifiedGutterAST:f&&te?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:O&&te?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:D&&te?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:k,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:E,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=Mt(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,Jp(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 H(this.renderFullAST(e,t))}renderPartialHTML(e,t){return H(t==null?e:N({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!Kp(n))return;let i=e.type===`new`?[]:_g(Gp(this.deletionAnnotations)),a=e.type===`deleted`?[]:_g(Gp(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){Sg({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}Sg({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(cp(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(cp(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return ep({fileOrDiff:e,mode:t,stickyHeader:n})}};function _g(e){return e?.map(e=>cp(e))??[]}var vg=new Intl.PluralRules(`en-US`);function yg(e){return`${e} unmodified line${vg.select(e)===`one`?``:`s`}`}function bg(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function xg(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 Sg({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`,P(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`,P(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`,P(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function Cg(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,Zm({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(Zm({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,Zm({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(Zm({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=Qm(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?yg(n):`More unchanged context may be available`;c.pushToGutter(e,Zm({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(Zm({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function wg(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function Tg(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function Eg(e,t,n,r){let i=Tg(e),a=Tg(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let r=e.length;r<t.length;r++)l[r]??=n[r];for(let e=s;e<t.length;e++)l[e]??=Dg(e,r.getLineText(e));return l}function Dg(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function Og(e,t){let n=[],r=Ag(t);for(let t=0;t<e.lineCount;t++){let i=e.getLineText(t,!0);n.push(t<e.lineCount-1&&!kg(i)?i+r:i)}return n}function kg(e){return e.endsWith(` +`)||e.endsWith(`\r`)}function Ag(e){for(let t of e){if(t.endsWith(`\r +`))return`\r +`;if(t.endsWith(` +`))return` +`;if(t.endsWith(`\r`))return`\r`}return` +`}function jg(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function Mg(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function Ng(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function Pg(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}async function Fg(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function Ig({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function Lg(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Sm(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader==null?`default`:`custom`}}ki();function Rg(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}var zg=-1,Bg=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++zg}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;pendingFiles;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:k},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new Xi,this.scrollSyncManager=new Km,this.interactionManager=new Ai(`diff`,ji(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 Lg(e)}createHunksRenderer(e){return new gg(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{let n=this.fileDiffCache;if(n==null)return;let r=n.hunks.at(-1),i,a;hunkIterator:for(let o of n.hunks){let n=t===`deletions`?o.deletionStart:o.additionStart,s=t===`deletions`?o.deletionCount:o.additionCount,c=Ce(n,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(e<c){let t=c-e;i=Math.max(u-t,0),a=Math.max(l-t,0);break hunkIterator}if(e>=c+s){if(o===r){let t=e-(c+s);i=u+o.unifiedLineCount+t,a=l+o.splitLineCount+t;break hunkIterator}continue}for(let n of o.hunkContent)if(n.type===`context`){if(e<c+n.lines){let t=e-c;a=l+t,i=u+t;break hunkIterator}c+=n.lines,l+=n.lines,u+=n.lines}else{let r=t===`deletions`?n.deletions:n.additions;if(e<c+r){let r=e-c;i=u+(t===`additions`?n.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(n.deletions,n.additions),u+=n.deletions+n.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(ji(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme==`string`||this.fileContainer==null||this.appliedThemeCSS==null)return!1;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!me(this.appliedThemeCSS.theme,this.options.theme??k)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||typeof this.options.hunkSeparators==`function`)}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??`additions`})}flushDeferredLineState(){let{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}let{diffStyle:e=`split`,overflow:t=`scroll`}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t===`wrap`,columnVariables:this.shouldApplyColumnVariables(t)?`apply`:`measure`}),t===`scroll`&&e===`split`?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators==`function`||e===`scroll`&&(this.lineAnnotations.length>0||this.pre?.hasAttribute(`data-has-merge-conflict`)===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){fe(this.handleEditSessionRender),this.emitPostRender(!0),this.editor?.cleanUp(e),this.editor=void 0,this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,this.pendingFiles=void 0,this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=Ig(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t),Wg(this.pre,Hg({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||Gg(this.headerElement,Ug({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),ym(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)!(e instanceof HTMLElement)||e.tagName.toLowerCase()!==`code`||(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute(`data-dehydrated`)),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?Et(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;e==null||t==null||!Rg(e)||this.pendingFiles?.fileDiff===e||(this.pendingFiles={fileDiff:e,promise:this.loadFilesForDiff(e,t)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}finally{this.pendingFiles?.fileDiff===e&&(this.pendingFiles=void 0)}}async handleFilesLoaded(e,t){this.fileDiff!==e||!e.isPartial||(Lm(`merge`,e,t),this.setHydratedState(t),await Fg(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender())}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){let l=Ig(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);e!=null&&e.cacheKey===void 0&&(e.cacheKey=e.prevName==null?e.name:e.prevName+`:`+e.name),this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!Vg(u,this.deletionFile)||!Vg(d,this.additionFile)),y=e!=null&&e!==this.fileDiff,b=i!=null&&(i.length>0||this.lineAnnotations.length>0)&&i!==this.lineAnnotations;if(!f&&Zf(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&e===this.fileDiff||e==null&&!v))return this.applyCachedThemeState(p);let x;e==null&&_&&(v||this.fileDiff==null)&&(x=Et(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;if(this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e==null?x!=null&&(y=!0,this.fileDiff=x):this.fileDiff=e,y&&(this.cachedHeaderHTML=void 0),i!=null&&this.setLineAnnotations(i),this.fileDiff==null)return!1;this.fileDiff.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(Qh(this.fileDiff,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:C=!1,disableFileHeader:w=!1}=this.options;if(w&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,ce);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g)&&this.applyPartialRender({previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}get fileDiffCache(){return this.hunksRenderer.diffCache??this.fileDiff}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.fileDiffCache,r=this.lineAnnotations,i=this.computeEditorRenderRange(this.renderRange);e!=null&&t!=null&&n!=null&&!n.isPartial&&this.hunksRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.fileDiffCache!==n||e.__syncRenderView(a,t,n,r,i)})}computeEditorRenderRange(e){let t=this.fileDiffCache;if(e==null||t==null||eh(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return uh({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.attachEditor: cannot attach an editor to a "${this.type}" diff`);return this.editor?.cleanUp(),this.editor=e,this.hunksRenderer.beginEditSession(),this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary(),this.hunksRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),e=>{this.editor=void 0,e!==!0&&this.finishEditSession()}}finishEditSession(){this.hunksRenderer.endEditSession(),this.completeEditSession()}completeEditSession(){let e=this.fileDiffCache;if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=Xh(e,this.hunksRenderer.getExpandedHunksMap(),t);return Qh(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(Zh(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){this.hunksRenderer.applyDocumentChange(e);let n=this.hunksRenderer.diffCache;if(n!=null){let e=this.fileDiff?.cacheKey;e!=null&&n.cacheKey==null&&(n.cacheKey=e),this.fileDiff=n}t!==void 0&&t!==this.lineAnnotations&&(this.setLineAnnotations(t),this.hunksRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations()),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let{shouldRefreshDiffsView:r,lineCountChangeInFlight:i}=n;if(this.hunksRenderer.updateRenderCache(e,t,i)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}r===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle===`split`?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}isLineRenderable(e){let t=this.fileDiffCache;if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return ch({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.fileDiffCache;if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return lh({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.fileDiffCache,{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=rh(o);if(e<s){let c=ih({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=sh({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=rh(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){de(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||mg(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!Pg(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}-${cp(r)}`,a=this.annotationCache.get(i);if(a==null||!Ng(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:am(cp(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=om();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:xm(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):xm(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=em;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});return this.pre==null?(this.pre=document.createElement(`pre`),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(let t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute(`data-unified`)?this.codeUnified=t:t.hasAttribute(`data-deletions`)?this.codeDeletions=t:t.hasAttribute(`data-additions`)&&(this.codeAdditions=t))}applyHeaderToDOM(e,t){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,r=this.cachedHeaderHTML??H(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:a,renderHeaderFilenameSuffix:o,renderHeaderMetadata:s}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,te,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let c=a?.(n)??void 0,l=o?.(n)??void 0,u=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,ee,c),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,D,l),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,O,u),this.headerCustom?.remove(),this.headerCustom=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}(this.unsafeCSSStyle?.parentNode!==t||this.appliedUnsafeCSS!==e)&&(this.unsafeCSSStyle??=sm(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=mm(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??k,s=typeof o==`string`?o:{...o},c=um(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=Tm({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:hm(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=gm(this.themeCSSStyle.textContent??``,um(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&Om()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?wm(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=Kg(t[0]),a=Kg(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=H(i),r.content.innerHTML=H(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=vm({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=vm({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=vm({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:a,options:{diffStyle:o=`split`}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let s=this.getCodeColumns(o,r,a,i);if(s==null)return!1;let c=e.startingLine,l=t.startingLine,u=c+e.totalLines,d=l+t.totalLines,f=Math.max(c,l),p=Math.min(u,d);if(p<=f)return!1;let m=Math.max(0,f-c),h=Math.max(0,u-p),g=this.trimColumns({columns:s,trimStart:m,trimEnd:h,previousStart:c,overlapStart:f,overlapEnd:p,diffStyle:o});if(g<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let _=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(l,Math.max(f-l,0));if(y==null&&l<f)return!1;let b=v(p,Math.max(d-p,0));if(b==null&&d>p)return!1;let x=(e,t)=>{if(e!=null){if(o===`unified`&&!Array.isArray(s))this.insertPartialHTML(o,s,e,t);else if(o===`split`&&Array.isArray(s))this.insertPartialHTML(o,s,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);_+=e.rowCount}};return this.cleanupErrorWrapper(),x(y,`afterbegin`),x(b,`beforeend`),this.lastRowCount!==_&&(this.applyRowSpan(o,s,_),this.lastRowCount=_),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){if(this.options.diffStyle!==`split`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(t))return;let n=(t,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(t,e),i=Kg(r?.[0]),a=Kg(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};n(`deletions`,t[0]),n(`additions`,t[1])}refreshUnifiedDiffView(){if(this.options.diffStyle!==`unified`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(t==null||Array.isArray(t))return;let n=this.hunksRenderer.renderCodeAST(`unified`,e),r=Kg(n?.[0]),i=Kg(n?.[1]),a=()=>{for(let[e,n]of[[t.gutter,r],[t.content,i]])n!=null&&(e.innerHTML=H(n));e.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,t,e.rowCount),this.lastRowCount=e.rowCount)};this.shouldGuardRebuildScroll()?wm(this.pre,a):a(),this.renderSeparators(e.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=Kg(t[0]),i=Kg(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let t=Number.parseInt(e?.bufferSize??``,10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty(`grid-row`,`span ${t}`),e.style.setProperty(`min-height`,`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore??(this.bufferBefore=document.createElement(`div`),this.bufferBefore.dataset.virtualizerBuffer=`before`,e.before(this.bufferBefore)),this.bufferBefore.style.setProperty(`height`,`${t.bufferBefore}px`),this.bufferBefore.style.setProperty(`contain`,`strict`)):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter??(this.bufferAfter=document.createElement(`div`),this.bufferAfter.dataset.virtualizerBuffer=`after`,e.after(this.bufferAfter)),this.bufferAfter.style.setProperty(`height`,`${t.bufferAfter}px`),this.bufferAfter.style.setProperty(`contain`,`strict`)):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};nm(u,this.appliedPreAttributes)||(bm(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function Vg(e,t){return e==null||t==null?e==null&&t==null:Ot(e,t)}function Hg({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function Ug({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function Wg(e,t,n=!1){return!n&&e==null&&t}function Gg(e,t,n=!1){return e==null&&t&&!n}function Kg(e){if(e!=null&&e.type===`element`)return e.children??[]}var qg=`extension.markeditVersionBrowser`,Jg={wrapLines:!0,showLineNumbers:!0,lineDiff:`word-alt`,expandUnchanged:!1,expansionLineCount:20,diffIndicators:`classic`,hunkSeparators:`line-info`},Yg=[`word-alt`,`word`,`char`,`none`],Xg=[`classic`,`bars`,`none`],Zg=[`simple`,`metadata`,`line-info`,`line-info-basic`];function Qg(e){let t=e_(e_(e)[qg]);return{wrapLines:t_(t.wrapLines,Jg.wrapLines),showLineNumbers:t_(t.showLineNumbers,Jg.showLineNumbers),lineDiff:r_(t.lineDiff,Yg,Jg.lineDiff),expandUnchanged:t_(t.expandUnchanged,Jg.expandUnchanged),expansionLineCount:n_(t.expansionLineCount,Jg.expansionLineCount,1,100),diffIndicators:r_(t.diffIndicators,Xg,Jg.diffIndicators),hunkSeparators:r_(t.hunkSeparators,Zg,Jg.hunkSeparators)}}var $g=Qg(r.MarkEdit.userSettings);function e_(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function t_(e,t){return typeof e==`boolean`?e:t}function n_(e,t,n,r){return typeof e==`number`&&Number.isInteger(e)?Math.min(Math.max(e,n),r):t}function r_(e,t,n){return typeof e==`string`&&t.includes(e)?e:n}var i_=`markedit-version-browser.diff-style`,a_={dark:`github-dark-default`,light:`github-light-default`},o_=`[data-gutter] { -webkit-user-select: none; user-select: none; }`;function s_(){try{let e=localStorage.getItem(i_);if(e===`unified`||e===`split`)return e}catch{}return`unified`}function c_(e){try{localStorage.setItem(i_,e)}catch{}}function l_(e,t,n,r){let i={theme:a_,disableFileHeader:!0,disableLineNumbers:!$g.showLineNumbers,overflow:$g.wrapLines?`wrap`:`scroll`,unsafeCSS:o_};if(n===t){let t=new jm({...i});return t.render({file:{name:`document.md`,contents:n,lang:`markdown`},containerWrapper:e}),t}let a=new Bg({...i,diffStyle:r,diffIndicators:$g.diffIndicators,hunkSeparators:$g.hunkSeparators,lineDiffType:$g.lineDiff,expandUnchanged:$g.expandUnchanged,expansionLineCount:$g.expansionLineCount});return a.render({oldFile:{name:`document.md`,contents:t,lang:`markdown`},newFile:{name:`document.md`,contents:n,lang:`markdown`},containerWrapper:e}),a}var u_;async function d_(e,t){let n=await r.MarkEdit.getFileVersions(),i=n[0];if(i===void 0)return n;let a;try{a=await r.MarkEdit.getFileVersionContent(i.id)}catch{return n}return a===void 0?n:(t.set(i.id,a),a===e?n.slice(1):n)}function f_(){if(typeof r.MarkEdit.getFileVersions!=`function`){r.MarkEdit.showAlert({title:`Version Browser Unavailable`,message:`This version of MarkEdit does not support file version history.`,buttons:[`OK`,`Get Latest Version`]}).then(e=>{e>0&&open(`https://github.com/MarkEdit-app/MarkEdit/releases/latest`)});return}u_?.();let e=r.MarkEdit.editorView,t=r.MarkEdit.editorAPI.getText(),n=s_(),s=g(n);if(s===void 0)return;let{overlay:c,versionSelect:u,status:d,diffContainer:f,restoreButton:p,deleteButton:m,closeButton:h,layoutButtons:b}=s,x=y(),S=e.dom,C=()=>{let e=S.getBoundingClientRect();Object.assign(c.style,{top:`${e.top}px`,left:`${e.left}px`,width:`${e.width}px`,height:`${e.height}px`})};document.body.appendChild(c),C(),requestAnimationFrame(()=>c.classList.add(`is-visible`)),e.contentDOM.blur();let w=[],T,E,ee,D=!1,O=!1,te=!1,k=new Map,ne=i(),re=new ResizeObserver(C);re.observe(S);let ie=()=>r.MarkEdit.editorView===e,A=l(d,f,()=>O),ae=()=>{let e=T?.isLocal===!1,n=T!==void 0&&e&&k.has(T.id);a(s,{busy:D,hasVersions:w.length>0,selectedVersion:T,isDownloaded:n,hasDifferences:E===void 0?void 0:E!==t})},oe=(e,t)=>{e&&ne.invalidate(),D=e,c.setAttribute(`aria-busy`,String(e)),t!==void 0&&A.show(t,!0),ae()},se=()=>{T!==void 0&&E!==void 0&&(ee?.cleanUp(),f.replaceChildren(),ee=l_(f,t,E,n),A.hide(),f.hidden=!1)},ce=async e=>{T=e,E=void 0,u.value=e.id;let t=ne.begin(),n=k.has(e.id);c.setAttribute(`aria-busy`,`true`);let i=n?void 0:A.show(`Fetching contents...`,!0);if(i===void 0&&A.hide(),ae(),O||!ne.isCurrent(t))return;let a=k.get(e.id);if(!n){try{a=await r.MarkEdit.getFileVersionContent(e.id)}catch{!O&&ne.isCurrent(t)&&(c.setAttribute(`aria-busy`,`false`),A.show(`The version could not be loaded.`));return}a!==void 0&&k.set(e.id,a)}if(!(O||!ne.isCurrent(t))){if(!ie()){pe();return}if(c.setAttribute(`aria-busy`,`false`),a===void 0){A.show(`This version is no longer available.`);return}i!==void 0&&await A.settle(i),!(O||!ne.isCurrent(t))&&(E=a,ae(),se())}},le=()=>{if(u.setAttribute(`aria-busy`,`false`),w.length===0){u.replaceChildren(new Option(`No saved versions`)),u.disabled=!0,A.show(`No saved versions are available for this document.`);return}_(u,w),u.disabled=!1,ce(w[0])},ue=async()=>{if(w=[],T=void 0,E=void 0,oe(!0,`Loading versions...`),u.disabled=!0,u.replaceChildren(new Option),u.setAttribute(`aria-busy`,`true`),!O){try{w=await d_(t,k)}catch{O||(u.setAttribute(`aria-busy`,`false`),oe(!1),A.show(`Version history could not be loaded.`));return}if(O||!ie()){pe();return}oe(!1),le()}},de=async()=>{if(T===void 0||E===void 0||E===t||D)return;let e=T;if(!ie()||(oe(!0,`Restoring version...`),O))return;let n=!1;try{n=await r.MarkEdit.restoreFileVersion(e.id)}catch{n=!1}O||(n?pe():(oe(!1),A.show(`The version could not be restored.`)))},fe=async()=>{if(T===void 0||!T.isLocal||D)return;let e=T;if(await r.MarkEdit.showAlert({title:`Delete This Version?`,message:`This action cannot be undone.`,buttons:[`Delete`,`Cancel`]})!==0||!ie()||(oe(!0,`Deleting version...`),O))return;let t=!1;try{t=await r.MarkEdit.deleteLocalFileVersions([e.id])}catch{t=!1}O||(t?(k.delete(e.id),ee?.cleanUp(),ee=void 0,await ue()):(oe(!1),A.show(`The version could not be deleted.`)))},pe=()=>{if(O)return;O=!0,ne.invalidate(),A.dispose(),window.removeEventListener(`keydown`,me,!0),c.classList.remove(`is-visible`),c.style.pointerEvents=`none`;let t=()=>{te||(te=!0,ee?.cleanUp(),re.disconnect(),c.remove(),x.remove(),u_===pe&&(u_=void 0,ie()&&e.focus()))};c.addEventListener(`transitionend`,t,{once:!0});let n=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:180;window.setTimeout(t,n)};b.forEach(e=>{e.addEventListener(`click`,()=>{n=e.dataset.style===`split`?`split`:`unified`,c_(n),v(b,n),se()})}),p.addEventListener(`click`,()=>void de()),m.addEventListener(`click`,()=>void fe()),h.addEventListener(`click`,pe),u.addEventListener(`change`,()=>{let e=w.find(e=>e.id===u.value);e!==void 0&&ce(e)}),c.addEventListener(`pointerdown`,()=>c.classList.remove(`is-keyboard-navigation`));let me=e=>{if(e.key===`Tab`){c.classList.add(`is-keyboard-navigation`),o(c,e);return}if(e.key===`Escape`&&!D){e.preventDefault(),e.stopPropagation(),pe();return}if(e.key!==`ArrowUp`&&e.key!==`ArrowDown`||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||D||w.length===0)return;e.preventDefault(),e.stopPropagation();let t=e.key===`ArrowUp`?-1:1,n=w.findIndex(e=>e.id===T?.id),r=Math.min(Math.max(n+t,0),w.length-1);r!==n&&ce(w[r])};window.addEventListener(`keydown`,me,!0),u_=pe,c.focus(),ue()}r.MarkEdit.addMainMenuItem({title:`Browse Versions`,icon:`clock.arrow.circlepath`,action:f_}); \ No newline at end of file diff --git a/main.ts b/main.ts new file mode 100644 index 0000000..99c7bb3 --- /dev/null +++ b/main.ts @@ -0,0 +1,8 @@ +import { MarkEdit } from 'markedit-api'; +import { showVersionBrowser } from './src/browser'; + +MarkEdit.addMainMenuItem({ + title: 'Browse Versions', + icon: 'clock.arrow.circlepath', + action: showVersionBrowser, +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..69a7e81 --- /dev/null +++ b/package.json @@ -0,0 +1,29 @@ +{ + "name": "markedit-version-browser", + "version": "1.0.0", + "description": "Browse version history with nicely rendered diffs.", + "scripts": { + "build": "vite build", + "test": "vitest run", + "reload": "osascript -e 'quit app \"MarkEdit\"' -e 'delay 1' -e 'launch app \"MarkEdit\"'", + "uninstall": "rm ~/Library/Containers/app.cyan.markedit/Data/Documents/scripts/$(node -p \"require('./package.json').name\").js" + }, + "license": "MIT", + "devDependencies": { + "@codemirror/commands": "^6.0.0", + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0", + "@types/node": "^22.0.0", + "jsdom": "^30.0.1", + "markedit-api": "https://github.com/MarkEdit-app/MarkEdit-api#v0.33.0", + "markedit-vite": "https://github.com/MarkEdit-app/MarkEdit-vite#v0.6.0", + "typescript": "^7.0.0", + "vite": "^8.0.0", + "vitest": "^4.1.11", + "vite-plugin-singlefile": "^2.3.3" + }, + "dependencies": { + "@pierre/diffs": "^1.3.6" + } +} diff --git a/src/browser.ts b/src/browser.ts new file mode 100644 index 0000000..00587df --- /dev/null +++ b/src/browser.ts @@ -0,0 +1,418 @@ +import type { FileVersion } from 'markedit-api'; +import { MarkEdit } from 'markedit-api'; +import { createRequestGate, keepFocusWithinBrowser, updateBrowserActions } from './interaction'; +import { createBrowserStatus } from './status'; +import { createBrowserElements, installBrowserStyle, populateVersionSelect, setLayoutButtonState } from './view'; +import { createDiff, getStoredDiffStyle, storeDiffStyle, type RenderedDiff } from './diff'; + +let closeBrowserHandler: (() => void) | undefined; + +async function getBrowsableVersions( + currentContent: string, + contentCache: Map<string, string>, +): Promise<FileVersion[]> { + const versions = await MarkEdit.getFileVersions(); + const latestVersion = versions[0]; + if (latestVersion === undefined) { + return versions; + } + + let latestContent: string | undefined; + try { + latestContent = await MarkEdit.getFileVersionContent(latestVersion.id); + } catch { + return versions; + } + + if (latestContent === undefined) { + return versions; + } + + contentCache.set(latestVersion.id, latestContent); + return latestContent === currentContent ? versions.slice(1) : versions; +} + +export function showVersionBrowser(): void { + if (typeof MarkEdit.getFileVersions !== 'function') { + void MarkEdit.showAlert({ + title: 'Version Browser Unavailable', + message: 'This version of MarkEdit does not support file version history.', + buttons: ['OK', 'Get Latest Version'], + }).then((choice) => { + if (choice > 0) { + open('https://github.com/MarkEdit-app/MarkEdit/releases/latest'); + } + }); + + return; + } + + closeBrowserHandler?.(); + const editorView = MarkEdit.editorView; + const currentContent = MarkEdit.editorAPI.getText(); + let diffStyle = getStoredDiffStyle(); + const elements = createBrowserElements(diffStyle); + if (elements === undefined) { + return; + } + + const { + overlay, + versionSelect, + status, + diffContainer, + restoreButton, + deleteButton, + closeButton, + layoutButtons, + } = elements; + + const style = installBrowserStyle(); + const editorElement = editorView.dom; + const positionOverlay = () => { + const bounds = editorElement.getBoundingClientRect(); + Object.assign(overlay.style, { + top: `${bounds.top}px`, + left: `${bounds.left}px`, + width: `${bounds.width}px`, + height: `${bounds.height}px`, + }); + }; + + document.body.appendChild(overlay); + positionOverlay(); + requestAnimationFrame(() => overlay.classList.add('is-visible')); + editorView.contentDOM.blur(); + + let versions: FileVersion[] = []; + let selectedVersion: FileVersion | undefined; + let selectedContent: string | undefined; + let diff: RenderedDiff | undefined; + let busy = false; + let closing = false; + let cleanedUp = false; + + const contentCache = new Map<string, string>(); + const requestGate = createRequestGate(); + const resizeObserver = new ResizeObserver(positionOverlay); + resizeObserver.observe(editorElement); + + const isCurrentContext = () => MarkEdit.editorView === editorView; + const browserStatus = createBrowserStatus(status, diffContainer, () => closing); + + const updateActions = () => { + const isNonlocal = selectedVersion?.isLocal === false; + const isDownloaded = selectedVersion !== undefined && isNonlocal && contentCache.has(selectedVersion.id); + + updateBrowserActions(elements, { + busy, + hasVersions: versions.length > 0, + selectedVersion, + isDownloaded, + hasDifferences: selectedContent === undefined ? undefined : selectedContent !== currentContent, + }); + }; + + const setBusy = (value: boolean, message?: string) => { + if (value) { + requestGate.invalidate(); + } + + busy = value; + overlay.setAttribute('aria-busy', String(value)); + if (message !== undefined) { + browserStatus.show(message, true); + } + + updateActions(); + }; + + const renderDiff = () => { + if (selectedVersion === undefined || selectedContent === undefined) { + return; + } + + diff?.cleanUp(); + diffContainer.replaceChildren(); + diff = createDiff(diffContainer, currentContent, selectedContent, diffStyle); + browserStatus.hide(); + diffContainer.hidden = false; + }; + + const selectVersion = async(version: FileVersion) => { + selectedVersion = version; + selectedContent = undefined; + versionSelect.value = version.id; + const currentRequest = requestGate.begin(); + const hasCachedContent = contentCache.has(version.id); + overlay.setAttribute('aria-busy', 'true'); + const loadingStatusID = hasCachedContent ? undefined : browserStatus.show('Fetching contents...', true); + if (loadingStatusID === undefined) { + browserStatus.hide(); + } + + updateActions(); + if (closing || !requestGate.isCurrent(currentRequest)) { + return; + } + + let content = contentCache.get(version.id); + if (!hasCachedContent) { + try { + content = await MarkEdit.getFileVersionContent(version.id); + } catch { + if (!closing && requestGate.isCurrent(currentRequest)) { + overlay.setAttribute('aria-busy', 'false'); + browserStatus.show('The version could not be loaded.'); + } + + return; + } + + if (content !== undefined) { + contentCache.set(version.id, content); + } + } + + if (closing || !requestGate.isCurrent(currentRequest)) { + return; + } + + if (!isCurrentContext()) { + close(); + return; + } + + overlay.setAttribute('aria-busy', 'false'); + if (content === undefined) { + browserStatus.show('This version is no longer available.'); + return; + } + + if (loadingStatusID !== undefined) { + await browserStatus.settle(loadingStatusID); + } + + if (closing || !requestGate.isCurrent(currentRequest)) { + return; + } + + selectedContent = content; + updateActions(); + renderDiff(); + }; + + const renderVersions = () => { + versionSelect.setAttribute('aria-busy', 'false'); + if (versions.length === 0) { + versionSelect.replaceChildren(new Option('No saved versions')); + versionSelect.disabled = true; + browserStatus.show('No saved versions are available for this document.'); + return; + } + + populateVersionSelect(versionSelect, versions); + versionSelect.disabled = false; + void selectVersion(versions[0]); + }; + + const reloadVersions = async() => { + versions = []; + selectedVersion = undefined; + selectedContent = undefined; + setBusy(true, 'Loading versions...'); + versionSelect.disabled = true; + versionSelect.replaceChildren(new Option()); + versionSelect.setAttribute('aria-busy', 'true'); + + if (closing) { + return; + } + + try { + versions = await getBrowsableVersions(currentContent, contentCache); + } catch { + if (!closing) { + versionSelect.setAttribute('aria-busy', 'false'); + setBusy(false); + browserStatus.show('Version history could not be loaded.'); + } + + return; + } + + if (closing || !isCurrentContext()) { + close(); + return; + } + + setBusy(false); + renderVersions(); + }; + + const restoreVersion = async() => { + if (selectedVersion === undefined || selectedContent === undefined || selectedContent === currentContent || busy) { + return; + } + + const versionToRestore = selectedVersion; + if (!isCurrentContext()) { + return; + } + + setBusy(true, 'Restoring version...'); + if (closing) { + return; + } + + let restored = false; + try { + restored = await MarkEdit.restoreFileVersion(versionToRestore.id); + } catch { + restored = false; + } + + if (closing) { + return; + } + + if (restored) { + close(); + } else { + setBusy(false); + browserStatus.show('The version could not be restored.'); + } + }; + + const deleteVersion = async() => { + if (selectedVersion === undefined || !selectedVersion.isLocal || busy) { + return; + } + + const versionToDelete = selectedVersion; + const choice = await MarkEdit.showAlert({ + title: 'Delete This Version?', + message: 'This action cannot be undone.', + buttons: ['Delete', 'Cancel'], + }); + + if (choice !== 0 || !isCurrentContext()) { + return; + } + + setBusy(true, 'Deleting version...'); + if (closing) { + return; + } + + let deleted = false; + try { + deleted = await MarkEdit.deleteLocalFileVersions([versionToDelete.id]); + } catch { + deleted = false; + } + + if (closing) { + return; + } + + if (deleted) { + contentCache.delete(versionToDelete.id); + diff?.cleanUp(); + diff = undefined; + await reloadVersions(); + } else { + setBusy(false); + browserStatus.show('The version could not be deleted.'); + } + }; + + const close = () => { + if (closing) { + return; + } + + closing = true; + requestGate.invalidate(); + browserStatus.dispose(); + window.removeEventListener('keydown', handleKeyDown, true); + overlay.classList.remove('is-visible'); + overlay.style.pointerEvents = 'none'; + + const cleanUp = () => { + if (cleanedUp) { + return; + } + + cleanedUp = true; + diff?.cleanUp(); + resizeObserver.disconnect(); + overlay.remove(); + style.remove(); + + if (closeBrowserHandler === close) { + closeBrowserHandler = undefined; + if (isCurrentContext()) { + editorView.focus(); + } + } + }; + + overlay.addEventListener('transitionend', cleanUp, { once: true }); + const delay = window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 0 : 180; + window.setTimeout(cleanUp, delay); + }; + + layoutButtons.forEach((button) => { + button.addEventListener('click', () => { + diffStyle = button.dataset.style === 'split' ? 'split' : 'unified'; + storeDiffStyle(diffStyle); + setLayoutButtonState(layoutButtons, diffStyle); + renderDiff(); + }); + }); + + restoreButton.addEventListener('click', () => void restoreVersion()); + deleteButton.addEventListener('click', () => void deleteVersion()); + closeButton.addEventListener('click', close); + versionSelect.addEventListener('change', () => { + const version = versions.find((candidate) => candidate.id === versionSelect.value); + if (version !== undefined) { + void selectVersion(version); + } + }); + + overlay.addEventListener('pointerdown', () => overlay.classList.remove('is-keyboard-navigation')); + const handleKeyDown = (event: KeyboardEvent) => { + if (event.key === 'Tab') { + overlay.classList.add('is-keyboard-navigation'); + keepFocusWithinBrowser(overlay, event); + return; + } + + if (event.key === 'Escape' && !busy) { + event.preventDefault(); + event.stopPropagation(); + close(); + return; + } + + if ((event.key !== 'ArrowUp' && event.key !== 'ArrowDown') || event.metaKey || event.ctrlKey || event.altKey || event.shiftKey || busy || versions.length === 0) { + return; + } + + event.preventDefault(); + event.stopPropagation(); + const offset = event.key === 'ArrowUp' ? -1 : 1; + const currentIndex = versions.findIndex((version) => version.id === selectedVersion?.id); + const nextIndex = Math.min(Math.max(currentIndex + offset, 0), versions.length - 1); + if (nextIndex !== currentIndex) { + void selectVersion(versions[nextIndex]); + } + }; + + window.addEventListener('keydown', handleKeyDown, true); + closeBrowserHandler = close; + overlay.focus(); + void reloadVersions(); +} diff --git a/src/diff.ts b/src/diff.ts new file mode 100644 index 0000000..47e0d90 --- /dev/null +++ b/src/diff.ts @@ -0,0 +1,73 @@ +import { File, FileDiff } from '@pierre/diffs'; +import { settings } from './settings'; +import type { DiffStyle } from './settings'; + +export type { DiffStyle } from './settings'; +export type RenderedDiff = File | FileDiff; + +const diffStyleStorageKey = 'markedit-version-browser.diff-style'; +const theme = { dark: 'github-dark-default', light: 'github-light-default' } as const; +const unsafeCSS = '[data-gutter] { -webkit-user-select: none; user-select: none; }'; + +export function getStoredDiffStyle(): DiffStyle { + try { + const value = localStorage.getItem(diffStyleStorageKey); + if (value === 'unified' || value === 'split') { + return value; + } + } catch {} + + return 'unified'; +} + +export function storeDiffStyle(diffStyle: DiffStyle): void { + try { + localStorage.setItem(diffStyleStorageKey, diffStyle); + } catch {} +} + +export function createDiff( + container: HTMLElement, + currentContent: string, + selectedContent: string, + diffStyle: DiffStyle, +): RenderedDiff { + const sharedOptions = { + theme, + disableFileHeader: true, + disableLineNumbers: !settings.showLineNumbers, + overflow: settings.wrapLines ? 'wrap' as const : 'scroll' as const, + unsafeCSS, + }; + + if (selectedContent === currentContent) { + const file = new File({ + ...sharedOptions, + }); + + file.render({ + file: { name: 'document.md', contents: selectedContent, lang: 'markdown' }, + containerWrapper: container, + }); + + return file; + } + + const fileDiff = new FileDiff({ + ...sharedOptions, + diffStyle, + diffIndicators: settings.diffIndicators, + hunkSeparators: settings.hunkSeparators, + lineDiffType: settings.lineDiff, + expandUnchanged: settings.expandUnchanged, + expansionLineCount: settings.expansionLineCount, + }); + + fileDiff.render({ + oldFile: { name: 'document.md', contents: currentContent, lang: 'markdown' }, + newFile: { name: 'document.md', contents: selectedContent, lang: 'markdown' }, + containerWrapper: container, + }); + + return fileDiff; +} diff --git a/src/interaction.ts b/src/interaction.ts new file mode 100644 index 0000000..dc08fc3 --- /dev/null +++ b/src/interaction.ts @@ -0,0 +1,107 @@ +import type { FileVersion } from 'markedit-api'; +import type { BrowserElements } from './view'; + +export interface RequestGate { + begin(): number; + invalidate(): void; + isCurrent(request: number): boolean; +} + +export interface BrowserActionState { + busy: boolean; + hasVersions: boolean; + selectedVersion?: FileVersion; + isDownloaded: boolean; + hasDifferences: boolean | undefined; +} + +export function createRequestGate(): RequestGate { + let currentRequest = 0; + + return { + begin() { + currentRequest += 1; + return currentRequest; + }, + + invalidate() { + currentRequest += 1; + }, + + isCurrent(request: number) { + return request === currentRequest; + }, + }; +} + +export function updateBrowserActions(elements: BrowserElements, state: BrowserActionState): void { + const { + versionSelect, + nonlocalIndicator, + restoreWrapper, + deleteWrapper, + restoreDescription, + deleteDescription, + restoreButton, + deleteButton, + layoutButtons, + } = elements; + + const disabled = state.busy || state.selectedVersion === undefined; + const isNonlocal = state.selectedVersion?.isLocal === false; + const restoreHasNoDifferences = !disabled && state.hasDifferences === false; + + nonlocalIndicator.classList.toggle('is-visible', isNonlocal); + nonlocalIndicator.setAttribute('aria-hidden', String(!isNonlocal)); + nonlocalIndicator.classList.toggle('is-downloaded', state.isDownloaded); + nonlocalIndicator.title = state.isDownloaded ? 'Downloaded from iCloud' : 'Stored in iCloud'; + nonlocalIndicator.setAttribute('aria-label', nonlocalIndicator.title); + + restoreButton.disabled = disabled || state.hasDifferences === undefined; + if (restoreHasNoDifferences) { + restoreButton.setAttribute('aria-disabled', 'true'); + restoreButton.setAttribute('aria-describedby', restoreDescription.id); + } else { + restoreButton.removeAttribute('aria-disabled'); + restoreButton.removeAttribute('aria-describedby'); + } + + restoreWrapper.title = restoreHasNoDifferences ? 'The selected version is identical to the current document.' : ''; + deleteButton.disabled = disabled; + if (isNonlocal) { + deleteButton.setAttribute('aria-disabled', 'true'); + deleteButton.setAttribute('aria-describedby', deleteDescription.id); + } else { + deleteButton.removeAttribute('aria-disabled'); + deleteButton.removeAttribute('aria-describedby'); + } + + deleteWrapper.title = isNonlocal ? 'Versions stored in iCloud cannot be deleted.' : ''; + layoutButtons.forEach((button) => button.disabled = disabled); + versionSelect.disabled = state.busy || !state.hasVersions; +} + +export function keepFocusWithinBrowser(overlay: HTMLElement, event: KeyboardEvent): void { + const focusableElements = Array.from(overlay.querySelectorAll<HTMLElement>( + 'button:not(:disabled), select:not(:disabled), [href], [tabindex]:not([tabindex="-1"])', + )); + + const firstElement = focusableElements[0]; + const lastElement = focusableElements.at(-1); + + if (firstElement === undefined || lastElement === undefined) { + event.preventDefault(); + overlay.focus(); + return; + } + + const activeElement = document.activeElement; + const focusIsOutsideControls = activeElement === overlay || !overlay.contains(activeElement); + if (event.shiftKey && (activeElement === firstElement || focusIsOutsideControls)) { + event.preventDefault(); + lastElement.focus(); + } else if (!event.shiftKey && (activeElement === lastElement || focusIsOutsideControls)) { + event.preventDefault(); + firstElement.focus(); + } +} diff --git a/src/pierre-themes.ts b/src/pierre-themes.ts new file mode 100644 index 0000000..6dc823d --- /dev/null +++ b/src/pierre-themes.ts @@ -0,0 +1,46 @@ +import { normalizeTheme } from 'shiki/core'; +import type { ThemeRegistration } from 'shiki/core'; + +type ThemeLoader = () => Promise<{ default: ThemeRegistration }>; + +interface ThemeOptions { + name: string; + colorScheme?: 'light' | 'dark'; + collection?: string; + displayName?: string; + load: ThemeLoader; +} + +export function createTheme(options: ThemeOptions) { + return { + ...options, + load: async() => normalizeTheme((await options.load()).default), + }; +} + +const descriptors = [ + createTheme({ + name: 'github-light-default', + colorScheme: 'light', + collection: 'github', + displayName: 'GitHub Light Default', + load: () => import('@shikijs/themes/github-light-default'), + }), + createTheme({ + name: 'github-dark-default', + colorScheme: 'dark', + collection: 'github', + displayName: 'GitHub Dark Default', + load: () => import('@shikijs/themes/github-dark-default'), + }), +]; + +export const pierreThemes = { + getTheme: (name: string) => descriptors.find((theme) => theme.name === name), + getThemes: () => descriptors, +}; + +export const shikiThemes = { + getTheme: () => undefined, + getThemes: () => [], +}; diff --git a/src/settings.ts b/src/settings.ts new file mode 100644 index 0000000..3ca9506 --- /dev/null +++ b/src/settings.ts @@ -0,0 +1,74 @@ +import { MarkEdit } from 'markedit-api'; + +export const settingsKey = 'extension.markeditVersionBrowser'; + +export type DiffStyle = 'unified' | 'split'; +export type LineDiff = 'word-alt' | 'word' | 'char' | 'none'; +export type DiffIndicators = 'classic' | 'bars' | 'none'; +export type HunkSeparators = 'simple' | 'metadata' | 'line-info' | 'line-info-basic'; + +export interface VersionBrowserSettings { + wrapLines: boolean; + showLineNumbers: boolean; + lineDiff: LineDiff; + expandUnchanged: boolean; + expansionLineCount: number; + diffIndicators: DiffIndicators; + hunkSeparators: HunkSeparators; +} + +export const defaultSettings: VersionBrowserSettings = { + wrapLines: true, + showLineNumbers: true, + lineDiff: 'word-alt', + expandUnchanged: false, + expansionLineCount: 20, + diffIndicators: 'classic', + hunkSeparators: 'line-info', +}; + +const lineDiffs = ['word-alt', 'word', 'char', 'none'] as const; +const diffIndicators = ['classic', 'bars', 'none'] as const; +const hunkSeparators = ['simple', 'metadata', 'line-info', 'line-info-basic'] as const; + +export function parseSettings(userSettings: unknown): VersionBrowserSettings { + const rootValue = toObject(toObject(userSettings)[settingsKey]); + + return { + wrapLines: toBoolean(rootValue.wrapLines, defaultSettings.wrapLines), + showLineNumbers: toBoolean(rootValue.showLineNumbers, defaultSettings.showLineNumbers), + lineDiff: toOption(rootValue.lineDiff, lineDiffs, defaultSettings.lineDiff), + expandUnchanged: toBoolean(rootValue.expandUnchanged, defaultSettings.expandUnchanged), + expansionLineCount: toInteger(rootValue.expansionLineCount, defaultSettings.expansionLineCount, 1, 100), + diffIndicators: toOption(rootValue.diffIndicators, diffIndicators, defaultSettings.diffIndicators), + hunkSeparators: toOption(rootValue.hunkSeparators, hunkSeparators, defaultSettings.hunkSeparators), + }; +} + +export const settings = parseSettings(MarkEdit.userSettings); + +function toObject(value: unknown): Record<string, unknown> { + return typeof value === 'object' && value !== null && !Array.isArray(value) + ? value as Record<string, unknown> + : {}; +} + +function toBoolean(value: unknown, defaultValue: boolean): boolean { + return typeof value === 'boolean' ? value : defaultValue; +} + +function toInteger(value: unknown, defaultValue: number, minimum: number, maximum: number): number { + return typeof value === 'number' && Number.isInteger(value) + ? Math.min(Math.max(value, minimum), maximum) + : defaultValue; +} + +function toOption<const Options extends readonly string[]>( + value: unknown, + options: Options, + defaultValue: Options[number], +): Options[number] { + return typeof value === 'string' && options.includes(value) + ? value + : defaultValue; +} diff --git a/src/shiki.ts b/src/shiki.ts new file mode 100644 index 0000000..afa2a97 --- /dev/null +++ b/src/shiki.ts @@ -0,0 +1,17 @@ +export { + codeToHtml, + createCssVariablesTheme, + createHighlighterCore as createHighlighter, + getTokenStyleObject, + stringifyTokenStyle, +} from 'shiki/core'; + +export { createJavaScriptRegexEngine } from 'shiki/engine/javascript'; + +export const bundledLanguages = { + markdown: () => import('@shikijs/langs/markdown'), +}; + +export function createOnigurumaEngine(): never { + throw new Error('The Oniguruma highlighter is not bundled.'); +} diff --git a/src/status.ts b/src/status.ts new file mode 100644 index 0000000..29e28ed --- /dev/null +++ b/src/status.ts @@ -0,0 +1,86 @@ +export interface BrowserStatus { + show(message: string, loading?: boolean): number; + hide(): void; + settle(id: number): Promise<void>; + dispose(): void; +} + +const spinnerDelay = 300; +const spinnerMinimumDuration = 200; + +export function createBrowserStatus( + status: HTMLElement, + diffContainer: HTMLElement, + isClosing: () => boolean, +): BrowserStatus { + let statusID = 0; + let spinnerTimer: number | undefined; + let spinnerShownAt: number | undefined; + + const dispose = () => { + statusID += 1; + window.clearTimeout(spinnerTimer); + spinnerTimer = undefined; + spinnerShownAt = undefined; + }; + + return { + show(message: string, loading = false) { + dispose(); + const currentStatusID = statusID; + + status.replaceChildren(); + status.append(message); + + if (loading) { + status.hidden = true; + spinnerTimer = window.setTimeout(() => { + spinnerTimer = undefined; + + if (!isClosing() && currentStatusID === statusID) { + const spinner = document.createElement('span'); + spinner.className = 'version-browser-spinner'; + status.prepend(spinner); + status.hidden = false; + spinnerShownAt = performance.now(); + } + }, spinnerDelay); + } else { + status.hidden = false; + } + + diffContainer.hidden = true; + return currentStatusID; + }, + + hide() { + dispose(); + status.hidden = true; + }, + + async settle(currentStatusID: number) { + if (currentStatusID !== statusID) { + return; + } + + window.clearTimeout(spinnerTimer); + spinnerTimer = undefined; + const shownAt = spinnerShownAt; + + if (shownAt === undefined) { + return; + } + + const remaining = spinnerMinimumDuration - (performance.now() - shownAt); + if (remaining > 0) { + await new Promise((resolve) => window.setTimeout(resolve, remaining)); + } + + if (currentStatusID === statusID && spinnerShownAt === shownAt) { + spinnerShownAt = undefined; + } + }, + + dispose, + }; +} diff --git a/src/view.ts b/src/view.ts new file mode 100644 index 0000000..9ef69c1 --- /dev/null +++ b/src/view.ts @@ -0,0 +1,107 @@ +import type { FileVersion } from 'markedit-api'; +import type { DiffStyle } from './diff'; +import browserCSS from '../assets/browser.css?inline'; +import browserHTML from '../assets/browser.html?raw'; +import cloudSVG from '../assets/cloud.svg?raw'; +import downloadedSVG from '../assets/downloaded.svg?raw'; + +export interface BrowserElements { + overlay: HTMLElement; + versionSelect: HTMLSelectElement; + status: HTMLElement; + diffContainer: HTMLElement; + nonlocalIndicator: HTMLElement; + restoreWrapper: HTMLElement; + deleteWrapper: HTMLElement; + restoreDescription: HTMLElement; + deleteDescription: HTMLElement; + restoreButton: HTMLButtonElement; + deleteButton: HTMLButtonElement; + closeButton: HTMLButtonElement; + layoutButtons: HTMLButtonElement[]; +} + +const versionDateFormatter = new Intl.DateTimeFormat(undefined, { + dateStyle: 'medium', + timeStyle: 'short', +}); + +// Unique identifier for each instance to ensure unique element IDs +let browserInstanceID = 0; + +export function createBrowserElements(diffStyle: DiffStyle): BrowserElements | undefined { + const overlay = document.createElement('section'); + overlay.className = 'markedit-version-browser'; + overlay.tabIndex = -1; + overlay.setAttribute('aria-label', 'Version browser'); + overlay.setAttribute('aria-modal', 'true'); + overlay.setAttribute('role', 'dialog'); + overlay.innerHTML = browserHTML; + + const versionSelect = overlay.querySelector<HTMLSelectElement>('.version-browser-select'); + const status = overlay.querySelector<HTMLElement>('.version-browser-status'); + const diffContainer = overlay.querySelector<HTMLElement>('.version-browser-diff'); + const nonlocalIndicator = overlay.querySelector<HTMLElement>('.version-browser-nonlocal'); + const restoreWrapper = overlay.querySelector<HTMLElement>('.version-browser-restore-wrapper'); + const deleteWrapper = overlay.querySelector<HTMLElement>('.version-browser-delete-wrapper'); + const restoreDescription = overlay.querySelector<HTMLElement>('.version-browser-restore-description'); + const deleteDescription = overlay.querySelector<HTMLElement>('.version-browser-delete-description'); + const restoreButton = overlay.querySelector<HTMLButtonElement>('[data-action="restore"]'); + const deleteButton = overlay.querySelector<HTMLButtonElement>('[data-action="delete"]'); + const closeButton = overlay.querySelector<HTMLButtonElement>('[data-action="close"]'); + + if (versionSelect === null || status === null || diffContainer === null || nonlocalIndicator === null || restoreWrapper === null || deleteWrapper === null || restoreDescription === null || deleteDescription === null || restoreButton === null || deleteButton === null || closeButton === null) { + return undefined; + } + + browserInstanceID += 1; + restoreDescription.id = `version-browser-restore-description-${browserInstanceID}`; + deleteDescription.id = `version-browser-delete-description-${browserInstanceID}`; + + const layoutButtons = Array.from(overlay.querySelectorAll<HTMLButtonElement>('[data-style]')); + setLayoutButtonState(layoutButtons, diffStyle); + nonlocalIndicator.innerHTML = ` + <span class="version-browser-cloud version-browser-cloud-download">${cloudSVG}</span> + <span class="version-browser-cloud version-browser-cloud-downloaded">${downloadedSVG}</span> + `; + + return { + overlay, + versionSelect, + status, + diffContainer, + nonlocalIndicator, + restoreWrapper, + deleteWrapper, + restoreDescription, + deleteDescription, + restoreButton, + deleteButton, + closeButton, + layoutButtons, + }; +} + +export function populateVersionSelect(select: HTMLSelectElement, versions: FileVersion[]): void { + const options = versions.map((version) => new Option( + versionDateFormatter.format(new Date(version.modificationDate)), + version.id, + )); + + select.replaceChildren(...options); +} + +export function setLayoutButtonState(buttons: HTMLButtonElement[], diffStyle: DiffStyle): void { + buttons.forEach((button) => { + const selected = button.dataset.style === diffStyle; + button.classList.toggle('active', selected); + button.setAttribute('aria-pressed', String(selected)); + }); +} + +export function installBrowserStyle(): HTMLStyleElement { + const style = document.createElement('style'); + style.textContent = browserCSS; + document.head.appendChild(style); + return style; +} diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/src/vite-env.d.ts @@ -0,0 +1 @@ +/// <reference types="vite/client" /> diff --git a/tests/browser.test.ts b/tests/browser.test.ts new file mode 100644 index 0000000..f476643 --- /dev/null +++ b/tests/browser.test.ts @@ -0,0 +1,404 @@ +// @vitest-environment jsdom + +import type { FileVersion } from 'markedit-api'; +import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; + +const markEdit = vi.hoisted(() => ({ + getFileVersions: vi.fn(), + getFileVersionContent: vi.fn(), + restoreFileVersion: vi.fn(), + deleteLocalFileVersions: vi.fn(), + showAlert: vi.fn(), + editorAPI: { getText: vi.fn() }, + editorView: undefined as unknown as { + dom: HTMLElement; + contentDOM: { blur(): void }; + focus(): void; + }, +})); + +const diff = vi.hoisted(() => ({ + create: vi.fn((_container: HTMLElement, _currentContent: string, _selectedContent: string, _diffStyle: string) => ({ cleanUp: vi.fn() })), + getStyle: vi.fn(() => 'unified'), + storeStyle: vi.fn(), +})); + +vi.mock('markedit-api', () => ({ MarkEdit: markEdit })); +vi.mock('../src/diff', () => ({ + createDiff: diff.create, + getStoredDiffStyle: diff.getStyle, + storeDiffStyle: diff.storeStyle, +})); + +import { showVersionBrowser } from '../src/browser'; + +describe('version browser workflow', () => { + beforeEach(() => { + vi.clearAllMocks(); + document.body.replaceChildren(); + document.head.querySelectorAll('style').forEach((style) => style.remove()); + + const editorElement = document.createElement('div'); + markEdit.editorView = { + dom: editorElement, + contentDOM: { blur: vi.fn() }, + focus: vi.fn(), + }; + + markEdit.editorAPI.getText.mockReturnValue('current'); + markEdit.showAlert.mockResolvedValue(1); + markEdit.restoreFileVersion.mockResolvedValue(false); + markEdit.deleteLocalFileVersions.mockResolvedValue(false); + + vi.stubGlobal('ResizeObserver', ResizeObserverStub); + vi.stubGlobal('requestAnimationFrame', (callback: FrameRequestCallback) => { + callback(0); + return 1; + }); + + Object.defineProperty(window, 'matchMedia', { + configurable: true, + value: vi.fn(() => ({ matches: true })), + }); + }); + + afterEach(async() => { + const overlay = document.querySelector<HTMLElement>('.markedit-version-browser'); + overlay?.querySelector<HTMLButtonElement>('[data-action="close"]')?.click(); + overlay?.dispatchEvent(new Event('transitionend')); + await Promise.resolve(); + vi.unstubAllGlobals(); + }); + + test('offers the latest release when file version history is unsupported', async() => { + const getFileVersions = markEdit.getFileVersions; + markEdit.getFileVersions = undefined as never; + markEdit.showAlert.mockResolvedValueOnce(1); + const open = vi.fn(); + vi.stubGlobal('open', open); + + showVersionBrowser(); + markEdit.getFileVersions = getFileVersions; + await flushPromises(); + + expect(markEdit.showAlert).toHaveBeenCalledWith({ + title: 'Version Browser Unavailable', + message: 'This version of MarkEdit does not support file version history.', + buttons: ['OK', 'Get Latest Version'], + }); + expect(open).toHaveBeenCalledWith('https://github.com/MarkEdit-app/MarkEdit/releases/latest'); + expect(markEdit.editorAPI.getText).not.toHaveBeenCalled(); + expect(document.querySelector('.markedit-version-browser')).toBeNull(); + }); + + test('reopened browsers use unique description IDs while overlays overlap', () => { + markEdit.getFileVersions.mockReturnValue(new Promise(() => {})); + + showVersionBrowser(); + showVersionBrowser(); + + const overlays = Array.from(document.querySelectorAll<HTMLElement>('.markedit-version-browser')); + const descriptionIDs = overlays.flatMap((overlay) => Array.from( + overlay.querySelectorAll<HTMLElement>('.version-browser-restore-description, .version-browser-delete-description'), + (description) => description.id, + )); + + expect(overlays).toHaveLength(2); + expect(descriptionIDs).toHaveLength(4); + expect(new Set(descriptionIDs)).toHaveLength(4); + overlays[0].dispatchEvent(new Event('transitionend')); + }); + + test('a slower selection cannot replace a newer selection', async() => { + const firstVersion = createVersion('first'); + const secondVersion = createVersion('second'); + const secondContent = deferred<string>(); + + markEdit.getFileVersions.mockResolvedValue([firstVersion, secondVersion]); + markEdit.getFileVersionContent.mockImplementation((id: string) => ( + id === secondVersion.id ? secondContent.promise : Promise.resolve('first content') + )); + + showVersionBrowser(); + await waitForRenderedContent('first content'); + + selectVersion(secondVersion.id); + await vi.waitFor(() => expect(markEdit.getFileVersionContent).toHaveBeenCalledWith(secondVersion.id)); + selectVersion(firstVersion.id); + await vi.waitFor(() => expect(diff.create).toHaveBeenCalledTimes(2)); + + secondContent.resolve('second content'); + await flushPromises(); + + expect(diff.create).not.toHaveBeenCalledWith( + expect.anything(), + expect.anything(), + 'second content', + expect.anything(), + ); + + expect(diff.create.mock.calls.at(-1)?.[2]).toBe('first content'); + }); + + test('an uncached local version hides the previous diff while loading', async() => { + const firstVersion = createVersion('first'); + const secondVersion = createVersion('second'); + const secondContent = deferred<string>(); + + markEdit.getFileVersions.mockResolvedValue([firstVersion, secondVersion]); + markEdit.getFileVersionContent.mockImplementation((id: string) => ( + id === secondVersion.id ? secondContent.promise : Promise.resolve('first content') + )); + + showVersionBrowser(); + await waitForRenderedContent('first content'); + const diffContainer = document.querySelector<HTMLElement>('.version-browser-diff')!; + expect(diffContainer.hidden).toBe(false); + + selectVersion(secondVersion.id); + await vi.waitFor(() => expect(markEdit.getFileVersionContent).toHaveBeenCalledWith(secondVersion.id)); + expect(diffContainer.hidden).toBe(true); + + secondContent.resolve('second content'); + await waitForRenderedContent('second content'); + expect(diffContainer.hidden).toBe(false); + }); + + test('a failed newest-version probe keeps the version list available', async() => { + const version = createVersion('first'); + + markEdit.getFileVersions.mockResolvedValue([version]); + markEdit.getFileVersionContent + .mockRejectedValueOnce(new Error('probe failed')) + .mockResolvedValueOnce('first content'); + + showVersionBrowser(); + await waitForRenderedContent('first content'); + + expect(markEdit.getFileVersionContent).toHaveBeenCalledTimes(2); + expect(getVersionSelect().disabled).toBe(false); + }); + + test('successful version contents are reused within the browser session', async() => { + const firstVersion = createVersion('first'); + const secondVersion = createVersion('second', false); + + markEdit.getFileVersions.mockResolvedValue([firstVersion, secondVersion]); + markEdit.getFileVersionContent.mockImplementation((id: string) => Promise.resolve(`${id} content`)); + + showVersionBrowser(); + await waitForRenderedContent('first content'); + selectVersion(secondVersion.id); + await waitForRenderedContent('second content'); + selectVersion(firstVersion.id); + await vi.waitFor(() => expect(diff.create.mock.calls.at(-1)?.[2]).toBe('first content')); + selectVersion(secondVersion.id); + await vi.waitFor(() => expect(diff.create.mock.calls.at(-1)?.[2]).toBe('second content')); + + expect(markEdit.getFileVersionContent).toHaveBeenCalledTimes(2); + expect(markEdit.getFileVersionContent).toHaveBeenCalledWith(firstVersion.id); + expect(markEdit.getFileVersionContent).toHaveBeenCalledWith(secondVersion.id); + }); + + test('deleting during a fetch prevents stale content from rendering', async() => { + const firstVersion = createVersion('first'); + const secondVersion = createVersion('second'); + const secondContent = deferred<string>(); + const deletion = deferred<boolean>(); + + markEdit.getFileVersions.mockResolvedValue([firstVersion, secondVersion]); + markEdit.getFileVersionContent.mockImplementation((id: string) => ( + id === secondVersion.id ? secondContent.promise : Promise.resolve('first content') + )); + + markEdit.showAlert.mockResolvedValue(0); + markEdit.deleteLocalFileVersions.mockReturnValue(deletion.promise); + + showVersionBrowser(); + await waitForRenderedContent('first content'); + selectVersion(secondVersion.id); + getButton('delete').click(); + + await vi.waitFor(() => expect(markEdit.deleteLocalFileVersions).toHaveBeenCalledWith([secondVersion.id])); + secondContent.resolve('second content'); + await flushPromises(); + + expect(getStatus().textContent).toBe('Deleting version...'); + expect(diff.create).not.toHaveBeenCalledWith( + expect.anything(), + expect.anything(), + 'second content', + expect.anything(), + ); + + deletion.resolve(false); + await vi.waitFor(() => expect(getStatus().textContent).toBe('The version could not be deleted.')); + }); + + test('a failed reload leaves the empty selector disabled', async() => { + const version = createVersion('first'); + + markEdit.getFileVersions + .mockResolvedValueOnce([version]) + .mockRejectedValueOnce(new Error('reload failed')); + markEdit.getFileVersionContent.mockResolvedValue('first content'); + markEdit.showAlert.mockResolvedValue(0); + markEdit.deleteLocalFileVersions.mockResolvedValue(true); + + showVersionBrowser(); + await waitForRenderedContent('first content'); + getButton('delete').click(); + + await vi.waitFor(() => expect(getStatus().textContent).toBe('Version history could not be loaded.')); + const select = getVersionSelect(); + + expect(select.disabled).toBe(true); + expect(select.options).toHaveLength(1); + expect(select.options[0].text).toBe(''); + expect(getButton('restore').disabled).toBe(true); + }); + + test('restore starts immediately without confirmation', async() => { + const version = createVersion('first'); + + markEdit.getFileVersions.mockResolvedValue([version]); + markEdit.getFileVersionContent.mockResolvedValue('first content'); + + showVersionBrowser(); + await waitForRenderedContent('first content'); + getButton('restore').click(); + + await vi.waitFor(() => expect(markEdit.restoreFileVersion).toHaveBeenCalledWith(version.id)); + expect(markEdit.showAlert).not.toHaveBeenCalled(); + }); + + test('identical content explains why Restore is unavailable', async() => { + const differentVersion = createVersion('different'); + const identicalVersion = createVersion('identical'); + + markEdit.getFileVersions.mockResolvedValue([differentVersion, identicalVersion]); + markEdit.getFileVersionContent.mockImplementation((id: string) => Promise.resolve( + id === identicalVersion.id ? 'current' : 'different content', + )); + + showVersionBrowser(); + await waitForRenderedContent('different content'); + selectVersion(identicalVersion.id); + await waitForRenderedContent('current'); + + const restoreButton = getButton('restore'); + expect(restoreButton.disabled).toBe(false); + expect(restoreButton.getAttribute('aria-disabled')).toBe('true'); + expect(document.getElementById(restoreButton.getAttribute('aria-describedby') ?? '')?.textContent).toBe('The selected version is identical to the current document.'); + expect(restoreButton.parentElement?.title).toBe('The selected version is identical to the current document.'); + + restoreButton.click(); + expect(markEdit.restoreFileVersion).not.toHaveBeenCalled(); + }); + + test('an iCloud version becomes downloaded after its content arrives', async() => { + const localVersion = createVersion('local'); + const version = createVersion('icloud', false); + const content = deferred<string>(); + + markEdit.getFileVersions.mockResolvedValue([localVersion, version]); + markEdit.getFileVersionContent.mockImplementation((id: string) => ( + id === version.id ? content.promise : Promise.resolve('local content') + )); + + showVersionBrowser(); + await waitForRenderedContent('local content'); + selectVersion(version.id); + + const indicator = await vi.waitFor(() => { + const element = document.querySelector<HTMLElement>('.version-browser-nonlocal'); + expect(element?.classList.contains('is-visible')).toBe(true); + return element!; + }); + expect(indicator.title).toBe('Stored in iCloud'); + expect(indicator.getAttribute('role')).toBe('img'); + expect(getButton('delete').disabled).toBe(false); + expect(getButton('delete').getAttribute('aria-disabled')).toBe('true'); + expect(document.getElementById(getButton('delete').getAttribute('aria-describedby') ?? '')?.textContent).toBe('Versions stored in iCloud cannot be deleted.'); + getButton('delete').click(); + expect(markEdit.showAlert).not.toHaveBeenCalled(); + + content.resolve('icloud content'); + await vi.waitFor(() => expect(indicator.title).toBe('Downloaded from iCloud')); + expect(indicator.classList.contains('is-downloaded')).toBe(true); + expect(diff.create.mock.calls.at(-1)?.[2]).toBe('icloud content'); + }); + + test('version picker focus styling follows keyboard input', async() => { + const version = createVersion('first'); + + markEdit.getFileVersions.mockResolvedValue([version]); + markEdit.getFileVersionContent.mockResolvedValue('first content'); + + showVersionBrowser(); + await waitForRenderedContent('first content'); + + const overlay = document.querySelector<HTMLElement>('.markedit-version-browser')!; + const select = getVersionSelect(); + + window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Tab' })); + expect(overlay.classList.contains('is-keyboard-navigation')).toBe(true); + + select.dispatchEvent(new Event('pointerdown', { bubbles: true })); + expect(overlay.classList.contains('is-keyboard-navigation')).toBe(false); + }); +}); + +class ResizeObserverStub { + observe(): void {} + disconnect(): void {} +} + +function createVersion(id: string, isLocal = true): FileVersion { + return { + id, + modificationDate: new Date(0), + isLocal, + }; +} + +function getVersionSelect(): HTMLSelectElement { + return document.querySelector<HTMLSelectElement>('.version-browser-select')!; +} + +function selectVersion(id: string): void { + const select = getVersionSelect(); + select.value = id; + select.dispatchEvent(new Event('change', { bubbles: true })); +} + +function getButton(action: 'restore' | 'delete'): HTMLButtonElement { + return document.querySelector<HTMLButtonElement>(`[data-action="${action}"]`)!; +} + +function getStatus(): HTMLElement { + return document.querySelector<HTMLElement>('.version-browser-status')!; +} + +async function waitForRenderedContent(content: string): Promise<void> { + await vi.waitFor(() => expect(diff.create).toHaveBeenCalledWith( + expect.anything(), + 'current', + content, + 'unified', + )); +} + +async function flushPromises(): Promise<void> { + await Promise.resolve(); + await Promise.resolve(); +} + +function deferred<T>() { + let resolve!: (value: T) => void; + const promise = new Promise<T>((resolvePromise) => { + resolve = resolvePromise; + }); + + return { promise, resolve }; +} diff --git a/tests/diff.test.ts b/tests/diff.test.ts new file mode 100644 index 0000000..427f888 --- /dev/null +++ b/tests/diff.test.ts @@ -0,0 +1,92 @@ +// @vitest-environment jsdom + +import { beforeEach, describe, expect, test, vi } from 'vitest'; + +const pierre = vi.hoisted(() => ({ + fileOptions: undefined as unknown, + fileDiffOptions: undefined as unknown, + fileRender: vi.fn(), + fileDiffRender: vi.fn(), +})); + +const settings = vi.hoisted(() => ({ + wrapLines: false, + showLineNumbers: false, + lineDiff: 'char' as const, + expandUnchanged: true, + expansionLineCount: 40, + diffIndicators: 'bars' as const, + hunkSeparators: 'metadata' as const, +})); + +vi.mock('@pierre/diffs', () => ({ + File: vi.fn(function FileMock(this: { render: typeof pierre.fileRender }, options: unknown) { + pierre.fileOptions = options; + this.render = pierre.fileRender; + }), + FileDiff: vi.fn(function FileDiffMock(this: { render: typeof pierre.fileDiffRender }, options: unknown) { + pierre.fileDiffOptions = options; + this.render = pierre.fileDiffRender; + }), +})); + +vi.mock('../src/settings', () => ({ settings })); + +import { createDiff, getStoredDiffStyle } from '../src/diff'; + +describe('diff rendering settings', () => { + beforeEach(() => { + vi.clearAllMocks(); + localStorage.clear(); + pierre.fileOptions = undefined; + pierre.fileDiffOptions = undefined; + }); + + test('uses unified only when no toolbar choice is stored', () => { + expect(getStoredDiffStyle()).toBe('unified'); + + localStorage.setItem('markedit-version-browser.diff-style', 'split'); + expect(getStoredDiffStyle()).toBe('split'); + }); + + test('applies shared settings to identical content', () => { + const container = document.createElement('div'); + createDiff(container, 'same', 'same', 'unified'); + + expect(pierre.fileOptions).toMatchObject({ + theme: { dark: 'github-dark-default', light: 'github-light-default' }, + disableFileHeader: true, + disableLineNumbers: true, + overflow: 'scroll', + }); + + expect(pierre.fileRender).toHaveBeenCalledWith({ + file: { name: 'document.md', contents: 'same', lang: 'markdown' }, + containerWrapper: container, + }); + }); + + test('applies all settings to changed content', () => { + const container = document.createElement('div'); + createDiff(container, 'old', 'new', 'unified'); + + expect(pierre.fileDiffOptions).toMatchObject({ + theme: { dark: 'github-dark-default', light: 'github-light-default' }, + diffStyle: 'unified', + diffIndicators: 'bars', + disableFileHeader: true, + disableLineNumbers: true, + overflow: 'scroll', + hunkSeparators: 'metadata', + lineDiffType: 'char', + expandUnchanged: true, + expansionLineCount: 40, + }); + + expect(pierre.fileDiffRender).toHaveBeenCalledWith({ + oldFile: { name: 'document.md', contents: 'old', lang: 'markdown' }, + newFile: { name: 'document.md', contents: 'new', lang: 'markdown' }, + containerWrapper: container, + }); + }); +}); diff --git a/tests/interaction.test.ts b/tests/interaction.test.ts new file mode 100644 index 0000000..885b3e2 --- /dev/null +++ b/tests/interaction.test.ts @@ -0,0 +1,287 @@ +import assert from 'node:assert/strict'; +import type { FileVersion } from 'markedit-api'; +import { afterEach, test } from 'vitest'; +import { createRequestGate, keepFocusWithinBrowser, updateBrowserActions } from '../src/interaction.ts'; +import type { BrowserElements } from '../src/view.ts'; + +const originalDocument = Object.getOwnPropertyDescriptor(globalThis, 'document'); + +afterEach(() => { + if (originalDocument === undefined) { + Reflect.deleteProperty(globalThis, 'document'); + } else { + Object.defineProperty(globalThis, 'document', originalDocument); + } +}); + +test('request gate rejects superseded and invalidated requests', () => { + const requests = createRequestGate(); + const firstRequest = requests.begin(); + const secondRequest = requests.begin(); + + assert.equal(requests.isCurrent(firstRequest), false); + assert.equal(requests.isCurrent(secondRequest), true); + + requests.invalidate(); + assert.equal(requests.isCurrent(secondRequest), false); +}); + +test('iCloud versions cannot be deleted and reflect download state', () => { + const context = createActionContext(); + const version = createVersion(false); + + updateBrowserActions(context.elements, { + busy: false, + hasVersions: true, + selectedVersion: version, + isDownloaded: false, + hasDifferences: true, + }); + + assert.equal(context.nonlocalIndicator.classList.contains('is-visible'), true); + assert.equal(context.nonlocalIndicator.getAttribute('aria-hidden'), 'false'); + assert.equal(context.nonlocalIndicator.title, 'Stored in iCloud'); + assert.equal(context.nonlocalIndicator.classList.contains('is-downloaded'), false); + assert.equal(context.deleteButton.disabled, false); + assert.equal(context.deleteButton.getAttribute('aria-disabled'), 'true'); + assert.equal(context.deleteButton.getAttribute('aria-describedby'), context.deleteDescription.id); + assert.equal(context.deleteWrapper.title, 'Versions stored in iCloud cannot be deleted.'); + + updateBrowserActions(context.elements, { + busy: false, + hasVersions: true, + selectedVersion: version, + isDownloaded: true, + hasDifferences: true, + }); + + assert.equal(context.nonlocalIndicator.title, 'Downloaded from iCloud'); + assert.equal(context.nonlocalIndicator.classList.contains('is-downloaded'), true); +}); + +test('local versions enable actions unless the browser is busy', () => { + const context = createActionContext(); + const state = { + busy: false, + hasVersions: true, + selectedVersion: createVersion(true), + isDownloaded: false, + hasDifferences: true, + }; + + updateBrowserActions(context.elements, state); + assert.equal(context.nonlocalIndicator.classList.contains('is-visible'), false); + assert.equal(context.nonlocalIndicator.getAttribute('aria-hidden'), 'true'); + assert.equal(context.restoreButton.disabled, false); + assert.equal(context.deleteButton.disabled, false); + assert.equal(context.deleteButton.getAttribute('aria-disabled'), null); + assert.equal(context.deleteButton.getAttribute('aria-describedby'), null); + assert.equal(context.versionSelect.disabled, false); + assert.equal(context.layoutButton.disabled, false); + + updateBrowserActions(context.elements, { ...state, busy: true }); + assert.equal(context.restoreButton.disabled, true); + assert.equal(context.deleteButton.disabled, true); + assert.equal(context.versionSelect.disabled, true); + assert.equal(context.layoutButton.disabled, true); +}); + +test('identical content keeps Restore focusable and explains why it is unavailable', () => { + const context = createActionContext(); + const state = { + busy: false, + hasVersions: true, + selectedVersion: createVersion(true), + isDownloaded: false, + hasDifferences: false, + }; + + updateBrowserActions(context.elements, state); + assert.equal(context.restoreButton.disabled, false); + assert.equal(context.restoreButton.getAttribute('aria-disabled'), 'true'); + assert.equal(context.restoreButton.getAttribute('aria-describedby'), context.restoreDescription.id); + assert.equal(context.restoreWrapper.title, 'The selected version is identical to the current document.'); + + updateBrowserActions(context.elements, { ...state, hasDifferences: true }); + assert.equal(context.restoreButton.getAttribute('aria-disabled'), null); + assert.equal(context.restoreButton.getAttribute('aria-describedby'), null); + assert.equal(context.restoreWrapper.title, ''); +}); + +test('focus wraps forward from the final control', () => { + const context = createFocusContext(); + context.last.focus(); + + keepFocusWithinBrowser(context.overlay, context.createEvent(false)); + assert.equal(context.activeElement(), context.first); + assert.equal(context.defaultPrevented(), true); +}); + +test('focus wraps backward from the first control', () => { + const context = createFocusContext(); + context.first.focus(); + + keepFocusWithinBrowser(context.overlay, context.createEvent(true)); + assert.equal(context.activeElement(), context.last); + assert.equal(context.defaultPrevented(), true); +}); + +test('focus enters the controls from the browser overlay', () => { + const context = createFocusContext(); + context.overlay.focus(); + + keepFocusWithinBrowser(context.overlay, context.createEvent(false)); + assert.equal(context.activeElement(), context.first); + + context.overlay.focus(); + keepFocusWithinBrowser(context.overlay, context.createEvent(true)); + assert.equal(context.activeElement(), context.last); + assert.equal(context.defaultPrevented(), true); +}); + +test('focus stays within an empty browser', () => { + const context = createFocusContext([]); + keepFocusWithinBrowser(context.overlay, context.createEvent(false)); + assert.equal(context.activeElement(), context.overlay); + assert.equal(context.defaultPrevented(), true); +}); + +function createFocusContext(elements?: HTMLElement[]) { + let activeElement: HTMLElement | null = null; + let prevented = false; + const documentStub = { get activeElement() { return activeElement; } }; + + Object.defineProperty(globalThis, 'document', { + configurable: true, + value: documentStub, + }); + + const createElement = () => ({ + focus() { + activeElement = this as unknown as HTMLElement; + }, + }) as unknown as HTMLElement; + + const first = createElement(); + const last = createElement(); + const focusableElements = elements ?? [first, last]; + const overlay = { + contains(element: HTMLElement) { + return element === overlay || focusableElements.includes(element); + }, + focus() { + activeElement = this as unknown as HTMLElement; + }, + querySelectorAll() { + return focusableElements; + }, + } as unknown as HTMLElement; + + return { + first, + last, + overlay, + activeElement: () => activeElement, + defaultPrevented: () => prevented, + createEvent: (shiftKey: boolean) => ({ + shiftKey, + preventDefault() { + prevented = true; + }, + }) as KeyboardEvent, + }; +} + +function createVersion(isLocal: boolean): FileVersion { + return { + id: isLocal ? 'local' : 'icloud', + modificationDate: new Date(0), + isLocal, + }; +} + +function createActionContext() { + const classes = new Set<string>(); + const attributes = new Map<string, string>(); + const nonlocalIndicator = { + title: '', + classList: { + toggle(name: string, enabled: boolean) { + if (enabled) { + classes.add(name); + } else { + classes.delete(name); + } + }, + contains(name: string) { + return classes.has(name); + }, + }, + setAttribute(name: string, value: string) { + attributes.set(name, value); + }, + getAttribute(name: string) { + return attributes.get(name) ?? null; + }, + } as unknown as HTMLElement; + + const versionSelect = { disabled: true } as HTMLSelectElement; + const restoreWrapper = { title: '' } as HTMLElement; + const deleteWrapper = { title: '' } as HTMLElement; + const restoreDescription = { id: 'restore-description' } as HTMLElement; + const deleteDescription = { id: 'delete-description' } as HTMLElement; + const restoreButtonAttributes = new Map<string, string>(); + + const restoreButton = { + disabled: true, + setAttribute(name: string, value: string) { + restoreButtonAttributes.set(name, value); + }, + removeAttribute(name: string) { + restoreButtonAttributes.delete(name); + }, + getAttribute(name: string) { + return restoreButtonAttributes.get(name) ?? null; + }, + } as HTMLButtonElement; + + const deleteButtonAttributes = new Map<string, string>(); + const deleteButton = { + disabled: true, + setAttribute(name: string, value: string) { + deleteButtonAttributes.set(name, value); + }, + removeAttribute(name: string) { + deleteButtonAttributes.delete(name); + }, + getAttribute(name: string) { + return deleteButtonAttributes.get(name) ?? null; + }, + } as HTMLButtonElement; + + const layoutButton = { disabled: true } as HTMLButtonElement; + const elements = { + versionSelect, + nonlocalIndicator, + restoreWrapper, + deleteWrapper, + restoreDescription, + deleteDescription, + restoreButton, + deleteButton, + layoutButtons: [layoutButton], + } as BrowserElements; + + return { + elements, + versionSelect, + nonlocalIndicator, + restoreWrapper, + deleteWrapper, + restoreDescription, + deleteDescription, + restoreButton, + deleteButton, + layoutButton, + }; +} diff --git a/tests/settings.test.ts b/tests/settings.test.ts new file mode 100644 index 0000000..36b87b8 --- /dev/null +++ b/tests/settings.test.ts @@ -0,0 +1,52 @@ +import { describe, expect, test, vi } from 'vitest'; + +vi.mock('markedit-api', () => ({ MarkEdit: { userSettings: {} } })); + +import { defaultSettings, parseSettings, settingsKey } from '../src/settings'; + +describe('version browser settings', () => { + test('uses defaults without the extension namespace', () => { + expect(parseSettings({})).toEqual(defaultSettings); + expect(parseSettings(null)).toEqual(defaultSettings); + }); + + test('parses all supported settings', () => { + expect(parseSettings({ + [settingsKey]: { + wrapLines: false, + showLineNumbers: false, + lineDiff: 'char', + expandUnchanged: true, + expansionLineCount: 40, + diffIndicators: 'bars', + hunkSeparators: 'metadata', + }, + })).toEqual({ + wrapLines: false, + showLineNumbers: false, + lineDiff: 'char', + expandUnchanged: true, + expansionLineCount: 40, + diffIndicators: 'bars', + hunkSeparators: 'metadata', + }); + }); + + test('defaults invalid fields and clamps the expansion count', () => { + const parsed = parseSettings({ + [settingsKey]: { + wrapLines: 'yes', + showLineNumbers: null, + lineDiff: 'line', + expandUnchanged: 1, + expansionLineCount: 500, + diffIndicators: 'arrows', + hunkSeparators: 'custom', + }, + }); + + expect(parsed).toEqual({ ...defaultSettings, expansionLineCount: 100 }); + expect(parseSettings({ [settingsKey]: { expansionLineCount: 0 } }).expansionLineCount).toBe(1); + expect(parseSettings({ [settingsKey]: { expansionLineCount: 2.5 } }).expansionLineCount).toBe(20); + }); +}); diff --git a/tests/status.test.ts b/tests/status.test.ts new file mode 100644 index 0000000..9026ead --- /dev/null +++ b/tests/status.test.ts @@ -0,0 +1,140 @@ +import assert from 'node:assert/strict'; +import { test } from 'vitest'; +import { createBrowserStatus } from '../src/status.ts'; + +test('loading status delay, cancellation, and minimum duration', async() => { + const clock = new FakeClock(); + const originalWindow = Object.getOwnPropertyDescriptor(globalThis, 'window'); + const originalDocument = Object.getOwnPropertyDescriptor(globalThis, 'document'); + const originalPerformance = Object.getOwnPropertyDescriptor(globalThis, 'performance'); + + Object.defineProperties(globalThis, { + window: { configurable: true, value: clock.window }, + document: { + configurable: true, + value: { createElement: () => ({ className: '' }) }, + }, + performance: { + configurable: true, + value: { now: () => clock.now }, + }, + }); + + try { + const statusElement = new StatusElement(); + const diffContainer = { hidden: false } as HTMLElement; + const status = createBrowserStatus( + statusElement as unknown as HTMLElement, + diffContainer, + () => false, + ); + + const loadingID = status.show('Fetching contents...', true); + assert.equal(statusElement.hidden, true); + assert.equal(statusElement.text, 'Fetching contents...'); + assert.equal(diffContainer.hidden, true); + + clock.advance(299); + assert.equal(statusElement.hidden, true); + assert.equal(statusElement.spinnerCount, 0); + + clock.advance(1); + assert.equal(statusElement.hidden, false); + assert.equal(statusElement.spinnerCount, 1); + + let settled = false; + const settling = status.settle(loadingID).then(() => settled = true); + + clock.advance(199); + await Promise.resolve(); + assert.equal(settled, false); + + clock.advance(1); + await settling; + assert.equal(settled, true); + + status.show('Loading versions...', true); + status.hide(); + clock.advance(300); + assert.equal(statusElement.hidden, true); + assert.equal(statusElement.spinnerCount, 1); + + const staleID = status.show('Fetching contents...', true); + status.show('The version could not be loaded.'); + await status.settle(staleID); + clock.advance(300); + assert.equal(statusElement.hidden, false); + assert.equal(statusElement.text, 'The version could not be loaded.'); + assert.equal(statusElement.spinnerCount, 1); + } finally { + restoreProperty('window', originalWindow); + restoreProperty('document', originalDocument); + restoreProperty('performance', originalPerformance); + } +}); + +class StatusElement { + hidden = false; + text = ''; + spinnerCount = 0; + + replaceChildren(): void { + this.text = ''; + } + + append(message: string): void { + this.text += message; + } + + prepend(): void { + this.spinnerCount += 1; + } +} + +class FakeClock { + now = 0; + private nextTimerID = 1; + private timers = new Map<number, { time: number; callback: () => void }>(); + + readonly window = { + setTimeout: (callback: () => void, delay = 0) => { + const timerID = this.nextTimerID++; + this.timers.set(timerID, { time: this.now + delay, callback }); + return timerID; + }, + clearTimeout: (timerID?: number) => { + if (timerID !== undefined) { + this.timers.delete(timerID); + } + }, + }; + + advance(duration: number): void { + const targetTime = this.now + duration; + + while (true) { + const nextTimer = [...this.timers.entries()] + .filter(([, timer]) => timer.time <= targetTime) + .sort((left, right) => left[1].time - right[1].time)[0]; + + if (nextTimer === undefined) { + break; + } + + const [timerID, timer] = nextTimer; + this.timers.delete(timerID); + this.now = timer.time; + timer.callback(); + } + + this.now = targetTime; + } +} + +function restoreProperty(name: 'window' | 'document' | 'performance', descriptor?: PropertyDescriptor): void { + if (descriptor === undefined) { + delete (globalThis as Record<string, unknown>)[name]; + } else { + Object.defineProperty(globalThis, name, descriptor); + } +} diff --git a/tests/themes.test.ts b/tests/themes.test.ts new file mode 100644 index 0000000..dbb0965 --- /dev/null +++ b/tests/themes.test.ts @@ -0,0 +1,14 @@ +import { describe, expect, test, vi } from 'vitest'; + +import { createTheme, pierreThemes } from '../src/pierre-themes'; + +describe('Pierre theme shim', () => { + test('exports the custom theme factory required by Pierre', () => { + const load = vi.fn(async() => ({ default: {} as never })); + const descriptor = createTheme({ name: 'custom', load }); + + expect(descriptor.name).toBe('custom'); + expect(descriptor.load).not.toBe(load); + expect(pierreThemes.getThemes()).not.toHaveLength(0); + }); +}); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..732aeb7 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "typeRoots": ["./node_modules/@types"], + "module": "esnext", + "target": "esnext", + "lib": ["es2019", "dom"], + "noImplicitAny": true, + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "strictNullChecks": true, + "importHelpers": true, + "noEmit": true, + "skipLibCheck": true + } +} diff --git a/vite.config.mts b/vite.config.mts new file mode 100644 index 0000000..c0e8ee5 --- /dev/null +++ b/vite.config.mts @@ -0,0 +1,20 @@ +import { fileURLToPath } from 'node:url'; +import { defineConfig, mergeConfig } from 'vite'; +import { defaultViteConfig } from 'markedit-vite'; +import { viteSingleFile } from 'vite-plugin-singlefile'; + +export default defineConfig(mergeConfig(defaultViteConfig(), { + resolve: { + alias: [ + { + find: /^shiki(?:\/wasm)?$/, + replacement: fileURLToPath(new URL('./src/shiki.ts', import.meta.url)), + }, + { + find: /^@pierre\/theming\/themes$/, + replacement: fileURLToPath(new URL('./src/pierre-themes.ts', import.meta.url)), + }, + ], + }, + plugins: [viteSingleFile()], +})); diff --git a/vitest.config.mts b/vitest.config.mts new file mode 100644 index 0000000..2928b54 --- /dev/null +++ b/vitest.config.mts @@ -0,0 +1,8 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + environment: 'node', + restoreMocks: true, + }, +}); \ No newline at end of file diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..2d9137c --- /dev/null +++ b/yarn.lock @@ -0,0 +1,1341 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@asamuzakjp/css-color@^6.0.5": + version "6.0.7" + resolved "https://registry.yarnpkg.com/@asamuzakjp/css-color/-/css-color-6.0.7.tgz#8f9f67452e6636930949abe047dd553b13276939" + integrity sha512-vC/bk1Lz7Tn/EfU9/apOTBk80/8dyGyWMowPoV1tJ52muDGsDqt2HPT2klrFUiY60MQmQv9q8yIht15JnBgDGw== + dependencies: + "@csstools/css-calc" "^3.3.0" + "@csstools/css-color-parser" "^4.1.10" + "@csstools/css-parser-algorithms" "^4.0.0" + "@csstools/css-tokenizer" "^4.0.0" + lru-cache "^11.5.2" + +"@asamuzakjp/dom-selector@^8.3.0": + version "8.3.2" + resolved "https://registry.yarnpkg.com/@asamuzakjp/dom-selector/-/dom-selector-8.3.2.tgz#1e84c1ea1e12a921c1aa94da4b1f657168f09596" + integrity sha512-93Z1N+BQNXysodoicpOIyNh2drHfz/CTf9nnT0FEx72GJcIiwgydD7tGAr78j41LsYn3hlRn+LdGPuBLn1Bl8Q== + dependencies: + bidi-js "^1.0.3" + css-tree "^3.2.1" + is-potential-custom-element-name "^1.0.1" + lru-cache "^11.5.2" + +"@bramus/specificity@^2.4.2": + version "2.4.2" + resolved "https://registry.yarnpkg.com/@bramus/specificity/-/specificity-2.4.2.tgz#aa8db8eb173fdee7324f82284833106adeecc648" + integrity sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw== + dependencies: + css-tree "^3.0.0" + +"@codemirror/commands@^6.0.0": + version "6.11.0" + resolved "https://registry.yarnpkg.com/@codemirror/commands/-/commands-6.11.0.tgz#2194d6fcad9ed787dcc42667db0e0543fab2e0ef" + integrity sha512-/K4Rl5BN0OtTiPWmJCdqODu38XnDMsDxKY5rgrPnCkutPTJf2wVbkoixLfealF5Kwse/s8P8M5jAiURiwSwnFA== + dependencies: + "@codemirror/language" "^6.0.0" + "@codemirror/state" "^6.7.0" + "@codemirror/view" "^6.27.0" + "@lezer/common" "^1.1.0" + +"@codemirror/language@^6.0.0": + version "6.12.4" + resolved "https://registry.yarnpkg.com/@codemirror/language/-/language-6.12.4.tgz#01e70fd5aa3a8a067ff1dfec75d5b6394cdfa058" + integrity sha512-1q4PaT+o6PbgpkJt4Q8Fv5XJxTy4FUZ4MWETtyiDw3J0Pyr9E2vqcKL+k9wcvjNTIsauxvE7OfmWj3FRPHQ76A== + dependencies: + "@codemirror/state" "^6.0.0" + "@codemirror/view" "^6.23.0" + "@lezer/common" "^1.5.0" + "@lezer/highlight" "^1.0.0" + "@lezer/lr" "^1.0.0" + style-mod "^4.0.0" + +"@codemirror/state@^6.0.0", "@codemirror/state@^6.7.0": + version "6.7.1" + resolved "https://registry.yarnpkg.com/@codemirror/state/-/state-6.7.1.tgz#9e88a17448c1dbc7b50acbeeec979ed7ccf1d6fc" + integrity sha512-9QzNDgE4EYDnAHfrTlR2lwiPciiOymLtwKK+8yHQzCc7GXhAP9xdEbEJFy2IWB1j9UGUl9BsgMmTo/ImA02T7A== + dependencies: + "@marijn/find-cluster-break" "^1.0.0" + +"@codemirror/view@^6.0.0", "@codemirror/view@^6.23.0", "@codemirror/view@^6.27.0": + version "6.43.9" + resolved "https://registry.yarnpkg.com/@codemirror/view/-/view-6.43.9.tgz#85c44ad1bc5fc930e5642e7313643dab7dc866a4" + integrity sha512-sTuUzTpPMFebRhg6dawChoKKgndIwfjmJgKVxBefPElcU2NwQ6AFroupk0SFqEerQyZOGRfDNnSN8Dw/lMAsXw== + dependencies: + "@codemirror/state" "^6.7.0" + crelt "^1.0.6" + style-mod "^4.1.0" + w3c-keyname "^2.2.4" + +"@csstools/color-helpers@^6.1.1": + version "6.1.1" + resolved "https://registry.yarnpkg.com/@csstools/color-helpers/-/color-helpers-6.1.1.tgz#1890f29a4347486b54048d24c6ab8fbef039ee61" + integrity sha512-gLNsunvwf3mCi5u5o46/Z/JcJMnhbHSaZ69rkgPzNM3J4s8hWwpPUQB6/tt0EDFyCiWzxANlx+2LJwpYj4zS1w== + +"@csstools/css-calc@^3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@csstools/css-calc/-/css-calc-3.3.0.tgz#33cc4bdbab8edf1b6e3ab8c1eba849c41a324f1a" + integrity sha512-c5ihYsPkdG6JCkU2zTMm4+k6r7RXuGxtWYhu5DHMIiF1FHzrfmHL5so11AoFpUv/tu61xfcmT4AmKoFfMPoqdQ== + +"@csstools/css-color-parser@^4.1.10": + version "4.2.1" + resolved "https://registry.yarnpkg.com/@csstools/css-color-parser/-/css-color-parser-4.2.1.tgz#d2795d618e3d497f394277eede34f10d7adfad0e" + integrity sha512-YpAJZhaHplYQkG8ib+/Fx5Y0eF2lVWi3tIvMJA6i39TLyUNp2439cifzW8VMjhlqrBjHzK5hVGugRRm2zTKI/A== + dependencies: + "@csstools/color-helpers" "^6.1.1" + "@csstools/css-calc" "^3.3.0" + +"@csstools/css-parser-algorithms@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.0.tgz#e1c65dc09378b42f26a111fca7f7075fc2c26164" + integrity sha512-+B87qS7fIG3L5h3qwJ/IFbjoVoOe/bpOdh9hAjXbvx0o8ImEmUsGXN0inFOnk2ChCFgqkkGFQ+TpM5rbhkKe4w== + +"@csstools/css-syntax-patches-for-csstree@^1.1.7": + version "1.1.9" + resolved "https://registry.yarnpkg.com/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.9.tgz#8c144089e7ad7cadc0393a5051345c3e6a8043dc" + integrity sha512-iGGw4OsAYsS6pD29MdJ2bX/nJx65a04ZZiw6x+VwWlP2DdXf6f++Zmuv/OzALpdyfVhjbduIIF2cXM7HWBIe9A== + +"@csstools/css-tokenizer@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@csstools/css-tokenizer/-/css-tokenizer-4.0.0.tgz#798a33950d11226a0ebb6acafa60f5594424967f" + integrity sha512-QxULHAm7cNu72w97JUNCBFODFaXpbDg+dP8b/oWFAZ2MTRppA3U00Y2L1HqaS4J6yBqxwa/Y3nMBaxVKbB/NsA== + +"@exodus/bytes@^1.11.0", "@exodus/bytes@^1.15.1", "@exodus/bytes@^1.6.0": + version "1.15.1" + resolved "https://registry.yarnpkg.com/@exodus/bytes/-/bytes-1.15.1.tgz#b13bc464ca162c17abf0837fb3a11aeab79e45d1" + integrity sha512-S6mL0yNB/Abt9Ei4tq8gDhcczc4S3+vQ4ra7vxnAf+YHC02srtqxKKZghx2Dq6p0e66THKwR6r8N6P95wEty7Q== + +"@jridgewell/sourcemap-codec@^1.5.5": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz#f4c663e862f06dc98ca4d453862c46902789a18d" + integrity sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw== + +"@lezer/common@^1.0.0", "@lezer/common@^1.1.0", "@lezer/common@^1.3.0", "@lezer/common@^1.5.0": + version "1.5.2" + resolved "https://registry.yarnpkg.com/@lezer/common/-/common-1.5.2.tgz#d6840db13779e3f1b42e70c9a97c4086d12fae22" + integrity sha512-sxQE460fPZyU3sdc8lafxiPwJHBzZRy/udNFynGQky1SePYBdhkBl1kOagA9uT3pxR8K09bOrmTUqA9wb/PjSQ== + +"@lezer/highlight@^1.0.0": + version "1.2.3" + resolved "https://registry.yarnpkg.com/@lezer/highlight/-/highlight-1.2.3.tgz#a20f324b71148a2ea9ba6ff42e58bbfaec702857" + integrity sha512-qXdH7UqTvGfdVBINrgKhDsVTJTxactNNxLk7+UMwZhU13lMHaOBlJe9Vqp907ya56Y3+ed2tlqzys7jDkTmW0g== + dependencies: + "@lezer/common" "^1.3.0" + +"@lezer/lr@^1.0.0": + version "1.4.10" + resolved "https://registry.yarnpkg.com/@lezer/lr/-/lr-1.4.10.tgz#b3acc36e5ad049b74ddb7719594e7e74d9161ff5" + integrity sha512-rnCpTIBafOx4mRp43xOxDJbFipJm/c0cia/V5TiGlhmMa+wsSdoGmUN3w5Bqrks/09Q/D4tNAmWaT8p6NRi77A== + dependencies: + "@lezer/common" "^1.0.0" + +"@marijn/find-cluster-break@^1.0.0": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@marijn/find-cluster-break/-/find-cluster-break-1.0.4.tgz#42c2aea61cda307cdb1347444792452d7b5dbfb4" + integrity sha512-Wy0V7+SGUjnF9/TkiM1hKVDPj7jKXduPNboMVtHTA8dySMURWqfg/JZ9E2Sq8JgSJmkl7k7Qe9FLeMSrSraWmQ== + +"@oxc-project/types@=0.147.0": + version "0.147.0" + resolved "https://registry.yarnpkg.com/@oxc-project/types/-/types-0.147.0.tgz#512e43196053db4a99928e35b287549a3226268b" + integrity sha512-IJ3s6ltHLp45S0bh7phkX+gJO7A1Wuz2EaqpAhb8WjqDwbzMiWKHhyyT42tskaWjEYXtHtVCPpnBJVT9+dcRLg== + +"@pierre/diffs@^1.3.6": + version "1.3.6" + resolved "https://registry.yarnpkg.com/@pierre/diffs/-/diffs-1.3.6.tgz#725888b0e9fbf4129c32eeff692dab153949ec23" + integrity sha512-a3woaW2QHy78JDxPJK0OJzwZUN4xoQLLIS/pceO8X6+L8gA5D682mP7/w3YxxEVRPXOaoe/p/RJ5Oj/3nrEzew== + dependencies: + "@pierre/theme" "2.0.0" + "@pierre/theming" "1.0.1" + "@shikijs/transformers" "^3.0.0 || ^4.0.0" + diff "9.0.0" + hast-util-to-html "9.0.5" + lru_map "0.4.1" + shiki "^3.0.0 || ^4.0.0" + +"@pierre/theme@2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@pierre/theme/-/theme-2.0.0.tgz#492924128fe652c0096622fe0d89558ba66ce5fa" + integrity sha512-yNDd9GYLQl1mEUJR8AneJ5e4ohLIHQd/wZLWr4fagt78vS2RwwZNW530vVgHqXFAyFVcFlRmGUD5ramXH46OXw== + +"@pierre/theming@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@pierre/theming/-/theming-1.0.1.tgz#79601332d7985b5f37ceebe20399a15ededa6809" + integrity sha512-WCI5Qd7iprDpISL9fBYOLe8RV53+b7mFNA3bPzl60/2CKCSrsKN8zEcep6Y3BAzvARlmca50zGjDodqPGiTUKA== + +"@rolldown/binding-android-arm-eabi@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.6.tgz#81bc32b79902fcd3875dffdf3be2ccba3ef8d794" + integrity sha512-b+jTcARdTiFLI6jB4a5XjTm0RWd6KcRfQj/I2356fxUZemiho9zQLxo0RtCuMDAyKcLo6cEltkgbQp6d1+sjjQ== + +"@rolldown/binding-android-arm64@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.6.tgz#9b20ae8d8a5bb979ea6aa8fa4b7e11f58c53f775" + integrity sha512-lkWU8ZJaRk9q3CIEY1Tc7vIFALp3Xw5NfGJo2hQg5oIqNgxWi1zI+IiDEK3r70BF5Dzol1tcXsnzsRc8NLhG+Q== + +"@rolldown/binding-darwin-arm64@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.6.tgz#1031ee06b51c9134ba5a6da3a7310388875f7dd8" + integrity sha512-dgR56NYnvAszm7Ob1B2/Vn0e8bUQYZH2UjVaMMtMVOCKFSfjhfLmuA/9+O+F+ajUdG6B/bSssrKW6JJYASa8jA== + +"@rolldown/binding-darwin-x64@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.6.tgz#11cf31040b779dba8e61d932ae3c0ee81ef94ae0" + integrity sha512-vpVxFvUCFioJqug7OTvqptkc4yb8UX0AwfDmJpaR/0sWz+BUmqSVAf7c8JkUgnN8YLspb4a/N6NhTyMAmdyQ7Q== + +"@rolldown/binding-freebsd-x64@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.6.tgz#72d805b459ba4a8bbfc112bca4a1c70740516ae9" + integrity sha512-h1wG6Y6K3JlRswxsI64qQJqBAy4vrLuHgRbc8CZMGSWTOFRY6ghMApM1NKzB2I0n5xV1fjkE18SuVl2QpLeNpA== + +"@rolldown/binding-linux-arm-gnueabihf@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.6.tgz#43b778dd021f50182a1efdb4149cd89cff86c942" + integrity sha512-tbCiqub0q2MVWJKgF5PoAlNWCtQydiOYSLIkd8sByqK/6MMYLJRcSXSYodqYtd0O+Fw7QaVmKKlS4oL94YRZ0w== + +"@rolldown/binding-linux-arm64-gnu@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.6.tgz#e9fa7a469999c1346d827b29154068d1c833c474" + integrity sha512-oxK9+baEBPhZG5HB4URY+uU04zJWeZlH6Tb9rB5DK4DF9XR1uXNLXt5Q5ZsugTKayNCNLhkcwz/ye74hRI98dg== + +"@rolldown/binding-linux-arm64-musl@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.6.tgz#5e68dd6eb85797745f494dfe8c490c2bce4218a6" + integrity sha512-muWCk27FVBEZtv0MsK8gnfSmgczA8KQ0uRVJbTABKhkRfQc38aUrcb7fhi3BNiyseFmgcRsoMfQsSNJ+DbZdSw== + +"@rolldown/binding-linux-ppc64-gnu@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.6.tgz#2a0efc15437a55dd2caf58f0318e129d11d98ee6" + integrity sha512-eWDoSfU7Co2qj3vgB3Dt4lj1mG6CoWbcJQkRMP3XJplyCMtuaq3LHvPFjS9QIPvMGWVadJC04Xiy0IdcVPtnwQ== + +"@rolldown/binding-linux-s390x-gnu@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.6.tgz#bc2b0b6325d8aae0f1a1c06fb10d665c82258541" + integrity sha512-2bWNjRSIayvupRKxXUY2tWG9fYdoUlTqWywHRvE8Eq3GvuQ+f2HeIkve697fIt+IQs/PV8yFsdWuhp1aJ1PdnA== + +"@rolldown/binding-linux-x64-gnu@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.6.tgz#e6e5022f6138fdc0d14cefacc67dc7bc5dff6430" + integrity sha512-KekI0gS0wLxe1UBSQSjenBVwou/JkcQPDzBPICGZjxUv9k3RteHDPBQaiOicZUFKRIH2wKEimGwVpnJsbPzu7w== + +"@rolldown/binding-linux-x64-musl@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.6.tgz#c8b462609809237bbf6265491b1e78d5c260ed46" + integrity sha512-TvtPnfVr+HtyGiDmPK4VWmlNm7QhNNAcK5Q9A7aOXsI8545yCyaoMaicXrFZ72JzeYjaUVk7yT243zT0jzjFKQ== + +"@rolldown/binding-openharmony-arm64@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.6.tgz#aa208791647b3b0bd23b372d5ee6bd5ed5988118" + integrity sha512-iOo0VEay2XFhaCcH0sps5XIimkSuOnNaZrf6+ZkoSOQBJPKNU48RkmJv0/lSpipexu5P+ouFgafe5IGr/DiQfg== + +"@rolldown/binding-win32-arm64-msvc@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.6.tgz#a2a5f1a84555d00afe0ac0ff387878bcf4ada52a" + integrity sha512-y5NTmmasMS455JlOCO4ZM9krIchv3Mvm1crL1iUPGOPgEzSkves9n0SdC5Sjz6+qWDFhd8/JpfWMH8NSWNHe+A== + +"@rolldown/binding-win32-x64-msvc@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.6.tgz#1162903e264ed10db4be8af40ba8cf13cd4a0b4a" + integrity sha512-np8iZSLfXlAD4kWhiyq/u0Yt8oZDtRQ8lGhQaCXo2rl37KNjeU0GjJuwr4P3oeZ++ROfofsKNBqR5LTO8aXyWQ== + +"@rolldown/pluginutils@^1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz#e3fcee093fbb5ce765e1ad088ff4de2889f6f9be" + integrity sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw== + +"@shikijs/core@4.4.3": + version "4.4.3" + resolved "https://registry.yarnpkg.com/@shikijs/core/-/core-4.4.3.tgz#00a942fa45ad0e4146ac6dbbac32b8b704b42e3f" + integrity sha512-QCR4q2ZO/ILJEuwiBMel4wdcTDb1JGwfjKTxPDF6x8ixOaluPrVqIn06C99AcRPhmYlBR56d/Fb+GN58GzExpg== + dependencies: + "@shikijs/primitive" "4.4.3" + "@shikijs/types" "4.4.3" + "@shikijs/vscode-textmate" "^10.0.2" + "@types/hast" "^3.0.5" + hast-util-to-html "^9.0.5" + +"@shikijs/engine-javascript@4.4.3": + version "4.4.3" + resolved "https://registry.yarnpkg.com/@shikijs/engine-javascript/-/engine-javascript-4.4.3.tgz#42dbdc18ec2f86003624674839a8f090cdd7cb62" + integrity sha512-FbOjFJp9VLdo1Wevs10BBtVxiTWwNLqZh5Gkhjgda/ioL15YOgeSl9n+6XMa3qRlPQzfhFNe641SrynFHYG0nQ== + dependencies: + "@shikijs/types" "4.4.3" + "@shikijs/vscode-textmate" "^10.0.2" + oniguruma-to-es "^4.3.6" + +"@shikijs/engine-oniguruma@4.4.3": + version "4.4.3" + resolved "https://registry.yarnpkg.com/@shikijs/engine-oniguruma/-/engine-oniguruma-4.4.3.tgz#a1754f9f42e0f35a55cda9a977599041a2ad5b07" + integrity sha512-EcOQkxdxGQrc1Row/cC2c96/v1dbZqGnEVu1qTuT/MJmp6+cXCvQussowVmCv5Tqr3KuY3c7IbM6HTW3LJ1k9w== + dependencies: + "@shikijs/types" "4.4.3" + "@shikijs/vscode-textmate" "^10.0.2" + +"@shikijs/langs@4.4.3": + version "4.4.3" + resolved "https://registry.yarnpkg.com/@shikijs/langs/-/langs-4.4.3.tgz#113282396f119dbba8d3b5e86668258fa8df6e7b" + integrity sha512-ePic0yfAJGOF83D5wBHK/00EjK65oahBYxFk5epgq33WRv7X9UuxLEV8PtR0szC0z8dl7INIpIodB99JRFlR+A== + dependencies: + "@shikijs/types" "4.4.3" + +"@shikijs/primitive@4.4.3": + version "4.4.3" + resolved "https://registry.yarnpkg.com/@shikijs/primitive/-/primitive-4.4.3.tgz#86490cea63b3e2c56b8d9163046e010258844d81" + integrity sha512-m0wBeLDQDeIxRdUmrCPdQqfuUamDwRL5isCfYbguKD6NiaKpVbsv+3J81DyIKgNW5h4WAIIr8T4EkgQrBBxvaQ== + dependencies: + "@shikijs/types" "4.4.3" + "@shikijs/vscode-textmate" "^10.0.2" + "@types/hast" "^3.0.5" + +"@shikijs/themes@4.4.3": + version "4.4.3" + resolved "https://registry.yarnpkg.com/@shikijs/themes/-/themes-4.4.3.tgz#8310a78261f4cf742663e07e2028df046a02bd72" + integrity sha512-w8UHjeUnIR965KMWJHUPXOc2mNJUnK3vpVLYLvw5IYU2mnTTJ89E24OrJDBNiJDQ0qzb0tc4l7mrIXx5cFeIyw== + dependencies: + "@shikijs/types" "4.4.3" + +"@shikijs/transformers@^3.0.0 || ^4.0.0": + version "4.4.3" + resolved "https://registry.yarnpkg.com/@shikijs/transformers/-/transformers-4.4.3.tgz#18869d95b0e2656fa7ae98350e09408c57585018" + integrity sha512-oJSARV6NaWd+rnNJbtnpAdj3Zg0ZVyzsnMgb3vi3HA+35y8lBWUCpOnWsmyiXZIikY+x1BDqrQUgmxfzWh7Jvw== + dependencies: + "@shikijs/core" "4.4.3" + "@shikijs/types" "4.4.3" + +"@shikijs/types@4.4.3": + version "4.4.3" + resolved "https://registry.yarnpkg.com/@shikijs/types/-/types-4.4.3.tgz#019aff19f0cbfb21642c59f6f8432ced74e27b45" + integrity sha512-UEJxmRR++MAGR6hugn0vgVS2W/6lWAts84FFSrnlH9sP0LNol7E5+NQ792pH8liWUhyMyjhTgSUH3k7iD7tc5g== + dependencies: + "@shikijs/vscode-textmate" "^10.0.2" + "@types/hast" "^3.0.5" + +"@shikijs/vscode-textmate@^10.0.2": + version "10.0.2" + resolved "https://registry.yarnpkg.com/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz#a90ab31d0cc1dfb54c66a69e515bf624fa7b2224" + integrity sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg== + +"@standard-schema/spec@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@standard-schema/spec/-/spec-1.1.0.tgz#a79b55dbaf8604812f52d140b2c9ab41bc150bb8" + integrity sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w== + +"@types/chai@^5.2.2": + version "5.2.3" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-5.2.3.tgz#8e9cd9e1c3581fa6b341a5aed5588eb285be0b4a" + integrity sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA== + dependencies: + "@types/deep-eql" "*" + assertion-error "^2.0.1" + +"@types/deep-eql@*": + version "4.0.2" + resolved "https://registry.yarnpkg.com/@types/deep-eql/-/deep-eql-4.0.2.tgz#334311971d3a07121e7eb91b684a605e7eea9cbd" + integrity sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw== + +"@types/estree@^1.0.0": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.9.tgz#cf3f0e876d7bee15a93ab925b82bf570a3904a24" + integrity sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg== + +"@types/hast@^3.0.0", "@types/hast@^3.0.5": + version "3.0.5" + resolved "https://registry.yarnpkg.com/@types/hast/-/hast-3.0.5.tgz#48020de4c0e63492f4ca9db42068c108f68b7f8f" + integrity sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g== + dependencies: + "@types/unist" "*" + +"@types/mdast@^4.0.0": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-4.0.4.tgz#7ccf72edd2f1aa7dd3437e180c64373585804dd6" + integrity sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA== + dependencies: + "@types/unist" "*" + +"@types/node@^22.0.0": + version "22.20.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.20.1.tgz#84e7cdf63cdaa20c134aa317ccc901aa21e16f0e" + integrity sha512-EANqOCF9QFyra+4pfxUcX9STKJpCLjMbObVzljIJomAWSnuSIEAvyzEU53GaajbXJEgdh0iEcPL+DGvpUd4k1Q== + dependencies: + undici-types "~6.21.0" + +"@types/unist@*", "@types/unist@^3.0.0": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/unist/-/unist-3.0.3.tgz#acaab0f919ce69cce629c2d4ed2eb4adc1b6c20c" + integrity sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q== + +"@typescript/typescript-aix-ppc64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz#cdc7ce81d60f1e09034960ddfb1fb880d7a776b6" + integrity sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ== + +"@typescript/typescript-darwin-arm64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz#a55fdfcfa58df58d27db2237cde6a5c1e35a7235" + integrity sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA== + +"@typescript/typescript-darwin-x64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz#38d1c9172800a91d707bec64d2a370a016634db4" + integrity sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA== + +"@typescript/typescript-freebsd-arm64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz#f1ff8810030b35d2b5be0db6a2dc650460ea94fa" + integrity sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ== + +"@typescript/typescript-freebsd-x64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz#3d86b03f353c5b1ba95162eb6ce35533bfc294bd" + integrity sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw== + +"@typescript/typescript-linux-arm64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz#d9334d96d6dac6ff85da9c865588948de939e91f" + integrity sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ== + +"@typescript/typescript-linux-arm@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz#ad94b41e1aee2a4dcc6a298c7b67c43345fde32e" + integrity sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ== + +"@typescript/typescript-linux-loong64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz#2965aee4fc873360139d893daafe6397a29138ad" + integrity sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ== + +"@typescript/typescript-linux-mips64el@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz#1a887a311bed3a833f80bfd4a9ed37c271936cf0" + integrity sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA== + +"@typescript/typescript-linux-ppc64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz#8b63c9b2f445b393eb4e43ec21da225dade3577d" + integrity sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA== + +"@typescript/typescript-linux-riscv64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz#b6e8a35c289b3ea97a92a41d461aaeed0d3b36e1" + integrity sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ== + +"@typescript/typescript-linux-s390x@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz#2ef96693be4861f6d17965427e5b009cbbed1a3e" + integrity sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw== + +"@typescript/typescript-linux-x64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz#73269cb0baba50aea0ca060445a6b88e583f1ce2" + integrity sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A== + +"@typescript/typescript-netbsd-arm64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz#3a3649f97fafa210b4e6e3798c15e06605c8a901" + integrity sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA== + +"@typescript/typescript-netbsd-x64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz#47ec59491a40c470d2807dc4d2b825528fd979ab" + integrity sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA== + +"@typescript/typescript-openbsd-arm64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz#796be8da0bd989d8a3fb96f2801e38a8365b4baf" + integrity sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ== + +"@typescript/typescript-openbsd-x64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz#d37fe2a729eb942c076c454ee7f1815faf7d560f" + integrity sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg== + +"@typescript/typescript-sunos-x64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz#aba8d3464c3565a7044789baba96916bd4ab2c88" + integrity sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g== + +"@typescript/typescript-win32-arm64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz#b9de50a17196383f62620b5f9d0a2f34ad3b60d7" + integrity sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ== + +"@typescript/typescript-win32-x64@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz#cf3b7b0d6ce5635daca4c8e01c189cdcde47ec3c" + integrity sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g== + +"@ungap/structured-clone@^1.0.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.4.0.tgz#5e2e1374c0a30b5a42e8b083523a225c6945f88a" + integrity sha512-1mEZtMKPM09vDmQt5y7YvmN2+DFTP7Tg0EWXdic8/C6VRnpb33e4ghisCIE3WZjsE2N8mf+QV1Zqh7ZFYLWInQ== + +"@vitest/expect@4.1.11": + version "4.1.11" + resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-4.1.11.tgz#5f580d1f9cdbba314dbf23b2d911f8eb23878f5f" + integrity sha512-VX2x5vNJXET47KAFzwERI+KRMtTTCSWTfSMKsW7JsUsXV4psq++e3DvZpuTDOpHcxytiDs6p2nhVb2tVDiiUYw== + dependencies: + "@standard-schema/spec" "^1.1.0" + "@types/chai" "^5.2.2" + "@vitest/spy" "4.1.11" + "@vitest/utils" "4.1.11" + chai "^6.2.2" + tinyrainbow "^3.1.0" + +"@vitest/mocker@4.1.11": + version "4.1.11" + resolved "https://registry.yarnpkg.com/@vitest/mocker/-/mocker-4.1.11.tgz#8e2906361bc5dfa271757a858ae80643118fcbb4" + integrity sha512-2XJVD55d1o5AZous5CCGKS74g/riOj9odEt2bQpCVZeblHyHdnMeFl4jl0XjU21stf4mbjUkew2eXQZt65g5CQ== + dependencies: + "@vitest/spy" "4.1.11" + estree-walker "^3.0.3" + magic-string "^0.30.21" + +"@vitest/pretty-format@4.1.11": + version "4.1.11" + resolved "https://registry.yarnpkg.com/@vitest/pretty-format/-/pretty-format-4.1.11.tgz#8b28eb8240771d6ea970e33beaeb41384b51868e" + integrity sha512-yiZzPbGTS9Sr/JpFl8zHrcIkAofNbFV6k21vIgQN/cY/oxZeXhJv5sc/MBJ5jFKWmWs+oJHw0UXLZjmf931+Vw== + dependencies: + tinyrainbow "^3.1.0" + +"@vitest/runner@4.1.11": + version "4.1.11" + resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-4.1.11.tgz#bfbad98c8d6c3f1fb4df12056ad569821ff77f21" + integrity sha512-LztvUgdwMNJMIkj3hQnnxiC2Xy1zNxq928W/xhjCLaNCzqTZOudjwbQf6v9IntZGPw132i2Lq2rgTRZHD3JHNw== + dependencies: + "@vitest/utils" "4.1.11" + pathe "^2.0.3" + +"@vitest/snapshot@4.1.11": + version "4.1.11" + resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-4.1.11.tgz#df461eb165924a3155986dde68e13360f53f3d4c" + integrity sha512-pN7ikn1ON7h8ee4gIAp4AzyK+zBtJPzVbqOgu5LCEh4VaJVbPQcgYQYJIMGQPXVeJJq1fnfazis7a5pFNPahog== + dependencies: + "@vitest/pretty-format" "4.1.11" + "@vitest/utils" "4.1.11" + magic-string "^0.30.21" + pathe "^2.0.3" + +"@vitest/spy@4.1.11": + version "4.1.11" + resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-4.1.11.tgz#0add45cae953afed9c88f98e2f6fc9164558c32a" + integrity sha512-apNa/prQy2qCeywhnixOHPRCgGNhvg7T4Dapfl1GahLp/R+uhBm5cPyFoNVyqsNd2h1nJxL6BqqdIjiABL60YA== + +"@vitest/utils@4.1.11": + version "4.1.11" + resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-4.1.11.tgz#9b27a4293b827942b223539bfab1bd9f7eada31b" + integrity sha512-zTCVGpyFsGWBhllOyKlTw/vnr6D9qxsfSDyfbyZmTyjHw5N/VuvzHpHoQjm2ZJzn4RJgx5w4r7V0er69CmLgPQ== + dependencies: + "@vitest/pretty-format" "4.1.11" + convert-source-map "^2.0.0" + tinyrainbow "^3.1.0" + +assertion-error@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-2.0.1.tgz#f641a196b335690b1070bf00b6e7593fec190bf7" + integrity sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA== + +bidi-js@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/bidi-js/-/bidi-js-1.0.3.tgz#6f8bcf3c877c4d9220ddf49b9bb6930c88f877d2" + integrity sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw== + dependencies: + require-from-string "^2.0.2" + +braces@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== + dependencies: + fill-range "^7.1.1" + +ccount@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/ccount/-/ccount-2.0.1.tgz#17a3bf82302e0870d6da43a01311a8bc02a3ecf5" + integrity sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg== + +chai@^6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/chai/-/chai-6.2.2.tgz#ae41b52c9aca87734505362717f3255facda360e" + integrity sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg== + +character-entities-html4@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/character-entities-html4/-/character-entities-html4-2.1.0.tgz#1f1adb940c971a4b22ba39ddca6b618dc6e56b2b" + integrity sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA== + +character-entities-legacy@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz#76bc83a90738901d7bc223a9e93759fdd560125b" + integrity sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ== + +comma-separated-tokens@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz#4e89c9458acb61bc8fef19f4529973b2392839ee" + integrity sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg== + +convert-source-map@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" + integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== + +crelt@^1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/crelt/-/crelt-1.0.7.tgz#3b441b2ddfa73161d6a2770aa4cd677f895eaf28" + integrity sha512-aK6BbWfhf4U/wCcLHKPJl/xa6VkVstRaPywWtMKGwuOLc/wZTyQYuoxgvZnNsBvv7Kg3YTBQYYBCggcviQczuA== + +css-tree@^3.0.0, css-tree@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-3.2.1.tgz#86cac7011561272b30e6b1e042ba6ce047aa7518" + integrity sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA== + dependencies: + mdn-data "2.27.1" + source-map-js "^1.2.1" + +data-urls@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-7.0.0.tgz#6dce8b63226a1ecfdd907ce18a8ccfb1eee506d3" + integrity sha512-23XHcCF+coGYevirZceTVD7NdJOqVn+49IHyxgszm+JIiHLoB2TkmPtsYkNWT1pvRSGkc35L6NHs0yHkN2SumA== + dependencies: + whatwg-mimetype "^5.0.0" + whatwg-url "^16.0.0" + +decimal.js@^10.6.0: + version "10.6.0" + resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.6.0.tgz#e649a43e3ab953a72192ff5983865e509f37ed9a" + integrity sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg== + +dequal@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be" + integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA== + +detect-libc@^2.0.3: + version "2.1.2" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.1.2.tgz#689c5dcdc1900ef5583a4cb9f6d7b473742074ad" + integrity sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ== + +devlop@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/devlop/-/devlop-1.1.0.tgz#4db7c2ca4dc6e0e834c30be70c94bbc976dc7018" + integrity sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA== + dependencies: + dequal "^2.0.0" + +diff@9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-9.0.0.tgz#297c31cd7c280f13dfe335791ec2063bd4a73a6f" + integrity sha512-svtcdpS8CgJyqAjEQIXdb3OjhFVVYjzGAPO8WGCmRbrml64SPw/jJD4GoE98aR7r25A0XcgrK3F02yw9R/vhQw== + +entities@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-8.0.0.tgz#c1df5fe3602429747fa233d0dd26f142f0ce4743" + integrity sha512-zwfzJecQ/Uej6tusMqwAqU/6KL2XaB2VZ2Jg54Je6ahNBGNH6Ek6g3jjNCF0fG9EWQKGZNddNjU5F1ZQn/sBnA== + +es-module-lexer@^2.0.0: + version "2.3.2" + resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-2.3.2.tgz#311fa4f40168c1975c505477c51b23234d41ad55" + integrity sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw== + +estree-walker@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-3.0.3.tgz#67c3e549ec402a487b4fc193d1953a524752340d" + integrity sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g== + dependencies: + "@types/estree" "^1.0.0" + +expect-type@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/expect-type/-/expect-type-1.4.0.tgz#24edf7f0cc69a44d008567ba4594ab96f3c3a3d6" + integrity sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA== + +fdir@^6.5.0: + version "6.5.0" + resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.5.0.tgz#ed2ab967a331ade62f18d077dae192684d50d350" + integrity sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg== + +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== + dependencies: + to-regex-range "^5.0.1" + +fsevents@~2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== + +hast-util-to-html@9.0.5, hast-util-to-html@^9.0.5: + version "9.0.5" + resolved "https://registry.yarnpkg.com/hast-util-to-html/-/hast-util-to-html-9.0.5.tgz#ccc673a55bb8e85775b08ac28380f72d47167005" + integrity sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw== + dependencies: + "@types/hast" "^3.0.0" + "@types/unist" "^3.0.0" + ccount "^2.0.0" + comma-separated-tokens "^2.0.0" + hast-util-whitespace "^3.0.0" + html-void-elements "^3.0.0" + mdast-util-to-hast "^13.0.0" + property-information "^7.0.0" + space-separated-tokens "^2.0.0" + stringify-entities "^4.0.0" + zwitch "^2.0.4" + +hast-util-whitespace@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz#7778ed9d3c92dd9e8c5c8f648a49c21fc51cb621" + integrity sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw== + dependencies: + "@types/hast" "^3.0.0" + +html-encoding-sniffer@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz#f8d9390b3b348b50d4f61c16dd2ef5c05980a882" + integrity sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg== + dependencies: + "@exodus/bytes" "^1.6.0" + +html-void-elements@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/html-void-elements/-/html-void-elements-3.0.0.tgz#fc9dbd84af9e747249034d4d62602def6517f1d7" + integrity sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg== + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-potential-custom-element-name@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" + integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== + +jsdom@^30.0.1: + version "30.0.1" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-30.0.1.tgz#1b0751cbd0abce86762c48697583b5e91433f6e4" + integrity sha512-52v7mUVUfNQVYYqE1lcdaymWL0njO7lTLUog6ZvW2U5KsbiLk/GnZlVJ+qx0xfNJZ6Gn+KSpPNE52vurbxZwrA== + dependencies: + "@asamuzakjp/css-color" "^6.0.5" + "@asamuzakjp/dom-selector" "^8.3.0" + "@bramus/specificity" "^2.4.2" + "@csstools/css-syntax-patches-for-csstree" "^1.1.7" + "@exodus/bytes" "^1.15.1" + css-tree "^3.2.1" + data-urls "^7.0.0" + decimal.js "^10.6.0" + html-encoding-sniffer "^6.0.0" + is-potential-custom-element-name "^1.0.1" + lru-cache "^11.5.2" + parse5 "^8.0.1" + saxes "^6.0.0" + symbol-tree "^3.2.4" + tough-cookie "^6.0.2" + undici "^8.9.0" + w3c-xmlserializer "^5.0.0" + webidl-conversions "^8.0.1" + whatwg-mimetype "^5.0.0" + whatwg-url "^17.1.0" + xml-name-validator "^5.0.0" + +lightningcss-android-arm64@1.33.0: + version "1.33.0" + resolved "https://registry.yarnpkg.com/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz#9a6841f88ae50fc83502903892b41af41bc2b907" + integrity sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg== + +lightningcss-darwin-arm64@1.33.0: + version "1.33.0" + resolved "https://registry.yarnpkg.com/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz#c0f2c31c0bfd19fa4dd3f18e957a1f1a152097d6" + integrity sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg== + +lightningcss-darwin-x64@1.33.0: + version "1.33.0" + resolved "https://registry.yarnpkg.com/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz#cb0705965acb538c6683949ce6925fb3cdf7c361" + integrity sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ== + +lightningcss-freebsd-x64@1.33.0: + version "1.33.0" + resolved "https://registry.yarnpkg.com/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz#763538828b26bab2680dadafcc84ee78b0eb502b" + integrity sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg== + +lightningcss-linux-arm-gnueabihf@1.33.0: + version "1.33.0" + resolved "https://registry.yarnpkg.com/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz#6862e3176a331aedbdec1ed352b4d7d0dd0784de" + integrity sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ== + +lightningcss-linux-arm64-gnu@1.33.0: + version "1.33.0" + resolved "https://registry.yarnpkg.com/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz#c6a3a2ed15141daf6bdc2628930f8e39bdf473aa" + integrity sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg== + +lightningcss-linux-arm64-musl@1.33.0: + version "1.33.0" + resolved "https://registry.yarnpkg.com/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz#7fa1334971fc82845f9827df6ef8a0b20914bac6" + integrity sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ== + +lightningcss-linux-x64-gnu@1.33.0: + version "1.33.0" + resolved "https://registry.yarnpkg.com/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz#8b927862ea8c2bbc6831a46509244b50d9936e55" + integrity sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg== + +lightningcss-linux-x64-musl@1.33.0: + version "1.33.0" + resolved "https://registry.yarnpkg.com/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz#0c525bb077dfd94404c059cfe42dad797e96aeaf" + integrity sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw== + +lightningcss-win32-arm64-msvc@1.33.0: + version "1.33.0" + resolved "https://registry.yarnpkg.com/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz#850ee1103dac989cfab50e3ac22d1a69e394e63d" + integrity sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA== + +lightningcss-win32-x64-msvc@1.33.0: + version "1.33.0" + resolved "https://registry.yarnpkg.com/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz#e343ae152eed3609dc6e11949d1a3bf39a1c946f" + integrity sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA== + +lightningcss@^1.33.0: + version "1.33.0" + resolved "https://registry.yarnpkg.com/lightningcss/-/lightningcss-1.33.0.tgz#c08867d71a79385c6e190214fd72fef3e5f95f0b" + integrity sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA== + dependencies: + detect-libc "^2.0.3" + optionalDependencies: + lightningcss-android-arm64 "1.33.0" + lightningcss-darwin-arm64 "1.33.0" + lightningcss-darwin-x64 "1.33.0" + lightningcss-freebsd-x64 "1.33.0" + lightningcss-linux-arm-gnueabihf "1.33.0" + lightningcss-linux-arm64-gnu "1.33.0" + lightningcss-linux-arm64-musl "1.33.0" + lightningcss-linux-x64-gnu "1.33.0" + lightningcss-linux-x64-musl "1.33.0" + lightningcss-win32-arm64-msvc "1.33.0" + lightningcss-win32-x64-msvc "1.33.0" + +lru-cache@^11.5.2: + version "11.5.2" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.5.2.tgz#00e16665c90c620fba14a3c368732a976493f760" + integrity sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g== + +lru_map@0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.4.1.tgz#f7b4046283c79fb7370c36f8fca6aee4324b0a98" + integrity sha512-I+lBvqMMFfqaV8CJCISjI3wbjmwVu/VyOoU7+qtu9d7ioW5klMgsTTiUOUp+DJvfTTzKXoPbyC6YfgkNcyPSOg== + +magic-string@^0.30.21: + version "0.30.21" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.21.tgz#56763ec09a0fa8091df27879fd94d19078c00d91" + integrity sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ== + dependencies: + "@jridgewell/sourcemap-codec" "^1.5.5" + +"markedit-api@https://github.com/MarkEdit-app/MarkEdit-api#v0.33.0": + version "0.33.0" + resolved "https://github.com/MarkEdit-app/MarkEdit-api#627a06a52a243ee8c6a734a0fdffd19d324395c9" + +"markedit-vite@https://github.com/MarkEdit-app/MarkEdit-vite#v0.6.0": + version "0.6.0" + resolved "https://github.com/MarkEdit-app/MarkEdit-vite#c78db6f15691262076293522ba4283d260110fa2" + +mdast-util-to-hast@^13.0.0: + version "13.2.1" + resolved "https://registry.yarnpkg.com/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz#d7ff84ca499a57e2c060ae67548ad950e689a053" + integrity sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA== + dependencies: + "@types/hast" "^3.0.0" + "@types/mdast" "^4.0.0" + "@ungap/structured-clone" "^1.0.0" + devlop "^1.0.0" + micromark-util-sanitize-uri "^2.0.0" + trim-lines "^3.0.0" + unist-util-position "^5.0.0" + unist-util-visit "^5.0.0" + vfile "^6.0.0" + +mdn-data@2.27.1: + version "2.27.1" + resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.27.1.tgz#e37b9c50880b75366c4d40ac63d9bbcacdb61f0e" + integrity sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ== + +micromark-util-character@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/micromark-util-character/-/micromark-util-character-2.1.1.tgz#2f987831a40d4c510ac261e89852c4e9703ccda6" + integrity sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q== + dependencies: + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + +micromark-util-encode@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz#0d51d1c095551cfaac368326963cf55f15f540b8" + integrity sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw== + +micromark-util-sanitize-uri@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz#ab89789b818a58752b73d6b55238621b7faa8fd7" + integrity sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ== + dependencies: + micromark-util-character "^2.0.0" + micromark-util-encode "^2.0.0" + micromark-util-symbol "^2.0.0" + +micromark-util-symbol@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz#e5da494e8eb2b071a0d08fb34f6cefec6c0a19b8" + integrity sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q== + +micromark-util-types@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/micromark-util-types/-/micromark-util-types-2.0.2.tgz#f00225f5f5a0ebc3254f96c36b6605c4b393908e" + integrity sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA== + +micromatch@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" + integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== + dependencies: + braces "^3.0.3" + picomatch "^2.3.1" + +nanoid@^3.3.17: + version "3.3.18" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.18.tgz#f66a2de1199ffde0fcf21c8a5f13106b1c081913" + integrity sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w== + +obug@^2.1.1: + version "2.1.4" + resolved "https://registry.yarnpkg.com/obug/-/obug-2.1.4.tgz#9090d8a548a522517915d2aa6aae907197ac6cf8" + integrity sha512-4a+OsYv9UktOJKE+l1A4OufDgdRF9PifWj+tJnHURo/P+WOxpG4GzUFL9qCalmWauao6ogiG+QvnCovwPoyAWA== + +oniguruma-parser@^0.12.2: + version "0.12.2" + resolved "https://registry.yarnpkg.com/oniguruma-parser/-/oniguruma-parser-0.12.2.tgz#e27ca446f7fcf0969662a3ab9b4f43176d62b139" + integrity sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw== + +oniguruma-to-es@^4.3.6: + version "4.3.6" + resolved "https://registry.yarnpkg.com/oniguruma-to-es/-/oniguruma-to-es-4.3.6.tgz#43e640280241b0d687a314e7a641d476407a1c4d" + integrity sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA== + dependencies: + oniguruma-parser "^0.12.2" + regex "^6.1.0" + regex-recursion "^6.0.2" + +parse5@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-8.0.1.tgz#f43bcd2cd683efe084075333e9ce0da7d06da31e" + integrity sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw== + dependencies: + entities "^8.0.0" + +pathe@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/pathe/-/pathe-2.0.3.tgz#3ecbec55421685b70a9da872b2cff3e1cbed1716" + integrity sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w== + +picocolors@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" + integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== + +picomatch@^2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.2.tgz#5a942915e26b372dc0f0e6753149a16e6b1c5601" + integrity sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA== + +picomatch@^4.0.3, picomatch@^4.0.4, picomatch@^4.0.5: + version "4.0.7" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.7.tgz#6313360034ccb36b3dc61ecbdff78121f90fe21f" + integrity sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA== + +postcss@^8.5.26: + version "8.5.26" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.26.tgz#6e75135780c7e10df3433bf2266c552d35c8c620" + integrity sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ== + dependencies: + nanoid "^3.3.17" + picocolors "^1.1.1" + source-map-js "^1.2.1" + +property-information@^7.0.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/property-information/-/property-information-7.2.0.tgz#0809b34264e995c0bfcd3227028a1e35210af80a" + integrity sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg== + +punycode@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== + +regex-recursion@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/regex-recursion/-/regex-recursion-6.0.2.tgz#a0b1977a74c87f073377b938dbedfab2ea582b33" + integrity sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg== + dependencies: + regex-utilities "^2.3.0" + +regex-utilities@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/regex-utilities/-/regex-utilities-2.3.0.tgz#87163512a15dce2908cf079c8960d5158ff43280" + integrity sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng== + +regex@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/regex/-/regex-6.1.0.tgz#d7ce98f8ee32da7497c13f6601fca2bc4a6a7803" + integrity sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg== + dependencies: + regex-utilities "^2.3.0" + +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + +rolldown@~1.2.4: + version "1.2.6" + resolved "https://registry.yarnpkg.com/rolldown/-/rolldown-1.2.6.tgz#025f5c11975cc70129ea9c76c54f35dd35881786" + integrity sha512-vMM4q3aixf46GiF1Kok8jDPFsEpXgFWGjUHXNkNHNm+Y2adXAG2dbX91jkti3i0ZRsOlcmbuzAz1poObSHCmUA== + dependencies: + "@oxc-project/types" "=0.147.0" + "@rolldown/pluginutils" "^1.0.0" + optionalDependencies: + "@rolldown/binding-android-arm-eabi" "1.2.6" + "@rolldown/binding-android-arm64" "1.2.6" + "@rolldown/binding-darwin-arm64" "1.2.6" + "@rolldown/binding-darwin-x64" "1.2.6" + "@rolldown/binding-freebsd-x64" "1.2.6" + "@rolldown/binding-linux-arm-gnueabihf" "1.2.6" + "@rolldown/binding-linux-arm64-gnu" "1.2.6" + "@rolldown/binding-linux-arm64-musl" "1.2.6" + "@rolldown/binding-linux-ppc64-gnu" "1.2.6" + "@rolldown/binding-linux-s390x-gnu" "1.2.6" + "@rolldown/binding-linux-x64-gnu" "1.2.6" + "@rolldown/binding-linux-x64-musl" "1.2.6" + "@rolldown/binding-openharmony-arm64" "1.2.6" + "@rolldown/binding-win32-arm64-msvc" "1.2.6" + "@rolldown/binding-win32-x64-msvc" "1.2.6" + +saxes@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/saxes/-/saxes-6.0.0.tgz#fe5b4a4768df4f14a201b1ba6a65c1f3d9988cc5" + integrity sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA== + dependencies: + xmlchars "^2.2.0" + +"shiki@^3.0.0 || ^4.0.0": + version "4.4.3" + resolved "https://registry.yarnpkg.com/shiki/-/shiki-4.4.3.tgz#31fb41c5c82435779a0b5a9b92a3b0377b061e15" + integrity sha512-Mb/GvXPHBAXdgGIcnfU5L3ldpn1XcxrGkPHwqgRx17/I2XRfqlFKk2vGkHWINn1kdXvzJZeuO3is6I9KLPFm0g== + dependencies: + "@shikijs/core" "4.4.3" + "@shikijs/engine-javascript" "4.4.3" + "@shikijs/engine-oniguruma" "4.4.3" + "@shikijs/langs" "4.4.3" + "@shikijs/themes" "4.4.3" + "@shikijs/types" "4.4.3" + "@shikijs/vscode-textmate" "^10.0.2" + "@types/hast" "^3.0.5" + +siginfo@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/siginfo/-/siginfo-2.0.0.tgz#32e76c70b79724e3bb567cb9d543eb858ccfaf30" + integrity sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g== + +source-map-js@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46" + integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== + +space-separated-tokens@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz#1ecd9d2350a3844572c3f4a312bceb018348859f" + integrity sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q== + +stackback@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/stackback/-/stackback-0.0.2.tgz#1ac8a0d9483848d1695e418b6d031a3c3ce68e3b" + integrity sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw== + +std-env@^4.0.0-rc.1: + version "4.2.0" + resolved "https://registry.yarnpkg.com/std-env/-/std-env-4.2.0.tgz#8ebe0ec60485668ab47227b312f4254cdf80c9d3" + integrity sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw== + +stringify-entities@^4.0.0: + version "4.0.4" + resolved "https://registry.yarnpkg.com/stringify-entities/-/stringify-entities-4.0.4.tgz#b3b79ef5f277cc4ac73caeb0236c5ba939b3a4f3" + integrity sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg== + dependencies: + character-entities-html4 "^2.0.0" + character-entities-legacy "^3.0.0" + +style-mod@^4.0.0, style-mod@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/style-mod/-/style-mod-4.1.3.tgz#6e9012255bb799bdac37e288f7671b5d71bf9f73" + integrity sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ== + +symbol-tree@^3.2.4: + version "3.2.4" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" + integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== + +tinybench@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/tinybench/-/tinybench-2.9.0.tgz#103c9f8ba6d7237a47ab6dd1dcff77251863426b" + integrity sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg== + +tinyexec@^1.0.2: + version "1.3.0" + resolved "https://registry.yarnpkg.com/tinyexec/-/tinyexec-1.3.0.tgz#aacc1dbb1d4e93e6ad8dd64944e09f9ad147a474" + integrity sha512-QKAl9m8gWWGHV8jZcPeym6j+XULi6tOf1mT83WYJ4Lk2ytW/uwAWkrP0uFsdoYMdueVJ0qs26wZ+23xeB4ibNQ== + +tinyglobby@^0.2.15, tinyglobby@^0.2.17: + version "0.2.17" + resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.17.tgz#562a9a6c9eb2b3b123d39719f9af5bb44fcd7631" + integrity sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g== + dependencies: + fdir "^6.5.0" + picomatch "^4.0.4" + +tinyrainbow@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/tinyrainbow/-/tinyrainbow-3.1.1.tgz#c0168387d3d8d70b6b3c2c0936de5fee738cea20" + integrity sha512-yau8yJdTt989Mm0Bd/236QnzEiPf2xLLTqUZRUJOo/3CB078LSwzei343DgtJVmfJKJE3TMINY1u42SQsP6mXw== + +tldts-core@^7.4.11: + version "7.4.11" + resolved "https://registry.yarnpkg.com/tldts-core/-/tldts-core-7.4.11.tgz#a02fba29af72cbf9e658cb3a335f857efc9475f7" + integrity sha512-CW3WN2rIIE/Of21mulhgnGOwoDyEFNygyIBOONSdyAuSATgMMUCpLeUlB+E8sAwA5xRV9hYPl+kyZ9citHCaKg== + +tldts@^7.0.5: + version "7.4.11" + resolved "https://registry.yarnpkg.com/tldts/-/tldts-7.4.11.tgz#51d5a3feeb473e592edf671491a24fb23789eed2" + integrity sha512-aBiNayCfTQxuIJBm06M+xR14cYaYlDlSXZbgsnKzKNxDKUVq7KFwTjwBSsb7m9Y5xO8WfPnBc63WaYFMTGlvqw== + dependencies: + tldts-core "^7.4.11" + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +tough-cookie@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-6.0.2.tgz#7b1f22fcf2daf06c4ff9d53ec1845f44c6627062" + integrity sha512-exgYmnmL/sJpR3upZfXG5PoatXQii55xAiXGXzY+sROLZ/Y+SLcp9PgJNI9Vz37HpQ74WvDcLT8eqm+kV3FzrA== + dependencies: + tldts "^7.0.5" + +tr46@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-6.0.0.tgz#f5a1ae546a0adb32a277a2278d0d17fa2f9093e6" + integrity sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw== + dependencies: + punycode "^2.3.1" + +trim-lines@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/trim-lines/-/trim-lines-3.0.1.tgz#d802e332a07df861c48802c04321017b1bd87338" + integrity sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg== + +typescript@^7.0.0: + version "7.0.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-7.0.2.tgz#9ec773d7954a8c182c17cc5bbd575aa28bc51582" + integrity sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA== + optionalDependencies: + "@typescript/typescript-aix-ppc64" "7.0.2" + "@typescript/typescript-darwin-arm64" "7.0.2" + "@typescript/typescript-darwin-x64" "7.0.2" + "@typescript/typescript-freebsd-arm64" "7.0.2" + "@typescript/typescript-freebsd-x64" "7.0.2" + "@typescript/typescript-linux-arm" "7.0.2" + "@typescript/typescript-linux-arm64" "7.0.2" + "@typescript/typescript-linux-loong64" "7.0.2" + "@typescript/typescript-linux-mips64el" "7.0.2" + "@typescript/typescript-linux-ppc64" "7.0.2" + "@typescript/typescript-linux-riscv64" "7.0.2" + "@typescript/typescript-linux-s390x" "7.0.2" + "@typescript/typescript-linux-x64" "7.0.2" + "@typescript/typescript-netbsd-arm64" "7.0.2" + "@typescript/typescript-netbsd-x64" "7.0.2" + "@typescript/typescript-openbsd-arm64" "7.0.2" + "@typescript/typescript-openbsd-x64" "7.0.2" + "@typescript/typescript-sunos-x64" "7.0.2" + "@typescript/typescript-win32-arm64" "7.0.2" + "@typescript/typescript-win32-x64" "7.0.2" + +undici-types@~6.21.0: + version "6.21.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb" + integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ== + +undici@^8.9.0: + version "8.10.0" + resolved "https://registry.yarnpkg.com/undici/-/undici-8.10.0.tgz#67ed7c4087f0f40fba7bef3a46f2be80572f2473" + integrity sha512-HvltHd7avK13QIw/oLe4qoOLyoVSoafqJ2jYOrtMRBkbYT31eiBQ8O0ehRKZiEZCMEyLFQNIADpgCWC5fALvYQ== + +unist-util-is@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-6.0.1.tgz#d0a3f86f2dd0db7acd7d8c2478080b5c67f9c6a9" + integrity sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g== + dependencies: + "@types/unist" "^3.0.0" + +unist-util-position@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/unist-util-position/-/unist-util-position-5.0.0.tgz#678f20ab5ca1207a97d7ea8a388373c9cf896be4" + integrity sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA== + dependencies: + "@types/unist" "^3.0.0" + +unist-util-stringify-position@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz#449c6e21a880e0855bf5aabadeb3a740314abac2" + integrity sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ== + dependencies: + "@types/unist" "^3.0.0" + +unist-util-visit-parents@^6.0.0: + version "6.0.2" + resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-6.0.2.tgz#777df7fb98652ce16b4b7cd999d0a1a40efa3a02" + integrity sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ== + dependencies: + "@types/unist" "^3.0.0" + unist-util-is "^6.0.0" + +unist-util-visit@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-5.1.0.tgz#9a2a28b0aa76a15e0da70a08a5863a2f060e2468" + integrity sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg== + dependencies: + "@types/unist" "^3.0.0" + unist-util-is "^6.0.0" + unist-util-visit-parents "^6.0.0" + +vfile-message@^4.0.0: + version "4.0.3" + resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-4.0.3.tgz#87b44dddd7b70f0641c2e3ed0864ba73e2ea8df4" + integrity sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw== + dependencies: + "@types/unist" "^3.0.0" + unist-util-stringify-position "^4.0.0" + +vfile@^6.0.0: + version "6.0.3" + resolved "https://registry.yarnpkg.com/vfile/-/vfile-6.0.3.tgz#3652ab1c496531852bf55a6bac57af981ebc38ab" + integrity sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q== + dependencies: + "@types/unist" "^3.0.0" + vfile-message "^4.0.0" + +vite-plugin-singlefile@^2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/vite-plugin-singlefile/-/vite-plugin-singlefile-2.3.3.tgz#e859aea4c0c4b74fcbba6baf527e88f2ad09de69" + integrity sha512-XVnGH0QzbOa8fxRSsHdCarVN1BSBXNi7uLMQYlrGRN5apdHkk62XQWRJhVever0lnfuyBkwn+kvVChdm/OoOUg== + dependencies: + micromatch "^4.0.8" + +"vite@^6.0.0 || ^7.0.0 || ^8.0.0", vite@^8.0.0: + version "8.2.2" + resolved "https://registry.yarnpkg.com/vite/-/vite-8.2.2.tgz#399aefad3656145145be110d137a07ea5bb55014" + integrity sha512-cFKLV/PRgAUlIRm5WjMjJ86jrftzpqcgH+Us+DS8mI3CDNiH30Whrz8uHL3+MOLPAgqbMBAqWdAHAphOAM+z/Q== + dependencies: + lightningcss "^1.33.0" + picomatch "^4.0.5" + postcss "^8.5.26" + rolldown "~1.2.4" + tinyglobby "^0.2.17" + optionalDependencies: + fsevents "~2.3.3" + +vitest@^4.1.11: + version "4.1.11" + resolved "https://registry.yarnpkg.com/vitest/-/vitest-4.1.11.tgz#1653c1521ae917f960d9b21877797c47dfd8bf21" + integrity sha512-fhACrNXUidIbGSBr5FlbuBkO7VWC1ZyLl0DO4CU2DrQoAPxX84Ysxs+HeGQpii5lZWV1Q4gBZTTu49mF+A6Edw== + dependencies: + "@vitest/expect" "4.1.11" + "@vitest/mocker" "4.1.11" + "@vitest/pretty-format" "4.1.11" + "@vitest/runner" "4.1.11" + "@vitest/snapshot" "4.1.11" + "@vitest/spy" "4.1.11" + "@vitest/utils" "4.1.11" + es-module-lexer "^2.0.0" + expect-type "^1.3.0" + magic-string "^0.30.21" + obug "^2.1.1" + pathe "^2.0.3" + picomatch "^4.0.3" + std-env "^4.0.0-rc.1" + tinybench "^2.9.0" + tinyexec "^1.0.2" + tinyglobby "^0.2.15" + tinyrainbow "^3.1.0" + vite "^6.0.0 || ^7.0.0 || ^8.0.0" + why-is-node-running "^2.3.0" + +w3c-keyname@^2.2.4: + version "2.2.8" + resolved "https://registry.yarnpkg.com/w3c-keyname/-/w3c-keyname-2.2.8.tgz#7b17c8c6883d4e8b86ac8aba79d39e880f8869c5" + integrity sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ== + +w3c-xmlserializer@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz#f925ba26855158594d907313cedd1476c5967f6c" + integrity sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA== + dependencies: + xml-name-validator "^5.0.0" + +webidl-conversions@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-8.0.1.tgz#0657e571fe6f06fcb15ca50ed1fdbcb495cd1686" + integrity sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ== + +whatwg-mimetype@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz#d8232895dbd527ceaee74efd4162008fb8a8cf48" + integrity sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw== + +whatwg-url@^16.0.0: + version "16.0.1" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-16.0.1.tgz#047f7f4bd36ef76b7198c172d1b1cebc66f764dd" + integrity sha512-1to4zXBxmXHV3IiSSEInrreIlu02vUOvrhxJJH5vcxYTBDAx51cqZiKdyTxlecdKNSjj8EcxGBxNf6Vg+945gw== + dependencies: + "@exodus/bytes" "^1.11.0" + tr46 "^6.0.0" + webidl-conversions "^8.0.1" + +whatwg-url@^17.1.0: + version "17.1.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-17.1.0.tgz#693144cd2060d324e73b15a717d1f38ecfb3f02e" + integrity sha512-3GeworPmc2ZfEEHP7lEbUfBX/L75wdEsi0rLNhXcXxnoN5jyq0SL5gCy06SGW2cyTIZdTvWIDQNQoza++vKeaw== + dependencies: + "@exodus/bytes" "^1.15.1" + tr46 "^6.0.0" + webidl-conversions "^8.0.1" + +why-is-node-running@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/why-is-node-running/-/why-is-node-running-2.3.0.tgz#a3f69a97107f494b3cdc3bdddd883a7d65cebf04" + integrity sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w== + dependencies: + siginfo "^2.0.0" + stackback "0.0.2" + +xml-name-validator@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-5.0.0.tgz#82be9b957f7afdacf961e5980f1bf227c0bf7673" + integrity sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg== + +xmlchars@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" + integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== + +zwitch@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-2.0.4.tgz#c827d4b0acb76fc3e685a4c6ec2902d51070e9d7" + integrity sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==