@aaa_iii/fzv 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +1 -1
- package/README.md +1 -1
- package/dist/client/assets/{c-Bt2S8zZg.js → c-DbF230Kq.js} +1 -1
- package/dist/client/assets/{cpp-DPK4tyRH.js → cpp-4Vg3XxcV.js} +1 -1
- package/dist/client/assets/{highlight-Cjbz6wKa.js → highlight-CYo2BdOL.js} +3 -3
- package/dist/client/assets/{index-CDvmZwbk.js → index-BqkhaGwN.js} +4 -4
- package/dist/client/assets/{java-J15MpnFT.js → java-B44aWtXw.js} +1 -1
- package/dist/client/assets/{jsx-DUOQ5e6U.js → jsx-CpUrIMpC.js} +1 -1
- package/dist/client/assets/{latex-CJrCGu_N.js → latex-DGDTr05l.js} +1 -1
- package/dist/client/assets/{lua-CKx32ZrF.js → lua-BG0o5O3J.js} +1 -1
- package/dist/client/assets/{pdf-27wT5C7q.js → pdf-Bl0IIfym.js} +1 -1
- package/dist/client/assets/{r-C56hVSf1.js → r-DVnxg6z5.js} +1 -1
- package/dist/client/assets/{ruby-CmgALhjT.js → ruby-BZOK9uNJ.js} +1 -1
- package/dist/client/assets/{tsx-clVZ5Fr8.js → tsx-5hb28Oy_.js} +1 -1
- package/dist/client/assets/{typescript-D4OylR-N.js → typescript-c0BGdOyD.js} +1 -1
- package/dist/client/assets/{xml-DDzn0dx3.js → xml-CFUy4_Y5.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/interactive.js +32 -0
- package/dist/server/server.js +1 -1
- package/dist/shared.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-
|
|
2
|
-
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=class{indexed;a;b;constructor(e){let t=0,n=e=>/[\p{L}\p{N}]/u.test(e),r=e=>e&&e.toLocaleLowerCase()===e&&e.toLocaleUpperCase()!==e,i=e=>e&&e.toLocaleUpperCase()===e&&e.toLocaleLowerCase()!==e;this.indexed=e.map(e=>{let a=Array.from(e.path),o=a.map(e=>e.toLocaleLowerCase()),s=new Int8Array(a.length);for(let e=0;e<a.length;e++){let t=a[e],o=a[e-1]??``;e===0||o===`/`||o===`\\`||([`_`,`-`,`.`].includes(o)||!n(o))&&n(t)?s[e]=8:(r(o)&&i(t)||/\d/.test(t)&&!/\d/.test(o))&&(s[e]=7)}return t=Math.max(t,a.length),{file:e,chars:a,lower:o,bonuses:s}}),this.a=new Int32Array(t),this.b=new Int32Array(t)}termScore(e,t){let{chars:n,lower:r,bonuses:i}=t,a=n.length;if(e.chars.length>a)return-1;let o=(t,i)=>e.smartCase?e.chars[t]===n[i]:e.lower[t]===r[i],s=0;for(let t=0;t<e.chars.length;t++){let e=!1;for(;s<a;)if(o(t,s++)){e=!0;break}if(!e)return-1}let c=-1073741823,l=this.a,u=this.b;l.fill(c,0,a);for(let e=0;e<a;e++)o(0,e)&&(l[e]=16+2*i[e]);for(let t=1;t<e.chars.length;t++){u.fill(c,0,a);let e=c;for(let n=0;n<a;n++){if(n>=2&&l[n-2]>c&&(e=Math.max(e,l[n-2]+n-2)),!o(t,n))continue;let r=n>0&&l[n-1]>c?l[n-1]+16+i[n]+4:c,a=e>c?e+16+i[n]-3-(n-2):c;u[n]=Math.max(r,a)}[l,u]=[u,l]}let d=c;for(let e=0;e<a;e++)d=Math.max(d,l[e]);return d}search(e,t=250){let n=e.trim(),r=n.endsWith(`/`)?n.slice(0,-1):``;if(!n||this.indexed.some(e=>e.file.kind===`directory`&&e.file.path===r)){let e=r?`${r}/`:``,n=this.indexed.map(e=>e.file).filter(t=>t.path.startsWith(e)&&!t.path.slice(e.length).includes(`/`)).sort((e,t)=>Number(t.kind===`directory`)-Number(e.kind===`directory`)||e.path.localeCompare(t.path));return{files:n.slice(0,t),total:n.length}}let i=e.trim().split(/\s+/).filter(Boolean).map(e=>{let t=Array.from(e);return{chars:t,lower:t.map(e=>e.toLocaleLowerCase()),smartCase:/[A-Z]/.test(e)}}),a=[];for(let e of this.indexed){let t=0;for(let n of i){let r=this.termScore(n,e);if(r<0){t=-1;break}t+=r}t>=0&&a.push({file:e.file,score:t})}return a.sort((e,t)=>t.score-e.score||e.file.path.length-t.file.path.length||e.file.path.localeCompare(t.file.path)),{files:a.slice(0,t).map(e=>e.file),total:a.length}}};function t(e,t){return t?`diff\0${t.stage}\0${e}`:e}function n(e,t=1){return`fzv:project:${e}:v${t}`}function r(e){if(!e||typeof e!=`object`)return null;let n=e;if(n.version!==2||!Array.isArray(n.groups)||!n.groups.length||n.groups.length>32)return null;let r=[],i=new Set;for(let e of n.groups){if(!e||typeof e.id!=`string`||i.has(e.id)||!Array.isArray(e.tabs))return null;i.add(e.id);let n=new Set,a=[],o=null;for(let r of e.tabs){if(!r||typeof r.path!=`string`)continue;let e=r.diff===`index`||r.diff===`worktree`?r.diff:void 0,i=t(r.path,e&&{stage:e});n.has(i)||(n.add(i),o??=i,a.push({path:r.path,mode:r.mode===`source`?`source`:`viewer`,...e?{diff:e,...typeof r.originalPath==`string`?{originalPath:r.originalPath}:{},layout:r.layout===`inline`?`inline`:`side-by-side`,collapse:r.collapse===!0,ignoreTrimWhitespace:r.ignoreTrimWhitespace===!0}:{}}))}r.push({id:e.id,tabs:a,active:typeof e.active==`string`&&n.has(e.active)?e.active:o})}let a=new Set,o=new Set,s=(e,t=0)=>{if(!e||typeof e!=`object`||t>32)return null;let n=e;if(typeof n.id!=`string`)return null;if(n.type===`group`)return!i.has(n.id)||a.has(n.id)?null:(a.add(n.id),{type:`group`,id:n.id});if(n.type!==`split`||o.has(n.id)||![`x`,`y`].includes(n.axis)||!Number.isFinite(n.ratio)||n.ratio<=0||n.ratio>=1||!Array.isArray(n.children)||n.children.length!==2)return null;o.add(n.id);let r=s(n.children[0],t+1),c=s(n.children[1],t+1);return r&&c?{type:`split`,id:n.id,axis:n.axis,ratio:n.ratio,children:[r,c]}:null},c=s(n.layout);return!c||a.size!==i.size?null:{version:2,layout:c,groups:r,activeGroup:typeof n.activeGroup==`string`&&i.has(n.activeGroup)?n.activeGroup:r[0].id}}function i(e,t){try{let i=r(JSON.parse(e.getItem(n(t,2))??`null`));if(i)return i;let a=JSON.parse(e.getItem(n(t))??`null`);return!a||typeof a!=`object`||!(`version`in a)||a.version!==1||!(`tabs`in a)||!Array.isArray(a.tabs)?null:{version:1,tabs:[...new Set(a.tabs.filter(e=>typeof e==`string`))],active:`active`in a&&typeof a.active==`string`?a.active:null}}catch{return null}}function a(e,t,r){try{e.setItem(n(t,r.version),JSON.stringify(r))}catch{}}function o(e){let t=document.createElement(`i`);return t.className=`codicon codicon-${e}`,t.setAttribute(`aria-hidden`,`true`),t}function s(e){return o(e.kind===`directory`?`folder`:e.kind===`pdf`?`file-pdf`:e.kind===`image`?`file-media`:e.kind===`html`?`file-code`:e.kind===`office`?/\.xlsx$/i.test(e.name)?`table`:/\.pptx$/i.test(e.name)?`preview`:`file-text`:/\.md$/i.test(e.name)?`markdown`:/\.(?:[cm]?js|jsx|ts|tsx|py|rs|go|c|cc|cpp|h|hpp|cs|java|rb|lua|sh|json|ya?ml|toml|css|scss|xml|sql|tex|sty|bib|bst)$/i.test(e.name)||[`Makefile`,`Dockerfile`].includes(e.name)?`file-code`:`file`)}function c(e,t){return(n,r)=>t(e(n),e(r))}var l=(e,t)=>e-t,u=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}},d=class e{start;endExclusive;static fromTo(t,n){return new e(t,n)}static addRange(t,n){let r=0;for(;r<n.length&&n[r].endExclusive<t.start;)r++;let i=r;for(;i<n.length&&n[i].start<=t.endExclusive;)i++;if(r===i)n.splice(r,0,t);else{let a=Math.min(t.start,n[r].start),o=Math.max(t.endExclusive,n[i-1].endExclusive);n.splice(r,i-r,new e(a,o))}}static tryCreate(t,n){if(!(t>n))return new e(t,n)}static ofLength(t){return new e(0,t)}static ofStartAndLength(t,n){return new e(t,t+n)}static emptyAt(t){return new e(t,t)}constructor(e,t){if(this.start=e,this.endExclusive=t,e>t)throw new u(`Invalid range: ${this.toString()}`)}get isEmpty(){return this.start===this.endExclusive}delta(t){return new e(this.start+t,this.endExclusive+t)}deltaStart(t){return new e(this.start+t,this.endExclusive)}deltaEnd(t){return new e(this.start,this.endExclusive+t)}get length(){return this.endExclusive-this.start}toString(){return`[${this.start}, ${this.endExclusive})`}equals(e){return this.start===e.start&&this.endExclusive===e.endExclusive}containsRange(e){return this.start<=e.start&&e.endExclusive<=this.endExclusive}contains(e){return this.start<=e&&e<this.endExclusive}join(t){return new e(Math.min(this.start,t.start),Math.max(this.endExclusive,t.endExclusive))}intersect(t){let n=Math.max(this.start,t.start),r=Math.min(this.endExclusive,t.endExclusive);if(n<=r)return new e(n,r)}intersectionLength(e){let t=Math.max(this.start,e.start),n=Math.min(this.endExclusive,e.endExclusive);return Math.max(0,n-t)}intersects(e){return Math.max(this.start,e.start)<Math.min(this.endExclusive,e.endExclusive)}intersectsOrTouches(e){return Math.max(this.start,e.start)<=Math.min(this.endExclusive,e.endExclusive)}isBefore(e){return this.endExclusive<=e.start}isAfter(e){return this.start>=e.endExclusive}slice(e){return e.slice(this.start,this.endExclusive)}substring(e){return e.substring(this.start,this.endExclusive)}clip(e){if(this.isEmpty)throw new u(`Invalid clipping range: ${this.toString()}`);return Math.max(this.start,Math.min(this.endExclusive-1,e))}clipCyclic(e){if(this.isEmpty)throw new u(`Invalid clipping range: ${this.toString()}`);return e<this.start?this.endExclusive-(this.start-e)%this.length:e>=this.endExclusive?this.start+(e-this.start)%this.length:e}map(e){let t=[];for(let n=this.start;n<this.endExclusive;n++)t.push(e(n));return t}forEach(e){for(let t=this.start;t<this.endExclusive;t++)e(t)}joinRightTouching(t){if(this.endExclusive!==t.start)throw new u(`Invalid join: ${this.toString()} and ${t.toString()}`);return new e(this.start,t.endExclusive)}},f=class e{lineNumber;column;constructor(e,t){this.lineNumber=e,this.column=t}with(t=this.lineNumber,n=this.column){return t===this.lineNumber&&n===this.column?this:new e(t,n)}delta(e=0,t=0){return this.with(Math.max(1,this.lineNumber+e),Math.max(1,this.column+t))}equals(t){return e.equals(this,t)}static equals(e,t){return!e&&!t||!!e&&!!t&&e.lineNumber===t.lineNumber&&e.column===t.column}isBefore(t){return e.isBefore(this,t)}static isBefore(e,t){return e.lineNumber<t.lineNumber?!0:t.lineNumber<e.lineNumber?!1:e.column<t.column}isBeforeOrEqual(t){return e.isBeforeOrEqual(this,t)}static isBeforeOrEqual(e,t){return e.lineNumber<t.lineNumber?!0:t.lineNumber<e.lineNumber?!1:e.column<=t.column}static compare(e,t){let n=e.lineNumber|0,r=t.lineNumber|0;return n===r?(e.column|0)-(t.column|0):n-r}clone(){return new e(this.lineNumber,this.column)}toString(){return`(`+this.lineNumber+`,`+this.column+`)`}static lift(t){return new e(t.lineNumber,t.column)}static isIPosition(e){return!!e&&typeof e.lineNumber==`number`&&typeof e.column==`number`}toJSON(){return{lineNumber:this.lineNumber,column:this.column}}},p=class e{startLineNumber;startColumn;endLineNumber;endColumn;constructor(e,t,n,r){e>n||e===n&&t>r?(this.startLineNumber=n,this.startColumn=r,this.endLineNumber=e,this.endColumn=t):(this.startLineNumber=e,this.startColumn=t,this.endLineNumber=n,this.endColumn=r)}isEmpty(){return e.isEmpty(this)}static isEmpty(e){return e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn}containsPosition(t){return e.containsPosition(this,t)}static containsPosition(e,t){return!(t.lineNumber<e.startLineNumber||t.lineNumber>e.endLineNumber||t.lineNumber===e.startLineNumber&&t.column<e.startColumn||t.lineNumber===e.endLineNumber&&t.column>e.endColumn)}static strictContainsPosition(e,t){return!(t.lineNumber<e.startLineNumber||t.lineNumber>e.endLineNumber||t.lineNumber===e.startLineNumber&&t.column<=e.startColumn||t.lineNumber===e.endLineNumber&&t.column>=e.endColumn)}containsRange(t){return e.containsRange(this,t)}static containsRange(e,t){return!(t.startLineNumber<e.startLineNumber||t.endLineNumber<e.startLineNumber||t.startLineNumber>e.endLineNumber||t.endLineNumber>e.endLineNumber||t.startLineNumber===e.startLineNumber&&t.startColumn<e.startColumn||t.endLineNumber===e.endLineNumber&&t.endColumn>e.endColumn)}strictContainsRange(t){return e.strictContainsRange(this,t)}static strictContainsRange(e,t){return!(t.startLineNumber<e.startLineNumber||t.endLineNumber<e.startLineNumber||t.startLineNumber>e.endLineNumber||t.endLineNumber>e.endLineNumber||t.startLineNumber===e.startLineNumber&&t.startColumn<=e.startColumn||t.endLineNumber===e.endLineNumber&&t.endColumn>=e.endColumn)}plusRange(t){return e.plusRange(this,t)}static plusRange(t,n){let r,i,a,o;return n.startLineNumber<t.startLineNumber?(r=n.startLineNumber,i=n.startColumn):n.startLineNumber===t.startLineNumber?(r=n.startLineNumber,i=Math.min(n.startColumn,t.startColumn)):(r=t.startLineNumber,i=t.startColumn),n.endLineNumber>t.endLineNumber?(a=n.endLineNumber,o=n.endColumn):n.endLineNumber===t.endLineNumber?(a=n.endLineNumber,o=Math.max(n.endColumn,t.endColumn)):(a=t.endLineNumber,o=t.endColumn),new e(r,i,a,o)}intersectRanges(t){return e.intersectRanges(this,t)}static intersectRanges(t,n){let r=t.startLineNumber,i=t.startColumn,a=t.endLineNumber,o=t.endColumn,s=n.startLineNumber,c=n.startColumn,l=n.endLineNumber,u=n.endColumn;return r<s?(r=s,i=c):r===s&&(i=Math.max(i,c)),a>l?(a=l,o=u):a===l&&(o=Math.min(o,u)),r>a||r===a&&i>o?null:new e(r,i,a,o)}equalsRange(t){return e.equalsRange(this,t)}static equalsRange(e,t){return!e&&!t||!!e&&!!t&&e.startLineNumber===t.startLineNumber&&e.startColumn===t.startColumn&&e.endLineNumber===t.endLineNumber&&e.endColumn===t.endColumn}getEndPosition(){return e.getEndPosition(this)}static getEndPosition(e){return new f(e.endLineNumber,e.endColumn)}getStartPosition(){return e.getStartPosition(this)}static getStartPosition(e){return new f(e.startLineNumber,e.startColumn)}toString(){return`[`+this.startLineNumber+`,`+this.startColumn+` -> `+this.endLineNumber+`,`+this.endColumn+`]`}setEndPosition(t,n){return new e(this.startLineNumber,this.startColumn,t,n)}setStartPosition(t,n){return new e(t,n,this.endLineNumber,this.endColumn)}collapseToStart(){return e.collapseToStart(this)}static collapseToStart(t){return new e(t.startLineNumber,t.startColumn,t.startLineNumber,t.startColumn)}collapseToEnd(){return e.collapseToEnd(this)}static collapseToEnd(t){return new e(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn)}delta(t){return new e(this.startLineNumber+t,this.startColumn,this.endLineNumber+t,this.endColumn)}isSingleLine(){return this.startLineNumber===this.endLineNumber}static fromPositions(t,n=t){return new e(t.lineNumber,t.column,n.lineNumber,n.column)}static lift(t){return t?new e(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn):null}static isIRange(e){return!!e&&typeof e.startLineNumber==`number`&&typeof e.startColumn==`number`&&typeof e.endLineNumber==`number`&&typeof e.endColumn==`number`}static areIntersectingOrTouching(e,t){return!(e.endLineNumber<t.startLineNumber||e.endLineNumber===t.startLineNumber&&e.endColumn<t.startColumn||t.endLineNumber<e.startLineNumber||t.endLineNumber===e.startLineNumber&&t.endColumn<e.startColumn)}static areIntersecting(e,t){return!(e.endLineNumber<t.startLineNumber||e.endLineNumber===t.startLineNumber&&e.endColumn<=t.startColumn||t.endLineNumber<e.startLineNumber||t.endLineNumber===e.startLineNumber&&t.endColumn<=e.startColumn)}static areOnlyIntersecting(e,t){return!(e.endLineNumber<t.startLineNumber-1||e.endLineNumber===t.startLineNumber&&e.endColumn<t.startColumn-1||t.endLineNumber<e.startLineNumber-1||t.endLineNumber===e.startLineNumber&&t.endColumn<e.startColumn-1)}static compareRangesUsingStarts(e,t){if(e&&t){let n=e.startLineNumber|0,r=t.startLineNumber|0;if(n===r){let n=e.startColumn|0,r=t.startColumn|0;if(n===r){let n=e.endLineNumber|0,r=t.endLineNumber|0;return n===r?(e.endColumn|0)-(t.endColumn|0):n-r}return n-r}return n-r}return!!e-+!!t}static compareRangesUsingEnds(e,t){return e.endLineNumber===t.endLineNumber?e.endColumn===t.endColumn?e.startLineNumber===t.startLineNumber?e.startColumn-t.startColumn:e.startLineNumber-t.startLineNumber:e.endColumn-t.endColumn:e.endLineNumber-t.endLineNumber}static spansMultipleLines(e){return e.endLineNumber>e.startLineNumber}toJSON(){return this}};function m(e,t){let n=h(e,t);return n===-1?void 0:e[n]}function h(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}function g(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?a=n:i=n+1}return i}var _=class e{static ofLength(t,n){return new e(t,t+n)}static fromRange(t){return new e(t.startLineNumber,t.endLineNumber)}static fromRangeInclusive(t){return new e(t.startLineNumber,t.endLineNumber+1)}static compareByStart=c(e=>e.startLineNumber,l);static subtract(t,n){return n?t.startLineNumber<n.startLineNumber&&n.endLineNumberExclusive<t.endLineNumberExclusive?[new e(t.startLineNumber,n.startLineNumber),new e(n.endLineNumberExclusive,t.endLineNumberExclusive)]:n.startLineNumber<=t.startLineNumber&&t.endLineNumberExclusive<=n.endLineNumberExclusive?[]:n.endLineNumberExclusive<t.endLineNumberExclusive?[new e(Math.max(n.endLineNumberExclusive,t.startLineNumber),t.endLineNumberExclusive)]:[new e(t.startLineNumber,Math.min(n.startLineNumber,t.endLineNumberExclusive))]:[t]}static joinMany(e){if(e.length===0)return[];let t=new v(e[0].slice());for(let n=1;n<e.length;n++)t=t.getUnion(new v(e[n].slice()));return t.ranges}static join(t){if(t.length===0)throw new u(`lineRanges cannot be empty`);let n=t[0].startLineNumber,r=t[0].endLineNumberExclusive;for(let e=1;e<t.length;e++)n=Math.min(n,t[e].startLineNumber),r=Math.max(r,t[e].endLineNumberExclusive);return new e(n,r)}static deserialize(t){return new e(t[0],t[1])}startLineNumber;endLineNumberExclusive;constructor(e,t){if(e>t)throw new u(`startLineNumber ${e} cannot be after endLineNumberExclusive ${t}`);this.startLineNumber=e,this.endLineNumberExclusive=t}contains(e){return this.startLineNumber<=e&&e<this.endLineNumberExclusive}containsRange(e){return this.startLineNumber<=e.startLineNumber&&e.endLineNumberExclusive<=this.endLineNumberExclusive}get isEmpty(){return this.startLineNumber===this.endLineNumberExclusive}delta(t){return new e(this.startLineNumber+t,this.endLineNumberExclusive+t)}deltaLength(t){return new e(this.startLineNumber,this.endLineNumberExclusive+t)}get length(){return this.endLineNumberExclusive-this.startLineNumber}join(t){return new e(Math.min(this.startLineNumber,t.startLineNumber),Math.max(this.endLineNumberExclusive,t.endLineNumberExclusive))}toString(){return`[${this.startLineNumber},${this.endLineNumberExclusive})`}intersect(t){let n=Math.max(this.startLineNumber,t.startLineNumber),r=Math.min(this.endLineNumberExclusive,t.endLineNumberExclusive);if(n<=r)return new e(n,r)}intersectsStrict(e){return this.startLineNumber<e.endLineNumberExclusive&&e.startLineNumber<this.endLineNumberExclusive}intersectsOrTouches(e){return this.startLineNumber<=e.endLineNumberExclusive&&e.startLineNumber<=this.endLineNumberExclusive}equals(e){return this.startLineNumber===e.startLineNumber&&this.endLineNumberExclusive===e.endLineNumberExclusive}toInclusiveRange(){return this.isEmpty?null:new p(this.startLineNumber,1,this.endLineNumberExclusive-1,2**53-1)}toExclusiveRange(){return new p(this.startLineNumber,1,this.endLineNumberExclusive,1)}mapToLineArray(e){let t=[];for(let n=this.startLineNumber;n<this.endLineNumberExclusive;n++)t.push(e(n));return t}forEach(e){for(let t=this.startLineNumber;t<this.endLineNumberExclusive;t++)e(t)}serialize(){return[this.startLineNumber,this.endLineNumberExclusive]}toOffsetRange(){return new d(this.startLineNumber-1,this.endLineNumberExclusive-1)}distanceToRange(e){return this.endLineNumberExclusive<=e.startLineNumber?e.startLineNumber-this.endLineNumberExclusive:e.endLineNumberExclusive<=this.startLineNumber?this.startLineNumber-e.endLineNumberExclusive:0}distanceToLine(e){return this.contains(e)?0:e<this.startLineNumber?this.startLineNumber-e:e-this.endLineNumberExclusive}addMargin(t,n){return new e(this.startLineNumber-t,this.endLineNumberExclusive+n)}},v=class e{_normalizedRanges;constructor(e=[]){this._normalizedRanges=e}get ranges(){return this._normalizedRanges}addRange(e){if(e.length===0)return;let t=g(this._normalizedRanges,t=>t.endLineNumberExclusive>=e.startLineNumber),n=h(this._normalizedRanges,t=>t.startLineNumber<=e.endLineNumberExclusive)+1;if(t===n)this._normalizedRanges.splice(t,0,e);else if(t===n-1){let n=this._normalizedRanges[t];this._normalizedRanges[t]=n.join(e)}else{let r=this._normalizedRanges[t].join(this._normalizedRanges[n-1]).join(e);this._normalizedRanges.splice(t,n-t,r)}}contains(e){let t=m(this._normalizedRanges,t=>t.startLineNumber<=e);return!!t&&t.endLineNumberExclusive>e}intersects(e){let t=m(this._normalizedRanges,t=>t.startLineNumber<e.endLineNumberExclusive);return!!t&&t.endLineNumberExclusive>e.startLineNumber}getUnion(t){if(this._normalizedRanges.length===0)return t;if(t._normalizedRanges.length===0)return this;let n=[],r=0,i=0,a=null;for(;r<this._normalizedRanges.length||i<t._normalizedRanges.length;){let e=null;if(r<this._normalizedRanges.length&&i<t._normalizedRanges.length){let n=this._normalizedRanges[r],a=t._normalizedRanges[i];n.startLineNumber<a.startLineNumber?(e=n,r++):(e=a,i++)}else r<this._normalizedRanges.length?(e=this._normalizedRanges[r],r++):(e=t._normalizedRanges[i],i++);a===null?a=e:a.endLineNumberExclusive>=e.startLineNumber?a=new _(a.startLineNumber,Math.max(a.endLineNumberExclusive,e.endLineNumberExclusive)):(n.push(a),a=e)}return a!==null&&n.push(a),new e(n)}subtractFrom(t){let n=g(this._normalizedRanges,e=>e.endLineNumberExclusive>=t.startLineNumber),r=h(this._normalizedRanges,e=>e.startLineNumber<=t.endLineNumberExclusive)+1;if(n===r)return new e([t]);let i=[],a=t.startLineNumber;for(let e=n;e<r;e++){let t=this._normalizedRanges[e];t.startLineNumber>a&&i.push(new _(a,t.startLineNumber)),a=t.endLineNumberExclusive}return a<t.endLineNumberExclusive&&i.push(new _(a,t.endLineNumberExclusive)),new e(i)}toString(){return this._normalizedRanges.map(e=>e.toString()).join(`, `)}getIntersection(t){let n=[],r=0,i=0;for(;r<this._normalizedRanges.length&&i<t._normalizedRanges.length;){let e=this._normalizedRanges[r],a=t._normalizedRanges[i],o=e.intersect(a);o&&!o.isEmpty&&n.push(o),e.endLineNumberExclusive<a.endLineNumberExclusive?r++:i++}return new e(n)}getWithDelta(t){return new e(this._normalizedRanges.map(e=>e.delta(t)))}};(class e{offset1;offset2;static zero=new e(0,0);static max=new e(2**53-1,2**53-1);constructor(e,t){this.offset1=e,this.offset2=t}toString(){return`${this.offset1} <-> ${this.offset2}`}delta(t){return t===0?this:new e(this.offset1+t,this.offset2+t)}equals(e){return this.offset1===e.offset1&&this.offset2===e.offset2}}),class e{static instance=new e;isValid(){return!0}};var y=function(e){return e[e.WordLower=0]=`WordLower`,e[e.WordUpper=1]=`WordUpper`,e[e.WordNumber=2]=`WordNumber`,e[e.End=3]=`End`,e[e.Other=4]=`Other`,e[e.Separator=5]=`Separator`,e[e.Space=6]=`Space`,e[e.LineBreakCR=7]=`LineBreakCR`,e[e.LineBreakLF=8]=`LineBreakLF`,e}(y||{});y.WordLower,y.WordUpper,y.WordNumber,y.End,y.Other,y.Separator,y.Space,y.LineBreakCR,y.LineBreakLF;function b(e){return e.split(/\r\n|\r|\n/)}function ee(e,t,n,r=3,i=3){let a=[],o=1,s=1,c=e=>{let c=e-o,l=o,u=s,d=l===1&&u===1,f=l+c===t+1&&u+c===n+1;(d||f)&&c>=i+r?(d&&!f&&(c-=i),f&&!d&&(l+=i,u+=i,c-=i),a.push({original:l,modified:u,length:c})):c>=i*2+r&&a.push({original:l+i,modified:u+i,length:c-i*2})};for(let t of e)c(t.original[0]),o=t.original[1],s=t.modified[1];return c(t+1),a}function te(e,t){let n=[],r=!0,i=e.original[0],a=e.modified[0],o=(e,t,o=!1)=>{if(!(e<i||t<a)){if(r)r=!1;else if(!o&&(e===i||t===a))return;(e!==i||t!==a)&&(n.push([i,e,a,t]),i=e,a=t)}};for(let n of e.inner){n.original[1]>1&&n.modified[1]>1&&o(n.original[0],n.modified[0]);let e=n.original[2]<=t.length?t[n.original[2]-1].length+1:2**53-1;n.original[3]<e&&o(n.original[2],n.modified[2])}return o(e.original[1],e.modified[1],!0),n}function x(e,t,n,r=[]){let i=[],a=new Map(r.map((e,t)=>[e.original,t])),o=1,s=1,c=e=>{for(;o<e;){let e=a.get(o);if(e!==void 0){let{length:t}=r[e];i.push({type:`hidden`,region:e,count:t}),o+=t,s+=t}else i.push({type:`line`,original:o++,modified:s++})}};return e.forEach((e,r)=>{if(c(e.original[0]),n===`inline`){for(let t=e.original[0];t<e.original[1];t++)i.push({type:`line`,original:t,change:r});for(let t=e.modified[0];t<e.modified[1];t++)i.push({type:`line`,modified:t,change:r})}else for(let[n,a,o,s]of te(e,t))for(let e=0;e<Math.max(a-n,s-o);e++)i.push({type:`line`,original:n+e<a?n+e:void 0,modified:o+e<s?o+e:void 0,change:r});o=e.original[1],s=e.modified[1]}),c(t.length+1),i}function ne(e,t,n){let r=()=>({changed:new Set,whole:new Set,chars:new Map}),i=r(),a=r(),o=(e,t,[n,r,i,a])=>{for(let o=n;o<=i;o++){let s=o===n?r-1:0,c=o===i?a-1:t[o-1]?.length??0;if(o>n&&o===i&&c===0)continue;let l=e.chars.get(o)??[];l.push({start:s,end:c}),e.chars.set(o,l)}};for(let r of e){let[e,s]=r.original,[c,l]=r.modified;for(let t=e;t<s;t++)i.changed.add(t);for(let e=c;e<l;e++)a.changed.add(e);if(e===s||c===l){for(let t=e;t<s;t++)i.whole.add(t);for(let e=c;e<l;e++)a.whole.add(e)}else for(let u of r.inner)u.original[0]>=e&&u.original[0]<s&&o(i,t,u.original),u.modified[0]>=c&&u.modified[0]<l&&o(a,n,u.modified)}return{original:i,modified:a}}var re=`modulepreload`,S=function(e){return`/_fzv/`+e},C={},w=function(e){return e.pathname.endsWith(`.css`)},ie=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},T=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=S(t,n);let r=s(t),i=w(r);return ie(C,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:re,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},E={layout:`side-by-side`,collapse:!1,ignoreTrimWhitespace:!1},ae=20,D=5e3,oe={index:[`HEAD`,`Index`],worktree:[`Index`,`Working Tree`]};async function se(e,t){let n=await fetch(e,{signal:t});if(n.status===404)return null;if(!n.ok)throw Error(`HTTP ${n.status}`);return n.text()}function ce(e,t){let n=(e,n)=>`/api/git/file?${new URLSearchParams({path:e,revision:n,r:String(t)})}`;return e.stage===`index`?[n(e.originalPath??e.path,`HEAD`),n(e.path,`index`)]:[n(e.path,`index`),`/file?${new URLSearchParams({path:e.path,revision:String(t)})}`]}function le(e,t,n,r){return new Promise((i,a)=>{let o=new Worker(new URL(`/_fzv/assets/worker-12brr2uW.js`,``+import.meta.url),{type:`module`}),s=()=>{o.terminate(),a(r.reason)};r.addEventListener(`abort`,s,{once:!0}),o.addEventListener(`message`,e=>{r.removeEventListener(`abort`,s),o.terminate(),i(e.data)}),o.addEventListener(`error`,e=>{r.removeEventListener(`abort`,s),o.terminate(),a(Error(e.message||`The diff worker failed.`))}),o.postMessage({original:e,modified:t,options:{ignoreTrimWhitespace:n,maxComputationTimeMs:D}})})}async function ue(e,t,n,r){try{let{tokenizeSource:i}=await T(async()=>{let{tokenizeSource:e}=await import(`./highlight-Cjbz6wKa.js`);return{tokenizeSource:e}},[]),a=await i(e,n,r);return a?.length===t?a:null}catch{return null}}function de(e,t,n,r,i,a){let o=r?.length?new Uint8Array(t.length):null,s=new Set;for(let{start:e,end:t}of r??[])e===t?s.add(e):o.fill(1,e,t);let c=()=>{let e=document.createElement(`span`);return e.className=`${i} diff-range-empty`,e},l=n&&a?n.map(e=>({text:e.content,token:e})):[{text:t,token:void 0}],u=0;for(let t of l){let n=0;for(;n<t.text.length;){s.delete(u+n)&&e.append(c());let r=o?.[u+n]??0,l=n+1;for(;l<t.text.length&&(o?.[u+l]??0)===r&&!s.has(u+l);)l++;let d=t.text.slice(n,l),f=t.token?a(t.token,d):document.createTextNode(d);if(r){let t=document.createElement(`span`);t.className=i,t.append(f),e.append(t)}else e.append(f);n=l}u+=t.text.length}s.size&&e.append(c())}function fe(e,t,n){let r=document.createElement(`section`);r.className=`preview-pane diff-pane`,r.hidden=!0,r.setAttribute(`role`,`tabpanel`),r.setAttribute(`aria-label`,`${e.path} (${oe[e.stage][1]})`);let i=new AbortController,a=i.signal,s=document.createElement(`div`);s.className=`diff-editor`;let c=document.createElement(`div`);c.className=`diff-message`,c.setAttribute(`role`,`status`),c.textContent=`Loading…`,s.append(c),r.append(s);let l={...n},u=null,d=[!0,!0],f=null,p=[null,null],m=null,h=null,g=new Set,_=[],v=[],y=[],te=!1,re=e=>Math.floor(e.clientHeight/3),S=e=>{let t=v.at(-1);t&&e!==void 0&&(t.scrollTop=e*ae-re(t))},C=e=>{c.textContent=e,c.hidden=!e},w=()=>{if(!u||!f)return;let[t,n]=u,{changes:r}=f,i=v.at(-1)?.scrollTop??0,d=l.collapse?ee(r,t.length,n.length):[],h=d.filter((e,t)=>!g.has(t));_=x(r,t,l.layout,h).map(e=>e.type===`hidden`?{...e,region:d.indexOf(h[e.region])}:e),y=[],_.forEach((e,t)=>{e.type===`line`&&e.change!==void 0&&y.length===e.change&&y.push(t)});let b=ne(r,t,n),[te,re]=oe[e.stage],S=[],C=(e,t)=>{let n=document.createElement(`div`);n.className=`diff-row diff-hidden-lines`;let r=document.createElement(`button`);return r.type=`button`,r.className=`diff-hidden-lines-button`,r.append(o(`unfold`),document.createTextNode(` ${e} hidden line${e===1?``:`s`}`)),r.title=`Show unchanged lines`,r.addEventListener(`click`,()=>{g.add(t),w()}),n.append(r),n},T=(e,r,i,a)=>{let s=r?n:t,c=i.changed.has(e),l=document.createElement(`div`);l.className=`diff-row`,c&&l.classList.add(r?`line-insert`:`line-delete`),i.whole.has(e)&&l.classList.add(r?`whole-insert`:`whole-delete`);let u=document.createElement(`span`);u.className=`diff-gutter`,c&&u.classList.add(r?`gutter-insert`:`gutter-delete`);for(let e of a){let t=document.createElement(`span`);t.className=`diff-line-number`,t.textContent=e===void 0?``:String(e),u.append(t)}let d=document.createElement(`span`);d.className=`diff-sign`,c&&d.append(o(r?`add`:`remove`)),u.append(d);let f=document.createElement(`span`);return f.className=`diff-code`,de(f,s[e-1],p[r]?.[e-1],i.chars.get(e),r?`char-insert`:`char-delete`,m),l.append(u,f),l},E=e=>{let t=document.createElement(`div`);t.className=`diff-row`;let n=document.createElement(`span`);n.className=`diff-gutter`;for(let t=0;t<e;t++){let e=document.createElement(`span`);e.className=`diff-line-number`,n.append(e)}let r=document.createElement(`span`);r.className=`diff-sign`,n.append(r);let i=document.createElement(`span`);return i.className=`diff-code diagonal-fill`,t.append(n,i),t},D=(e,t)=>{let n=document.createElement(`div`);n.className=`diff-side ${e}`,n.setAttribute(`role`,`region`),n.setAttribute(`aria-label`,t),n.tabIndex=-1;let r=document.createElement(`div`);return r.className=`diff-lines`,n.append(r),S.push(n),r};if(l.layout===`inline`){let e=D(`inline diff-scroll`,`${te} and ${re}`),t=document.createDocumentFragment();for(let e of _)e.type===`hidden`?t.append(C(e.count,e.region)):e.modified===void 0?t.append(T(e.original,0,b.original,[e.original,void 0])):e.original===void 0||e.change!==void 0?t.append(T(e.modified,1,b.modified,[void 0,e.modified])):t.append(T(e.modified,1,b.modified,[e.original,e.modified]));e.append(t)}else{let e=D(`original`,te),t=D(`modified diff-scroll`,re),n=document.createDocumentFragment(),r=document.createDocumentFragment();for(let e of _)e.type===`hidden`?(n.append(C(e.count,e.region)),r.append(C(e.count,e.region))):(n.append(e.original===void 0?E(1):T(e.original,0,b.original,[e.original])),r.append(e.modified===void 0?E(1):T(e.modified,1,b.modified,[e.modified])));e.append(n),t.append(r)}let se=document.createElement(`div`);se.className=`diff-sides`,se.dataset.layout=l.layout,se.append(...S,ie(b.original,b.modified)),s.replaceChildren(c,se),v=S;let ce=S.at(-1);ce.addEventListener(`scroll`,()=>{for(let e of S)e!==ce&&(e.scrollTop=ce.scrollTop)},{signal:a});for(let e of S.slice(0,-1))e.addEventListener(`wheel`,e=>{Math.abs(e.deltaY)<=Math.abs(e.deltaX)||(e.preventDefault(),ce.scrollBy({top:e.deltaY*(e.deltaMode===1?ae:1),behavior:`instant`}))},{passive:!1,signal:a});ce.scrollTop=i},ie=(e,t)=>{let n=document.createElement(`div`);n.className=`diff-overview`,n.setAttribute(`aria-hidden`,`true`);let r=Math.max(1,_.length);return _.forEach((i,a)=>{if(i.type!==`line`||i.change===void 0)return;let o=[[`delete`,i.original!==void 0&&e.changed.has(i.original)],[`insert`,i.modified!==void 0&&t.changed.has(i.modified)]];for(let[e,t]of o){if(!t)continue;let i=document.createElement(`span`);i.className=`diff-overview-mark ${e}`,i.style.top=`${a/r*100}%`,i.style.height=`max(2px, ${100/r}%)`,n.append(i)}}),n.addEventListener(`pointerdown`,e=>{let t=n.getBoundingClientRect(),r=v.at(-1);r&&(r.scrollTop=(e.clientY-t.top)/Math.max(1,t.height)*r.scrollHeight-r.clientHeight/2)},{signal:a}),n},E=async()=>{if(!u)return;h?.abort();let t=new AbortController;h=t;let n=()=>t.abort();a.addEventListener(`abort`,n,{once:!0});try{let n=await le(u[0],u[1],l.ignoreTrimWhitespace,t.signal);if(t.signal.aborted)return;f=n,g.clear(),C(!d[0]&&!d[1]?`${e.path} is not available in ${oe[e.stage].join(` or `)}.`:n.quitEarly?`Diff computation stopped early after 5 seconds. The result may not be minimal.`:n.changes.length?``:`No changes.`),w(),te&&S(y[0]),te=!1}catch(n){t.signal.aborted||C(`Could not compare ${e.path}: ${n}`)}finally{a.removeEventListener(`abort`,n)}},[D,fe]=ce(e,t);return Promise.all([se(D,a),se(fe,a)]).then(async([t,n])=>{d=[t!==null,n!==null];let r=[t??``,n??``];u=[b(r[0]),b(r[1])],await E();let[i,o,s]=await Promise.all([t===null?null:ue(r[0],u[0].length,e.originalPath?.split(`/`).at(-1)??e.name,a),n===null?null:ue(r[1],u[1].length,e.name,a),T(()=>import(`./highlight-Cjbz6wKa.js`),[]).catch(()=>null)]);!a.aborted&&(i||o)&&s&&(p=[i,o],m=s.tokenSpan,w())}).catch(t=>{a.aborted||C(`Could not load ${e.path}: ${t}`)}),{element:r,setActive:()=>{},update:e=>{let t=e.ignoreTrimWhitespace!==l.ignoreTrimWhitespace;l={...e},t?E():w()},navigate:e=>{let t=v.at(-1);if(!t||!y.length)return;let n=Math.round((t.scrollTop+re(t))/ae);S(e>0?y.find(e=>e>n)??y[0]:y.findLast(e=>e<n)??y.at(-1))},revealFirstChange:()=>{f?S(y[0]):te=!0},dispose:()=>{i.abort(),r.remove()}}}function pe(e,t,n,r,i){if(e.type===`split`)return{...e,children:e.children.map(e=>pe(e,t,n,r,i))};if(e.id!==t)return e;let a={type:`group`,id:n};return{type:`split`,id:i,axis:r===`left`||r===`right`?`x`:`y`,ratio:.5,children:r===`left`||r===`up`?[a,e]:[e,a]}}function O(e,t){if(e.type===`group`)return e.id===t?null:e;let n=O(e.children[0],t),r=O(e.children[1],t);return n?r?{...e,children:[n,r]}:n:r}function me(e){return e.type===`group`?[e.id]:e.children.flatMap(me)}function he(e,t){if(e.type===`group`)return t===`x`?220:140;let n=e.children.map(e=>he(e,t));return e.axis===t?n[0]+n[1]+4:Math.max(...n)}function ge(e,t){let n=Math.max(0,t-4),r=he(e.children[0],e.axis),i=he(e.children[1],e.axis);if(n<=r+i){let e=r/(r+i);return[e,e]}return[r/n,1-i/n]}function _e(e,t){let n=new Map,r=new Map,i=(e,t)=>{if(e.type===`group`){n.set(e.id,t);return}let a=e.axis===`x`,o=a?t.width:t.height,s=Math.min(4,o),[c,l]=ge(e,o),u=Math.max(c,Math.min(l,e.ratio)),d=Math.max(0,o-s)*u,f=Math.max(0,o-s-d),p={...t,[a?`width`:`height`]:d},m=a?{...t,x:t.x+d+s,width:f}:{...t,y:t.y+d+s,height:f},h=a?{...t,x:t.x+d,width:s}:{...t,y:t.y+d,height:s};r.set(e.id,{node:e,rect:t,sash:h}),i(e.children[0],p),i(e.children[1],m)};return i(e,t),{groups:n,splits:r}}function ve(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ye=ve();function be(e){ye=e}var xe={exec:()=>null};function Se(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function k(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(A.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Ce=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),A={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Se(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Se(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:Se(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Se(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Se(e=>RegExp(`^ {0,${e}}(?:</?(?:${Ie})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,`i`)),blockquoteBeginRegex:Se(e=>RegExp(`^ {0,${e}}>`))},we=/^(?:[ \t]*(?:\n|$))+/,j=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Te=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ee=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,De=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Oe=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ke=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ae=k(ke).replace(/bull/g,Oe).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),je=k(ke).replace(/bull/g,Oe).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),M=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Me=/^[^\n]+/,Ne=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Pe=k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Ne).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Fe=k(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Oe).getRegex(),Ie=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Le=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Re=k(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Le).replace(`tag`,Ie).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ze=e=>k(M).replace(`hr`,Ee).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,Ie).getRegex(),Be=ze(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Ve=ze(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),He={blockquote:k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Ve).getRegex(),code:j,def:Pe,fences:Te,heading:De,hr:Ee,html:Re,lheading:Ae,list:Fe,newline:we,paragraph:Be,table:xe,text:Me},Ue=k(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Ee).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,Ie).getRegex(),We={...He,lheading:je,table:Ue,paragraph:k(M).replace(`hr`,Ee).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Ue).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,Ie).getRegex()},Ge={...He,html:k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Le).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:xe,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:k(M).replace(`hr`,Ee).replace(`heading`,` *#{1,6} *[^
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-Bl0IIfym.js","assets/pdf-C_UMrClT.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=class{indexed;a;b;constructor(e){let t=0,n=e=>/[\p{L}\p{N}]/u.test(e),r=e=>e&&e.toLocaleLowerCase()===e&&e.toLocaleUpperCase()!==e,i=e=>e&&e.toLocaleUpperCase()===e&&e.toLocaleLowerCase()!==e;this.indexed=e.map(e=>{let a=Array.from(e.path),o=a.map(e=>e.toLocaleLowerCase()),s=new Int8Array(a.length);for(let e=0;e<a.length;e++){let t=a[e],o=a[e-1]??``;e===0||o===`/`||o===`\\`||([`_`,`-`,`.`].includes(o)||!n(o))&&n(t)?s[e]=8:(r(o)&&i(t)||/\d/.test(t)&&!/\d/.test(o))&&(s[e]=7)}return t=Math.max(t,a.length),{file:e,chars:a,lower:o,bonuses:s}}),this.a=new Int32Array(t),this.b=new Int32Array(t)}termScore(e,t){let{chars:n,lower:r,bonuses:i}=t,a=n.length;if(e.chars.length>a)return-1;let o=(t,i)=>e.smartCase?e.chars[t]===n[i]:e.lower[t]===r[i],s=0;for(let t=0;t<e.chars.length;t++){let e=!1;for(;s<a;)if(o(t,s++)){e=!0;break}if(!e)return-1}let c=-1073741823,l=this.a,u=this.b;l.fill(c,0,a);for(let e=0;e<a;e++)o(0,e)&&(l[e]=16+2*i[e]);for(let t=1;t<e.chars.length;t++){u.fill(c,0,a);let e=c;for(let n=0;n<a;n++){if(n>=2&&l[n-2]>c&&(e=Math.max(e,l[n-2]+n-2)),!o(t,n))continue;let r=n>0&&l[n-1]>c?l[n-1]+16+i[n]+4:c,a=e>c?e+16+i[n]-3-(n-2):c;u[n]=Math.max(r,a)}[l,u]=[u,l]}let d=c;for(let e=0;e<a;e++)d=Math.max(d,l[e]);return d}search(e,t=250){let n=e.trim(),r=n.endsWith(`/`)?n.slice(0,-1):``;if(!n||this.indexed.some(e=>e.file.kind===`directory`&&e.file.path===r)){let e=r?`${r}/`:``,n=this.indexed.map(e=>e.file).filter(t=>t.path.startsWith(e)&&!t.path.slice(e.length).includes(`/`)).sort((e,t)=>Number(t.kind===`directory`)-Number(e.kind===`directory`)||e.path.localeCompare(t.path));return{files:n.slice(0,t),total:n.length}}let i=e.trim().split(/\s+/).filter(Boolean).map(e=>{let t=Array.from(e);return{chars:t,lower:t.map(e=>e.toLocaleLowerCase()),smartCase:/[A-Z]/.test(e)}}),a=[];for(let e of this.indexed){let t=0;for(let n of i){let r=this.termScore(n,e);if(r<0){t=-1;break}t+=r}t>=0&&a.push({file:e.file,score:t})}return a.sort((e,t)=>t.score-e.score||e.file.path.length-t.file.path.length||e.file.path.localeCompare(t.file.path)),{files:a.slice(0,t).map(e=>e.file),total:a.length}}};function t(e,t){return t?`diff\0${t.stage}\0${e}`:e}function n(e,t=1){return`fzv:project:${e}:v${t}`}function r(e){if(!e||typeof e!=`object`)return null;let n=e;if(n.version!==2||!Array.isArray(n.groups)||!n.groups.length||n.groups.length>32)return null;let r=[],i=new Set;for(let e of n.groups){if(!e||typeof e.id!=`string`||i.has(e.id)||!Array.isArray(e.tabs))return null;i.add(e.id);let n=new Set,a=[],o=null;for(let r of e.tabs){if(!r||typeof r.path!=`string`)continue;let e=r.diff===`index`||r.diff===`worktree`?r.diff:void 0,i=t(r.path,e&&{stage:e});n.has(i)||(n.add(i),o??=i,a.push({path:r.path,mode:r.mode===`source`?`source`:`viewer`,...e?{diff:e,...typeof r.originalPath==`string`?{originalPath:r.originalPath}:{},layout:r.layout===`inline`?`inline`:`side-by-side`,collapse:r.collapse===!0,ignoreTrimWhitespace:r.ignoreTrimWhitespace===!0}:{}}))}r.push({id:e.id,tabs:a,active:typeof e.active==`string`&&n.has(e.active)?e.active:o})}let a=new Set,o=new Set,s=(e,t=0)=>{if(!e||typeof e!=`object`||t>32)return null;let n=e;if(typeof n.id!=`string`)return null;if(n.type===`group`)return!i.has(n.id)||a.has(n.id)?null:(a.add(n.id),{type:`group`,id:n.id});if(n.type!==`split`||o.has(n.id)||![`x`,`y`].includes(n.axis)||!Number.isFinite(n.ratio)||n.ratio<=0||n.ratio>=1||!Array.isArray(n.children)||n.children.length!==2)return null;o.add(n.id);let r=s(n.children[0],t+1),c=s(n.children[1],t+1);return r&&c?{type:`split`,id:n.id,axis:n.axis,ratio:n.ratio,children:[r,c]}:null},c=s(n.layout);return!c||a.size!==i.size?null:{version:2,layout:c,groups:r,activeGroup:typeof n.activeGroup==`string`&&i.has(n.activeGroup)?n.activeGroup:r[0].id}}function i(e,t){try{let i=r(JSON.parse(e.getItem(n(t,2))??`null`));if(i)return i;let a=JSON.parse(e.getItem(n(t))??`null`);return!a||typeof a!=`object`||!(`version`in a)||a.version!==1||!(`tabs`in a)||!Array.isArray(a.tabs)?null:{version:1,tabs:[...new Set(a.tabs.filter(e=>typeof e==`string`))],active:`active`in a&&typeof a.active==`string`?a.active:null}}catch{return null}}function a(e,t,r){try{e.setItem(n(t,r.version),JSON.stringify(r))}catch{}}function o(e){let t=document.createElement(`i`);return t.className=`codicon codicon-${e}`,t.setAttribute(`aria-hidden`,`true`),t}function s(e){return o(e.kind===`directory`?`folder`:e.kind===`pdf`?`file-pdf`:e.kind===`image`?`file-media`:e.kind===`html`?`file-code`:e.kind===`office`?/\.xlsx$/i.test(e.name)?`table`:/\.pptx$/i.test(e.name)?`preview`:`file-text`:/\.md$/i.test(e.name)?`markdown`:/\.(?:[cm]?js|jsx|ts|tsx|py|rs|go|c|cc|cpp|h|hpp|cs|java|rb|lua|sh|json|ya?ml|toml|css|scss|xml|sql|tex|sty|bib|bst)$/i.test(e.name)||[`Makefile`,`Dockerfile`].includes(e.name)?`file-code`:`file`)}function c(e,t){return(n,r)=>t(e(n),e(r))}var l=(e,t)=>e-t,u=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}},d=class e{start;endExclusive;static fromTo(t,n){return new e(t,n)}static addRange(t,n){let r=0;for(;r<n.length&&n[r].endExclusive<t.start;)r++;let i=r;for(;i<n.length&&n[i].start<=t.endExclusive;)i++;if(r===i)n.splice(r,0,t);else{let a=Math.min(t.start,n[r].start),o=Math.max(t.endExclusive,n[i-1].endExclusive);n.splice(r,i-r,new e(a,o))}}static tryCreate(t,n){if(!(t>n))return new e(t,n)}static ofLength(t){return new e(0,t)}static ofStartAndLength(t,n){return new e(t,t+n)}static emptyAt(t){return new e(t,t)}constructor(e,t){if(this.start=e,this.endExclusive=t,e>t)throw new u(`Invalid range: ${this.toString()}`)}get isEmpty(){return this.start===this.endExclusive}delta(t){return new e(this.start+t,this.endExclusive+t)}deltaStart(t){return new e(this.start+t,this.endExclusive)}deltaEnd(t){return new e(this.start,this.endExclusive+t)}get length(){return this.endExclusive-this.start}toString(){return`[${this.start}, ${this.endExclusive})`}equals(e){return this.start===e.start&&this.endExclusive===e.endExclusive}containsRange(e){return this.start<=e.start&&e.endExclusive<=this.endExclusive}contains(e){return this.start<=e&&e<this.endExclusive}join(t){return new e(Math.min(this.start,t.start),Math.max(this.endExclusive,t.endExclusive))}intersect(t){let n=Math.max(this.start,t.start),r=Math.min(this.endExclusive,t.endExclusive);if(n<=r)return new e(n,r)}intersectionLength(e){let t=Math.max(this.start,e.start),n=Math.min(this.endExclusive,e.endExclusive);return Math.max(0,n-t)}intersects(e){return Math.max(this.start,e.start)<Math.min(this.endExclusive,e.endExclusive)}intersectsOrTouches(e){return Math.max(this.start,e.start)<=Math.min(this.endExclusive,e.endExclusive)}isBefore(e){return this.endExclusive<=e.start}isAfter(e){return this.start>=e.endExclusive}slice(e){return e.slice(this.start,this.endExclusive)}substring(e){return e.substring(this.start,this.endExclusive)}clip(e){if(this.isEmpty)throw new u(`Invalid clipping range: ${this.toString()}`);return Math.max(this.start,Math.min(this.endExclusive-1,e))}clipCyclic(e){if(this.isEmpty)throw new u(`Invalid clipping range: ${this.toString()}`);return e<this.start?this.endExclusive-(this.start-e)%this.length:e>=this.endExclusive?this.start+(e-this.start)%this.length:e}map(e){let t=[];for(let n=this.start;n<this.endExclusive;n++)t.push(e(n));return t}forEach(e){for(let t=this.start;t<this.endExclusive;t++)e(t)}joinRightTouching(t){if(this.endExclusive!==t.start)throw new u(`Invalid join: ${this.toString()} and ${t.toString()}`);return new e(this.start,t.endExclusive)}},f=class e{lineNumber;column;constructor(e,t){this.lineNumber=e,this.column=t}with(t=this.lineNumber,n=this.column){return t===this.lineNumber&&n===this.column?this:new e(t,n)}delta(e=0,t=0){return this.with(Math.max(1,this.lineNumber+e),Math.max(1,this.column+t))}equals(t){return e.equals(this,t)}static equals(e,t){return!e&&!t||!!e&&!!t&&e.lineNumber===t.lineNumber&&e.column===t.column}isBefore(t){return e.isBefore(this,t)}static isBefore(e,t){return e.lineNumber<t.lineNumber?!0:t.lineNumber<e.lineNumber?!1:e.column<t.column}isBeforeOrEqual(t){return e.isBeforeOrEqual(this,t)}static isBeforeOrEqual(e,t){return e.lineNumber<t.lineNumber?!0:t.lineNumber<e.lineNumber?!1:e.column<=t.column}static compare(e,t){let n=e.lineNumber|0,r=t.lineNumber|0;return n===r?(e.column|0)-(t.column|0):n-r}clone(){return new e(this.lineNumber,this.column)}toString(){return`(`+this.lineNumber+`,`+this.column+`)`}static lift(t){return new e(t.lineNumber,t.column)}static isIPosition(e){return!!e&&typeof e.lineNumber==`number`&&typeof e.column==`number`}toJSON(){return{lineNumber:this.lineNumber,column:this.column}}},p=class e{startLineNumber;startColumn;endLineNumber;endColumn;constructor(e,t,n,r){e>n||e===n&&t>r?(this.startLineNumber=n,this.startColumn=r,this.endLineNumber=e,this.endColumn=t):(this.startLineNumber=e,this.startColumn=t,this.endLineNumber=n,this.endColumn=r)}isEmpty(){return e.isEmpty(this)}static isEmpty(e){return e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn}containsPosition(t){return e.containsPosition(this,t)}static containsPosition(e,t){return!(t.lineNumber<e.startLineNumber||t.lineNumber>e.endLineNumber||t.lineNumber===e.startLineNumber&&t.column<e.startColumn||t.lineNumber===e.endLineNumber&&t.column>e.endColumn)}static strictContainsPosition(e,t){return!(t.lineNumber<e.startLineNumber||t.lineNumber>e.endLineNumber||t.lineNumber===e.startLineNumber&&t.column<=e.startColumn||t.lineNumber===e.endLineNumber&&t.column>=e.endColumn)}containsRange(t){return e.containsRange(this,t)}static containsRange(e,t){return!(t.startLineNumber<e.startLineNumber||t.endLineNumber<e.startLineNumber||t.startLineNumber>e.endLineNumber||t.endLineNumber>e.endLineNumber||t.startLineNumber===e.startLineNumber&&t.startColumn<e.startColumn||t.endLineNumber===e.endLineNumber&&t.endColumn>e.endColumn)}strictContainsRange(t){return e.strictContainsRange(this,t)}static strictContainsRange(e,t){return!(t.startLineNumber<e.startLineNumber||t.endLineNumber<e.startLineNumber||t.startLineNumber>e.endLineNumber||t.endLineNumber>e.endLineNumber||t.startLineNumber===e.startLineNumber&&t.startColumn<=e.startColumn||t.endLineNumber===e.endLineNumber&&t.endColumn>=e.endColumn)}plusRange(t){return e.plusRange(this,t)}static plusRange(t,n){let r,i,a,o;return n.startLineNumber<t.startLineNumber?(r=n.startLineNumber,i=n.startColumn):n.startLineNumber===t.startLineNumber?(r=n.startLineNumber,i=Math.min(n.startColumn,t.startColumn)):(r=t.startLineNumber,i=t.startColumn),n.endLineNumber>t.endLineNumber?(a=n.endLineNumber,o=n.endColumn):n.endLineNumber===t.endLineNumber?(a=n.endLineNumber,o=Math.max(n.endColumn,t.endColumn)):(a=t.endLineNumber,o=t.endColumn),new e(r,i,a,o)}intersectRanges(t){return e.intersectRanges(this,t)}static intersectRanges(t,n){let r=t.startLineNumber,i=t.startColumn,a=t.endLineNumber,o=t.endColumn,s=n.startLineNumber,c=n.startColumn,l=n.endLineNumber,u=n.endColumn;return r<s?(r=s,i=c):r===s&&(i=Math.max(i,c)),a>l?(a=l,o=u):a===l&&(o=Math.min(o,u)),r>a||r===a&&i>o?null:new e(r,i,a,o)}equalsRange(t){return e.equalsRange(this,t)}static equalsRange(e,t){return!e&&!t||!!e&&!!t&&e.startLineNumber===t.startLineNumber&&e.startColumn===t.startColumn&&e.endLineNumber===t.endLineNumber&&e.endColumn===t.endColumn}getEndPosition(){return e.getEndPosition(this)}static getEndPosition(e){return new f(e.endLineNumber,e.endColumn)}getStartPosition(){return e.getStartPosition(this)}static getStartPosition(e){return new f(e.startLineNumber,e.startColumn)}toString(){return`[`+this.startLineNumber+`,`+this.startColumn+` -> `+this.endLineNumber+`,`+this.endColumn+`]`}setEndPosition(t,n){return new e(this.startLineNumber,this.startColumn,t,n)}setStartPosition(t,n){return new e(t,n,this.endLineNumber,this.endColumn)}collapseToStart(){return e.collapseToStart(this)}static collapseToStart(t){return new e(t.startLineNumber,t.startColumn,t.startLineNumber,t.startColumn)}collapseToEnd(){return e.collapseToEnd(this)}static collapseToEnd(t){return new e(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn)}delta(t){return new e(this.startLineNumber+t,this.startColumn,this.endLineNumber+t,this.endColumn)}isSingleLine(){return this.startLineNumber===this.endLineNumber}static fromPositions(t,n=t){return new e(t.lineNumber,t.column,n.lineNumber,n.column)}static lift(t){return t?new e(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn):null}static isIRange(e){return!!e&&typeof e.startLineNumber==`number`&&typeof e.startColumn==`number`&&typeof e.endLineNumber==`number`&&typeof e.endColumn==`number`}static areIntersectingOrTouching(e,t){return!(e.endLineNumber<t.startLineNumber||e.endLineNumber===t.startLineNumber&&e.endColumn<t.startColumn||t.endLineNumber<e.startLineNumber||t.endLineNumber===e.startLineNumber&&t.endColumn<e.startColumn)}static areIntersecting(e,t){return!(e.endLineNumber<t.startLineNumber||e.endLineNumber===t.startLineNumber&&e.endColumn<=t.startColumn||t.endLineNumber<e.startLineNumber||t.endLineNumber===e.startLineNumber&&t.endColumn<=e.startColumn)}static areOnlyIntersecting(e,t){return!(e.endLineNumber<t.startLineNumber-1||e.endLineNumber===t.startLineNumber&&e.endColumn<t.startColumn-1||t.endLineNumber<e.startLineNumber-1||t.endLineNumber===e.startLineNumber&&t.endColumn<e.startColumn-1)}static compareRangesUsingStarts(e,t){if(e&&t){let n=e.startLineNumber|0,r=t.startLineNumber|0;if(n===r){let n=e.startColumn|0,r=t.startColumn|0;if(n===r){let n=e.endLineNumber|0,r=t.endLineNumber|0;return n===r?(e.endColumn|0)-(t.endColumn|0):n-r}return n-r}return n-r}return!!e-+!!t}static compareRangesUsingEnds(e,t){return e.endLineNumber===t.endLineNumber?e.endColumn===t.endColumn?e.startLineNumber===t.startLineNumber?e.startColumn-t.startColumn:e.startLineNumber-t.startLineNumber:e.endColumn-t.endColumn:e.endLineNumber-t.endLineNumber}static spansMultipleLines(e){return e.endLineNumber>e.startLineNumber}toJSON(){return this}};function m(e,t){let n=h(e,t);return n===-1?void 0:e[n]}function h(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}function g(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?a=n:i=n+1}return i}var _=class e{static ofLength(t,n){return new e(t,t+n)}static fromRange(t){return new e(t.startLineNumber,t.endLineNumber)}static fromRangeInclusive(t){return new e(t.startLineNumber,t.endLineNumber+1)}static compareByStart=c(e=>e.startLineNumber,l);static subtract(t,n){return n?t.startLineNumber<n.startLineNumber&&n.endLineNumberExclusive<t.endLineNumberExclusive?[new e(t.startLineNumber,n.startLineNumber),new e(n.endLineNumberExclusive,t.endLineNumberExclusive)]:n.startLineNumber<=t.startLineNumber&&t.endLineNumberExclusive<=n.endLineNumberExclusive?[]:n.endLineNumberExclusive<t.endLineNumberExclusive?[new e(Math.max(n.endLineNumberExclusive,t.startLineNumber),t.endLineNumberExclusive)]:[new e(t.startLineNumber,Math.min(n.startLineNumber,t.endLineNumberExclusive))]:[t]}static joinMany(e){if(e.length===0)return[];let t=new v(e[0].slice());for(let n=1;n<e.length;n++)t=t.getUnion(new v(e[n].slice()));return t.ranges}static join(t){if(t.length===0)throw new u(`lineRanges cannot be empty`);let n=t[0].startLineNumber,r=t[0].endLineNumberExclusive;for(let e=1;e<t.length;e++)n=Math.min(n,t[e].startLineNumber),r=Math.max(r,t[e].endLineNumberExclusive);return new e(n,r)}static deserialize(t){return new e(t[0],t[1])}startLineNumber;endLineNumberExclusive;constructor(e,t){if(e>t)throw new u(`startLineNumber ${e} cannot be after endLineNumberExclusive ${t}`);this.startLineNumber=e,this.endLineNumberExclusive=t}contains(e){return this.startLineNumber<=e&&e<this.endLineNumberExclusive}containsRange(e){return this.startLineNumber<=e.startLineNumber&&e.endLineNumberExclusive<=this.endLineNumberExclusive}get isEmpty(){return this.startLineNumber===this.endLineNumberExclusive}delta(t){return new e(this.startLineNumber+t,this.endLineNumberExclusive+t)}deltaLength(t){return new e(this.startLineNumber,this.endLineNumberExclusive+t)}get length(){return this.endLineNumberExclusive-this.startLineNumber}join(t){return new e(Math.min(this.startLineNumber,t.startLineNumber),Math.max(this.endLineNumberExclusive,t.endLineNumberExclusive))}toString(){return`[${this.startLineNumber},${this.endLineNumberExclusive})`}intersect(t){let n=Math.max(this.startLineNumber,t.startLineNumber),r=Math.min(this.endLineNumberExclusive,t.endLineNumberExclusive);if(n<=r)return new e(n,r)}intersectsStrict(e){return this.startLineNumber<e.endLineNumberExclusive&&e.startLineNumber<this.endLineNumberExclusive}intersectsOrTouches(e){return this.startLineNumber<=e.endLineNumberExclusive&&e.startLineNumber<=this.endLineNumberExclusive}equals(e){return this.startLineNumber===e.startLineNumber&&this.endLineNumberExclusive===e.endLineNumberExclusive}toInclusiveRange(){return this.isEmpty?null:new p(this.startLineNumber,1,this.endLineNumberExclusive-1,2**53-1)}toExclusiveRange(){return new p(this.startLineNumber,1,this.endLineNumberExclusive,1)}mapToLineArray(e){let t=[];for(let n=this.startLineNumber;n<this.endLineNumberExclusive;n++)t.push(e(n));return t}forEach(e){for(let t=this.startLineNumber;t<this.endLineNumberExclusive;t++)e(t)}serialize(){return[this.startLineNumber,this.endLineNumberExclusive]}toOffsetRange(){return new d(this.startLineNumber-1,this.endLineNumberExclusive-1)}distanceToRange(e){return this.endLineNumberExclusive<=e.startLineNumber?e.startLineNumber-this.endLineNumberExclusive:e.endLineNumberExclusive<=this.startLineNumber?this.startLineNumber-e.endLineNumberExclusive:0}distanceToLine(e){return this.contains(e)?0:e<this.startLineNumber?this.startLineNumber-e:e-this.endLineNumberExclusive}addMargin(t,n){return new e(this.startLineNumber-t,this.endLineNumberExclusive+n)}},v=class e{_normalizedRanges;constructor(e=[]){this._normalizedRanges=e}get ranges(){return this._normalizedRanges}addRange(e){if(e.length===0)return;let t=g(this._normalizedRanges,t=>t.endLineNumberExclusive>=e.startLineNumber),n=h(this._normalizedRanges,t=>t.startLineNumber<=e.endLineNumberExclusive)+1;if(t===n)this._normalizedRanges.splice(t,0,e);else if(t===n-1){let n=this._normalizedRanges[t];this._normalizedRanges[t]=n.join(e)}else{let r=this._normalizedRanges[t].join(this._normalizedRanges[n-1]).join(e);this._normalizedRanges.splice(t,n-t,r)}}contains(e){let t=m(this._normalizedRanges,t=>t.startLineNumber<=e);return!!t&&t.endLineNumberExclusive>e}intersects(e){let t=m(this._normalizedRanges,t=>t.startLineNumber<e.endLineNumberExclusive);return!!t&&t.endLineNumberExclusive>e.startLineNumber}getUnion(t){if(this._normalizedRanges.length===0)return t;if(t._normalizedRanges.length===0)return this;let n=[],r=0,i=0,a=null;for(;r<this._normalizedRanges.length||i<t._normalizedRanges.length;){let e=null;if(r<this._normalizedRanges.length&&i<t._normalizedRanges.length){let n=this._normalizedRanges[r],a=t._normalizedRanges[i];n.startLineNumber<a.startLineNumber?(e=n,r++):(e=a,i++)}else r<this._normalizedRanges.length?(e=this._normalizedRanges[r],r++):(e=t._normalizedRanges[i],i++);a===null?a=e:a.endLineNumberExclusive>=e.startLineNumber?a=new _(a.startLineNumber,Math.max(a.endLineNumberExclusive,e.endLineNumberExclusive)):(n.push(a),a=e)}return a!==null&&n.push(a),new e(n)}subtractFrom(t){let n=g(this._normalizedRanges,e=>e.endLineNumberExclusive>=t.startLineNumber),r=h(this._normalizedRanges,e=>e.startLineNumber<=t.endLineNumberExclusive)+1;if(n===r)return new e([t]);let i=[],a=t.startLineNumber;for(let e=n;e<r;e++){let t=this._normalizedRanges[e];t.startLineNumber>a&&i.push(new _(a,t.startLineNumber)),a=t.endLineNumberExclusive}return a<t.endLineNumberExclusive&&i.push(new _(a,t.endLineNumberExclusive)),new e(i)}toString(){return this._normalizedRanges.map(e=>e.toString()).join(`, `)}getIntersection(t){let n=[],r=0,i=0;for(;r<this._normalizedRanges.length&&i<t._normalizedRanges.length;){let e=this._normalizedRanges[r],a=t._normalizedRanges[i],o=e.intersect(a);o&&!o.isEmpty&&n.push(o),e.endLineNumberExclusive<a.endLineNumberExclusive?r++:i++}return new e(n)}getWithDelta(t){return new e(this._normalizedRanges.map(e=>e.delta(t)))}};(class e{offset1;offset2;static zero=new e(0,0);static max=new e(2**53-1,2**53-1);constructor(e,t){this.offset1=e,this.offset2=t}toString(){return`${this.offset1} <-> ${this.offset2}`}delta(t){return t===0?this:new e(this.offset1+t,this.offset2+t)}equals(e){return this.offset1===e.offset1&&this.offset2===e.offset2}}),class e{static instance=new e;isValid(){return!0}};var y=function(e){return e[e.WordLower=0]=`WordLower`,e[e.WordUpper=1]=`WordUpper`,e[e.WordNumber=2]=`WordNumber`,e[e.End=3]=`End`,e[e.Other=4]=`Other`,e[e.Separator=5]=`Separator`,e[e.Space=6]=`Space`,e[e.LineBreakCR=7]=`LineBreakCR`,e[e.LineBreakLF=8]=`LineBreakLF`,e}(y||{});y.WordLower,y.WordUpper,y.WordNumber,y.End,y.Other,y.Separator,y.Space,y.LineBreakCR,y.LineBreakLF;function b(e){return e.split(/\r\n|\r|\n/)}function ee(e,t,n,r=3,i=3){let a=[],o=1,s=1,c=e=>{let c=e-o,l=o,u=s,d=l===1&&u===1,f=l+c===t+1&&u+c===n+1;(d||f)&&c>=i+r?(d&&!f&&(c-=i),f&&!d&&(l+=i,u+=i,c-=i),a.push({original:l,modified:u,length:c})):c>=i*2+r&&a.push({original:l+i,modified:u+i,length:c-i*2})};for(let t of e)c(t.original[0]),o=t.original[1],s=t.modified[1];return c(t+1),a}function te(e,t){let n=[],r=!0,i=e.original[0],a=e.modified[0],o=(e,t,o=!1)=>{if(!(e<i||t<a)){if(r)r=!1;else if(!o&&(e===i||t===a))return;(e!==i||t!==a)&&(n.push([i,e,a,t]),i=e,a=t)}};for(let n of e.inner){n.original[1]>1&&n.modified[1]>1&&o(n.original[0],n.modified[0]);let e=n.original[2]<=t.length?t[n.original[2]-1].length+1:2**53-1;n.original[3]<e&&o(n.original[2],n.modified[2])}return o(e.original[1],e.modified[1],!0),n}function x(e,t,n,r=[]){let i=[],a=new Map(r.map((e,t)=>[e.original,t])),o=1,s=1,c=e=>{for(;o<e;){let e=a.get(o);if(e!==void 0){let{length:t}=r[e];i.push({type:`hidden`,region:e,count:t}),o+=t,s+=t}else i.push({type:`line`,original:o++,modified:s++})}};return e.forEach((e,r)=>{if(c(e.original[0]),n===`inline`){for(let t=e.original[0];t<e.original[1];t++)i.push({type:`line`,original:t,change:r});for(let t=e.modified[0];t<e.modified[1];t++)i.push({type:`line`,modified:t,change:r})}else for(let[n,a,o,s]of te(e,t))for(let e=0;e<Math.max(a-n,s-o);e++)i.push({type:`line`,original:n+e<a?n+e:void 0,modified:o+e<s?o+e:void 0,change:r});o=e.original[1],s=e.modified[1]}),c(t.length+1),i}function ne(e,t,n){let r=()=>({changed:new Set,whole:new Set,chars:new Map}),i=r(),a=r(),o=(e,t,[n,r,i,a])=>{for(let o=n;o<=i;o++){let s=o===n?r-1:0,c=o===i?a-1:t[o-1]?.length??0;if(o>n&&o===i&&c===0)continue;let l=e.chars.get(o)??[];l.push({start:s,end:c}),e.chars.set(o,l)}};for(let r of e){let[e,s]=r.original,[c,l]=r.modified;for(let t=e;t<s;t++)i.changed.add(t);for(let e=c;e<l;e++)a.changed.add(e);if(e===s||c===l){for(let t=e;t<s;t++)i.whole.add(t);for(let e=c;e<l;e++)a.whole.add(e)}else for(let u of r.inner)u.original[0]>=e&&u.original[0]<s&&o(i,t,u.original),u.modified[0]>=c&&u.modified[0]<l&&o(a,n,u.modified)}return{original:i,modified:a}}var re=`modulepreload`,S=function(e){return`/_fzv/`+e},C={},w=function(e){return e.pathname.endsWith(`.css`)},ie=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},T=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=S(t,n);let r=s(t),i=w(r);return ie(C,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:re,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},E={layout:`side-by-side`,collapse:!1,ignoreTrimWhitespace:!1},ae=20,D=5e3,oe={index:[`HEAD`,`Index`],worktree:[`Index`,`Working Tree`]};async function se(e,t){let n=await fetch(e,{signal:t});if(n.status===404)return null;if(!n.ok)throw Error(`HTTP ${n.status}`);return n.text()}function ce(e,t){let n=(e,n)=>`/api/git/file?${new URLSearchParams({path:e,revision:n,r:String(t)})}`;return e.stage===`index`?[n(e.originalPath??e.path,`HEAD`),n(e.path,`index`)]:[n(e.path,`index`),`/file?${new URLSearchParams({path:e.path,revision:String(t)})}`]}function le(e,t,n,r){return new Promise((i,a)=>{let o=new Worker(new URL(`/_fzv/assets/worker-12brr2uW.js`,``+import.meta.url),{type:`module`}),s=()=>{o.terminate(),a(r.reason)};r.addEventListener(`abort`,s,{once:!0}),o.addEventListener(`message`,e=>{r.removeEventListener(`abort`,s),o.terminate(),i(e.data)}),o.addEventListener(`error`,e=>{r.removeEventListener(`abort`,s),o.terminate(),a(Error(e.message||`The diff worker failed.`))}),o.postMessage({original:e,modified:t,options:{ignoreTrimWhitespace:n,maxComputationTimeMs:D}})})}async function ue(e,t,n,r){try{let{tokenizeSource:i}=await T(async()=>{let{tokenizeSource:e}=await import(`./highlight-CYo2BdOL.js`);return{tokenizeSource:e}},[]),a=await i(e,n,r);return a?.length===t?a:null}catch{return null}}function de(e,t,n,r,i,a){let o=r?.length?new Uint8Array(t.length):null,s=new Set;for(let{start:e,end:t}of r??[])e===t?s.add(e):o.fill(1,e,t);let c=()=>{let e=document.createElement(`span`);return e.className=`${i} diff-range-empty`,e},l=n&&a?n.map(e=>({text:e.content,token:e})):[{text:t,token:void 0}],u=0;for(let t of l){let n=0;for(;n<t.text.length;){s.delete(u+n)&&e.append(c());let r=o?.[u+n]??0,l=n+1;for(;l<t.text.length&&(o?.[u+l]??0)===r&&!s.has(u+l);)l++;let d=t.text.slice(n,l),f=t.token?a(t.token,d):document.createTextNode(d);if(r){let t=document.createElement(`span`);t.className=i,t.append(f),e.append(t)}else e.append(f);n=l}u+=t.text.length}s.size&&e.append(c())}function fe(e,t,n){let r=document.createElement(`section`);r.className=`preview-pane diff-pane`,r.hidden=!0,r.setAttribute(`role`,`tabpanel`),r.setAttribute(`aria-label`,`${e.path} (${oe[e.stage][1]})`);let i=new AbortController,a=i.signal,s=document.createElement(`div`);s.className=`diff-editor`;let c=document.createElement(`div`);c.className=`diff-message`,c.setAttribute(`role`,`status`),c.textContent=`Loading…`,s.append(c),r.append(s);let l={...n},u=null,d=[!0,!0],f=null,p=[null,null],m=null,h=null,g=new Set,_=[],v=[],y=[],te=!1,re=e=>Math.floor(e.clientHeight/3),S=e=>{let t=v.at(-1);t&&e!==void 0&&(t.scrollTop=e*ae-re(t))},C=e=>{c.textContent=e,c.hidden=!e},w=()=>{if(!u||!f)return;let[t,n]=u,{changes:r}=f,i=v.at(-1)?.scrollTop??0,d=l.collapse?ee(r,t.length,n.length):[],h=d.filter((e,t)=>!g.has(t));_=x(r,t,l.layout,h).map(e=>e.type===`hidden`?{...e,region:d.indexOf(h[e.region])}:e),y=[],_.forEach((e,t)=>{e.type===`line`&&e.change!==void 0&&y.length===e.change&&y.push(t)});let b=ne(r,t,n),[te,re]=oe[e.stage],S=[],C=(e,t)=>{let n=document.createElement(`div`);n.className=`diff-row diff-hidden-lines`;let r=document.createElement(`button`);return r.type=`button`,r.className=`diff-hidden-lines-button`,r.append(o(`unfold`),document.createTextNode(` ${e} hidden line${e===1?``:`s`}`)),r.title=`Show unchanged lines`,r.addEventListener(`click`,()=>{g.add(t),w()}),n.append(r),n},T=(e,r,i,a)=>{let s=r?n:t,c=i.changed.has(e),l=document.createElement(`div`);l.className=`diff-row`,c&&l.classList.add(r?`line-insert`:`line-delete`),i.whole.has(e)&&l.classList.add(r?`whole-insert`:`whole-delete`);let u=document.createElement(`span`);u.className=`diff-gutter`,c&&u.classList.add(r?`gutter-insert`:`gutter-delete`);for(let e of a){let t=document.createElement(`span`);t.className=`diff-line-number`,t.textContent=e===void 0?``:String(e),u.append(t)}let d=document.createElement(`span`);d.className=`diff-sign`,c&&d.append(o(r?`add`:`remove`)),u.append(d);let f=document.createElement(`span`);return f.className=`diff-code`,de(f,s[e-1],p[r]?.[e-1],i.chars.get(e),r?`char-insert`:`char-delete`,m),l.append(u,f),l},E=e=>{let t=document.createElement(`div`);t.className=`diff-row`;let n=document.createElement(`span`);n.className=`diff-gutter`;for(let t=0;t<e;t++){let e=document.createElement(`span`);e.className=`diff-line-number`,n.append(e)}let r=document.createElement(`span`);r.className=`diff-sign`,n.append(r);let i=document.createElement(`span`);return i.className=`diff-code diagonal-fill`,t.append(n,i),t},D=(e,t)=>{let n=document.createElement(`div`);n.className=`diff-side ${e}`,n.setAttribute(`role`,`region`),n.setAttribute(`aria-label`,t),n.tabIndex=-1;let r=document.createElement(`div`);return r.className=`diff-lines`,n.append(r),S.push(n),r};if(l.layout===`inline`){let e=D(`inline diff-scroll`,`${te} and ${re}`),t=document.createDocumentFragment();for(let e of _)e.type===`hidden`?t.append(C(e.count,e.region)):e.modified===void 0?t.append(T(e.original,0,b.original,[e.original,void 0])):e.original===void 0||e.change!==void 0?t.append(T(e.modified,1,b.modified,[void 0,e.modified])):t.append(T(e.modified,1,b.modified,[e.original,e.modified]));e.append(t)}else{let e=D(`original`,te),t=D(`modified diff-scroll`,re),n=document.createDocumentFragment(),r=document.createDocumentFragment();for(let e of _)e.type===`hidden`?(n.append(C(e.count,e.region)),r.append(C(e.count,e.region))):(n.append(e.original===void 0?E(1):T(e.original,0,b.original,[e.original])),r.append(e.modified===void 0?E(1):T(e.modified,1,b.modified,[e.modified])));e.append(n),t.append(r)}let se=document.createElement(`div`);se.className=`diff-sides`,se.dataset.layout=l.layout,se.append(...S,ie(b.original,b.modified)),s.replaceChildren(c,se),v=S;let ce=S.at(-1);ce.addEventListener(`scroll`,()=>{for(let e of S)e!==ce&&(e.scrollTop=ce.scrollTop)},{signal:a});for(let e of S.slice(0,-1))e.addEventListener(`wheel`,e=>{Math.abs(e.deltaY)<=Math.abs(e.deltaX)||(e.preventDefault(),ce.scrollBy({top:e.deltaY*(e.deltaMode===1?ae:1),behavior:`instant`}))},{passive:!1,signal:a});ce.scrollTop=i},ie=(e,t)=>{let n=document.createElement(`div`);n.className=`diff-overview`,n.setAttribute(`aria-hidden`,`true`);let r=Math.max(1,_.length);return _.forEach((i,a)=>{if(i.type!==`line`||i.change===void 0)return;let o=[[`delete`,i.original!==void 0&&e.changed.has(i.original)],[`insert`,i.modified!==void 0&&t.changed.has(i.modified)]];for(let[e,t]of o){if(!t)continue;let i=document.createElement(`span`);i.className=`diff-overview-mark ${e}`,i.style.top=`${a/r*100}%`,i.style.height=`max(2px, ${100/r}%)`,n.append(i)}}),n.addEventListener(`pointerdown`,e=>{let t=n.getBoundingClientRect(),r=v.at(-1);r&&(r.scrollTop=(e.clientY-t.top)/Math.max(1,t.height)*r.scrollHeight-r.clientHeight/2)},{signal:a}),n},E=async()=>{if(!u)return;h?.abort();let t=new AbortController;h=t;let n=()=>t.abort();a.addEventListener(`abort`,n,{once:!0});try{let n=await le(u[0],u[1],l.ignoreTrimWhitespace,t.signal);if(t.signal.aborted)return;f=n,g.clear(),C(!d[0]&&!d[1]?`${e.path} is not available in ${oe[e.stage].join(` or `)}.`:n.quitEarly?`Diff computation stopped early after 5 seconds. The result may not be minimal.`:n.changes.length?``:`No changes.`),w(),te&&S(y[0]),te=!1}catch(n){t.signal.aborted||C(`Could not compare ${e.path}: ${n}`)}finally{a.removeEventListener(`abort`,n)}},[D,fe]=ce(e,t);return Promise.all([se(D,a),se(fe,a)]).then(async([t,n])=>{d=[t!==null,n!==null];let r=[t??``,n??``];u=[b(r[0]),b(r[1])],await E();let[i,o,s]=await Promise.all([t===null?null:ue(r[0],u[0].length,e.originalPath?.split(`/`).at(-1)??e.name,a),n===null?null:ue(r[1],u[1].length,e.name,a),T(()=>import(`./highlight-CYo2BdOL.js`),[]).catch(()=>null)]);!a.aborted&&(i||o)&&s&&(p=[i,o],m=s.tokenSpan,w())}).catch(t=>{a.aborted||C(`Could not load ${e.path}: ${t}`)}),{element:r,setActive:()=>{},update:e=>{let t=e.ignoreTrimWhitespace!==l.ignoreTrimWhitespace;l={...e},t?E():w()},navigate:e=>{let t=v.at(-1);if(!t||!y.length)return;let n=Math.round((t.scrollTop+re(t))/ae);S(e>0?y.find(e=>e>n)??y[0]:y.findLast(e=>e<n)??y.at(-1))},revealFirstChange:()=>{f?S(y[0]):te=!0},dispose:()=>{i.abort(),r.remove()}}}function pe(e,t,n,r,i){if(e.type===`split`)return{...e,children:e.children.map(e=>pe(e,t,n,r,i))};if(e.id!==t)return e;let a={type:`group`,id:n};return{type:`split`,id:i,axis:r===`left`||r===`right`?`x`:`y`,ratio:.5,children:r===`left`||r===`up`?[a,e]:[e,a]}}function O(e,t){if(e.type===`group`)return e.id===t?null:e;let n=O(e.children[0],t),r=O(e.children[1],t);return n?r?{...e,children:[n,r]}:n:r}function me(e){return e.type===`group`?[e.id]:e.children.flatMap(me)}function he(e,t){if(e.type===`group`)return t===`x`?220:140;let n=e.children.map(e=>he(e,t));return e.axis===t?n[0]+n[1]+4:Math.max(...n)}function ge(e,t){let n=Math.max(0,t-4),r=he(e.children[0],e.axis),i=he(e.children[1],e.axis);if(n<=r+i){let e=r/(r+i);return[e,e]}return[r/n,1-i/n]}function _e(e,t){let n=new Map,r=new Map,i=(e,t)=>{if(e.type===`group`){n.set(e.id,t);return}let a=e.axis===`x`,o=a?t.width:t.height,s=Math.min(4,o),[c,l]=ge(e,o),u=Math.max(c,Math.min(l,e.ratio)),d=Math.max(0,o-s)*u,f=Math.max(0,o-s-d),p={...t,[a?`width`:`height`]:d},m=a?{...t,x:t.x+d+s,width:f}:{...t,y:t.y+d+s,height:f},h=a?{...t,x:t.x+d,width:s}:{...t,y:t.y+d,height:s};r.set(e.id,{node:e,rect:t,sash:h}),i(e.children[0],p),i(e.children[1],m)};return i(e,t),{groups:n,splits:r}}function ve(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ye=ve();function be(e){ye=e}var xe={exec:()=>null};function Se(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function k(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(A.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Ce=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),A={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Se(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Se(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:Se(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Se(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Se(e=>RegExp(`^ {0,${e}}(?:</?(?:${Ie})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,`i`)),blockquoteBeginRegex:Se(e=>RegExp(`^ {0,${e}}>`))},we=/^(?:[ \t]*(?:\n|$))+/,j=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Te=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ee=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,De=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Oe=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ke=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ae=k(ke).replace(/bull/g,Oe).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),je=k(ke).replace(/bull/g,Oe).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),M=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Me=/^[^\n]+/,Ne=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Pe=k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Ne).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Fe=k(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Oe).getRegex(),Ie=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Le=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Re=k(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Le).replace(`tag`,Ie).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ze=e=>k(M).replace(`hr`,Ee).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,Ie).getRegex(),Be=ze(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Ve=ze(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),He={blockquote:k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Ve).getRegex(),code:j,def:Pe,fences:Te,heading:De,hr:Ee,html:Re,lheading:Ae,list:Fe,newline:we,paragraph:Be,table:xe,text:Me},Ue=k(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Ee).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,Ie).getRegex(),We={...He,lheading:je,table:Ue,paragraph:k(M).replace(`hr`,Ee).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Ue).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,Ie).getRegex()},Ge={...He,html:k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Le).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:xe,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:k(M).replace(`hr`,Ee).replace(`heading`,` *#{1,6} *[^
|
|
3
3
|
]`).replace(`lheading`,Ae).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Ke=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,qe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Je=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,Ye=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,N=/[\p{P}\p{S}]/u,Xe=/[\s\p{P}\p{S}]/u,Ze=/[^\s\p{P}\p{S}]/u,Qe=k(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Xe).getRegex(),$e=/[\p{Pi}\p{Ps}"']/u,et=/(?!~)[\p{P}\p{S}]/u,P=/(?!~)[\s\p{P}\p{S}]/u,tt=/(?:[^\s\p{P}\p{S}]|~)/u,nt=k(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Ce?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),rt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,it=k(rt,`u`).replace(/punct/g,N).getRegex(),at=k(rt,`u`).replace(/punct/g,et).getRegex(),ot=k(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,$e).replace(/punct/g,N).getRegex(),st=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,ct=k(st,`gu`).replace(/notPunctSpace/g,Ze).replace(/punctSpace/g,Xe).replace(/punct/g,N).getRegex(),lt=k(st,`gu`).replace(/notPunctSpace/g,tt).replace(/punctSpace/g,P).replace(/punct/g,et).getRegex(),ut=k(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ze).replace(/punctSpace/g,Xe).replace(/punct/g,N).getRegex(),dt=k(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Ze).replace(/punctSpace/g,Xe).replace(/punct/g,N).getRegex(),F=k(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ze).replace(/punctSpace/g,Xe).replace(/punct/g,N).getRegex(),ft=k(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,N).getRegex(),pt=k(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ze).replace(/punctSpace/g,Xe).replace(/punct/g,N).getRegex(),mt=k(/\\(punct)/,`gu`).replace(/punct/g,N).getRegex(),ht=k(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,`gu`).replace(/punct/g,N).getRegex(),gt=k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_t=k(Le).replace(`(?:-->|$)`,`-->`).getRegex(),vt=k(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,_t).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),yt=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,bt=k(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,yt).getRegex(),xt=k(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,bt).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),St=k(/^!?\[(label)\]\[(ref)\]/).replace(`label`,bt).replace(`ref`,Ne).getRegex(),Ct=k(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Ne).getRegex(),wt=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Tt=k(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,yt).getRegex(),Et=k(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,k(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Tt).replace(`ref`,wt).getRegex()).replace(`nolink`,k(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,wt).getRegex()).getRegex(),Dt=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ot=k(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),kt={_backpedal:xe,anyPunctuation:mt,anyPunctuationOutsideCode:ht,autolink:gt,blockSkip:nt,br:Je,code:qe,del:xe,delLDelim:xe,delRDelim:xe,emStrongLDelim:it,emStrongRDelimAst:ct,emStrongRDelimUnd:dt,escape:Ke,link:xt,nolink:Ct,punctuation:Qe,reflink:St,reflinkSearch:Et,tag:vt,text:Ye,url:xe},At={...kt,emStrongLDelim:ot,emStrongRDelimAst:ut,emStrongRDelimUnd:F,link:k(/^!?\[(label)\]\((.*?)\)/).replace(`label`,bt).getRegex(),reflink:k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,bt).getRegex()},jt={...kt,emStrongRDelimAst:lt,emStrongLDelim:at,delLDelim:ft,delRDelim:pt,url:k(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,Ot).replace(`protocol`,Dt).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:k(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,Dt).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Mt={...jt,br:k(Je).replace(`{2,}`,`*`).getRegex(),text:k(jt.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Nt={normal:He,gfm:We,pedantic:Ge},Pt={normal:kt,gfm:jt,breaks:Mt,pedantic:At},Ft={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},It=e=>Ft[e];function I(e,t){if(t){if(A.escapeTest.test(e))return e.replace(A.escapeReplace,It)}else if(A.escapeTestNoEncode.test(e))return e.replace(A.escapeReplaceNoEncode,It);return e}function Lt(e){return A.numericCharacterReference.test(e)?e.replace(A.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return`&`;let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:r===38?`&`:String.fromCodePoint(r)}):e}function Rt(e){try{e=encodeURI(e).replace(A.percentDecode,`%`)}catch{return null}return e}function zt(e,t){let n=e.replace(A.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(A.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(A.slashPipe,`|`);return n}function Bt(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Vt(e){let t=e.split(`
|
|
4
4
|
`),n=t.length-1;for(;n>=0&&A.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
5
5
|
`)}function L(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function Ht(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function R(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Ut(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`,l=r.state.inLink,u=r.state.linkEmitted,d=r.state.inRawBlock;r.state.inLink=!0,r.state.linkEmitted=!1;let f=r.inlineTokens(s),p=r.state.linkEmitted;if(r.state.linkEmitted=u,r.state.inLink=l,!c){if(p){r.state.inRawBlock=d;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:f}}function Wt(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
@@ -65,5 +65,5 @@ ${e}</tr>
|
|
|
65
65
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${I(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?I(n,!0):this.parser.parseInline(r),o=Rt(e);if(o===null)return a;e=I(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+I(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Rt(e);if(i===null)return I(n);e=i;let a=`<img src="${I(e)}" alt="${I(n)}"`;return t&&(a+=` title="${I(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:I(e.text)}},Jt=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},B=class e{options;renderer;textRenderer;constructor(e){this.options=e||ye,this.options.renderer=this.options.renderer||new qt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Jt}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Yt=class{options;block;constructor(e){this.options=e||ye}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?z.lex:z.lexInline}provideParser(e=this.block){return e?B.parse:B.parseInline}};function Xt(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var Zt=new class{defaults=ve();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=B;Renderer=qt;TextRenderer=Jt;Lexer=z;Tokenizer=Kt;Hooks=Yt;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(Xt(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)Xt(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)Xt(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;Xt(n,this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);Xt(n,this.walkTokens(i,t))}):e.tokens&&Xt(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new qt(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Kt(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Yt;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=Yt.passThroughHooks.has(n)?e=>{if(this.defaults.async&&Yt.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&Xt(n,t.call(this,e)),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return z.lex(e,t??this.defaults)}parser(e,t){return B.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?z.lex:z.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?B.parse:B.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?z.lex:z.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?B.parse:B.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
66
66
|
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+I(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function V(e,t){return Zt.parse(e,t)}V.options=V.setOptions=function(e){return Zt.setOptions(e),V.defaults=Zt.defaults,be(V.defaults),V},V.getDefaults=ve,V.defaults=ye;function Qt(...e){return Zt.use(...e),V.defaults=Zt.defaults,be(V.defaults),V}V.use=Qt,V.walkTokens=function(e,t){return Zt.walkTokens(e,t)},V.parseInline=Zt.parseInline,V.Parser=B,V.parser=B.parse,V.Renderer=qt,V.TextRenderer=Jt,V.Lexer=z,V.lexer=z.lex,V.Tokenizer=Kt,V.Hooks=Yt,V.parse=V,V.options,V.setOptions,V.walkTokens,V.parseInline,B.parse,z.lex;function $t(e,t){this.v=e,this.k=t}function en(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tn(e){if(Array.isArray(e))return e}function nn(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function rn(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
67
67
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function an(e,t){return tn(e)||nn(e,t)||on(e,t)||rn()}function on(e,t){if(e){if(typeof e==`string`)return en(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?en(e,t):void 0}}function sn(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof $t;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}sn.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},sn.prototype.next=function(e){return this._invoke(`next`,e)},sn.prototype.throw=function(e){return this._invoke(`throw`,e)},sn.prototype.return=function(e){return this._invoke(`return`,e)};var cn=Object.entries,ln=Object.setPrototypeOf,un=Object.isFrozen,dn=Object.getPrototypeOf,fn=Object.getOwnPropertyDescriptor,H=Object.freeze,U=Object.seal,pn=Object.create,mn=typeof Reflect<`u`&&Reflect,hn=mn.apply,gn=mn.construct;H||=function(e){return e},U||=function(e){return e},hn||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},gn||=function(e){return new e(...[...arguments].slice(1))};var _n=K(Array.prototype.forEach);Array.prototype.indexOf;var vn=K(Array.prototype.lastIndexOf),yn=K(Array.prototype.pop),bn=K(Array.prototype.push),xn=K(Array.prototype.slice),Sn=K(Array.prototype.splice),Cn=Array.isArray,wn=zn(Set),Tn=K(Set.prototype.add),En=K(Set.prototype.has),Dn=K(String.prototype.toLowerCase),On=K(String.prototype.toString),kn=K(String.prototype.match),An=K(String.prototype.replace),jn=K(String.prototype.indexOf),Mn=K(String.prototype.trim),Nn=K(Number.prototype.toString),Pn=K(Boolean.prototype.toString),Fn=typeof BigInt>`u`?null:K(BigInt.prototype.toString),In=typeof Symbol>`u`?null:K(Symbol.prototype.toString),W=K(Object.prototype.hasOwnProperty),Ln=K(Object.prototype.toString),G=K(RegExp.prototype.test),Rn=zn(TypeError);function K(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return hn(e,t,n)}}function zn(e){return function(){return gn(e,[...arguments])}}function q(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Dn;if(ln&&ln(e,null),!Cn(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(un(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Bn(e){for(let t=0;t<e.length;t++)W(e,t)||(e[t]=null);return e}function J(e){let t=pn(null);for(let r of cn(e)){var n=an(r,2);let i=n[0],a=n[1];W(e,i)&&(t[i]=Cn(a)?Bn(a):a&&typeof a==`object`&&a.constructor===Object?J(a):a)}return t}function Vn(e){switch(typeof e){case`string`:return e;case`number`:return Nn(e);case`boolean`:return Pn(e);case`bigint`:return Fn?Fn(e):`0`;case`symbol`:return In?In(e):`Symbol()`;case`undefined`:return Ln(e);case`function`:case`object`:{if(e===null)return Ln(e);let t=e,n=Y(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Ln(e)}return Ln(e)}default:return Ln(e)}}function Y(e,t){for(;e!==null;){let n=fn(e,t);if(n){if(n.get)return K(n.get);if(typeof n.value==`function`)return K(n.value)}e=dn(e)}function n(){return null}return n}function Hn(e,t){for(;e!==null;){let n=fn(e,t);if(n)return n.get?K(n.get):null;e=dn(e)}return null}function Un(e){try{return G(e,``),!0}catch{return!1}}var Wn=H(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Gn=H(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Kn=H([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),qn=H([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Jn=H(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Yn=H([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Xn=H([`#text`]),Zn=H(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Qn=H(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),$n=H(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),er=H([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),tr=U(/{{[\w\W]*|^[\w\W]*}}/g),nr=U(/<%[\w\W]*|^[\w\W]*%>/g),rr=U(/\${[\w\W]*/g),ir=U(/^data-[\-\w.\u00B7-\uFFFF]+$/),ar=U(/^aria-[\-\w]+$/),or=U(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),sr=U(/^(?:\w+script|data):/i),cr=U(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),lr=U(/^html$/i),ur=U(/^[a-z][.\w]*(-[.\w]+)+$/i),dr=U(/<[/\w!]/g),fr=U(/<[/\w]/g),pr=U(/<\/no(script|embed|frames)/i),mr=U(/\/>/i),X={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},hr=H(q({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),gr=function(){return typeof window>`u`?null:window},_r=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},vr=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},yr=function(e,t,n,r){return W(e,t)&&Cn(e[t])?q(r.base?J(r.base):{},e[t],r.transform):n},br=function(e,t,n){let r=W(e,t)?e[t]:void 0;return r&&typeof r==`object`?J(r):n()};function xr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:gr(),t=e=>xr(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==X.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Y(d,`cloneNode`),p=Y(d,`remove`),m=Y(d,`removeAttributeNode`),h=Y(d,`nextSibling`),g=Y(d,`childNodes`),_=Y(d,`parentNode`),v=Y(d,`shadowRoot`),y=Y(d,`attributes`),b=o&&o.prototype?Y(o.prototype,`nodeType`):null,ee=o&&o.prototype?Y(o.prototype,`nodeName`):null,te=o&&o.prototype?Y(o.prototype,`ownerDocument`):null,x=function(e){return b?b(e):e.nodeType},ne=function(e){return ee?ee(e):e.nodeName},re=Hn(d,`namespaceURI`),S=function(e){return re?re(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let C,w=``,ie,T=!1,E=0,ae=function(){if(E>0)throw Rn(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},D=function(e){ae(),E++;try{return C.createHTML(e)}finally{E--}},oe=function(e){ae(),E++;try{return C.createScriptURL(e)}finally{E--}},se=function(){return T||=(ie=_r(u,i),!0),ie},ce=n,le=ce.implementation,ue=ce.createNodeIterator,de=ce.createDocumentFragment,fe=ce.getElementsByTagName,pe=r.importNode,O=vr();t.isSupported=typeof cn==`function`&&typeof _==`function`&&le&&le.createHTMLDocument!==void 0;let me=tr,he=nr,ge=rr,_e=ir,ve=ar,ye=sr,be=cr,xe=ur,Se=or,k=null,Ce=q({},[...Wn,...Gn,...Kn,...Jn,...Xn]),A=null,we=q({},[...Zn,...Qn,...$n,...er]),j=Object.seal(pn(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Te=null,Ee=null,De=Object.seal(pn(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Oe=!0,ke=!0,Ae=!1,je=!0,M=!1,Me=!0,Ne=!1,Pe=!1,Fe=null,Ie=null,Le=!1,Re=!1,ze=!1,Be=!1,Ve=!0,He=!1,Ue=`user-content-`,We=!0,Ge=!1,Ke=null,qe={},Je=null,Ye=q({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),N=null,Xe=q({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ze=null,Qe=q({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),$e=`http://www.w3.org/1998/Math/MathML`,et=`http://www.w3.org/2000/svg`,P=`http://www.w3.org/1999/xhtml`,tt=P,nt=!1,rt=null,it=q({},[$e,et,P],On),at=H([`mi`,`mo`,`mn`,`ms`,`mtext`]),ot=q({},at),st=H([`annotation-xml`]),ct=q({},st),lt=q({},[`title`,`style`,`font`,`a`,`script`]),ut=null,dt=[`application/xhtml+xml`,`text/html`],F=null,ft=null,pt=n.createElement(`form`),mt=function(e){return e instanceof RegExp||e instanceof Function},ht=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ft&&ft===e)return;(!e||typeof e!=`object`)&&(e={}),e=J(e),ut=dt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,F=ut===`application/xhtml+xml`?On:Dn,k=yr(e,`ALLOWED_TAGS`,Ce,{transform:F}),A=yr(e,`ALLOWED_ATTR`,we,{transform:F}),rt=yr(e,`ALLOWED_NAMESPACES`,it,{transform:On}),Ze=yr(e,`ADD_URI_SAFE_ATTR`,Qe,{transform:F,base:Qe}),N=yr(e,`ADD_DATA_URI_TAGS`,Xe,{transform:F,base:Xe}),Je=yr(e,`FORBID_CONTENTS`,Ye,{transform:F}),Te=yr(e,`FORBID_TAGS`,J({}),{transform:F}),Ee=yr(e,`FORBID_ATTR`,J({}),{transform:F}),qe=W(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?J(e.USE_PROFILES):e.USE_PROFILES:!1,Oe=e.ALLOW_ARIA_ATTR!==!1,ke=e.ALLOW_DATA_ATTR!==!1,Ae=e.ALLOW_UNKNOWN_PROTOCOLS||!1,je=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,M=e.SAFE_FOR_TEMPLATES||!1,Me=e.SAFE_FOR_XML!==!1,Ne=e.WHOLE_DOCUMENT||!1,Re=e.RETURN_DOM||!1,ze=e.RETURN_DOM_FRAGMENT||!1,Be=e.RETURN_TRUSTED_TYPE||!1,Le=e.FORCE_BODY||!1,Ve=e.SANITIZE_DOM!==!1,He=e.SANITIZE_NAMED_PROPS||!1,We=e.KEEP_CONTENT!==!1,Ge=e.IN_PLACE||!1,Se=Un(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:or,tt=typeof e.NAMESPACE==`string`?e.NAMESPACE:P,ot=br(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>q({},at)),ct=br(e,`HTML_INTEGRATION_POINTS`,()=>q({},st));let t=br(e,`CUSTOM_ELEMENT_HANDLING`,()=>pn(null));if(j=pn(null),W(t,`tagNameCheck`)&&mt(t.tagNameCheck)&&(j.tagNameCheck=t.tagNameCheck),W(t,`attributeNameCheck`)&&mt(t.attributeNameCheck)&&(j.attributeNameCheck=t.attributeNameCheck),W(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(j.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),U(j),M&&(ke=!1),ze&&(Re=!0),qe&&(k=q({},Xn),A=pn(null),qe.html===!0&&(q(k,Wn),q(A,Zn)),qe.svg===!0&&(q(k,Gn),q(A,Qn),q(A,er)),qe.svgFilters===!0&&(q(k,Kn),q(A,Qn),q(A,er)),qe.mathMl===!0&&(q(k,Jn),q(A,$n),q(A,er))),De.tagCheck=null,De.attributeCheck=null,W(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?De.tagCheck=e.ADD_TAGS:Cn(e.ADD_TAGS)&&(k===Ce&&(k=J(k)),q(k,e.ADD_TAGS,F))),W(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?De.attributeCheck=e.ADD_ATTR:Cn(e.ADD_ATTR)&&(A===we&&(A=J(A)),q(A,e.ADD_ATTR,F))),W(e,`ADD_FORBID_CONTENTS`)&&Cn(e.ADD_FORBID_CONTENTS)&&(Je===Ye&&(Je=J(Je)),q(Je,e.ADD_FORBID_CONTENTS,F)),We&&(k[`#text`]=!0),Ne&&q(k,[`html`,`head`,`body`]),k.table&&(q(k,[`tbody`]),delete Te.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Rn(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Rn(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=C;C=e.TRUSTED_TYPES_POLICY;try{w=D(``)}catch(e){throw C=t,e}}else e.TRUSTED_TYPES_POLICY===null?(C=void 0,w=``):(C===void 0&&(C=se()),C&&typeof w==`string`&&(w=D(``)));H&&H(e),ft=e},gt=q({},[...Gn,...Kn,...qn]),_t=q({},[...Jn,...Yn]),vt=function(e,t,n){return t.namespaceURI===P?e===`svg`:t.namespaceURI===$e?e===`svg`&&(n===`annotation-xml`||ot[n]):!!gt[e]},yt=function(e,t,n){return t.namespaceURI===P?e===`math`:t.namespaceURI===et?e===`math`&&ct[n]:!!_t[e]},bt=function(e,t,n){return t.namespaceURI===et&&!ct[n]||t.namespaceURI===$e&&!ot[n]?!1:!_t[e]&&(lt[e]||!gt[e])},xt=function(e){let t=S(e),n=Dn(ne(e)),r=_(e),i,a;return r&&x(r)===X.element?(i={namespaceURI:S(r)},a=Dn(ne(r))):(i={namespaceURI:tt},a=`template`),rt[t]?t===et?vt(n,i,a):t===$e?yt(n,i,a):t===P?bt(n,i,a):!!(ut===`application/xhtml+xml`&&rt[t]):!1},St=function(e){bn(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw Rn(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},Ct=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},wt=function(e){Ot(e);let t=g(e);t&&_n(xn(t),e=>{try{p(e)}catch{}});let n=x(e)===X.element?y(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&Ct(e,r,i)}},Tt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}bn(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(Re||ze)try{St(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},Et=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||A[F(i)]||Ct(e,r,i)}},Dt=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&x(e)===X.element){let t=v(e);L(t)&&r.push(t)}let i=g(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},Ot=function(e){Dt(e,e=>{x(e)===X.element&&Et(e)})},kt=function(e){let t=[];return Dt(e,e=>{t.push(e)},!0),t},At=function(e,t){let n=wn();_n(kt(e),e=>{x(e)===X.element&&Tn(n,e)}),_n(t,e=>{x(e)===X.element&&!En(n,e)&&Et(e)})},jt=function(e,n){let r=!1;return _n(t.removed,t=>{t.element&&(r||=t.element===e,Ot(t.element))}),At(e,n),r},Mt=function(e,t){let n=Ke,r=null,i=()=>(r||(r=wn(),_n(t,e=>{Tn(r,e)})),r);for(let t=0;;t++){let r=kt(e),a=[e],o=!1;if(_n(r,e=>{x(e)===X.documentFragment?bn(a,e):!o&&!En(n,e)&&(o=En(i(),e))}),!o)return;if(t>=8)throw Rn(`the tree kept changing during in-place sanitization; refusing to return it`);_n(a,(t,n)=>{Nt(t,n>0,e,i())})}},Nt=function(e,t,n,r){let i=Lt(e),a;for(;a=i.nextNode();)En(r,a)&&!En(Ke,a)&&(t&&R(O.uponSanitizeShadowNode,a,null),qt(a,n),Qt(a,n),L(a.content)&&$t(a.content))},Pt=function(e){Ke&&Tn(Ke,e)},Ft=function(e,t){return Me?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},It=function(e){Me&&Dt(e,e=>{let t=x(e);if(t===X.processingInstruction||t===X.comment&&G(fr,e.data)){try{p(e)}catch{}return!1}if(t===X.element){let t=e,n=F(ne(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Ft(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},I=function(e){let t=null,r=null;if(Le)e=`<remove></remove>`+e;else{let t=kn(e,/^[\r\n\t ]+/);r=t&&t[0]}ut===`application/xhtml+xml`&&tt===P&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=C?D(e):e;if(tt===P)try{t=new l().parseFromString(i,ut)}catch{}if(!t||!t.documentElement){t=le.createDocument(tt,`template`,null);try{t.documentElement.innerHTML=nt?w:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),tt===P?fe.call(t,Ne?`html`:`body`)[0]:Ne?t.documentElement:a},Lt=function(e){let t=te?te(e):e.ownerDocument;return ue.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Rt=function(e){return e=An(e,me,` `),e=An(e,he,` `),e=An(e,ge,` `),e},zt=function(e){Bt(e);let t=e.querySelectorAll?.call(e,`template`);t&&_n(t,e=>{L(e.content)&&zt(e.content)})},Bt=function(e){e.normalize();let t=te?te(e):e.ownerDocument,n=ue.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Rt(r.data),r=n.nextNode()},Vt=function(e){let t=ee?ee(e):null;return typeof t!=`string`||F(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},L=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===X.documentFragment}catch{return!1}},Ht=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function R(e,n,r){e.length!==0&&_n(e,e=>{e.call(t,n,r,ft)})}let Ut=function(e,t){return!!(Me&&e.hasChildNodes()&&!Ht(e.firstElementChild)&&G(dr,e.textContent)&&G(dr,e.innerHTML)||Me&&hr[t]&&x(e)===X.element&&S(e)===P&&(Ht(e.firstElementChild)||typeof e.textContent==`string`&&G(dr,e.textContent))||e.nodeType===X.processingInstruction||Me&&e.nodeType===X.comment&&G(fr,e.data))},Wt=function(e,t){return e instanceof RegExp?G(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Gt=function(e,t,n){if(!Te[t]&&Yt(t)&&Wt(j.tagNameCheck,t))return!1;if(We&&!Je[t]&&!Je[Dn(t)]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return St(e),!0},Kt=function(e,t,n,r){return e.length===0?t:t===n||t===r?J(t):t},z=function(e,t){return e===t||_(e)!==null?!1:(Ge&&Ot(e),!0)},qt=function(e,n){if(Pt(e),R(O.beforeSanitizeElements,e,null),z(e,n))return!0;if(Vt(e))return St(e),!0;let r=F(ne(e));if(k=Kt(O.uponSanitizeElement,k,Ce,Fe),R(O.uponSanitizeElement,e,{tagName:r,allowedTags:k}),z(e,n))return!0;if(Ut(e,r))return St(e),!0;if(Te[r]||!(De.tagCheck instanceof Function&&De.tagCheck(r))&&!k[r]){let t=Gt(e,r,n);return t===!1&&(R(O.afterSanitizeElements,e,null),z(e,n))?!0:t}if(x(e)===X.element&&!xt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&G(pr,e.innerHTML))return St(e),!0;if(M&&e.nodeType===X.text){let n=Rt(e.textContent);e.textContent!==n&&(bn(t.removed,{element:e.cloneNode()}),e.textContent=n)}return R(O.afterSanitizeElements,e,null),z(e,n)},Jt=function(e,t,r){if(Ee[t]||Ft(t,e)||Ve&&(t===`id`||t===`name`)&&(r in n||r in pt))return!1;let i=A[t]||De.attributeCheck instanceof Function&&De.attributeCheck(t,e);return ke&&G(_e,t)||Oe&&G(ve,t)?!0:i?Ze[t]||G(Se,An(r,be,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&jn(r,`data:`)===0&&N[e]||Ae&&!G(ye,An(r,be,``))?!0:!r:Yt(e)&&Wt(j.tagNameCheck,e)&&Wt(j.attributeNameCheck,t,e)||t===`is`&&j.allowCustomizedBuiltInElements&&Wt(j.tagNameCheck,r)},B=q({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Yt=function(e){return!B[Dn(e)]&&G(xe,e)},Xt=function(e,t,n,r){if(C&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return D(r);case`TrustedScriptURL`:return oe(r)}return r},Zt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Vt(e)||(St(e),!1)}catch{return Tt(t,e),!1}},V=function(e,t){return Me&&G(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:Dn(e)===`attributename`&&kn(t,`href`)!==null},Qt=function(e,n){if(R(O.beforeSanitizeAttributes,e,null),z(e,n))return;let r=e.attributes;if(!r||Vt(e))return;A=Kt(O.uponSanitizeAttribute,A,we,Ie);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:A,forceKeepAttr:void 0},a=r.length,o=F(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=F(s),d=l,f=s===`value`?d:Mn(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,R(O.uponSanitizeAttribute,e,i),f=i.attrValue,He&&(u===`id`||u===`name`)&&jn(f,Ue)!==0&&(Tt(s,e,n),f=Ue+f,p=!0),V(s,f)?Tt(s,e,n):i.forceKeepAttr||(i.keepAttr?!je&&G(mr,f)?Tt(s,e,n):(M&&(f=Rt(f)),Jt(o,u,f)?(f=Xt(o,u,c,f),f!==d&&Zt(e,s,c,f)&&p&&yn(t.removed)):Tt(s,e,n)):Tt(s,e,n))}R(O.afterSanitizeAttributes,e,null),z(e,n)},$t=function(e){let t=null,n=Lt(e);for(R(O.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(R(O.uponSanitizeShadowNode,t,null),qt(t,e),Qt(t,e),L(t.content)&&$t(t.content),x(t)===X.element){let e=v(t);L(e)&&(en(e),$t(e))}M&&Bt(e),R(O.afterSanitizeShadowDOM,e,null)},en=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){$t(e.shadow);continue}let n=e.node,r=x(n)===X.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=ee?ee(n):null;if(typeof e==`string`&&F(e)===`template`){let e=n.content;L(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);L(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(nt=!e,nt&&(e=`<!-->`),typeof e!=`string`&&!Ht(e)&&(e=Vn(e),typeof e!=`string`))throw Rn(`dirty is not a string, aborting`);if(!t.isSupported)return e;Pe?(k=Fe,A=Ie):ht(n),(O.uponSanitizeElement.length>0||O.uponSanitizeAttribute.length>0)&&(k=J(k)),O.uponSanitizeAttribute.length>0&&(A=J(A)),t.removed=[];let c=Ge&&typeof e!=`string`&&Ht(e),l=[],u=Ke;if(c){It(e);let t=ne(e);if(typeof t==`string`){let n=F(t);if(!k[n]||Te[n])throw wt(e),Rn(`root node is forbidden and cannot be sanitized in-place`)}if(Vt(e))throw wt(e),Rn(`root node is clobbered and cannot be sanitized in-place`);l=kt(e),Ke=wn()}else if(Ht(e))i=I(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===X.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),en(i);else{if(!Re&&!M&&!Ne&&e.indexOf(`<`)===-1)return C&&Be?D(e):e;if(i=I(e),!i)return Re?null:Be?w:``}i&&Le&&St(i.firstChild);let d=c?e:i;try{c&&en(e);let t=Lt(d);for(;o=t.nextNode();)qt(o,d),Qt(o,d),L(o.content)&&$t(o.content);c&&Mt(e,l)}catch(t){throw c&&(wt(e),jt(e,l)),t}finally{Ke=u}if(c){if(jt(e,l))throw Rn(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return M&&zt(e),e}if(Re){if(M&&zt(i),ze)for(s=de.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(A.shadowroot||A.shadowrootmode)&&(s=pe.call(r,s,!0)),s}let f=Ne?i.outerHTML:i.innerHTML;return Ne&&k[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&G(lr,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
68
|
-
`+f),M&&(f=Rt(f)),C&&Be?D(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ht(e),Pe=!0,Fe=k,Ie=A},t.clearConfig=function(){ft=null,Pe=!1,Fe=null,Ie=null,C=ie,w=``},t.isValidAttribute=function(e,t,n){ft||ht({});let r=F(e),i=F(t);return typeof n==`string`&&(V(t,n)||!je&&G(mr,n))?!1:Jt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&W(O,e)&&bn(O[e],t)},t.removeHook=function(e,t){if(W(O,e)){if(t!==void 0){let n=vn(O[e],t);return n===-1?void 0:Sn(O[e],n,1)[0]}return yn(O[e])}},t.removeHooks=function(e){W(O,e)&&(O[e]=[])},t.removeAllHooks=function(){O=vr()},t}var Sr=xr();function Cr(e,t){if(e.startsWith(`#`))return e;let
|
|
69
|
-
`);let l=document.createElement(`pre`);return l.className=`text-preview source-text`,l.textContent=e,i.append(a,c,l),T(async()=>{let{highlightSource:e}=await import(`./highlight-Cjbz6wKa.js`);return{highlightSource:e}},[]).then(({highlightSource:r})=>r(l,e,t,n)).catch(()=>{}),i}function Er(e){return e.kind===`html`||e.kind===`text`&&/\.md$/i.test(e.name)}function Dr(e){return e.kind===`text`&&!Er(e)?`source`:`viewer`}function Or(e,t=0,n=!1){return`${n?`/file`:e.kind===`html`?`/preview-html`:e.kind===`office`?`/office-pdf`:`/file`}?${new URLSearchParams({path:e.path,revision:String(t)})}`}function kr(e,t){e.classList.add(`preview-error`);let n=document.createElement(`p`);n.textContent=t,e.replaceChildren(n)}function Ar(e,t=0,n=Dr(e),r=()=>{}){let i=document.createElement(`section`);i.className=`preview-pane`,i.hidden=!0,i.setAttribute(`role`,`tabpanel`),i.setAttribute(`aria-label`,e.path);let a=new AbortController,s=!1,c=a.signal,l=Or(e,t),u;if(e.kind===`text`||e.kind===`html`){let a=document.createElement(`div`);a.className=`viewer-surface`;let o=document.createElement(`div`);o.className=`source-surface`,o.textContent=`Loading…`;let s=Er(e);s&&i.append(a),i.append(o),s||(n=`source`);let d=n,f,p=!1,m=!1,h=()=>{f===void 0||c.aborted||(d===`source`&&!p&&(o.replaceChildren(Tr(f,e.name,c,r)),p=!0),d===`viewer`&&e.kind===`text`&&!m&&(a.replaceChildren(wr(f,e.path)),m=!0))},g,_=()=>{g??=fetch(Or(e,t,!0),{signal:c}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.text()}).then(e=>{f=e,h()}).catch(t=>{if(c.aborted)return;let n=`Could not load ${e.path}: ${t}`;kr(o,n),e.kind===`text`&&kr(a,n)})};if(e.kind===`html`){let t=document.createElement(`iframe`);t.title=e.path,t.setAttribute(`sandbox`,`allow-scripts`),a.append(t),u=n=>{d=n,a.hidden=n!==`viewer`,o.hidden=n!==`source`,n===`source`?(_(),h()):t.hasAttribute(`src`)||(t.src=l,fetch(l,{method:`HEAD`,signal:c}).then(t=>{t.ok||kr(a,`Could not load ${e.path} (HTTP ${t.status}).`)}).catch(e=>{c.aborted||kr(a,String(e))}))}}else a.textContent=`Loading…`,_(),u=e=>{s||(e=`source`),d=e,a.hidden=e!==`viewer`,o.hidden=e!==`source`,h()};u(n)}else if(e.kind===`pdf`)i.textContent=`Loading…`,T(async()=>{let{mountPdf:e}=await import(`./pdf-27wT5C7q.js`);return{mountPdf:e}},__vite__mapDeps([0,1])).then(({mountPdf:e})=>{if(!c.aborted)return e(i,l,c,()=>s)}).catch(t=>{c.aborted||kr(i,`Could not load ${e.path}: ${t}`)});else if(e.kind===`office`){i.textContent=`Converting…`;let t=fetch(l,{signal:c}).then(async e=>{if(!e.ok)throw Error((await e.text()).trim()||`HTTP ${e.status}`);return new Uint8Array(await e.arrayBuffer())});Promise.all([T(()=>import(`./pdf-27wT5C7q.js`),__vite__mapDeps([0,1])),t]).then(([{mountPdf:e},t])=>{if(!c.aborted)return e(i,t,c,()=>s)}).catch(t=>{c.aborted||kr(i,`Could not preview ${e.path}. ${t instanceof Error?t.message:t}`)})}else if(e.kind===`image`){let t=document.createElement(`div`);t.className=`image-stage`;let n=document.createElement(`img`);n.src=l,n.alt=e.path,n.draggable=!1,n.addEventListener(`error`,()=>kr(i,`Could not load ${e.path}.`),{signal:c}),t.append(n);let r=document.createElement(`div`);r.className=`image-toolbar`,r.setAttribute(`role`,`group`),r.setAttribute(`aria-label`,`Image zoom`);let a=document.createElement(`span`);a.className=`image-zoom-value`,a.textContent=`100%`;let s=1,u=0,d=0,f=!1,p=0,m=0,h=()=>{n.style.transform=`translate3d(${u}px, ${d}px, 0) scale(${s})`,a.textContent=`${Math.round(s*100)}%`,t.classList.toggle(`zoomed`,s>1.001)},g=(e,n,r)=>{let i=Math.max(.1,Math.min(12,e)),a=i/s;if(n!==void 0&&r!==void 0){let e=t.getBoundingClientRect(),i=n-e.left-e.width/2,o=r-e.top-e.height/2;u=i-(i-u)*a,d=o-(o-d)*a}else u*=a,d*=a;s=i,h()},_=(e,t,n)=>{let r=document.createElement(`button`);return r.type=`button`,r.title=e,r.setAttribute(`aria-label`,e),r.textContent=t,r.addEventListener(`click`,n,{signal:c}),r},v=_(`Zoom out`,``,()=>g(s/1.25));v.append(o(`remove`)),v.className=`image-zoom-out`;let y=_(`Fit image to viewer`,`Fit`,()=>{u=0,d=0,g(1)});y.className=`image-fit`;let b=_(`Zoom in`,``,()=>g(s*1.25));b.append(o(`add`)),b.className=`image-zoom-in`,r.append(v,a,y,b),t.addEventListener(`wheel`,e=>{e.ctrlKey&&(e.preventDefault(),g(s*Math.exp(-e.deltaY*.002),e.clientX,e.clientY))},{passive:!1,signal:c}),t.addEventListener(`pointerdown`,e=>{e.button!==0||s<=1.001||(f=!0,p=e.clientX,m=e.clientY,t.classList.add(`dragging`),t.setPointerCapture(e.pointerId))},{signal:c}),t.addEventListener(`pointermove`,e=>{f&&(u+=e.clientX-p,d+=e.clientY-m,p=e.clientX,m=e.clientY,h())},{signal:c});let ee=()=>{f=!1,t.classList.remove(`dragging`)};t.addEventListener(`pointerup`,ee,{signal:c}),t.addEventListener(`pointercancel`,ee,{signal:c}),t.addEventListener(`lostpointercapture`,ee,{signal:c}),i.append(t,r)}return{element:i,setActive:e=>{s=e},setMode:u,dispose:()=>{a.abort(),i.querySelectorAll(`iframe`).forEach(e=>e.remove()),i.remove()}}}var jr=e=>t(e.file.path,e.diff);function Mr(e,t){Object.assign(e.style,{left:`${t.x}px`,top:`${t.y}px`,width:`${t.width}px`,height:`${t.height}px`})}var Nr=class{host;onChange;copyToClipboard;onOpenFile;groups=new Map;tree;selectedGroup;sequence=0;tabSequence=0;revision=0;sashes=new Map;measured;dragged=null;dragSurface=document.createElement(`div`);highlight=document.createElement(`div`);resizeSurface=document.createElement(`div`);resizeObserver;gitChanges=new Map;constructor(e,t,n,r=()=>{}){this.host=e,this.onChange=t,this.copyToClipboard=n,this.onOpenFile=r,this.selectedGroup=this.makeGroup(),this.tree={type:`group`,id:this.selectedGroup.id},this.measured=_e(this.tree,this.hostRect()),this.dragSurface.className=`editor-drag-surface`,this.dragSurface.hidden=!0,this.highlight.className=`editor-drop-highlight`,this.dragSurface.append(this.highlight),this.resizeSurface.className=`editor-resize-surface`,this.resizeSurface.hidden=!0,e.append(this.dragSurface,this.resizeSurface),e.addEventListener(`dragover`,e=>this.dragOver(e)),e.addEventListener(`drop`,e=>{if(!this.dragged)return;e.preventDefault(),e.stopPropagation();let t=this.dropTarget(e),n=this.dragged;this.endDrag(),t&&this.transfer(n,t,this.isCopy(e))}),e.addEventListener(`dragleave`,t=>{e.contains(t.relatedTarget)||(this.highlight.hidden=!0)}),window.addEventListener(`dragend`,()=>this.endDrag()),window.addEventListener(`drop`,()=>this.endDrag()),window.addEventListener(`keydown`,e=>{e.key===`Escape`&&this.endDrag()}),window.addEventListener(`blur`,()=>{setTimeout(()=>this.activateFrame(document.activeElement),0)}),this.resizeObserver=new ResizeObserver(()=>this.layout()),this.resizeObserver.observe(e),this.render(!1)}get activeTab(){return this.selectedGroup.active}get tabs(){return me(this.tree).flatMap(e=>this.groups.get(e)?.tabs??[])}hostRect(){return{x:0,y:0,width:this.host.clientWidth,height:this.host.clientHeight}}makeGroup(){let e;do e=`group-${++this.sequence}`;while(this.groups.has(e));let t=document.createElement(`section`);t.className=`editor-group`,t.dataset.groupId=e,t.setAttribute(`role`,`region`);let n=document.getElementById(`editor-group-template`);t.append(n.content.cloneNode(!0));for(let n of t.querySelectorAll(`[id]`))n.dataset.control=n.id,this.groups.size&&(n.id+=`-${e}`);let r=e=>t.querySelector(`[data-control="${e}"]`);r(`current-path`).classList.add(`current-path`);let i={id:e,element:t,header:t.querySelector(`.group-header`),tabbar:r(`tabbar`),tabs:[],active:null,control:r};return t.addEventListener(`pointerdown`,()=>this.selectGroup(i),{capture:!0}),t.addEventListener(`focusin`,()=>this.selectGroup(i)),r(`group-focus`).addEventListener(`click`,()=>{this.selectGroup(i),this.focus()}),r(`reload-file`).addEventListener(`click`,()=>this.reload(i.active)),r(`copy-path`).addEventListener(`click`,()=>{let e=i.active?.file.path;e&&this.copyToClipboard(e,`File path`)}),r(`viewer-mode`).addEventListener(`click`,()=>this.setMode(i.active,`viewer`)),r(`source-mode`).addEventListener(`click`,()=>this.setMode(i.active,`source`)),r(`open-changes`).addEventListener(`click`,()=>{let e=i.active,t=e&&this.preferredChange(e.file.path);t&&this.openDiff(t)}),r(`open-changed-file`).addEventListener(`click`,()=>{let e=i.active;e?.diff&&this.onOpenFile(e.file.path)}),r(`previous-change`).addEventListener(`click`,()=>this.navigateChange(-1)),r(`next-change`).addEventListener(`click`,()=>this.navigateChange(1)),r(`diff-inline`).addEventListener(`click`,()=>this.updateDiff(i.active,e=>({...e,layout:e.layout===`inline`?`side-by-side`:`inline`}))),r(`diff-collapse`).addEventListener(`click`,()=>this.updateDiff(i.active,e=>({...e,collapse:!e.collapse}))),r(`diff-whitespace`).addEventListener(`click`,()=>this.updateDiff(i.active,e=>({...e,ignoreTrimWhitespace:!e.ignoreTrimWhitespace}))),r(`split-right`).addEventListener(`click`,()=>this.split(i,`right`)),r(`split-down`).addEventListener(`click`,()=>this.split(i,`down`)),this.groups.set(e,i),this.host.append(t),i}selectGroup(e){this.selectedGroup!==e&&(this.selectedGroup=e,this.render())}activate(e,t=!1){this.selectedGroup=e.group,e.group.active=e,this.render(),e.element.scrollIntoView({block:`nearest`,inline:`nearest`}),t&&e.button.focus()}mountPane(e){let t=e.pane.element;t.id=`${e.id}-panel`,t.setAttribute(`aria-labelledby`,e.id),t.addEventListener(`pointerdown`,()=>this.selectGroup(e.group),{capture:!0}),t.addEventListener(`focusin`,()=>this.selectGroup(e.group)),this.host.append(t)}createPane(e,t,n,r){return r?fe({path:e.path,name:e.name,stage:r.stage,originalPath:r.originalPath},t,r.state):Ar(e,t,n,e=>this.copyToClipboard(e,`Source`))}makeTab(e,t,n=Dr(e),r){let i=`file-tab-${++this.tabSequence}`,a=document.createElement(`div`);a.className=`tab`,a.setAttribute(`role`,`presentation`),a.draggable=!0;let c=document.createElement(`button`);c.type=`button`,c.className=`tab-select tab-label`,c.setAttribute(`role`,`tab`),c.id=i,c.title=e.path,c.setAttribute(`aria-label`,e.path),c.setAttribute(`aria-controls`,`${i}-panel`);let l=document.createElement(`span`);if(l.textContent=e.name,c.append(s(e),l),r){let t=`${e.path} (${oe[r.stage][1]})`;c.title=t,c.setAttribute(`aria-label`,t);let n=document.createElement(`span`);n.className=`tab-description`,n.textContent=`(${oe[r.stage][1]})`,c.append(n)}let u={id:i,file:e,...r?{diff:{...r,state:{...r.state}}}:{},group:t,mode:n,element:a,button:c,pane:this.createPane(e,0,n,r),revision:0};c.addEventListener(`click`,()=>this.activate(u)),c.addEventListener(`keydown`,e=>{let t=u.group.tabs,n=t.indexOf(u),r=e.key===`ArrowRight`?(n+1)%t.length:e.key===`ArrowLeft`?(n-1+t.length)%t.length:e.key===`Home`?0:e.key===`End`?t.length-1:-1;e.key===`Delete`?(e.preventDefault(),this.close(u,!0)):r>=0&&(e.preventDefault(),this.activate(t[r],!0))});let d=document.createElement(`button`);return d.type=`button`,d.className=`tab-close`,d.title=`Close tab`,d.setAttribute(`aria-label`,`Close ${c.title}`),d.append(o(`close`)),d.addEventListener(`click`,()=>this.close(u,!0)),a.append(c,d),a.addEventListener(`dragstart`,e=>{e.dataTransfer&&(this.dragged=u,e.dataTransfer.effectAllowed=`copyMove`,e.dataTransfer.setData(`application/x-fzv-tab`,u.id),this.host.classList.add(`dragging-tab`),requestAnimationFrame(()=>{this.dragged&&(this.dragSurface.hidden=!1,this.highlight.hidden=!0)}))}),this.mountPane(u),t.tabs.push(u),t.active=u,u}open(e){let t=this.selectedGroup;this.activate(t.tabs.find(t=>jr(t)===e.path)??this.makeTab(e,t))}openDiff(e){let n=e.path.split(`/`).at(-1);if(e.kind!==`text`&&e.kind!==`html`){e.status!==`D`&&this.onOpenFile(e.path);return}let r=this.selectedGroup,i=t(e.path,e),a=r.tabs.find(e=>jr(e)===i);if(a){a.diff.originalPath!==e.originalPath&&(a.diff.originalPath=e.originalPath,this.reload(a)),this.activate(a);return}let o=this.makeTab({path:e.path,name:n,kind:e.kind,size:0},r,`source`,{stage:e.stage,originalPath:e.originalPath,state:this.selectedGroup.active?.diff?.state??E});o.pane.revealFirstChange(),this.activate(o)}setGitChanges(e){this.gitChanges=new Map;for(let t of e)this.gitChanges.set(t.path,[...this.gitChanges.get(t.path)??[],t]);this.render(!1)}preferredChange(e){let t=this.gitChanges.get(e)??[];return t.find(e=>e.stage===`worktree`)??t[0]}reloadDiffs(){for(let e of this.tabs)e.diff&&this.reload(e)}navigateChange(e){let t=this.activeTab;return t?.diff?(t.pane.navigate(e),!0):!1}updateDiff(e,t){e?.diff&&(e.diff.state=t(e.diff.state),e.pane.update(e.diff.state),this.render())}close(e,t=!1){this.dragged===e&&this.endDrag();let n=e.group,r=n.tabs.indexOf(e);r<0||(n.tabs.splice(r,1),e.pane.dispose(),e.element.remove(),n.active===e&&(n.active=n.tabs[Math.min(r,n.tabs.length-1)]??null),this.removeEmptyGroup(n),this.render(),t&&this.focus())}removeEmptyGroup(e){if(e.tabs.length||this.groups.size===1)return;let t=me(this.tree).indexOf(e.id);if(this.tree=O(this.tree,e.id),this.groups.delete(e.id),e.element.remove(),this.selectedGroup===e){let e=me(this.tree);this.selectedGroup=this.groups.get(e[Math.min(t,e.length-1)])}}focus(){(this.activeTab?.button??document.getElementById(`main`))?.focus()}cycle(e){let t=this.selectedGroup;if(!t.tabs.length)return;let n=t.active?t.tabs.indexOf(t.active):-1;this.activate(t.tabs[(n+e+t.tabs.length)%t.tabs.length])}focusGroup(e){let t=me(this.tree)[e],n=this.groups.get(t);n&&(this.selectGroup(n),this.focus())}splitActive(e){this.split(this.selectedGroup,e)}split(e,t){e.active&&this.transfer(e.active,{group:e,direction:t},!0)}transfer(e,t,n){let r=e.group,i=t.group;if(t.direction){if(this.groups.size>=32||!n&&r===i&&r.tabs.length===1)return;let e=this.makeGroup();this.tree=pe(this.tree,i.id,e.id,t.direction,`split-${++this.sequence}`),i=e}let a=i.tabs.find(t=>jr(t)===jr(e));if(i===r){t.index!==void 0&&(i.tabs.splice(i.tabs.indexOf(e),1),i.tabs.splice(t.index,0,e)),this.activate(e,!0);return}if(a&&t.index!==void 0&&(i.tabs.splice(i.tabs.indexOf(a),1),i.tabs.splice(t.index,0,a)),n){let n=a??this.makeTab(e.file,i,e.mode,e.diff);!a&&t.index!==void 0&&(i.tabs.splice(i.tabs.indexOf(n),1),i.tabs.splice(t.index,0,n)),this.activate(n,!0);return}let o=r.tabs.indexOf(e);r.tabs.splice(o,1),r.active===e&&(r.active=r.tabs[Math.min(o,r.tabs.length-1)]??null),a?(e.pane.dispose(),e.element.remove()):(e.group=i,i.tabs.splice(t.index??i.tabs.length,0,e)),this.selectedGroup=i,i.active=a??e,this.removeEmptyGroup(r),this.activate(a??e,!0)}reload(e=this.activeTab){e&&(e.pane.dispose(),e.revision=++this.revision,e.pane=this.createPane(e.file,e.revision,e.mode,e.diff),this.mountPane(e),this.render())}setMode(e,t){!e?.diff&&e?.pane.setMode&&Er(e.file)&&(e.mode=t,e.pane.setMode(t),this.render())}frameTab(e){return this.tabs.find(t=>t.group.active===t&&t.file.kind===`html`&&t.mode===`viewer`&&t.pane.element.querySelector(`iframe`)?.contentWindow===e)}activateFrame(e){if(!(e instanceof HTMLIFrameElement))return;let t=this.frameTab(e.contentWindow);t&&this.selectGroup(t.group)}snapshot(){return{version:2,layout:this.tree,activeGroup:this.selectedGroup.id,groups:me(this.tree).map(e=>{let t=this.groups.get(e);return{id:e,tabs:t.tabs.map(e=>({path:e.file.path,mode:e.mode,...e.diff?{diff:e.diff.stage,...e.diff.originalPath?{originalPath:e.diff.originalPath}:{},...e.diff.state}:{}})),active:t.active?jr(t.active):null}})}}restore(e,t){if(!e){this.render();return}let n=new Map(t.map(e=>[e.path,e]));if(e.version===1){for(let t of e.tabs){let e=n.get(t);e&&this.makeTab(e,this.selectedGroup)}this.selectedGroup.active=this.selectedGroup.tabs.find(t=>t.file.path===e.active)??this.selectedGroup.tabs[0]??null}else{for(let e of this.groups.values())e.element.remove();this.groups.clear();let t=new Map;for(let r of e.groups){let e=this.makeGroup();t.set(r.id,e.id);for(let t of r.tabs){if(t.diff){let n=t.path.split(`/`).at(-1);this.makeTab({path:t.path,name:n,kind:/\.html?$/i.test(n)?`html`:`text`,size:0},e,`source`,{stage:t.diff,originalPath:t.originalPath,state:{layout:t.layout??E.layout,collapse:t.collapse??E.collapse,ignoreTrimWhitespace:t.ignoreTrimWhitespace??E.ignoreTrimWhitespace}});continue}let r=n.get(t.path);r&&this.makeTab(r,e,Er(r)?t.mode:Dr(r))}e.active=e.tabs.find(e=>jr(e)===r.active)??e.tabs[0]??null}let r=e=>e.type===`group`?{type:`group`,id:t.get(e.id)}:{...e,id:`split-${++this.sequence}`,children:[r(e.children[0]),r(e.children[1])]};this.tree=r(e.layout),this.selectedGroup=this.groups.get(t.get(e.activeGroup));for(let e of[...this.groups.values()])this.removeEmptyGroup(e)}this.render()}render(e=!0){let t=0;for(let e of me(this.tree)){let n=this.groups.get(e);n.element.setAttribute(`aria-label`,`Editor group ${++t}`),n.element.classList.toggle(`focused`,n===this.selectedGroup),n.element.classList.toggle(`multiple`,this.groups.size>1);let r=n.control(`group-focus`);r.hidden=this.groups.size===1,r.textContent=String(t),r.setAttribute(`aria-label`,`Focus editor group ${t}`),r.setAttribute(`aria-pressed`,String(n===this.selectedGroup)),r.title=`Focus editor group ${t} (f)`,n.element.setAttribute(`aria-owns`,n.tabs.map(e=>e.pane.element.id).join(` `));let i=n.active;n.control(`no-tabs`).hidden=!!n.tabs.length,n.control(`empty-state`).hidden=!!i;let a=i?.diff?`${i.file.path} (${oe[i.diff.stage].join(` ↔ `)})`:i?.file.path??`Ready when you are`;n.control(`current-path`).textContent=a,n.control(`current-path`).title=i?a:``;for(let e of[`reload-file`,`split-right`,`split-down`])n.control(e).disabled=!i||e.startsWith(`split-`)&&this.groups.size>=32;if(n.control(`copy-path`).disabled=!i,n.control(`open-file`).hidden=!i||!!i.diff,n.control(`download-file`).hidden=!i||!!i.diff,i&&!i.diff&&(n.control(`open-file`).href=Or(i.file,i.revision)),i&&!i.diff){let e=n.control(`download-file`);e.href=Or(i.file,i.revision,!0),e.download=i.file.name}n.control(`preview-modes`).hidden=!i||!!i.diff||!Er(i.file),n.control(`open-changes`).hidden=!i||!!i.diff||!this.preferredChange(i.file.path),n.control(`diff-actions`).hidden=!i?.diff;let o=i?.diff?.state;n.control(`diff-inline`).setAttribute(`aria-pressed`,String(o?.layout===`inline`)),n.control(`diff-collapse`).setAttribute(`aria-pressed`,String(!!o?.collapse)),n.control(`diff-whitespace`).setAttribute(`aria-pressed`,String(!!o&&!o.ignoreTrimWhitespace)),n.control(`viewer-mode`).setAttribute(`aria-pressed`,String(i?.mode===`viewer`)),n.control(`source-mode`).setAttribute(`aria-pressed`,String(i?.mode===`source`)),n.tabs.forEach((e,t)=>{let r=n.tabbar.children[t];r!==e.element&&n.tabbar.insertBefore(e.element,r??null);let a=e===i;e.element.classList.toggle(`active`,a),e.button.setAttribute(`aria-selected`,String(a)),e.button.tabIndex=a?0:-1,e.pane.element.hidden=!a,e.pane.element.dataset.groupId=n.id,e.pane.setActive(a&&n===this.selectedGroup)})}this.layout(),e&&this.onChange()}layout(){this.measured=_e(this.tree,this.hostRect());for(let[e,t]of this.measured.groups){let n=this.groups.get(e);Mr(n.element,t);let r=Math.min(t.height,n.header.offsetHeight);for(let e of n.tabs)Mr(e.pane.element,{...t,y:t.y+r,height:Math.max(0,t.height-r)})}for(let[e,t]of this.sashes)this.measured.splits.has(e)||(t.remove(),this.sashes.delete(e));for(let[e,{node:t,rect:n,sash:r}]of this.measured.splits){let i=this.sashes.get(e);i||(i=this.makeSash(e),this.sashes.set(e,i),this.host.append(i)),i.dataset.axis=t.axis,i.setAttribute(`aria-orientation`,t.axis===`x`?`vertical`:`horizontal`),i.setAttribute(`aria-label`,t.axis===`x`?`Resize editor columns`:`Resize editor rows`);let[a,o]=ge(t,t.axis===`x`?n.width:n.height);i.setAttribute(`aria-valuemin`,String(Math.round(a*100))),i.setAttribute(`aria-valuemax`,String(Math.round(o*100))),i.setAttribute(`aria-valuenow`,String(Math.round(Math.max(a,Math.min(o,t.ratio))*100))),Mr(i,r)}}makeSash(e){let t=document.createElement(`div`);t.className=`editor-sash`,t.setAttribute(`role`,`separator`),t.tabIndex=0;let n=null,r=(r=!1)=>{if(!n)return;let i=this.measured.splits.get(e);r&&i&&(i.node.ratio=n.ratio);let a=n.pointer;n=null,t.hasPointerCapture(a)&&t.releasePointerCapture(a),this.resizeSurface.hidden=!0,t.classList.remove(`resizing`),this.layout(),this.onChange()};return t.addEventListener(`pointerdown`,r=>{if(r.button!==0)return;r.preventDefault();let i=this.measured.splits.get(e);n={ratio:i.node.ratio,pointer:r.pointerId},t.setPointerCapture(r.pointerId),t.focus(),t.classList.add(`resizing`),this.resizeSurface.style.cursor=i.node.axis===`x`?`col-resize`:`row-resize`,this.resizeSurface.hidden=!1}),t.addEventListener(`pointermove`,t=>{if(!n)return;let r=this.measured.splits.get(e),i=this.host.getBoundingClientRect(),a=r.node.axis===`x`?r.rect.width:r.rect.height,o=r.node.axis===`x`?t.clientX-i.left-r.rect.x:t.clientY-i.top-r.rect.y,[s,c]=ge(r.node,a);r.node.ratio=Math.max(s,Math.min(c,(o-2)/Math.max(1,a-4))),this.layout()}),t.addEventListener(`pointerup`,()=>r()),t.addEventListener(`pointercancel`,()=>r(!0)),t.addEventListener(`lostpointercapture`,()=>r()),t.addEventListener(`keydown`,t=>{if(t.key===`Escape`&&n){t.preventDefault(),r(!0);return}let i=this.measured.splits.get(e),a=i.node.axis===`x`?`ArrowLeft`:`ArrowUp`;if(![a,i.node.axis===`x`?`ArrowRight`:`ArrowDown`,`Home`,`End`].includes(t.key))return;t.preventDefault();let[o,s]=ge(i.node,i.node.axis===`x`?i.rect.width:i.rect.height);i.node.ratio=t.key===`Home`?o:t.key===`End`?s:Math.max(o,Math.min(s,i.node.ratio+(t.key===a?-.05:.05))),this.layout(),this.onChange()}),t.addEventListener(`dblclick`,()=>{this.measured.splits.get(e).node.ratio=.5,this.layout(),this.onChange()}),t}isCopy(e){return/Mac|iPhone|iPad/.test(navigator.platform)?e.altKey:e.ctrlKey}endDrag(){this.dragged=null,this.host.classList.remove(`dragging-tab`),this.dragSurface.hidden=!0,this.highlight.hidden=!0}dropTarget(e){let t=this.host.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;for(let[t,i]of this.measured.groups){if(n<i.x||n>i.x+i.width||r<i.y||r>i.y+i.height)continue;let a=this.groups.get(t),o=a.tabbar.getBoundingClientRect();if(e.clientY<o.bottom){e.clientX<o.left+24&&(a.tabbar.scrollLeft-=12),e.clientX>o.right-24&&(a.tabbar.scrollLeft+=12);let t=a.tabs.filter(e=>!this.dragged||jr(e)!==jr(this.dragged)),n=t.findIndex(t=>{let n=t.element.getBoundingClientRect();return e.clientX<n.left+n.width/2});return{group:a,index:n<0?t.length:n}}let s=a.header.offsetHeight,c=(n-i.x)/i.width,l=(r-i.y-s)/Math.max(1,i.height-s),u;return l>=0&&(c<.1||c>.9||l<.1||l>.9)&&(u=c<1/3?`left`:c>2/3?`right`:l<.5?`up`:`down`),{group:a,direction:u}}return null}dragOver(e){if(!this.dragged)return;e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.isCopy(e)?`copy`:`move`);let t=this.dropTarget(e);if(this.highlight.hidden=!t,!t)return;let n=this.measured.groups.get(t.group.id);if(t.index!==void 0){let e=t.group.tabs.filter(e=>!this.dragged||jr(e)!==jr(this.dragged)),r=e[t.index]?.element.getBoundingClientRect(),i=e[t.index-1]?.element.getBoundingClientRect(),a=t.group.tabbar.getBoundingClientRect(),o=this.host.getBoundingClientRect(),s=Math.max(a.left,Math.min(a.right-2,r?.left??i?.right??a.left));this.highlight.classList.add(`tab-insertion`),Mr(this.highlight,{x:s-o.left,y:n.y,width:2,height:a.height});return}this.highlight.classList.remove(`tab-insertion`);let r=t.group.header.offsetHeight,i={...n,y:n.y+r,height:Math.max(0,n.height-r)};(t.direction===`left`||t.direction===`right`)&&(i.width/=2,t.direction===`right`&&(i.x+=i.width)),(t.direction===`up`||t.direction===`down`)&&(i.height/=2,t.direction===`down`&&(i.y+=i.height)),Mr(this.highlight,i)}},Pr=`fzv:theme`;function Fr(e){let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=null;try{let e=localStorage.getItem(Pr);(e===`light`||e===`dark`)&&(n=e)}catch{}let r=t=>{document.documentElement.dataset.theme=t;let n=t===`light`?`Switch to dark theme`:`Switch to light theme`;e.setAttribute(`aria-label`,n),e.setAttribute(`aria-pressed`,String(t===`dark`)),e.title=n;let r=document.createElement(`span`);r.textContent=t===`light`?`Dark`:`Light`,e.replaceChildren(o(`color-mode`),r)};r(n??(t.matches?`dark`:`light`)),t.addEventListener(`change`,()=>{n||r(t.matches?`dark`:`light`)}),e.addEventListener(`click`,()=>{n=document.documentElement.dataset.theme===`dark`?`light`:`dark`,r(n);try{localStorage.setItem(Pr,n)}catch{}})}function Ir(e={}){let t=new AbortController,n=t.signal,r=0,i=null,a=[],o=``,s=null,c=()=>{i?.remove(),i=null,a=[],o=``,r=0},l=()=>{if(!s)return;let e=s;s=null,e.open&&e.close(),e.remove()},u=()=>{if(s)return;c();let t=document.createElement(`dialog`);s=t,t.setAttribute(`aria-labelledby`,`fzv-keyboard-help-title`),Object.assign(t.style,{position:`fixed`,inset:`0`,margin:`auto`,width:`min(520px, calc(100vw - 28px))`,maxHeight:`min(80vh, 640px)`,overflow:`auto`,padding:`20px 22px`,border:`1px solid #8888`,borderRadius:`8px`,background:`#f8f8f8`,color:`#202020`,boxShadow:`0 12px 40px #0005`,font:`13px/1.5 system-ui, sans-serif`,zIndex:`2147483647`});let r=document.createElement(`div`);Object.assign(r.style,{display:`flex`,alignItems:`center`,gap:`12px`,marginBottom:`14px`});let i=document.createElement(`h2`);i.id=`fzv-keyboard-help-title`,i.textContent=`Keyboard shortcuts`,Object.assign(i.style,{flex:`1`,margin:`0`,fontSize:`16px`});let a=document.createElement(`button`);a.type=`button`,a.textContent=`Close`,a.setAttribute(`aria-label`,`Close keyboard shortcuts`),Object.assign(a.style,{padding:`5px 9px`,border:`1px solid #8888`,borderRadius:`4px`,background:`#fff`,color:`inherit`,font:`inherit`,cursor:`pointer`}),a.addEventListener(`click`,l,{signal:n}),r.append(i,a);let o=[[`/`,`Find a file`],[`r`,`Reload the active preview`],[`f`,e.bridgeWorkspace?`Show workspace hints`:`Show hints for links and controls`],[`h j k l`,`Scroll the active preview`],[`gg`,`Scroll to the top`],[`G`,`Scroll to the bottom`],[`?`,`Show this keyboard help`],[`Escape`,`Cancel hints or close this help`]];e.bridgeWorkspace||o.push([`Ctrl/Cmd + Tab`,`Switch tabs in the focused group`],[`Alt + j / k`,`Switch tabs in the focused group`],[`Ctrl/Cmd + 1–9`,`Focus an editor group`],[`Ctrl/Cmd + \\`,`Split the editor to the right`],[`Ctrl/Cmd + Shift + \\`,`Split the editor below`],[`Ctrl/Cmd + f`,`Find in a PDF`],[`Ctrl/Cmd + + / − / 0`,`Zoom an image or PDF`],[`]c / [c`,`Next / previous change in a diff`],[`Alt + F5 / Shift + Alt + F5`,`Next / previous change in a diff`],[`Ctrl/Cmd + Shift + e`,`Show the Explorer`],[`Ctrl/Cmd + Shift + g`,`Show Source Control`],[`Ctrl/Cmd + b`,`Show or hide the side bar`]);let u=document.createElement(`div`);Object.assign(u.style,{display:`grid`,gridTemplateColumns:`minmax(125px, auto) minmax(0, 1fr)`,gap:`7px 14px`,alignItems:`center`});for(let[e,t]of o){let n=document.createElement(`kbd`);n.textContent=e,Object.assign(n.style,{justifySelf:`start`,padding:`2px 5px`,border:`1px solid #aaa`,borderRadius:`3px`,background:`#eee`,color:`inherit`,font:`11px ui-monospace, monospace`,whiteSpace:`nowrap`});let r=document.createElement(`span`);r.textContent=t,u.append(n,r)}t.append(r,u),t.addEventListener(`cancel`,e=>{e.preventDefault(),l()},{signal:n}),document.body.append(t),t.showModal(),a.focus()},d=e=>e instanceof HTMLElement&&(e.isContentEditable||!!e.closest(`input, textarea, select, [role="textbox"]`)),f=()=>{c();let e=document.querySelector(`dialog[open]`)??document.body,t=[...e.querySelectorAll(`a[href], button:not(:disabled), input:not(:disabled):not([type="hidden"]), textarea:not(:disabled), select:not(:disabled), summary, [role="button"], [role="treeitem"], [tabindex]:not([tabindex="-1"]), [contenteditable]:not([contenteditable="false"]), iframe`)].filter(e=>{if(e.matches(`:disabled`)||e.closest(`[hidden], [inert], [aria-disabled="true"]`))return!1;let t=getComputedStyle(e);if(t.visibility!==`visible`||t.display===`none`||t.opacity===`0`)return!1;let n=e.getBoundingClientRect(),r=Math.max(0,n.left),i=Math.min(innerWidth,n.right),a=Math.max(0,n.top),o=Math.min(innerHeight,n.bottom);if(r>=i||a>=o)return!1;let s=document.elementFromPoint((r+i)/2,(a+o)/2);return s===e||!!(s&&e.contains(s))});if(!t.length)return;i=document.createElement(`div`),i.className=`vim-hints`,i.setAttribute(`aria-label`,`Link hints; type a label to jump, Escape to cancel`),i.style.pointerEvents=`none`;let n=Math.max(1,Math.ceil(Math.log(t.length)/Math.log(9)));a=t.map((e,t)=>{let r=t,a=``;for(let e=0;e<n;e++)a=`asdfghjkl`[r%9]+a,r=Math.floor(r/9);let o=e.getBoundingClientRect(),s=document.createElement(`span`);return s.className=`vim-hint`,s.dataset.hintTarget=e.id||e.getAttribute(`aria-label`)||e.textContent?.trim()||e.tagName,s.textContent=a.toUpperCase(),s.setAttribute(`aria-hidden`,`true`),Object.assign(s.style,{position:`fixed`,zIndex:`2147483647`,pointerEvents:`none`,left:`${Math.max(0,Math.min(innerWidth-32,o.left))}px`,top:`${Math.max(0,Math.min(innerHeight-20,o.top))}px`,font:`bold 12px/18px monospace`,padding:`0 3px`,color:`#1f1f1f`,backgroundColor:`#ffdf80`,border:`1px solid #b78618`,borderRadius:`2px`,boxShadow:`0 1px 2px #0003`}),i.append(s),{target:e,label:a,badge:s}}),e.append(i)},p=()=>{let t=e.getScrollRoot?.();if(t)return t;let n=document.activeElement;for(;n instanceof HTMLElement&&n!==document.body;){let e=getComputedStyle(n);if(/(auto|scroll)/.test(e.overflowY+e.overflowX)&&(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth))return n;n=n.parentElement}return document.scrollingElement},m=e=>{let t=p();t&&(e===`top`?t.scrollTo({top:0,behavior:`instant`}):e===`bottom`?t.scrollTo({top:t.scrollHeight,behavior:`instant`}):t.scrollBy({left:e===`h`?-64:e===`l`?64:0,top:e===`j`?64:e===`k`?-64:0,behavior:`instant`}))};return window.addEventListener(`keydown`,t=>{if(t.defaultPrevented||t.isComposing||d(t.composedPath()[0]??t.target)||t.ctrlKey||t.metaKey||t.altKey){r=0;return}let n=()=>{t.preventDefault(),t.stopImmediatePropagation()};if(s){t.key===`Escape`&&(l(),n());return}if(t.key===`Escape`){(i||r)&&(c(),n());return}if(i){if(n(),t.key===`Backspace`)o=o.slice(0,-1);else if(t.key.length===1)o+=t.key.toLowerCase();else return;let r=a.filter(e=>e.label.startsWith(o));for(let e of a)e.badge.hidden=!e.label.startsWith(o);if(!r.length){c();return}let i=r.find(e=>e.label===o);if(i){let t=i.target;c(),t.isConnected&&(t.focus(),e.onHintActivate?.(t)||t.click())}return}let p=r;if(r=0,t.key===`/`&&e.onSearch){n(),e.onSearch();return}if(t.key===`?`){n(),u();return}if(t.key===`r`&&e.onReload){n(),e.onReload();return}if(t.key===`f`&&!t.repeat){n(),e.bridgeWorkspace?parent.postMessage({type:`fzv:shortcut`,key:`f`},`*`):f();return}if(t.key===`g`){if(n(),t.repeat)return;let i=performance.now();p&&i-p<800?e.onScroll?.(`top`)||m(`top`):r=i;return}if(![`h`,`j`,`k`,`l`,`G`].includes(t.key))return;n();let h=t.key===`G`?`bottom`:t.key;e.onScroll?.(h)||m(h)},{capture:!0,signal:n}),window.addEventListener(`blur`,c,{signal:n}),window.addEventListener(`message`,t=>{e.bridgeWorkspace&&parent!==window&&t.source===parent&&(t.data?.type===`fzv:show-hints`&&f(),t.data?.type===`fzv:scroll`&&[`h`,`j`,`k`,`l`,`top`,`bottom`].includes(t.data.key)&&m(t.data.key))},{signal:n}),window.addEventListener(`resize`,c,{signal:n}),document.addEventListener(`pointerdown`,c,{capture:!0,signal:n}),document.addEventListener(`pointerdown`,()=>e.onFocus?.(),{capture:!0,signal:n}),document.addEventListener(`focusin`,()=>e.onFocus?.(),{signal:n}),document.addEventListener(`scroll`,()=>{i&&c()},{capture:!0,signal:n}),document.addEventListener(`focusin`,e=>{r=0,d(e.target)&&c()},{signal:n}),{cancel:c,showHints:f,showHelp:u,dispose:()=>{c(),l(),t.abort()}}}var Lr=`fzv:sidebar`,Rr=170,zr=300,Br=`(max-width: 700px)`;function Vr(){try{let e=JSON.parse(localStorage.getItem(Lr)??`{}`);return e&&typeof e==`object`?e:{}}catch{return{}}}var Hr=class{activityBar;sidebar;title;actions;content;sash;views=[];buttons=new Map;badges=new Map;active=null;state=Vr();narrow=window.matchMedia(Br);constructor(e,t,n,r,i,a){this.activityBar=e,this.sidebar=t,this.title=n,this.actions=r,this.content=i,this.sash=a,this.setWidth(this.state.width??zr,!1),this.installSash(),this.narrow.addEventListener(`change`,()=>{this.setVisible(!this.narrow.matches&&(this.state.visible??!0),!1)}),document.addEventListener(`pointerdown`,e=>{let t=e.target;this.narrow.matches&&this.visible&&!this.sidebar.contains(t)&&!this.activityBar.contains(t)&&this.setVisible(!1,!1)},{capture:!0}),this.sidebar.addEventListener(`keydown`,e=>{e.key===`Escape`&&this.narrow.matches&&(e.preventDefault(),this.setVisible(!1,!1))})}get visible(){return!this.sidebar.hidden}get activeView(){return this.visible?this.active?.id??null:null}add(e){if(this.buttons.has(e.id))return;this.views.push(e);let t=document.createElement(`button`);t.type=`button`,t.className=`activity-item`,t.setAttribute(`aria-label`,e.title),t.title=`${e.title} (${e.keybinding})`,t.dataset.view=e.id,t.setAttribute(`aria-pressed`,`false`);let n=document.createElement(`span`);n.className=`activity-badge`,n.hidden=!0,t.append(o(e.icon),n),t.addEventListener(`click`,()=>{this.activeView===e.id?this.setVisible(!1):this.show(e.id,!1)}),this.buttons.set(e.id,t),this.badges.set(e.id,n),this.activityBar.append(t),this.activityBar.hidden=!1,e.element.hidden=!0,this.content.append(e.element),(this.state.view===e.id||!this.active)&&(this.select(e,!1),this.setVisible(!this.narrow.matches&&(this.state.visible??!0),!1))}setBadge(e,t,n){let r=this.badges.get(e);if(!r)return;r.hidden=t===0,r.textContent=t>99?`99+`:String(t);let i=this.views.find(t=>t.id===e);this.buttons.get(e).setAttribute(`aria-label`,t?`${i.title} (${n})`:i.title)}show(e,t=!0){let n=this.views.find(t=>t.id===e);n&&(this.select(n),this.setVisible(!0),t&&n.focus())}toggleFocus(e){let t=this.views.find(t=>t.id===e);t&&(this.activeView===e&&t.element.contains(document.activeElement)?this.setVisible(!1):this.show(e))}toggle(){this.visible||!this.active?this.setVisible(!1):this.setVisible(!0)}afterOpen(){this.narrow.matches&&this.setVisible(!1,!1)}select(e,t=!0){this.active!==e&&(this.active&&(this.active.element.hidden=!0),this.active=e,e.element.hidden=!1,this.title.textContent=e.title,this.actions.replaceChildren(...e.actions??[]),t&&this.save({view:e.id}))}setVisible(e,t=!0){e&&=this.active!==null;let n=this.sidebar.contains(document.activeElement);this.sidebar.hidden=!e,this.sash.hidden=!e,this.activityBar.classList.toggle(`sidebar-hidden`,!e);for(let[t,n]of this.buttons){let r=e&&t===this.active?.id;n.classList.toggle(`checked`,r),n.setAttribute(`aria-pressed`,String(r))}!e&&n&&document.getElementById(`main`)?.focus(),t&&this.save({visible:e})}setWidth(e,t=!0){let n=Math.max(Rr,window.innerWidth-300),r=Math.round(Math.min(n,Math.max(Rr,e)));this.sidebar.style.setProperty(`--sidebar-width`,`${r}px`),t&&this.save({width:r})}installSash(){this.sash.addEventListener(`pointerdown`,e=>{if(e.button!==0)return;e.preventDefault(),this.sash.setPointerCapture(e.pointerId);let t=e.clientX,n=this.sidebar.getBoundingClientRect().width;document.body.classList.add(`sash-dragging`);let r=e=>this.setWidth(n+e.clientX-t,!1),i=e=>{this.sash.removeEventListener(`pointermove`,r),this.sash.removeEventListener(`pointerup`,i),this.sash.removeEventListener(`pointercancel`,i),document.body.classList.remove(`sash-dragging`),this.setWidth(n+e.clientX-t)};this.sash.addEventListener(`pointermove`,r),this.sash.addEventListener(`pointerup`,i),this.sash.addEventListener(`pointercancel`,i)}),this.sash.addEventListener(`dblclick`,()=>this.setWidth(zr))}save(e){this.state={...this.state,...e};try{localStorage.setItem(Lr,JSON.stringify(this.state))}catch{}}},Ur=`[role="treeitem"]`;function Wr(e){return Number(e.getAttribute(`aria-level`))}function Gr(e,t){for(let n of e.querySelectorAll(Ur))n.tabIndex=n===t?0:-1;t.focus()}function Kr(e,t,n){let r=e.target.closest(Ur);if(!r||e.altKey||e.ctrlKey||e.metaKey)return;let i=[...t.querySelectorAll(Ur)],a=i.indexOf(r),o=r.getAttribute(`aria-expanded`),s=e=>{e&&Gr(t,e)};switch(e.key){case`ArrowDown`:s(i[a+1]);break;case`ArrowUp`:s(i[a-1]);break;case`Home`:s(i[0]);break;case`End`:s(i.at(-1));break;case`ArrowRight`:o===`false`?n(r,!0):o===`true`&&i[a+1]&&Wr(i[a+1])>Wr(r)&&s(i[a+1]);break;case`ArrowLeft`:o===`true`?n(r,!1):s(i.slice(0,a).findLast(e=>Wr(e)<Wr(r)));break;case`Enter`:case` `:r.click();break;default:return}e.preventDefault()}function qr(e){return e.status===`?`?`U`:e.status===`U`?`!`:e.status}function Jr(e){let t=e.stage===`index`;switch(e.status){case`M`:return t?`Index Modified`:`Modified`;case`A`:return t?`Index Added`:`Intent to Add`;case`D`:return t?`Index Deleted`:`Deleted`;case`R`:return t?`Index Renamed`:`Intent to Rename`;case`C`:return`Index Copied`;case`T`:return`Type Changed`;case`?`:return`Untracked`;case`U`:return`Conflict`}}function Yr(e){switch(e.status){case`M`:return e.stage===`index`?`stage-modified`:`modified`;case`T`:return`modified`;case`D`:return e.stage===`index`?`stage-deleted`:`deleted`;case`A`:return`added`;case`R`:case`C`:return`renamed`;case`?`:return`untracked`;case`U`:return`conflicting`}}var Xr=class{handlers;element=document.createElement(`section`);actions;tree=document.createElement(`div`);message=document.createElement(`p`);status=null;activeKey=null;collapsed=new Set;focusedKey=null;constructor(e){this.handlers=e,this.element.className=`scm-view`,this.element.setAttribute(`aria-label`,`Source Control`),this.tree.className=`scm-tree`,this.tree.setAttribute(`role`,`tree`),this.tree.setAttribute(`aria-label`,`Source Control Changes`),this.message.className=`sidebar-message`,this.message.textContent=`Loading changes…`,this.element.append(this.message,this.tree),this.tree.addEventListener(`keydown`,e=>Kr(e,this.tree,(e,t)=>this.toggle(e.dataset.group,t))),this.tree.addEventListener(`focusin`,e=>{let t=e.target.closest(`.scm-row`);t&&this.setFocused(t)});let t=document.createElement(`button`);t.type=`button`,t.className=`toolbar-button`,t.setAttribute(`aria-label`,`Refresh`),t.title=`Refresh`,t.append(o(`refresh`)),t.addEventListener(`click`,()=>e.refresh()),this.actions=[t]}get count(){return this.status?.available?this.status.changes.length:0}setStatus(e){this.status=e,this.render()}setActive(e){if(e!==this.activeKey){this.activeKey=e;for(let t of this.rows())t.setAttribute(`aria-selected`,String(t.dataset.key===e))}}focus(){let e=this.rows();(e.find(e=>e.tabIndex===0)??e[0]??this.element.closest(`.sidebar`))?.focus()}groups(){if(!this.status?.available)return[];let e={merge:{id:`merge`,label:`Merge Changes`,changes:[]},index:{id:`index`,label:`Staged Changes`,changes:[]},workingTree:{id:`workingTree`,label:`Changes`,changes:[]}};for(let t of this.status.changes)e[t.status===`U`?`merge`:t.stage===`index`?`index`:`workingTree`].changes.push(t);for(let t of Object.values(e))t.changes.sort((e,t)=>e.path.localeCompare(t.path));return Object.values(e).filter(e=>e.id===`workingTree`||e.changes.length)}render(){let e=this.status,t=this.tree.contains(document.activeElement);this.message.hidden=e?.available===!0,e&&!e.available&&(this.message.textContent=`The project is not in a git repository, so there are no changes to show.`);let n=[];for(let e of this.groups())if(n.push(this.groupRow(e)),!this.collapsed.has(e.id))for(let t of e.changes)n.push(this.resourceRow(e,t));this.tree.replaceChildren(...n);let r=n.find(e=>e.dataset.key===this.focusedKey)??n[0];r&&(r.tabIndex=0,t&&r.focus())}groupRow(e){let t=document.createElement(`div`),n=!this.collapsed.has(e.id);t.className=`scm-row scm-group`,t.dataset.key=`group:${e.id}`,t.dataset.group=e.id,t.setAttribute(`role`,`treeitem`),t.setAttribute(`aria-level`,`1`),t.setAttribute(`aria-expanded`,String(n)),t.setAttribute(`aria-label`,`${e.label}, ${e.changes.length}`),t.tabIndex=-1;let r=o(n?`chevron-down`:`chevron-right`);r.classList.add(`scm-twistie`);let i=document.createElement(`span`);i.className=`scm-group-name`,i.textContent=e.label;let a=document.createElement(`span`);return a.className=`scm-count`,a.textContent=String(e.changes.length),t.append(r,i,a),t.addEventListener(`click`,()=>this.toggle(e.id)),t}resourceRow(e,n){let r=document.createElement(`div`),i=n.path.split(`/`).at(-1),a=n.path.slice(0,-i.length-1),c=t(n.path,n);r.className=`scm-row scm-resource git-${Yr(n)}`,r.classList.toggle(`deleted`,n.status===`D`),r.dataset.key=c,r.dataset.group=e.id,r.setAttribute(`role`,`treeitem`),r.setAttribute(`aria-level`,`2`),r.setAttribute(`aria-selected`,String(c===this.activeKey)),r.setAttribute(`aria-label`,`${n.path}, ${Jr(n)}`),r.title=`${n.originalPath?`${n.originalPath} → `:``}${n.path} • ${Jr(n)}`,r.tabIndex=-1;let l=document.createElement(`span`);l.className=`scm-label`;let u=document.createElement(`span`);u.className=`scm-name`,u.textContent=i;let d=document.createElement(`span`);d.className=`scm-description`,d.textContent=a,l.append(u,d);let f=document.createElement(`span`);if(f.className=`scm-actions`,n.status!==`D`){let e=document.createElement(`button`);e.type=`button`,e.className=`toolbar-button`,e.tabIndex=-1,e.setAttribute(`aria-label`,`Open File ${n.path}`),e.title=`Open File`,e.append(o(`go-to-file`)),e.addEventListener(`click`,e=>{e.stopPropagation(),this.handlers.openFile(n.path)}),f.append(e)}let p=document.createElement(`span`);return p.className=`scm-letter`,p.textContent=qr(n),r.append(s({path:n.path,name:i,kind:n.kind??`text`,size:0}),l,f,p),r.addEventListener(`click`,()=>this.open(n)),r}open(e){e.status===`U`?this.handlers.openFile(e.path):this.handlers.openChange(e)}toggle(e,t){let n=!this.collapsed.has(e);t!==n&&(n?this.collapsed.add(e):this.collapsed.delete(e),this.focusedKey=`group:${e}`,this.render())}rows(){return[...this.tree.querySelectorAll(`.scm-row`)]}setFocused(e){this.focusedKey=e.dataset.key??null;for(let t of this.rows())t.tabIndex=t===e?0:-1}},Zr=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),Qr=e=>e.status===`U`?4:[`M`,`T`,`C`].includes(e.status)?2:1,$r=class{handlers;element=document.createElement(`section`);actions;header=document.createElement(`button`);tree=document.createElement(`div`);message=document.createElement(`p`);root=null;expanded=new Set;open=!0;activePath=null;focusedPath=null;decorations=new Map;storageKey=``;projectName=``;constructor(e){this.handlers=e,this.element.className=`explorer-view`,this.element.setAttribute(`aria-label`,`Explorer`),this.header.type=`button`,this.header.className=`pane-header`,this.header.setAttribute(`aria-expanded`,`true`),this.header.addEventListener(`click`,()=>{this.open=!this.open,this.render()}),this.tree.className=`explorer-tree`,this.tree.setAttribute(`role`,`tree`),this.tree.setAttribute(`aria-label`,`Files Explorer`),this.message.className=`sidebar-message`,this.message.textContent=`Loading files…`,this.element.append(this.header,this.message,this.tree),this.tree.addEventListener(`keydown`,e=>Kr(e,this.tree,(e,t)=>this.setExpanded(e.dataset.path,t))),this.tree.addEventListener(`focusin`,e=>{let t=e.target.closest(`[role="treeitem"]`);t&&(this.focusedPath=t.dataset.path??null)});let t=(e,t,n)=>{let r=document.createElement(`button`);return r.type=`button`,r.className=`toolbar-button`,r.setAttribute(`aria-label`,e),r.title=e,r.append(o(t)),r.addEventListener(`click`,n),r};this.actions=[t(`Refresh Explorer`,`refresh`,()=>e.refresh()),t(`Collapse Folders in Explorer`,`collapse-all`,()=>{this.expanded.clear(),this.saveExpanded(),this.render()})]}setProject(e,t){this.projectName=t,this.header.setAttribute(`aria-label`,`${t} folder`);let n=`fzv:explorer:${e}`;if(n!==this.storageKey){this.storageKey=n;try{let e=JSON.parse(localStorage.getItem(n)??`[]`);this.expanded=new Set(Array.isArray(e)?e:[])}catch{this.expanded=new Set}this.render()}}setEntries(e,t){let n={directories:new Map,files:[]},r=e=>{let t=n;if(e)for(let n of e.split(`/`)){let e=t.directories.get(n);e||(e={directories:new Map,files:[]},t.directories.set(n,e)),t=e}return t};for(let e of t)r(e.path);for(let t of e)r(t.path.slice(0,-t.name.length-1)).files.push(t);this.root=n,this.render()}setGitChanges(e){let t=new Map,n=e=>e.status===`U`?2:+(e.stage===`worktree`);for(let r of e){if(r.status===`D`)continue;let e=t.get(r.path);(!e||n(r)>=n(e))&&t.set(r.path,r)}let r=new Map;for(let e of t.values()){let t=e.path.split(`/`);for(let n=1;n<t.length;n++){let i=t.slice(0,n).join(`/`),a=r.get(i);(!a||Qr(e)>Qr(a))&&r.set(i,e)}}this.decorations=new Map;for(let[e,n]of t)this.decorations.set(e,{color:Yr(n),letter:qr(n),tooltip:Jr(n)});for(let[e,t]of r)this.decorations.set(e,{color:Yr(t),tooltip:`Contains emphasized items`});this.render()}reveal(e){if(e!==this.activePath){if(this.activePath=e,e){let t=e.split(`/`);for(let e=1;e<t.length;e++)this.expanded.add(t.slice(0,e).join(`/`));this.focusedPath=e}this.render(),this.tree.querySelector(`[aria-selected="true"]`)?.scrollIntoView({block:`nearest`})}}focus(){let e=this.tree.querySelector(`[tabindex="0"]`)??this.tree.querySelector(`[role="treeitem"]`);e?Gr(this.tree,e):this.header.focus()}setExpanded(e,t){t?this.expanded.add(e):this.expanded.delete(e),this.focusedPath=e,this.saveExpanded(),this.render()}saveExpanded(){try{this.storageKey&&localStorage.setItem(this.storageKey,JSON.stringify([...this.expanded]))}catch{}}render(){let e=this.tree.contains(document.activeElement);this.header.setAttribute(`aria-expanded`,String(this.open)),this.header.replaceChildren(o(this.open?`chevron-down`:`chevron-right`),this.projectName),this.tree.hidden=!this.open;let t=this.root?.directories.size===0&&!this.root.files.length;this.message.hidden=!this.open||this.root!==null&&!t,t&&(this.message.textContent=`No previewable files yet. Add a PDF, HTML, image, or text file.`);let n=[];this.root&&this.open&&this.addRows(n,this.root,``,1),this.tree.replaceChildren(...n);let r=n.find(e=>e.dataset.path===this.focusedPath)??n[0];r&&(r.tabIndex=0,e&&r.focus())}addRows(e,t,n,r){let i=[...t.directories.keys()].sort(Zr.compare);for(let a of i){let i=n+a,s=this.expanded.has(i),c=o(s?`chevron-down`:`chevron-right`);c.classList.add(`explorer-twistie`);let l=this.row(i,a,r,[c]);l.setAttribute(`aria-expanded`,String(s)),l.addEventListener(`click`,()=>this.setExpanded(i,!s)),e.push(l),s&&this.addRows(e,t.directories.get(a),`${i}/`,r+1)}let a=[...t.files].sort((e,t)=>Zr.compare(e.name,t.name));for(let t of a){let n=document.createElement(`span`);n.className=`explorer-twistie`;let i=this.row(t.path,t.name,r,[n,s(t)]);i.setAttribute(`aria-selected`,String(t.path===this.activePath)),i.addEventListener(`click`,()=>this.handlers.openFile(t)),e.push(i)}}row(e,t,n,r){let i=document.createElement(`div`);i.className=`explorer-row`,i.dataset.path=e,i.setAttribute(`role`,`treeitem`),i.setAttribute(`aria-level`,String(n)),i.tabIndex=-1;let a=this.decorations.get(e);i.title=a?`${e} • ${a.tooltip}`:e;let s=document.createElement(`span`);s.className=`explorer-indent`;for(let e=1;e<n;e++){let e=document.createElement(`span`);e.className=`indent-guide`,s.append(e)}r[0].style.paddingLeft=`${8*n}px`,i.append(s);let c=document.createElement(`span`);if(c.className=`explorer-label`,c.textContent=t,i.append(...r,c),a){i.classList.add(`git-${a.color}`,`decorated`);let e=a.letter?document.createElement(`span`):o(`circle-filled`);e.classList.add(`explorer-badge`),a.letter&&(e.textContent=a.letter),i.append(e)}return i}};function Z(e){let t=document.getElementById(e);if(!t)throw Error(`Missing UI element: ${e}`);return t}var ei=Z(`search`),Q=Z(`search-panel`),ti=Z(`results`),ni=Z(`result-count`),ri=Z(`refresh-files`),ii=Z(`notification`);Fr(Z(`theme-toggle`));var ai=[],oi=new e([]),si=``,ci=[],li=0,ui,di=0,fi=0,pi=0,mi,hi=!1,gi=!1,_i=``,vi,yi=``,bi;try{bi=window.localStorage}catch{}function xi(e){ii.textContent=e,ii.hidden=!1,clearTimeout(ui),ui=setTimeout(()=>{ii.hidden=!0},5e3)}function Si(e){let t=document.activeElement,n=window.getSelection(),r=n?Array.from({length:n.rangeCount},(e,t)=>n.getRangeAt(t).cloneRange()):[],i=window.scrollX,a=window.scrollY,o=document.createElement(`textarea`);o.value=e,o.readOnly=!0,o.setAttribute(`aria-hidden`,`true`),Object.assign(o.style,{position:`fixed`,left:`-10000px`,top:`0`,width:`1px`,height:`1px`,opacity:`0`,fontSize:`16px`}),document.body.append(o);let s=!1;try{o.focus({preventScroll:!0}),o.select(),s=document.execCommand(`copy`)}catch{s=!1}if(o.remove(),t instanceof HTMLElement&&t.isConnected&&t.focus({preventScroll:!0}),n){n.removeAllRanges();for(let e of r)n.addRange(e)}return window.scrollTo(i,a),s}async function Ci(e,t){try{await navigator.clipboard.writeText(e),xi(`${t} copied to clipboard.`)}catch{xi(Si(e)?`${t} copied to clipboard.`:`Could not copy ${t.toLowerCase()}.`)}}function wi(){bi&&si&&a(bi,si,$.snapshot())}function Ti(){let e=oi.search(ei.value);ci=e.files,li=Math.min(Math.max(li,0),Math.max(0,ci.length-1));let t=ci.map((e,t)=>{let n=document.createElement(`button`);n.type=`button`,n.className=`result monaco-list-row quick-input-list-entry`,n.title=e.path,n.setAttribute(`aria-label`,e.path),n.classList.toggle(`active`,e.path===$.activeTab?.file.path),n.classList.toggle(`keyboard-selected`,t===li&&document.activeElement===ei),e.path===$.activeTab?.file.path&&n.setAttribute(`aria-current`,`true`);let r=document.createElement(`span`);r.className=`result-text`;let i=document.createElement(`span`);i.className=`result-name`,i.textContent=e.name+(e.kind===`directory`?`/`:``);let a=document.createElement(`span`);return a.className=`result-path`,a.textContent=e.path,r.append(i,a),n.append(s(e),r),n.addEventListener(`click`,()=>ki(e)),n});if(ti.replaceChildren(...t),!ci.length){let e=document.createElement(`div`);e.className=`no-results`,e.textContent=ai.length?`No files match your search.`:`No previewable files yet. Add a PDF, HTML, image, or text file, then refresh.`,ti.append(e)}ni.textContent=ei.value.trim()?`${e.total} match${e.total===1?``:`es`}`:`${e.total} item${e.total===1?``:`s`}`,e.total>ci.length&&(ni.textContent+=` · showing ${ci.length}`)}function Ei(){$.focus()}function Di(e){zi.cancel(),e?(ei.value=``,li=0,Q.open||Q.showModal(),ei.focus(),Ti(),Li(!1)):(Q.close(),Ei())}function Oi(){Di(!0)}function ki(e){e.kind===`directory`?(ei.value=`${e.path}/`,li=0,ei.focus(),Ti()):($.open(e),Di(!1))}async function Ai(e){let t=ai.find(t=>t.path===e);if(t)$.open(t);else try{let t=await fetch(`/api/session-files?${new URLSearchParams({path:e})}`),[n]=t.ok?await t.json():[];n?$.open(n):xi(`${e} is not available.`)}catch(t){xi(`Could not open ${e}: ${t}`)}}async function ji(){if(!gi)return;vi?.abort();let e=new AbortController;vi=e;try{let t=await fetch(`/api/git/status`,{signal:e.signal});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();if(vi!==e)return;let r=JSON.stringify(n),i=yi!==``&&r!==yi;yi=r,$.setGitChanges(n.available?n.changes:[]),Bi.setGitChanges(n.available?n.changes:[]),Vi.setStatus(n);let a=Vi.count;Ui.setBadge(`scm`,a,`${a} pending change${a===1?``:`s`}`);let o=n.available?n.branch??`HEAD`:null;Z(`status-branch`).hidden=o===null,Z(`status-branch-name`).textContent=o??``,i&&$.reloadDiffs()}catch{}}function Mi(e){return[...new Set(e.version===1?e.tabs:e.groups.flatMap(e=>e.tabs.map(e=>e.path)))]}async function Ni(e){let t=[],n=[],r=0;for(let i of Mi(e)){let e=new URLSearchParams({path:i}).toString().length+7;e>12e3||((n.length===32||n.length>0&&r+e>12e3)&&(t.push(n),n=[],r=0),n.push(i),r+=e)}return n.length&&t.push(n),(await Promise.all(t.map(async e=>{let t=new URLSearchParams;for(let n of e)t.append(`path`,n);let n=await fetch(`/api/session-files?${t}`);if(!n.ok)throw Error(`HTTP ${n.status}`);return await n.json()}))).flat()}function Pi(t,n){return t<pi?!1:(pi=t,ai=n.files,oi=new e([...n.directories,...ai]),Bi.setEntries(ai,n.directories),!0)}function Fi(e){let{paths:t}=e;for(let e of $.tabs)(!t||Er(e.file)&&e.mode===`viewer`||t.some(t=>e.file.path===t||e.file.path.startsWith(`${t}/`)))&&$.reload(e);Li(!0),ji()}function Ii(e){mi=Ri(e).finally(()=>{mi=void 0,hi&&(hi=!1,Ii(`background`))})}function Li(e){mi?e&&(hi=!0):Ii(`background`)}async function Ri(e=`refresh`){let t=++fi;e!==`background`&&(ri.disabled=!0,ni.textContent=`Loading files…`);try{if(e===`initial`){let e=fetch(`/api/files`).then(async e=>e.ok?{data:await e.json()}:{error:Error(`HTTP ${e.status}`)},e=>({error:e})),n=await fetch(`/api/project`);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();r.watch&&new EventSource(`/api/events`).addEventListener(`change`,e=>Fi(JSON.parse(e.data))),si=r.id,Bi.setProject(r.id,r.name),gi=r.git===!0,gi&&Ui.add(Hi),ji(),Z(`project-name`).textContent=r.name,Z(`status-project`).textContent=r.name;let a=bi?i(bi,si):null,o=!1;if(a)try{$.restore(a,await Ni(a)),o=!0}catch{}let s=await e;if(`error`in s)throw s.error;let c=s.data;a&&!o&&$.restore(a,c.files),Pi(t,c),Ti()}else{let n=await fetch(`/api/files`);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();if(!Pi(t,r))return;si=r.project.id,Bi.setProject(r.project.id,r.project.name);let i=new Set(r.files.map(e=>e.path));Z(`project-name`).textContent=r.project.name,Z(`status-project`).textContent=r.project.name;for(let e of $.tabs)!e.diff&&!i.has(e.file.path)&&$.close(e);Ti(),e===`refresh`&&xi(`File list refreshed.`)}}catch(e){if(t!==fi)return;ni.textContent=`Could not load files`,xi(`Could not load the project: ${e}`)}finally{t===fi&&(ri.disabled=!1)}}ei.addEventListener(`input`,()=>{li=0,cancelAnimationFrame(di),di=requestAnimationFrame(Ti)}),ei.addEventListener(`focus`,Ti),ei.addEventListener(`blur`,()=>{for(let e of ti.children)e.classList.remove(`keyboard-selected`)}),ei.addEventListener(`keydown`,e=>{e.key===`Escape`?(e.preventDefault(),Di(!1)):([`Enter`,`ArrowDown`,`ArrowUp`].includes(e.key)&&(cancelAnimationFrame(di),Ti()),e.key===`Enter`&&ci[li]&&(e.preventDefault(),ki(ci[li])),(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),li=Math.max(0,Math.min(ci.length-1,li+(e.key===`ArrowDown`?1:-1))),Ti(),ti.children[li]?.scrollIntoView({block:`nearest`})))}),Q.addEventListener(`close`,()=>{Q.open||Ei()}),Q.addEventListener(`cancel`,e=>{e.preventDefault(),Di(!1)}),Q.addEventListener(`click`,e=>{if(e.target!==Q)return;let t=Q.getBoundingClientRect();(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&Di(!1)}),Z(`close-search`).addEventListener(`click`,()=>Di(!1)),Z(`find-file`).addEventListener(`click`,Oi),ri.addEventListener(`click`,()=>{Ri()}),window.addEventListener(`keydown`,e=>{if(e.defaultPrevented||e.isComposing||document.querySelector(`dialog[open]`))return;let t=document.activeElement,n=t instanceof HTMLElement&&(t.isContentEditable||!!t.closest(`input,textarea,select,[role="textbox"]`));if(e.altKey&&!e.ctrlKey&&!e.metaKey&&[`j`,`k`].includes(e.key.toLowerCase())){e.preventDefault(),$.cycle(e.key.toLowerCase()===`j`?1:-1);return}if((e.ctrlKey||e.metaKey)&&!e.altKey&&!Q.open){let t=e.key.toLowerCase();if(e.shiftKey&&t===`e`){e.preventDefault(),Ui.toggleFocus(`explorer`);return}if(e.shiftKey&&t===`g`&&gi){e.preventDefault(),Ui.toggleFocus(`scm`);return}if(!e.shiftKey&&t===`b`){e.preventDefault(),Ui.toggle();return}}if(e.ctrlKey&&e.key===`Tab`){e.preventDefault(),$.cycle(e.shiftKey?-1:1);return}if(!n&&(e.ctrlKey||e.metaKey)&&!e.altKey&&!Q.open){if(e.code===`Backslash`){e.preventDefault(),$.splitActive(e.shiftKey?`down`:`right`);return}if(/^[1-9]$/.test(e.key)){e.preventDefault(),$.focusGroup(Number(e.key)-1);return}}let r=$.activeTab;if(e.key===`F5`&&e.altKey&&!e.ctrlKey&&!e.metaKey){$.navigateChange(e.shiftKey?-1:1)&&e.preventDefault();return}let i=_i;if(_i=``,!n&&r?.diff&&!e.ctrlKey&&!e.metaKey&&!e.altKey){if(i&&e.key===`c`){e.preventDefault(),$.navigateChange(i===`]`?1:-1);return}if(e.key===`]`||e.key===`[`){e.preventDefault(),_i=e.key;return}}if(!n&&(e.ctrlKey||e.metaKey)&&!e.altKey&&r?.file.kind===`image`){let t=[`+`,`=`].includes(e.key)?`.image-zoom-in`:[`-`,`_`].includes(e.key)?`.image-zoom-out`:e.key===`0`?`.image-fit`:null;t&&(e.preventDefault(),r.pane.element.querySelector(t)?.click())}});var zi=Ir({onSearch:Oi,onScroll:e=>{let t=$.activeTab;if(!t||t.file.kind!==`html`||t.mode!==`viewer`)return!1;let n=t.pane.element.querySelector(`iframe`);return n?.contentWindow?(n.contentWindow.postMessage({type:`fzv:scroll`,key:e},`*`),!0):!1},onHintActivate:e=>!(e instanceof HTMLIFrameElement)||!$.frameTab(e.contentWindow)?!1:($.activateFrame(e),e.contentWindow?.postMessage({type:`fzv:show-hints`},`*`),!0),onReload:()=>{Q.open||$.reload()},getScrollRoot:()=>Q.open?ti:[...$.activeTab?.pane.element.querySelectorAll(`.source-preview, .viewer-surface, .pdf-scroll, .diff-scroll`)??[]].find(e=>e.getClientRects().length>0)??null}),Bi=new $r({openFile:e=>{$.open(e),Ui.afterOpen()},refresh:()=>void Ri()}),Vi=new Xr({openChange:e=>{$.openDiff(e),Ui.afterOpen()},openFile:e=>{Ai(e),Ui.afterOpen()},refresh:()=>void ji()}),Hi={id:`scm`,title:`Source Control`,icon:`source-control`,keybinding:`Ctrl+Shift+G`,element:Vi.element,actions:Vi.actions,focus:()=>Vi.focus()},Ui=new Hr(Z(`activity-bar`),Z(`sidebar`),Z(`sidebar-title`),Z(`sidebar-actions`),Z(`sidebar-content`),Z(`sidebar-sash`)),$=new Nr(Z(`preview`),()=>{zi.cancel();let e=$.activeTab;document.title=e?`${e.file.name} — fzv`:`fzv`;let n=$.tabs.length;Z(`tab-count`).textContent=`${n} open tab${n===1?``:`s`}`,Ti(),Bi.reveal(e&&e.diff?.stage!==`index`?e.file.path:null),Vi.setActive(e?t(e.file.path,e.diff):null),wi()},(e,t)=>void Ci(e,t),e=>void Ai(e));Ui.add({id:`explorer`,title:`Explorer`,icon:`files`,keybinding:`Ctrl+Shift+E`,element:Bi.element,actions:Bi.actions,focus:()=>Bi.focus()}),Z(`status-branch`).addEventListener(`click`,()=>Ui.show(`scm`)),window.addEventListener(`focus`,()=>void ji()),window.addEventListener(`message`,e=>{if(e.origin!==`null`)return;let t=$.frameTab(e.source);t&&(e.data?.type===`fzv:focus`?$.activateFrame(t.pane.element.querySelector(`iframe`)):t===$.activeTab&&e.data?.type===`fzv:shortcut`&&(e.data.key===`/`&&Oi(),e.data.key===`r`&&$.reload(),e.data.key===`f`&&!Q.open&&($.focus(),zi.showHints())))}),Ii(`initial`);export{T as t};
|
|
68
|
+
`+f),M&&(f=Rt(f)),C&&Be?D(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ht(e),Pe=!0,Fe=k,Ie=A},t.clearConfig=function(){ft=null,Pe=!1,Fe=null,Ie=null,C=ie,w=``},t.isValidAttribute=function(e,t,n){ft||ht({});let r=F(e),i=F(t);return typeof n==`string`&&(V(t,n)||!je&&G(mr,n))?!1:Jt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&W(O,e)&&bn(O[e],t)},t.removeHook=function(e,t){if(W(O,e)){if(t!==void 0){let n=vn(O[e],t);return n===-1?void 0:Sn(O[e],n,1)[0]}return yn(O[e])}},t.removeHooks=function(e){W(O,e)&&(O[e]=[])},t.removeAllHooks=function(){O=vr()},t}var Sr=xr();function Cr(e,t,n=!1){if(e.startsWith(`#`))return e;let r=new URL(t.split(`/`).map(encodeURIComponent).join(`/`),`https://project.invalid/`),i=new URL(e,r);return n&&/^data:image\//i.test(i.href)?i.href:i.origin===r.origin?`/asset${i.pathname}${i.search}${i.hash}`:[`http:`,`https:`,`mailto:`].includes(i.protocol)?i.href:null}function wr(e,t){let n=document.createElement(`article`);n.className=`markdown-preview`,n.append(Sr.sanitize(V.parse(e,{async:!1}),{USE_PROFILES:{html:!0},FORBID_TAGS:[`style`,`form`,`button`],FORBID_ATTR:[`style`,`id`,`name`,`class`],RETURN_DOM_FRAGMENT:!0}));for(let e of n.querySelectorAll(`a, img`)){let n=e.tagName===`A`?`href`:`src`,r=e.getAttribute(n);if(e.removeAttribute(`srcset`),r){try{let i=Cr(r,t,e instanceof HTMLImageElement);i?e.setAttribute(n,i):e.removeAttribute(n)}catch{e.removeAttribute(n)}e instanceof HTMLAnchorElement&&(e.target=`_blank`,e.rel=`noopener noreferrer`)}}return n}function Tr(e,t,n,r){let i=document.createElement(`div`);i.className=`source-preview`;let a=document.createElement(`div`);a.className=`source-toolbar`;let s=document.createElement(`button`);s.type=`button`,s.className=`toolbar-button`,s.setAttribute(`aria-label`,`Copy source code`),s.title=`Copy source code`,s.append(o(`copy`),document.createTextNode(`Copy source code`)),s.addEventListener(`click`,()=>r(e),{signal:n}),a.append(s);let c=document.createElement(`pre`);c.className=`line-numbers`,c.setAttribute(`aria-hidden`,`true`),c.textContent=Array.from({length:e.split(/\r\n|\r|\n/).length},(e,t)=>String(t+1)).join(`
|
|
69
|
+
`);let l=document.createElement(`pre`);return l.className=`text-preview source-text`,l.textContent=e,i.append(a,c,l),T(async()=>{let{highlightSource:e}=await import(`./highlight-CYo2BdOL.js`);return{highlightSource:e}},[]).then(({highlightSource:r})=>r(l,e,t,n)).catch(()=>{}),i}function Er(e){return e.kind===`html`||e.kind===`text`&&/\.md$/i.test(e.name)}function Dr(e){return e.kind===`text`&&!Er(e)?`source`:`viewer`}function Or(e,t=0,n=!1){return`${n?`/file`:e.kind===`html`?`/preview-html`:e.kind===`office`?`/office-pdf`:`/file`}?${new URLSearchParams({path:e.path,revision:String(t)})}`}function kr(e,t){e.classList.add(`preview-error`);let n=document.createElement(`p`);n.textContent=t,e.replaceChildren(n)}function Ar(e,t=0,n=Dr(e),r=()=>{}){let i=document.createElement(`section`);i.className=`preview-pane`,i.hidden=!0,i.setAttribute(`role`,`tabpanel`),i.setAttribute(`aria-label`,e.path);let a=new AbortController,s=!1,c=a.signal,l=Or(e,t),u;if(e.kind===`text`||e.kind===`html`){let a=document.createElement(`div`);a.className=`viewer-surface`;let o=document.createElement(`div`);o.className=`source-surface`,o.textContent=`Loading…`;let s=Er(e);s&&i.append(a),i.append(o),s||(n=`source`);let d=n,f,p=!1,m=!1,h=()=>{f===void 0||c.aborted||(d===`source`&&!p&&(o.replaceChildren(Tr(f,e.name,c,r)),p=!0),d===`viewer`&&e.kind===`text`&&!m&&(a.replaceChildren(wr(f,e.path)),m=!0))},g,_=()=>{g??=fetch(Or(e,t,!0),{signal:c}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.text()}).then(e=>{f=e,h()}).catch(t=>{if(c.aborted)return;let n=`Could not load ${e.path}: ${t}`;kr(o,n),e.kind===`text`&&kr(a,n)})};if(e.kind===`html`){let t=document.createElement(`iframe`);t.title=e.path,t.setAttribute(`sandbox`,`allow-scripts`),a.append(t),u=n=>{d=n,a.hidden=n!==`viewer`,o.hidden=n!==`source`,n===`source`?(_(),h()):t.hasAttribute(`src`)||(t.src=l,fetch(l,{method:`HEAD`,signal:c}).then(t=>{t.ok||kr(a,`Could not load ${e.path} (HTTP ${t.status}).`)}).catch(e=>{c.aborted||kr(a,String(e))}))}}else a.textContent=`Loading…`,_(),u=e=>{s||(e=`source`),d=e,a.hidden=e!==`viewer`,o.hidden=e!==`source`,h()};u(n)}else if(e.kind===`pdf`)i.textContent=`Loading…`,T(async()=>{let{mountPdf:e}=await import(`./pdf-Bl0IIfym.js`);return{mountPdf:e}},__vite__mapDeps([0,1])).then(({mountPdf:e})=>{if(!c.aborted)return e(i,l,c,()=>s)}).catch(t=>{c.aborted||kr(i,`Could not load ${e.path}: ${t}`)});else if(e.kind===`office`){i.textContent=`Converting…`;let t=fetch(l,{signal:c}).then(async e=>{if(!e.ok)throw Error((await e.text()).trim()||`HTTP ${e.status}`);return new Uint8Array(await e.arrayBuffer())});Promise.all([T(()=>import(`./pdf-Bl0IIfym.js`),__vite__mapDeps([0,1])),t]).then(([{mountPdf:e},t])=>{if(!c.aborted)return e(i,t,c,()=>s)}).catch(t=>{c.aborted||kr(i,`Could not preview ${e.path}. ${t instanceof Error?t.message:t}`)})}else if(e.kind===`image`){let t=document.createElement(`div`);t.className=`image-stage`;let n=document.createElement(`img`);n.src=l,n.alt=e.path,n.draggable=!1,n.addEventListener(`error`,()=>kr(i,`Could not load ${e.path}.`),{signal:c}),t.append(n);let r=document.createElement(`div`);r.className=`image-toolbar`,r.setAttribute(`role`,`group`),r.setAttribute(`aria-label`,`Image zoom`);let a=document.createElement(`span`);a.className=`image-zoom-value`,a.textContent=`100%`;let s=1,u=0,d=0,f=!1,p=0,m=0,h=()=>{n.style.transform=`translate3d(${u}px, ${d}px, 0) scale(${s})`,a.textContent=`${Math.round(s*100)}%`,t.classList.toggle(`zoomed`,s>1.001)},g=(e,n,r)=>{let i=Math.max(.1,Math.min(12,e)),a=i/s;if(n!==void 0&&r!==void 0){let e=t.getBoundingClientRect(),i=n-e.left-e.width/2,o=r-e.top-e.height/2;u=i-(i-u)*a,d=o-(o-d)*a}else u*=a,d*=a;s=i,h()},_=(e,t,n)=>{let r=document.createElement(`button`);return r.type=`button`,r.title=e,r.setAttribute(`aria-label`,e),r.textContent=t,r.addEventListener(`click`,n,{signal:c}),r},v=_(`Zoom out`,``,()=>g(s/1.25));v.append(o(`remove`)),v.className=`image-zoom-out`;let y=_(`Fit image to viewer`,`Fit`,()=>{u=0,d=0,g(1)});y.className=`image-fit`;let b=_(`Zoom in`,``,()=>g(s*1.25));b.append(o(`add`)),b.className=`image-zoom-in`,r.append(v,a,y,b),t.addEventListener(`wheel`,e=>{e.ctrlKey&&(e.preventDefault(),g(s*Math.exp(-e.deltaY*.002),e.clientX,e.clientY))},{passive:!1,signal:c}),t.addEventListener(`pointerdown`,e=>{e.button!==0||s<=1.001||(f=!0,p=e.clientX,m=e.clientY,t.classList.add(`dragging`),t.setPointerCapture(e.pointerId))},{signal:c}),t.addEventListener(`pointermove`,e=>{f&&(u+=e.clientX-p,d+=e.clientY-m,p=e.clientX,m=e.clientY,h())},{signal:c});let ee=()=>{f=!1,t.classList.remove(`dragging`)};t.addEventListener(`pointerup`,ee,{signal:c}),t.addEventListener(`pointercancel`,ee,{signal:c}),t.addEventListener(`lostpointercapture`,ee,{signal:c}),i.append(t,r)}return{element:i,setActive:e=>{s=e},setMode:u,dispose:()=>{a.abort(),i.querySelectorAll(`iframe`).forEach(e=>e.remove()),i.remove()}}}var jr=e=>t(e.file.path,e.diff);function Mr(e,t){Object.assign(e.style,{left:`${t.x}px`,top:`${t.y}px`,width:`${t.width}px`,height:`${t.height}px`})}var Nr=class{host;onChange;copyToClipboard;onOpenFile;groups=new Map;tree;selectedGroup;sequence=0;tabSequence=0;revision=0;sashes=new Map;measured;dragged=null;dragSurface=document.createElement(`div`);highlight=document.createElement(`div`);resizeSurface=document.createElement(`div`);resizeObserver;gitChanges=new Map;constructor(e,t,n,r=()=>{}){this.host=e,this.onChange=t,this.copyToClipboard=n,this.onOpenFile=r,this.selectedGroup=this.makeGroup(),this.tree={type:`group`,id:this.selectedGroup.id},this.measured=_e(this.tree,this.hostRect()),this.dragSurface.className=`editor-drag-surface`,this.dragSurface.hidden=!0,this.highlight.className=`editor-drop-highlight`,this.dragSurface.append(this.highlight),this.resizeSurface.className=`editor-resize-surface`,this.resizeSurface.hidden=!0,e.append(this.dragSurface,this.resizeSurface),e.addEventListener(`dragover`,e=>this.dragOver(e)),e.addEventListener(`drop`,e=>{if(!this.dragged)return;e.preventDefault(),e.stopPropagation();let t=this.dropTarget(e),n=this.dragged;this.endDrag(),t&&this.transfer(n,t,this.isCopy(e))}),e.addEventListener(`dragleave`,t=>{e.contains(t.relatedTarget)||(this.highlight.hidden=!0)}),window.addEventListener(`dragend`,()=>this.endDrag()),window.addEventListener(`drop`,()=>this.endDrag()),window.addEventListener(`keydown`,e=>{e.key===`Escape`&&this.endDrag()}),window.addEventListener(`blur`,()=>{setTimeout(()=>this.activateFrame(document.activeElement),0)}),this.resizeObserver=new ResizeObserver(()=>this.layout()),this.resizeObserver.observe(e),this.render(!1)}get activeTab(){return this.selectedGroup.active}get tabs(){return me(this.tree).flatMap(e=>this.groups.get(e)?.tabs??[])}hostRect(){return{x:0,y:0,width:this.host.clientWidth,height:this.host.clientHeight}}makeGroup(){let e;do e=`group-${++this.sequence}`;while(this.groups.has(e));let t=document.createElement(`section`);t.className=`editor-group`,t.dataset.groupId=e,t.setAttribute(`role`,`region`);let n=document.getElementById(`editor-group-template`);t.append(n.content.cloneNode(!0));for(let n of t.querySelectorAll(`[id]`))n.dataset.control=n.id,this.groups.size&&(n.id+=`-${e}`);let r=e=>t.querySelector(`[data-control="${e}"]`);r(`current-path`).classList.add(`current-path`);let i={id:e,element:t,header:t.querySelector(`.group-header`),tabbar:r(`tabbar`),tabs:[],active:null,control:r};return t.addEventListener(`pointerdown`,()=>this.selectGroup(i),{capture:!0}),t.addEventListener(`focusin`,()=>this.selectGroup(i)),r(`group-focus`).addEventListener(`click`,()=>{this.selectGroup(i),this.focus()}),r(`reload-file`).addEventListener(`click`,()=>this.reload(i.active)),r(`copy-path`).addEventListener(`click`,()=>{let e=i.active?.file.path;e&&this.copyToClipboard(e,`File path`)}),r(`viewer-mode`).addEventListener(`click`,()=>this.setMode(i.active,`viewer`)),r(`source-mode`).addEventListener(`click`,()=>this.setMode(i.active,`source`)),r(`open-changes`).addEventListener(`click`,()=>{let e=i.active,t=e&&this.preferredChange(e.file.path);t&&this.openDiff(t)}),r(`open-changed-file`).addEventListener(`click`,()=>{let e=i.active;e?.diff&&this.onOpenFile(e.file.path)}),r(`previous-change`).addEventListener(`click`,()=>this.navigateChange(-1)),r(`next-change`).addEventListener(`click`,()=>this.navigateChange(1)),r(`diff-inline`).addEventListener(`click`,()=>this.updateDiff(i.active,e=>({...e,layout:e.layout===`inline`?`side-by-side`:`inline`}))),r(`diff-collapse`).addEventListener(`click`,()=>this.updateDiff(i.active,e=>({...e,collapse:!e.collapse}))),r(`diff-whitespace`).addEventListener(`click`,()=>this.updateDiff(i.active,e=>({...e,ignoreTrimWhitespace:!e.ignoreTrimWhitespace}))),r(`split-right`).addEventListener(`click`,()=>this.split(i,`right`)),r(`split-down`).addEventListener(`click`,()=>this.split(i,`down`)),this.groups.set(e,i),this.host.append(t),i}selectGroup(e){this.selectedGroup!==e&&(this.selectedGroup=e,this.render())}activate(e,t=!1){this.selectedGroup=e.group,e.group.active=e,this.render(),e.element.scrollIntoView({block:`nearest`,inline:`nearest`}),t&&e.button.focus()}mountPane(e){let t=e.pane.element;t.id=`${e.id}-panel`,t.setAttribute(`aria-labelledby`,e.id),t.addEventListener(`pointerdown`,()=>this.selectGroup(e.group),{capture:!0}),t.addEventListener(`focusin`,()=>this.selectGroup(e.group)),this.host.append(t)}createPane(e,t,n,r){return r?fe({path:e.path,name:e.name,stage:r.stage,originalPath:r.originalPath},t,r.state):Ar(e,t,n,e=>this.copyToClipboard(e,`Source`))}makeTab(e,t,n=Dr(e),r){let i=`file-tab-${++this.tabSequence}`,a=document.createElement(`div`);a.className=`tab`,a.setAttribute(`role`,`presentation`),a.draggable=!0;let c=document.createElement(`button`);c.type=`button`,c.className=`tab-select tab-label`,c.setAttribute(`role`,`tab`),c.id=i,c.title=e.path,c.setAttribute(`aria-label`,e.path),c.setAttribute(`aria-controls`,`${i}-panel`);let l=document.createElement(`span`);if(l.textContent=e.name,c.append(s(e),l),r){let t=`${e.path} (${oe[r.stage][1]})`;c.title=t,c.setAttribute(`aria-label`,t);let n=document.createElement(`span`);n.className=`tab-description`,n.textContent=`(${oe[r.stage][1]})`,c.append(n)}let u={id:i,file:e,...r?{diff:{...r,state:{...r.state}}}:{},group:t,mode:n,element:a,button:c,pane:this.createPane(e,0,n,r),revision:0};c.addEventListener(`click`,()=>this.activate(u)),c.addEventListener(`keydown`,e=>{let t=u.group.tabs,n=t.indexOf(u),r=e.key===`ArrowRight`?(n+1)%t.length:e.key===`ArrowLeft`?(n-1+t.length)%t.length:e.key===`Home`?0:e.key===`End`?t.length-1:-1;e.key===`Delete`?(e.preventDefault(),this.close(u,!0)):r>=0&&(e.preventDefault(),this.activate(t[r],!0))});let d=document.createElement(`button`);return d.type=`button`,d.className=`tab-close`,d.title=`Close tab`,d.setAttribute(`aria-label`,`Close ${c.title}`),d.append(o(`close`)),d.addEventListener(`click`,()=>this.close(u,!0)),a.append(c,d),a.addEventListener(`dragstart`,e=>{e.dataTransfer&&(this.dragged=u,e.dataTransfer.effectAllowed=`copyMove`,e.dataTransfer.setData(`application/x-fzv-tab`,u.id),this.host.classList.add(`dragging-tab`),requestAnimationFrame(()=>{this.dragged&&(this.dragSurface.hidden=!1,this.highlight.hidden=!0)}))}),this.mountPane(u),t.tabs.push(u),t.active=u,u}open(e){let t=this.selectedGroup;this.activate(t.tabs.find(t=>jr(t)===e.path)??this.makeTab(e,t))}openDiff(e){let n=e.path.split(`/`).at(-1);if(e.kind!==`text`&&e.kind!==`html`){e.status!==`D`&&this.onOpenFile(e.path);return}let r=this.selectedGroup,i=t(e.path,e),a=r.tabs.find(e=>jr(e)===i);if(a){a.diff.originalPath!==e.originalPath&&(a.diff.originalPath=e.originalPath,this.reload(a)),this.activate(a);return}let o=this.makeTab({path:e.path,name:n,kind:e.kind,size:0},r,`source`,{stage:e.stage,originalPath:e.originalPath,state:this.selectedGroup.active?.diff?.state??E});o.pane.revealFirstChange(),this.activate(o)}setGitChanges(e){this.gitChanges=new Map;for(let t of e)this.gitChanges.set(t.path,[...this.gitChanges.get(t.path)??[],t]);this.render(!1)}preferredChange(e){let t=this.gitChanges.get(e)??[];return t.find(e=>e.stage===`worktree`)??t[0]}reloadDiffs(){for(let e of this.tabs)e.diff&&this.reload(e)}navigateChange(e){let t=this.activeTab;return t?.diff?(t.pane.navigate(e),!0):!1}updateDiff(e,t){e?.diff&&(e.diff.state=t(e.diff.state),e.pane.update(e.diff.state),this.render())}close(e,t=!1){this.dragged===e&&this.endDrag();let n=e.group,r=n.tabs.indexOf(e);r<0||(n.tabs.splice(r,1),e.pane.dispose(),e.element.remove(),n.active===e&&(n.active=n.tabs[Math.min(r,n.tabs.length-1)]??null),this.removeEmptyGroup(n),this.render(),t&&this.focus())}removeEmptyGroup(e){if(e.tabs.length||this.groups.size===1)return;let t=me(this.tree).indexOf(e.id);if(this.tree=O(this.tree,e.id),this.groups.delete(e.id),e.element.remove(),this.selectedGroup===e){let e=me(this.tree);this.selectedGroup=this.groups.get(e[Math.min(t,e.length-1)])}}focus(){(this.activeTab?.button??document.getElementById(`main`))?.focus()}cycle(e){let t=this.selectedGroup;if(!t.tabs.length)return;let n=t.active?t.tabs.indexOf(t.active):-1;this.activate(t.tabs[(n+e+t.tabs.length)%t.tabs.length])}focusGroup(e){let t=me(this.tree)[e],n=this.groups.get(t);n&&(this.selectGroup(n),this.focus())}splitActive(e){this.split(this.selectedGroup,e)}split(e,t){e.active&&this.transfer(e.active,{group:e,direction:t},!0)}transfer(e,t,n){let r=e.group,i=t.group;if(t.direction){if(this.groups.size>=32||!n&&r===i&&r.tabs.length===1)return;let e=this.makeGroup();this.tree=pe(this.tree,i.id,e.id,t.direction,`split-${++this.sequence}`),i=e}let a=i.tabs.find(t=>jr(t)===jr(e));if(i===r){t.index!==void 0&&(i.tabs.splice(i.tabs.indexOf(e),1),i.tabs.splice(t.index,0,e)),this.activate(e,!0);return}if(a&&t.index!==void 0&&(i.tabs.splice(i.tabs.indexOf(a),1),i.tabs.splice(t.index,0,a)),n){let n=a??this.makeTab(e.file,i,e.mode,e.diff);!a&&t.index!==void 0&&(i.tabs.splice(i.tabs.indexOf(n),1),i.tabs.splice(t.index,0,n)),this.activate(n,!0);return}let o=r.tabs.indexOf(e);r.tabs.splice(o,1),r.active===e&&(r.active=r.tabs[Math.min(o,r.tabs.length-1)]??null),a?(e.pane.dispose(),e.element.remove()):(e.group=i,i.tabs.splice(t.index??i.tabs.length,0,e)),this.selectedGroup=i,i.active=a??e,this.removeEmptyGroup(r),this.activate(a??e,!0)}reload(e=this.activeTab){e&&(e.pane.dispose(),e.revision=++this.revision,e.pane=this.createPane(e.file,e.revision,e.mode,e.diff),this.mountPane(e),this.render())}setMode(e,t){!e?.diff&&e?.pane.setMode&&Er(e.file)&&(e.mode=t,e.pane.setMode(t),this.render())}frameTab(e){return this.tabs.find(t=>t.group.active===t&&t.file.kind===`html`&&t.mode===`viewer`&&t.pane.element.querySelector(`iframe`)?.contentWindow===e)}activateFrame(e){if(!(e instanceof HTMLIFrameElement))return;let t=this.frameTab(e.contentWindow);t&&this.selectGroup(t.group)}snapshot(){return{version:2,layout:this.tree,activeGroup:this.selectedGroup.id,groups:me(this.tree).map(e=>{let t=this.groups.get(e);return{id:e,tabs:t.tabs.map(e=>({path:e.file.path,mode:e.mode,...e.diff?{diff:e.diff.stage,...e.diff.originalPath?{originalPath:e.diff.originalPath}:{},...e.diff.state}:{}})),active:t.active?jr(t.active):null}})}}restore(e,t){if(!e){this.render();return}let n=new Map(t.map(e=>[e.path,e]));if(e.version===1){for(let t of e.tabs){let e=n.get(t);e&&this.makeTab(e,this.selectedGroup)}this.selectedGroup.active=this.selectedGroup.tabs.find(t=>t.file.path===e.active)??this.selectedGroup.tabs[0]??null}else{for(let e of this.groups.values())e.element.remove();this.groups.clear();let t=new Map;for(let r of e.groups){let e=this.makeGroup();t.set(r.id,e.id);for(let t of r.tabs){if(t.diff){let n=t.path.split(`/`).at(-1);this.makeTab({path:t.path,name:n,kind:/\.html?$/i.test(n)?`html`:`text`,size:0},e,`source`,{stage:t.diff,originalPath:t.originalPath,state:{layout:t.layout??E.layout,collapse:t.collapse??E.collapse,ignoreTrimWhitespace:t.ignoreTrimWhitespace??E.ignoreTrimWhitespace}});continue}let r=n.get(t.path);r&&this.makeTab(r,e,Er(r)?t.mode:Dr(r))}e.active=e.tabs.find(e=>jr(e)===r.active)??e.tabs[0]??null}let r=e=>e.type===`group`?{type:`group`,id:t.get(e.id)}:{...e,id:`split-${++this.sequence}`,children:[r(e.children[0]),r(e.children[1])]};this.tree=r(e.layout),this.selectedGroup=this.groups.get(t.get(e.activeGroup));for(let e of[...this.groups.values()])this.removeEmptyGroup(e)}this.render()}render(e=!0){let t=0;for(let e of me(this.tree)){let n=this.groups.get(e);n.element.setAttribute(`aria-label`,`Editor group ${++t}`),n.element.classList.toggle(`focused`,n===this.selectedGroup),n.element.classList.toggle(`multiple`,this.groups.size>1);let r=n.control(`group-focus`);r.hidden=this.groups.size===1,r.textContent=String(t),r.setAttribute(`aria-label`,`Focus editor group ${t}`),r.setAttribute(`aria-pressed`,String(n===this.selectedGroup)),r.title=`Focus editor group ${t} (f)`,n.element.setAttribute(`aria-owns`,n.tabs.map(e=>e.pane.element.id).join(` `));let i=n.active;n.control(`no-tabs`).hidden=!!n.tabs.length,n.control(`empty-state`).hidden=!!i;let a=i?.diff?`${i.file.path} (${oe[i.diff.stage].join(` ↔ `)})`:i?.file.path??`Ready when you are`;n.control(`current-path`).textContent=a,n.control(`current-path`).title=i?a:``;for(let e of[`reload-file`,`split-right`,`split-down`])n.control(e).disabled=!i||e.startsWith(`split-`)&&this.groups.size>=32;if(n.control(`copy-path`).disabled=!i,n.control(`open-file`).hidden=!i||!!i.diff,n.control(`download-file`).hidden=!i||!!i.diff,i&&!i.diff&&(n.control(`open-file`).href=Or(i.file,i.revision)),i&&!i.diff){let e=n.control(`download-file`);e.href=Or(i.file,i.revision,!0),e.download=i.file.name}n.control(`preview-modes`).hidden=!i||!!i.diff||!Er(i.file),n.control(`open-changes`).hidden=!i||!!i.diff||!this.preferredChange(i.file.path),n.control(`diff-actions`).hidden=!i?.diff;let o=i?.diff?.state;n.control(`diff-inline`).setAttribute(`aria-pressed`,String(o?.layout===`inline`)),n.control(`diff-collapse`).setAttribute(`aria-pressed`,String(!!o?.collapse)),n.control(`diff-whitespace`).setAttribute(`aria-pressed`,String(!!o&&!o.ignoreTrimWhitespace)),n.control(`viewer-mode`).setAttribute(`aria-pressed`,String(i?.mode===`viewer`)),n.control(`source-mode`).setAttribute(`aria-pressed`,String(i?.mode===`source`)),n.tabs.forEach((e,t)=>{let r=n.tabbar.children[t];r!==e.element&&n.tabbar.insertBefore(e.element,r??null);let a=e===i;e.element.classList.toggle(`active`,a),e.button.setAttribute(`aria-selected`,String(a)),e.button.tabIndex=a?0:-1,e.pane.element.hidden=!a,e.pane.element.dataset.groupId=n.id,e.pane.setActive(a&&n===this.selectedGroup)})}this.layout(),e&&this.onChange()}layout(){this.measured=_e(this.tree,this.hostRect());for(let[e,t]of this.measured.groups){let n=this.groups.get(e);Mr(n.element,t);let r=Math.min(t.height,n.header.offsetHeight);for(let e of n.tabs)Mr(e.pane.element,{...t,y:t.y+r,height:Math.max(0,t.height-r)})}for(let[e,t]of this.sashes)this.measured.splits.has(e)||(t.remove(),this.sashes.delete(e));for(let[e,{node:t,rect:n,sash:r}]of this.measured.splits){let i=this.sashes.get(e);i||(i=this.makeSash(e),this.sashes.set(e,i),this.host.append(i)),i.dataset.axis=t.axis,i.setAttribute(`aria-orientation`,t.axis===`x`?`vertical`:`horizontal`),i.setAttribute(`aria-label`,t.axis===`x`?`Resize editor columns`:`Resize editor rows`);let[a,o]=ge(t,t.axis===`x`?n.width:n.height);i.setAttribute(`aria-valuemin`,String(Math.round(a*100))),i.setAttribute(`aria-valuemax`,String(Math.round(o*100))),i.setAttribute(`aria-valuenow`,String(Math.round(Math.max(a,Math.min(o,t.ratio))*100))),Mr(i,r)}}makeSash(e){let t=document.createElement(`div`);t.className=`editor-sash`,t.setAttribute(`role`,`separator`),t.tabIndex=0;let n=null,r=(r=!1)=>{if(!n)return;let i=this.measured.splits.get(e);r&&i&&(i.node.ratio=n.ratio);let a=n.pointer;n=null,t.hasPointerCapture(a)&&t.releasePointerCapture(a),this.resizeSurface.hidden=!0,t.classList.remove(`resizing`),this.layout(),this.onChange()};return t.addEventListener(`pointerdown`,r=>{if(r.button!==0)return;r.preventDefault();let i=this.measured.splits.get(e);n={ratio:i.node.ratio,pointer:r.pointerId},t.setPointerCapture(r.pointerId),t.focus(),t.classList.add(`resizing`),this.resizeSurface.style.cursor=i.node.axis===`x`?`col-resize`:`row-resize`,this.resizeSurface.hidden=!1}),t.addEventListener(`pointermove`,t=>{if(!n)return;let r=this.measured.splits.get(e),i=this.host.getBoundingClientRect(),a=r.node.axis===`x`?r.rect.width:r.rect.height,o=r.node.axis===`x`?t.clientX-i.left-r.rect.x:t.clientY-i.top-r.rect.y,[s,c]=ge(r.node,a);r.node.ratio=Math.max(s,Math.min(c,(o-2)/Math.max(1,a-4))),this.layout()}),t.addEventListener(`pointerup`,()=>r()),t.addEventListener(`pointercancel`,()=>r(!0)),t.addEventListener(`lostpointercapture`,()=>r()),t.addEventListener(`keydown`,t=>{if(t.key===`Escape`&&n){t.preventDefault(),r(!0);return}let i=this.measured.splits.get(e),a=i.node.axis===`x`?`ArrowLeft`:`ArrowUp`;if(![a,i.node.axis===`x`?`ArrowRight`:`ArrowDown`,`Home`,`End`].includes(t.key))return;t.preventDefault();let[o,s]=ge(i.node,i.node.axis===`x`?i.rect.width:i.rect.height);i.node.ratio=t.key===`Home`?o:t.key===`End`?s:Math.max(o,Math.min(s,i.node.ratio+(t.key===a?-.05:.05))),this.layout(),this.onChange()}),t.addEventListener(`dblclick`,()=>{this.measured.splits.get(e).node.ratio=.5,this.layout(),this.onChange()}),t}isCopy(e){return/Mac|iPhone|iPad/.test(navigator.platform)?e.altKey:e.ctrlKey}endDrag(){this.dragged=null,this.host.classList.remove(`dragging-tab`),this.dragSurface.hidden=!0,this.highlight.hidden=!0}dropTarget(e){let t=this.host.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;for(let[t,i]of this.measured.groups){if(n<i.x||n>i.x+i.width||r<i.y||r>i.y+i.height)continue;let a=this.groups.get(t),o=a.tabbar.getBoundingClientRect();if(e.clientY<o.bottom){e.clientX<o.left+24&&(a.tabbar.scrollLeft-=12),e.clientX>o.right-24&&(a.tabbar.scrollLeft+=12);let t=a.tabs.filter(e=>!this.dragged||jr(e)!==jr(this.dragged)),n=t.findIndex(t=>{let n=t.element.getBoundingClientRect();return e.clientX<n.left+n.width/2});return{group:a,index:n<0?t.length:n}}let s=a.header.offsetHeight,c=(n-i.x)/i.width,l=(r-i.y-s)/Math.max(1,i.height-s),u;return l>=0&&(c<.1||c>.9||l<.1||l>.9)&&(u=c<1/3?`left`:c>2/3?`right`:l<.5?`up`:`down`),{group:a,direction:u}}return null}dragOver(e){if(!this.dragged)return;e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.isCopy(e)?`copy`:`move`);let t=this.dropTarget(e);if(this.highlight.hidden=!t,!t)return;let n=this.measured.groups.get(t.group.id);if(t.index!==void 0){let e=t.group.tabs.filter(e=>!this.dragged||jr(e)!==jr(this.dragged)),r=e[t.index]?.element.getBoundingClientRect(),i=e[t.index-1]?.element.getBoundingClientRect(),a=t.group.tabbar.getBoundingClientRect(),o=this.host.getBoundingClientRect(),s=Math.max(a.left,Math.min(a.right-2,r?.left??i?.right??a.left));this.highlight.classList.add(`tab-insertion`),Mr(this.highlight,{x:s-o.left,y:n.y,width:2,height:a.height});return}this.highlight.classList.remove(`tab-insertion`);let r=t.group.header.offsetHeight,i={...n,y:n.y+r,height:Math.max(0,n.height-r)};(t.direction===`left`||t.direction===`right`)&&(i.width/=2,t.direction===`right`&&(i.x+=i.width)),(t.direction===`up`||t.direction===`down`)&&(i.height/=2,t.direction===`down`&&(i.y+=i.height)),Mr(this.highlight,i)}},Pr=`fzv:theme`;function Fr(e){let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=null;try{let e=localStorage.getItem(Pr);(e===`light`||e===`dark`)&&(n=e)}catch{}let r=t=>{document.documentElement.dataset.theme=t;let n=t===`light`?`Switch to dark theme`:`Switch to light theme`;e.setAttribute(`aria-label`,n),e.setAttribute(`aria-pressed`,String(t===`dark`)),e.title=n;let r=document.createElement(`span`);r.textContent=t===`light`?`Dark`:`Light`,e.replaceChildren(o(`color-mode`),r)};r(n??(t.matches?`dark`:`light`)),t.addEventListener(`change`,()=>{n||r(t.matches?`dark`:`light`)}),e.addEventListener(`click`,()=>{n=document.documentElement.dataset.theme===`dark`?`light`:`dark`,r(n);try{localStorage.setItem(Pr,n)}catch{}})}function Ir(e={}){let t=new AbortController,n=t.signal,r=0,i=null,a=[],o=``,s=null,c=()=>{i?.remove(),i=null,a=[],o=``,r=0},l=()=>{if(!s)return;let e=s;s=null,e.open&&e.close(),e.remove()},u=()=>{if(s)return;c();let t=document.createElement(`dialog`);s=t,t.setAttribute(`aria-labelledby`,`fzv-keyboard-help-title`),Object.assign(t.style,{position:`fixed`,inset:`0`,margin:`auto`,width:`min(520px, calc(100vw - 28px))`,maxHeight:`min(80vh, 640px)`,overflow:`auto`,padding:`20px 22px`,border:`1px solid #8888`,borderRadius:`8px`,background:`#f8f8f8`,color:`#202020`,boxShadow:`0 12px 40px #0005`,font:`13px/1.5 system-ui, sans-serif`,zIndex:`2147483647`});let r=document.createElement(`div`);Object.assign(r.style,{display:`flex`,alignItems:`center`,gap:`12px`,marginBottom:`14px`});let i=document.createElement(`h2`);i.id=`fzv-keyboard-help-title`,i.textContent=`Keyboard shortcuts`,Object.assign(i.style,{flex:`1`,margin:`0`,fontSize:`16px`});let a=document.createElement(`button`);a.type=`button`,a.textContent=`Close`,a.setAttribute(`aria-label`,`Close keyboard shortcuts`),Object.assign(a.style,{padding:`5px 9px`,border:`1px solid #8888`,borderRadius:`4px`,background:`#fff`,color:`inherit`,font:`inherit`,cursor:`pointer`}),a.addEventListener(`click`,l,{signal:n}),r.append(i,a);let o=[[`/`,`Find a file`],[`r`,`Reload the active preview`],[`f`,e.bridgeWorkspace?`Show workspace hints`:`Show hints for links and controls`],[`h j k l`,`Scroll the active preview`],[`gg`,`Scroll to the top`],[`G`,`Scroll to the bottom`],[`?`,`Show this keyboard help`],[`Escape`,`Cancel hints or close this help`]];e.bridgeWorkspace||o.push([`Ctrl/Cmd + Tab`,`Switch tabs in the focused group`],[`Alt + j / k`,`Switch tabs in the focused group`],[`Ctrl/Cmd + 1–9`,`Focus an editor group`],[`Ctrl/Cmd + \\`,`Split the editor to the right`],[`Ctrl/Cmd + Shift + \\`,`Split the editor below`],[`Ctrl/Cmd + f`,`Find in a PDF`],[`Ctrl/Cmd + + / − / 0`,`Zoom an image or PDF`],[`]c / [c`,`Next / previous change in a diff`],[`Alt + F5 / Shift + Alt + F5`,`Next / previous change in a diff`],[`Ctrl/Cmd + Shift + e`,`Show the Explorer`],[`Ctrl/Cmd + Shift + g`,`Show Source Control`],[`Ctrl/Cmd + b`,`Show or hide the side bar`]);let u=document.createElement(`div`);Object.assign(u.style,{display:`grid`,gridTemplateColumns:`minmax(125px, auto) minmax(0, 1fr)`,gap:`7px 14px`,alignItems:`center`});for(let[e,t]of o){let n=document.createElement(`kbd`);n.textContent=e,Object.assign(n.style,{justifySelf:`start`,padding:`2px 5px`,border:`1px solid #aaa`,borderRadius:`3px`,background:`#eee`,color:`inherit`,font:`11px ui-monospace, monospace`,whiteSpace:`nowrap`});let r=document.createElement(`span`);r.textContent=t,u.append(n,r)}t.append(r,u),t.addEventListener(`cancel`,e=>{e.preventDefault(),l()},{signal:n}),document.body.append(t),t.showModal(),a.focus()},d=e=>e instanceof HTMLElement&&(e.isContentEditable||!!e.closest(`input, textarea, select, [role="textbox"]`)),f=()=>{c();let e=document.querySelector(`dialog[open]`)??document.body,t=[...e.querySelectorAll(`a[href], button:not(:disabled), input:not(:disabled):not([type="hidden"]), textarea:not(:disabled), select:not(:disabled), summary, [role="button"], [role="treeitem"], [tabindex]:not([tabindex="-1"]), [contenteditable]:not([contenteditable="false"]), iframe`)].filter(e=>{if(e.matches(`:disabled`)||e.closest(`[hidden], [inert], [aria-disabled="true"]`))return!1;let t=getComputedStyle(e);if(t.visibility!==`visible`||t.display===`none`||t.opacity===`0`)return!1;let n=e.getBoundingClientRect(),r=Math.max(0,n.left),i=Math.min(innerWidth,n.right),a=Math.max(0,n.top),o=Math.min(innerHeight,n.bottom);if(r>=i||a>=o)return!1;let s=document.elementFromPoint((r+i)/2,(a+o)/2);return s===e||!!(s&&e.contains(s))});if(!t.length)return;i=document.createElement(`div`),i.className=`vim-hints`,i.setAttribute(`aria-label`,`Link hints; type a label to jump, Escape to cancel`),i.style.pointerEvents=`none`;let n=Math.max(1,Math.ceil(Math.log(t.length)/Math.log(9)));a=t.map((e,t)=>{let r=t,a=``;for(let e=0;e<n;e++)a=`asdfghjkl`[r%9]+a,r=Math.floor(r/9);let o=e.getBoundingClientRect(),s=document.createElement(`span`);return s.className=`vim-hint`,s.dataset.hintTarget=e.id||e.getAttribute(`aria-label`)||e.textContent?.trim()||e.tagName,s.textContent=a.toUpperCase(),s.setAttribute(`aria-hidden`,`true`),Object.assign(s.style,{position:`fixed`,zIndex:`2147483647`,pointerEvents:`none`,left:`${Math.max(0,Math.min(innerWidth-32,o.left))}px`,top:`${Math.max(0,Math.min(innerHeight-20,o.top))}px`,font:`bold 12px/18px monospace`,padding:`0 3px`,color:`#1f1f1f`,backgroundColor:`#ffdf80`,border:`1px solid #b78618`,borderRadius:`2px`,boxShadow:`0 1px 2px #0003`}),i.append(s),{target:e,label:a,badge:s}}),e.append(i)},p=()=>{let t=e.getScrollRoot?.();if(t)return t;let n=document.activeElement;for(;n instanceof HTMLElement&&n!==document.body;){let e=getComputedStyle(n);if(/(auto|scroll)/.test(e.overflowY+e.overflowX)&&(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth))return n;n=n.parentElement}return document.scrollingElement},m=e=>{let t=p();t&&(e===`top`?t.scrollTo({top:0,behavior:`instant`}):e===`bottom`?t.scrollTo({top:t.scrollHeight,behavior:`instant`}):t.scrollBy({left:e===`h`?-64:e===`l`?64:0,top:e===`j`?64:e===`k`?-64:0,behavior:`instant`}))};return window.addEventListener(`keydown`,t=>{if(t.defaultPrevented||t.isComposing||d(t.composedPath()[0]??t.target)||t.ctrlKey||t.metaKey||t.altKey){r=0;return}let n=()=>{t.preventDefault(),t.stopImmediatePropagation()};if(s){t.key===`Escape`&&(l(),n());return}if(t.key===`Escape`){(i||r)&&(c(),n());return}if(i){if(n(),t.key===`Backspace`)o=o.slice(0,-1);else if(t.key.length===1)o+=t.key.toLowerCase();else return;let r=a.filter(e=>e.label.startsWith(o));for(let e of a)e.badge.hidden=!e.label.startsWith(o);if(!r.length){c();return}let i=r.find(e=>e.label===o);if(i){let t=i.target;c(),t.isConnected&&(t.focus(),e.onHintActivate?.(t)||t.click())}return}let p=r;if(r=0,t.key===`/`&&e.onSearch){n(),e.onSearch();return}if(t.key===`?`){n(),u();return}if(t.key===`r`&&e.onReload){n(),e.onReload();return}if(t.key===`f`&&!t.repeat){n(),e.bridgeWorkspace?parent.postMessage({type:`fzv:shortcut`,key:`f`},`*`):f();return}if(t.key===`g`){if(n(),t.repeat)return;let i=performance.now();p&&i-p<800?e.onScroll?.(`top`)||m(`top`):r=i;return}if(![`h`,`j`,`k`,`l`,`G`].includes(t.key))return;n();let h=t.key===`G`?`bottom`:t.key;e.onScroll?.(h)||m(h)},{capture:!0,signal:n}),window.addEventListener(`blur`,c,{signal:n}),window.addEventListener(`message`,t=>{e.bridgeWorkspace&&parent!==window&&t.source===parent&&(t.data?.type===`fzv:show-hints`&&f(),t.data?.type===`fzv:scroll`&&[`h`,`j`,`k`,`l`,`top`,`bottom`].includes(t.data.key)&&m(t.data.key))},{signal:n}),window.addEventListener(`resize`,c,{signal:n}),document.addEventListener(`pointerdown`,c,{capture:!0,signal:n}),document.addEventListener(`pointerdown`,()=>e.onFocus?.(),{capture:!0,signal:n}),document.addEventListener(`focusin`,()=>e.onFocus?.(),{signal:n}),document.addEventListener(`scroll`,()=>{i&&c()},{capture:!0,signal:n}),document.addEventListener(`focusin`,e=>{r=0,d(e.target)&&c()},{signal:n}),{cancel:c,showHints:f,showHelp:u,dispose:()=>{c(),l(),t.abort()}}}var Lr=`fzv:sidebar`,Rr=170,zr=300,Br=`(max-width: 700px)`;function Vr(){try{let e=JSON.parse(localStorage.getItem(Lr)??`{}`);return e&&typeof e==`object`?e:{}}catch{return{}}}var Hr=class{activityBar;sidebar;title;actions;content;sash;views=[];buttons=new Map;badges=new Map;active=null;state=Vr();narrow=window.matchMedia(Br);constructor(e,t,n,r,i,a){this.activityBar=e,this.sidebar=t,this.title=n,this.actions=r,this.content=i,this.sash=a,this.setWidth(this.state.width??zr,!1),this.installSash(),this.narrow.addEventListener(`change`,()=>{this.setVisible(!this.narrow.matches&&(this.state.visible??!0),!1)}),document.addEventListener(`pointerdown`,e=>{let t=e.target;this.narrow.matches&&this.visible&&!this.sidebar.contains(t)&&!this.activityBar.contains(t)&&this.setVisible(!1,!1)},{capture:!0}),this.sidebar.addEventListener(`keydown`,e=>{e.key===`Escape`&&this.narrow.matches&&(e.preventDefault(),this.setVisible(!1,!1))})}get visible(){return!this.sidebar.hidden}get activeView(){return this.visible?this.active?.id??null:null}add(e){if(this.buttons.has(e.id))return;this.views.push(e);let t=document.createElement(`button`);t.type=`button`,t.className=`activity-item`,t.setAttribute(`aria-label`,e.title),t.title=`${e.title} (${e.keybinding})`,t.dataset.view=e.id,t.setAttribute(`aria-pressed`,`false`);let n=document.createElement(`span`);n.className=`activity-badge`,n.hidden=!0,t.append(o(e.icon),n),t.addEventListener(`click`,()=>{this.activeView===e.id?this.setVisible(!1):this.show(e.id,!1)}),this.buttons.set(e.id,t),this.badges.set(e.id,n),this.activityBar.append(t),this.activityBar.hidden=!1,e.element.hidden=!0,this.content.append(e.element),(this.state.view===e.id||!this.active)&&(this.select(e,!1),this.setVisible(!this.narrow.matches&&(this.state.visible??!0),!1))}setBadge(e,t,n){let r=this.badges.get(e);if(!r)return;r.hidden=t===0,r.textContent=t>99?`99+`:String(t);let i=this.views.find(t=>t.id===e);this.buttons.get(e).setAttribute(`aria-label`,t?`${i.title} (${n})`:i.title)}show(e,t=!0){let n=this.views.find(t=>t.id===e);n&&(this.select(n),this.setVisible(!0),t&&n.focus())}toggleFocus(e){let t=this.views.find(t=>t.id===e);t&&(this.activeView===e&&t.element.contains(document.activeElement)?this.setVisible(!1):this.show(e))}toggle(){this.visible||!this.active?this.setVisible(!1):this.setVisible(!0)}afterOpen(){this.narrow.matches&&this.setVisible(!1,!1)}select(e,t=!0){this.active!==e&&(this.active&&(this.active.element.hidden=!0),this.active=e,e.element.hidden=!1,this.title.textContent=e.title,this.actions.replaceChildren(...e.actions??[]),t&&this.save({view:e.id}))}setVisible(e,t=!0){e&&=this.active!==null;let n=this.sidebar.contains(document.activeElement);this.sidebar.hidden=!e,this.sash.hidden=!e,this.activityBar.classList.toggle(`sidebar-hidden`,!e);for(let[t,n]of this.buttons){let r=e&&t===this.active?.id;n.classList.toggle(`checked`,r),n.setAttribute(`aria-pressed`,String(r))}!e&&n&&document.getElementById(`main`)?.focus(),t&&this.save({visible:e})}setWidth(e,t=!0){let n=Math.max(Rr,window.innerWidth-300),r=Math.round(Math.min(n,Math.max(Rr,e)));this.sidebar.style.setProperty(`--sidebar-width`,`${r}px`),t&&this.save({width:r})}installSash(){this.sash.addEventListener(`pointerdown`,e=>{if(e.button!==0)return;e.preventDefault(),this.sash.setPointerCapture(e.pointerId);let t=e.clientX,n=this.sidebar.getBoundingClientRect().width;document.body.classList.add(`sash-dragging`);let r=e=>this.setWidth(n+e.clientX-t,!1),i=e=>{this.sash.removeEventListener(`pointermove`,r),this.sash.removeEventListener(`pointerup`,i),this.sash.removeEventListener(`pointercancel`,i),document.body.classList.remove(`sash-dragging`),this.setWidth(n+e.clientX-t)};this.sash.addEventListener(`pointermove`,r),this.sash.addEventListener(`pointerup`,i),this.sash.addEventListener(`pointercancel`,i)}),this.sash.addEventListener(`dblclick`,()=>this.setWidth(zr))}save(e){this.state={...this.state,...e};try{localStorage.setItem(Lr,JSON.stringify(this.state))}catch{}}},Ur=`[role="treeitem"]`;function Wr(e){return Number(e.getAttribute(`aria-level`))}function Gr(e,t){for(let n of e.querySelectorAll(Ur))n.tabIndex=n===t?0:-1;t.focus()}function Kr(e,t,n){let r=e.target.closest(Ur);if(!r||e.altKey||e.ctrlKey||e.metaKey)return;let i=[...t.querySelectorAll(Ur)],a=i.indexOf(r),o=r.getAttribute(`aria-expanded`),s=e=>{e&&Gr(t,e)};switch(e.key){case`ArrowDown`:s(i[a+1]);break;case`ArrowUp`:s(i[a-1]);break;case`Home`:s(i[0]);break;case`End`:s(i.at(-1));break;case`ArrowRight`:o===`false`?n(r,!0):o===`true`&&i[a+1]&&Wr(i[a+1])>Wr(r)&&s(i[a+1]);break;case`ArrowLeft`:o===`true`?n(r,!1):s(i.slice(0,a).findLast(e=>Wr(e)<Wr(r)));break;case`Enter`:case` `:r.click();break;default:return}e.preventDefault()}function qr(e){return e.status===`?`?`U`:e.status===`U`?`!`:e.status}function Jr(e){let t=e.stage===`index`;switch(e.status){case`M`:return t?`Index Modified`:`Modified`;case`A`:return t?`Index Added`:`Intent to Add`;case`D`:return t?`Index Deleted`:`Deleted`;case`R`:return t?`Index Renamed`:`Intent to Rename`;case`C`:return`Index Copied`;case`T`:return`Type Changed`;case`?`:return`Untracked`;case`U`:return`Conflict`}}function Yr(e){switch(e.status){case`M`:return e.stage===`index`?`stage-modified`:`modified`;case`T`:return`modified`;case`D`:return e.stage===`index`?`stage-deleted`:`deleted`;case`A`:return`added`;case`R`:case`C`:return`renamed`;case`?`:return`untracked`;case`U`:return`conflicting`}}var Xr=class{handlers;element=document.createElement(`section`);actions;tree=document.createElement(`div`);message=document.createElement(`p`);status=null;activeKey=null;collapsed=new Set;focusedKey=null;constructor(e){this.handlers=e,this.element.className=`scm-view`,this.element.setAttribute(`aria-label`,`Source Control`),this.tree.className=`scm-tree`,this.tree.setAttribute(`role`,`tree`),this.tree.setAttribute(`aria-label`,`Source Control Changes`),this.message.className=`sidebar-message`,this.message.textContent=`Loading changes…`,this.element.append(this.message,this.tree),this.tree.addEventListener(`keydown`,e=>Kr(e,this.tree,(e,t)=>this.toggle(e.dataset.group,t))),this.tree.addEventListener(`focusin`,e=>{let t=e.target.closest(`.scm-row`);t&&this.setFocused(t)});let t=document.createElement(`button`);t.type=`button`,t.className=`toolbar-button`,t.setAttribute(`aria-label`,`Refresh`),t.title=`Refresh`,t.append(o(`refresh`)),t.addEventListener(`click`,()=>e.refresh()),this.actions=[t]}get count(){return this.status?.available?this.status.changes.length:0}setStatus(e){this.status=e,this.render()}setActive(e){if(e!==this.activeKey){this.activeKey=e;for(let t of this.rows())t.setAttribute(`aria-selected`,String(t.dataset.key===e))}}focus(){let e=this.rows();(e.find(e=>e.tabIndex===0)??e[0]??this.element.closest(`.sidebar`))?.focus()}groups(){if(!this.status?.available)return[];let e={merge:{id:`merge`,label:`Merge Changes`,changes:[]},index:{id:`index`,label:`Staged Changes`,changes:[]},workingTree:{id:`workingTree`,label:`Changes`,changes:[]}};for(let t of this.status.changes)e[t.status===`U`?`merge`:t.stage===`index`?`index`:`workingTree`].changes.push(t);for(let t of Object.values(e))t.changes.sort((e,t)=>e.path.localeCompare(t.path));return Object.values(e).filter(e=>e.id===`workingTree`||e.changes.length)}render(){let e=this.status,t=this.tree.contains(document.activeElement);this.message.hidden=e?.available===!0,e&&!e.available&&(this.message.textContent=`The project is not in a git repository, so there are no changes to show.`);let n=[];for(let e of this.groups())if(n.push(this.groupRow(e)),!this.collapsed.has(e.id))for(let t of e.changes)n.push(this.resourceRow(e,t));this.tree.replaceChildren(...n);let r=n.find(e=>e.dataset.key===this.focusedKey)??n[0];r&&(r.tabIndex=0,t&&r.focus())}groupRow(e){let t=document.createElement(`div`),n=!this.collapsed.has(e.id);t.className=`scm-row scm-group`,t.dataset.key=`group:${e.id}`,t.dataset.group=e.id,t.setAttribute(`role`,`treeitem`),t.setAttribute(`aria-level`,`1`),t.setAttribute(`aria-expanded`,String(n)),t.setAttribute(`aria-label`,`${e.label}, ${e.changes.length}`),t.tabIndex=-1;let r=o(n?`chevron-down`:`chevron-right`);r.classList.add(`scm-twistie`);let i=document.createElement(`span`);i.className=`scm-group-name`,i.textContent=e.label;let a=document.createElement(`span`);return a.className=`scm-count`,a.textContent=String(e.changes.length),t.append(r,i,a),t.addEventListener(`click`,()=>this.toggle(e.id)),t}resourceRow(e,n){let r=document.createElement(`div`),i=n.path.split(`/`).at(-1),a=n.path.slice(0,-i.length-1),c=t(n.path,n);r.className=`scm-row scm-resource git-${Yr(n)}`,r.classList.toggle(`deleted`,n.status===`D`),r.dataset.key=c,r.dataset.group=e.id,r.setAttribute(`role`,`treeitem`),r.setAttribute(`aria-level`,`2`),r.setAttribute(`aria-selected`,String(c===this.activeKey)),r.setAttribute(`aria-label`,`${n.path}, ${Jr(n)}`),r.title=`${n.originalPath?`${n.originalPath} → `:``}${n.path} • ${Jr(n)}`,r.tabIndex=-1;let l=document.createElement(`span`);l.className=`scm-label`;let u=document.createElement(`span`);u.className=`scm-name`,u.textContent=i;let d=document.createElement(`span`);d.className=`scm-description`,d.textContent=a,l.append(u,d);let f=document.createElement(`span`);if(f.className=`scm-actions`,n.status!==`D`){let e=document.createElement(`button`);e.type=`button`,e.className=`toolbar-button`,e.tabIndex=-1,e.setAttribute(`aria-label`,`Open File ${n.path}`),e.title=`Open File`,e.append(o(`go-to-file`)),e.addEventListener(`click`,e=>{e.stopPropagation(),this.handlers.openFile(n.path)}),f.append(e)}let p=document.createElement(`span`);return p.className=`scm-letter`,p.textContent=qr(n),r.append(s({path:n.path,name:i,kind:n.kind??`text`,size:0}),l,f,p),r.addEventListener(`click`,()=>this.open(n)),r}open(e){e.status===`U`?this.handlers.openFile(e.path):this.handlers.openChange(e)}toggle(e,t){let n=!this.collapsed.has(e);t!==n&&(n?this.collapsed.add(e):this.collapsed.delete(e),this.focusedKey=`group:${e}`,this.render())}rows(){return[...this.tree.querySelectorAll(`.scm-row`)]}setFocused(e){this.focusedKey=e.dataset.key??null;for(let t of this.rows())t.tabIndex=t===e?0:-1}},Zr=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),Qr=e=>e.status===`U`?4:[`M`,`T`,`C`].includes(e.status)?2:1,$r=class{handlers;element=document.createElement(`section`);actions;header=document.createElement(`button`);tree=document.createElement(`div`);message=document.createElement(`p`);root=null;expanded=new Set;open=!0;activePath=null;focusedPath=null;decorations=new Map;storageKey=``;projectName=``;constructor(e){this.handlers=e,this.element.className=`explorer-view`,this.element.setAttribute(`aria-label`,`Explorer`),this.header.type=`button`,this.header.className=`pane-header`,this.header.setAttribute(`aria-expanded`,`true`),this.header.addEventListener(`click`,()=>{this.open=!this.open,this.render()}),this.tree.className=`explorer-tree`,this.tree.setAttribute(`role`,`tree`),this.tree.setAttribute(`aria-label`,`Files Explorer`),this.message.className=`sidebar-message`,this.message.textContent=`Loading files…`,this.element.append(this.header,this.message,this.tree),this.tree.addEventListener(`keydown`,e=>Kr(e,this.tree,(e,t)=>this.setExpanded(e.dataset.path,t))),this.tree.addEventListener(`focusin`,e=>{let t=e.target.closest(`[role="treeitem"]`);t&&(this.focusedPath=t.dataset.path??null)});let t=(e,t,n)=>{let r=document.createElement(`button`);return r.type=`button`,r.className=`toolbar-button`,r.setAttribute(`aria-label`,e),r.title=e,r.append(o(t)),r.addEventListener(`click`,n),r};this.actions=[t(`Refresh Explorer`,`refresh`,()=>e.refresh()),t(`Collapse Folders in Explorer`,`collapse-all`,()=>{this.expanded.clear(),this.saveExpanded(),this.render()})]}setProject(e,t){this.projectName=t,this.header.setAttribute(`aria-label`,`${t} folder`);let n=`fzv:explorer:${e}`;if(n!==this.storageKey){this.storageKey=n;try{let e=JSON.parse(localStorage.getItem(n)??`[]`);this.expanded=new Set(Array.isArray(e)?e:[])}catch{this.expanded=new Set}this.render()}}setEntries(e,t){let n={directories:new Map,files:[]},r=e=>{let t=n;if(e)for(let n of e.split(`/`)){let e=t.directories.get(n);e||(e={directories:new Map,files:[]},t.directories.set(n,e)),t=e}return t};for(let e of t)r(e.path);for(let t of e)r(t.path.slice(0,-t.name.length-1)).files.push(t);this.root=n,this.render()}setGitChanges(e){let t=new Map,n=e=>e.status===`U`?2:+(e.stage===`worktree`);for(let r of e){if(r.status===`D`)continue;let e=t.get(r.path);(!e||n(r)>=n(e))&&t.set(r.path,r)}let r=new Map;for(let e of t.values()){let t=e.path.split(`/`);for(let n=1;n<t.length;n++){let i=t.slice(0,n).join(`/`),a=r.get(i);(!a||Qr(e)>Qr(a))&&r.set(i,e)}}this.decorations=new Map;for(let[e,n]of t)this.decorations.set(e,{color:Yr(n),letter:qr(n),tooltip:Jr(n)});for(let[e,t]of r)this.decorations.set(e,{color:Yr(t),tooltip:`Contains emphasized items`});this.render()}reveal(e){if(e!==this.activePath){if(this.activePath=e,e){let t=e.split(`/`);for(let e=1;e<t.length;e++)this.expanded.add(t.slice(0,e).join(`/`));this.focusedPath=e}this.render(),this.tree.querySelector(`[aria-selected="true"]`)?.scrollIntoView({block:`nearest`})}}focus(){let e=this.tree.querySelector(`[tabindex="0"]`)??this.tree.querySelector(`[role="treeitem"]`);e?Gr(this.tree,e):this.header.focus()}setExpanded(e,t){t?this.expanded.add(e):this.expanded.delete(e),this.focusedPath=e,this.saveExpanded(),this.render()}saveExpanded(){try{this.storageKey&&localStorage.setItem(this.storageKey,JSON.stringify([...this.expanded]))}catch{}}render(){let e=this.tree.contains(document.activeElement);this.header.setAttribute(`aria-expanded`,String(this.open)),this.header.replaceChildren(o(this.open?`chevron-down`:`chevron-right`),this.projectName),this.tree.hidden=!this.open;let t=this.root?.directories.size===0&&!this.root.files.length;this.message.hidden=!this.open||this.root!==null&&!t,t&&(this.message.textContent=`No previewable files yet. Add a PDF, HTML, image, or text file.`);let n=[];this.root&&this.open&&this.addRows(n,this.root,``,1),this.tree.replaceChildren(...n);let r=n.find(e=>e.dataset.path===this.focusedPath)??n[0];r&&(r.tabIndex=0,e&&r.focus())}addRows(e,t,n,r){let i=[...t.directories.keys()].sort(Zr.compare);for(let a of i){let i=n+a,s=this.expanded.has(i),c=o(s?`chevron-down`:`chevron-right`);c.classList.add(`explorer-twistie`);let l=this.row(i,a,r,[c]);l.setAttribute(`aria-expanded`,String(s)),l.addEventListener(`click`,()=>this.setExpanded(i,!s)),e.push(l),s&&this.addRows(e,t.directories.get(a),`${i}/`,r+1)}let a=[...t.files].sort((e,t)=>Zr.compare(e.name,t.name));for(let t of a){let n=document.createElement(`span`);n.className=`explorer-twistie`;let i=this.row(t.path,t.name,r,[n,s(t)]);i.setAttribute(`aria-selected`,String(t.path===this.activePath)),i.addEventListener(`click`,()=>this.handlers.openFile(t)),e.push(i)}}row(e,t,n,r){let i=document.createElement(`div`);i.className=`explorer-row`,i.dataset.path=e,i.setAttribute(`role`,`treeitem`),i.setAttribute(`aria-level`,String(n)),i.tabIndex=-1;let a=this.decorations.get(e);i.title=a?`${e} • ${a.tooltip}`:e;let s=document.createElement(`span`);s.className=`explorer-indent`;for(let e=1;e<n;e++){let e=document.createElement(`span`);e.className=`indent-guide`,s.append(e)}r[0].style.paddingLeft=`${8*n}px`,i.append(s);let c=document.createElement(`span`);if(c.className=`explorer-label`,c.textContent=t,i.append(...r,c),a){i.classList.add(`git-${a.color}`,`decorated`);let e=a.letter?document.createElement(`span`):o(`circle-filled`);e.classList.add(`explorer-badge`),a.letter&&(e.textContent=a.letter),i.append(e)}return i}};function Z(e){let t=document.getElementById(e);if(!t)throw Error(`Missing UI element: ${e}`);return t}var ei=Z(`search`),Q=Z(`search-panel`),ti=Z(`results`),ni=Z(`result-count`),ri=Z(`refresh-files`),ii=Z(`notification`);Fr(Z(`theme-toggle`));var ai=[],oi=new e([]),si=``,ci=[],li=0,ui,di=0,fi=0,pi=0,mi,hi=!1,gi=!1,_i=``,vi,yi=``,bi;try{bi=window.localStorage}catch{}function xi(e){ii.textContent=e,ii.hidden=!1,clearTimeout(ui),ui=setTimeout(()=>{ii.hidden=!0},5e3)}function Si(e){let t=document.activeElement,n=window.getSelection(),r=n?Array.from({length:n.rangeCount},(e,t)=>n.getRangeAt(t).cloneRange()):[],i=window.scrollX,a=window.scrollY,o=document.createElement(`textarea`);o.value=e,o.readOnly=!0,o.setAttribute(`aria-hidden`,`true`),Object.assign(o.style,{position:`fixed`,left:`-10000px`,top:`0`,width:`1px`,height:`1px`,opacity:`0`,fontSize:`16px`}),document.body.append(o);let s=!1;try{o.focus({preventScroll:!0}),o.select(),s=document.execCommand(`copy`)}catch{s=!1}if(o.remove(),t instanceof HTMLElement&&t.isConnected&&t.focus({preventScroll:!0}),n){n.removeAllRanges();for(let e of r)n.addRange(e)}return window.scrollTo(i,a),s}async function Ci(e,t){try{await navigator.clipboard.writeText(e),xi(`${t} copied to clipboard.`)}catch{xi(Si(e)?`${t} copied to clipboard.`:`Could not copy ${t.toLowerCase()}.`)}}function wi(){bi&&si&&a(bi,si,$.snapshot())}function Ti(){let e=oi.search(ei.value);ci=e.files,li=Math.min(Math.max(li,0),Math.max(0,ci.length-1));let t=ci.map((e,t)=>{let n=document.createElement(`button`);n.type=`button`,n.className=`result monaco-list-row quick-input-list-entry`,n.title=e.path,n.setAttribute(`aria-label`,e.path),n.classList.toggle(`active`,e.path===$.activeTab?.file.path),n.classList.toggle(`keyboard-selected`,t===li&&document.activeElement===ei),e.path===$.activeTab?.file.path&&n.setAttribute(`aria-current`,`true`);let r=document.createElement(`span`);r.className=`result-text`;let i=document.createElement(`span`);i.className=`result-name`,i.textContent=e.name+(e.kind===`directory`?`/`:``);let a=document.createElement(`span`);return a.className=`result-path`,a.textContent=e.path,r.append(i,a),n.append(s(e),r),n.addEventListener(`click`,()=>ki(e)),n});if(ti.replaceChildren(...t),!ci.length){let e=document.createElement(`div`);e.className=`no-results`,e.textContent=ai.length?`No files match your search.`:`No previewable files yet. Add a PDF, HTML, image, or text file, then refresh.`,ti.append(e)}ni.textContent=ei.value.trim()?`${e.total} match${e.total===1?``:`es`}`:`${e.total} item${e.total===1?``:`s`}`,e.total>ci.length&&(ni.textContent+=` · showing ${ci.length}`)}function Ei(){$.focus()}function Di(e){zi.cancel(),e?(ei.value=``,li=0,Q.open||Q.showModal(),ei.focus(),Ti(),Li(!1)):(Q.close(),Ei())}function Oi(){Di(!0)}function ki(e){e.kind===`directory`?(ei.value=`${e.path}/`,li=0,ei.focus(),Ti()):($.open(e),Di(!1))}async function Ai(e){let t=ai.find(t=>t.path===e);if(t)$.open(t);else try{let t=await fetch(`/api/session-files?${new URLSearchParams({path:e})}`),[n]=t.ok?await t.json():[];n?$.open(n):xi(`${e} is not available.`)}catch(t){xi(`Could not open ${e}: ${t}`)}}async function ji(){if(!gi)return;vi?.abort();let e=new AbortController;vi=e;try{let t=await fetch(`/api/git/status`,{signal:e.signal});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();if(vi!==e)return;let r=JSON.stringify(n),i=yi!==``&&r!==yi;yi=r,$.setGitChanges(n.available?n.changes:[]),Bi.setGitChanges(n.available?n.changes:[]),Vi.setStatus(n);let a=Vi.count;Ui.setBadge(`scm`,a,`${a} pending change${a===1?``:`s`}`);let o=n.available?n.branch??`HEAD`:null;Z(`status-branch`).hidden=o===null,Z(`status-branch-name`).textContent=o??``,i&&$.reloadDiffs()}catch{}}function Mi(e){return[...new Set(e.version===1?e.tabs:e.groups.flatMap(e=>e.tabs.map(e=>e.path)))]}async function Ni(e){let t=[],n=[],r=0;for(let i of Mi(e)){let e=new URLSearchParams({path:i}).toString().length+7;e>12e3||((n.length===32||n.length>0&&r+e>12e3)&&(t.push(n),n=[],r=0),n.push(i),r+=e)}return n.length&&t.push(n),(await Promise.all(t.map(async e=>{let t=new URLSearchParams;for(let n of e)t.append(`path`,n);let n=await fetch(`/api/session-files?${t}`);if(!n.ok)throw Error(`HTTP ${n.status}`);return await n.json()}))).flat()}function Pi(t,n){return t<pi?!1:(pi=t,ai=n.files,oi=new e([...n.directories,...ai]),Bi.setEntries(ai,n.directories),!0)}function Fi(e){let{paths:t}=e;for(let e of $.tabs)(!t||Er(e.file)&&e.mode===`viewer`||t.some(t=>e.file.path===t||e.file.path.startsWith(`${t}/`)))&&$.reload(e);Li(!0),ji()}function Ii(e){mi=Ri(e).finally(()=>{mi=void 0,hi&&(hi=!1,Ii(`background`))})}function Li(e){mi?e&&(hi=!0):Ii(`background`)}async function Ri(e=`refresh`){let t=++fi;e!==`background`&&(ri.disabled=!0,ni.textContent=`Loading files…`);try{if(e===`initial`){let e=fetch(`/api/files`).then(async e=>e.ok?{data:await e.json()}:{error:Error(`HTTP ${e.status}`)},e=>({error:e})),n=await fetch(`/api/project`);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();r.watch&&new EventSource(`/api/events`).addEventListener(`change`,e=>Fi(JSON.parse(e.data))),si=r.id,Bi.setProject(r.id,r.name),gi=r.git===!0,gi&&Ui.add(Hi),ji(),Z(`project-name`).textContent=r.name,Z(`status-project`).textContent=r.name;let a=bi?i(bi,si):null,o=!1;if(a)try{$.restore(a,await Ni(a)),o=!0}catch{}let s=await e;if(`error`in s)throw s.error;let c=s.data;a&&!o&&$.restore(a,c.files),Pi(t,c),Ti()}else{let n=await fetch(`/api/files`);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();if(!Pi(t,r))return;si=r.project.id,Bi.setProject(r.project.id,r.project.name);let i=new Set(r.files.map(e=>e.path));Z(`project-name`).textContent=r.project.name,Z(`status-project`).textContent=r.project.name;for(let e of $.tabs)!e.diff&&!i.has(e.file.path)&&$.close(e);Ti(),e===`refresh`&&xi(`File list refreshed.`)}}catch(e){if(t!==fi)return;ni.textContent=`Could not load files`,xi(`Could not load the project: ${e}`)}finally{t===fi&&(ri.disabled=!1)}}ei.addEventListener(`input`,()=>{li=0,cancelAnimationFrame(di),di=requestAnimationFrame(Ti)}),ei.addEventListener(`focus`,Ti),ei.addEventListener(`blur`,()=>{for(let e of ti.children)e.classList.remove(`keyboard-selected`)}),ei.addEventListener(`keydown`,e=>{e.key===`Escape`?(e.preventDefault(),Di(!1)):([`Enter`,`ArrowDown`,`ArrowUp`].includes(e.key)&&(cancelAnimationFrame(di),Ti()),e.key===`Enter`&&ci[li]&&(e.preventDefault(),ki(ci[li])),(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),li=Math.max(0,Math.min(ci.length-1,li+(e.key===`ArrowDown`?1:-1))),Ti(),ti.children[li]?.scrollIntoView({block:`nearest`})))}),Q.addEventListener(`close`,()=>{Q.open||Ei()}),Q.addEventListener(`cancel`,e=>{e.preventDefault(),Di(!1)}),Q.addEventListener(`click`,e=>{if(e.target!==Q)return;let t=Q.getBoundingClientRect();(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&Di(!1)}),Z(`close-search`).addEventListener(`click`,()=>Di(!1)),Z(`find-file`).addEventListener(`click`,Oi),ri.addEventListener(`click`,()=>{Ri()}),window.addEventListener(`keydown`,e=>{if(e.defaultPrevented||e.isComposing||document.querySelector(`dialog[open]`))return;let t=document.activeElement,n=t instanceof HTMLElement&&(t.isContentEditable||!!t.closest(`input,textarea,select,[role="textbox"]`));if(e.altKey&&!e.ctrlKey&&!e.metaKey&&[`j`,`k`].includes(e.key.toLowerCase())){e.preventDefault(),$.cycle(e.key.toLowerCase()===`j`?1:-1);return}if((e.ctrlKey||e.metaKey)&&!e.altKey&&!Q.open){let t=e.key.toLowerCase();if(e.shiftKey&&t===`e`){e.preventDefault(),Ui.toggleFocus(`explorer`);return}if(e.shiftKey&&t===`g`&&gi){e.preventDefault(),Ui.toggleFocus(`scm`);return}if(!e.shiftKey&&t===`b`){e.preventDefault(),Ui.toggle();return}}if(e.ctrlKey&&e.key===`Tab`){e.preventDefault(),$.cycle(e.shiftKey?-1:1);return}if(!n&&(e.ctrlKey||e.metaKey)&&!e.altKey&&!Q.open){if(e.code===`Backslash`){e.preventDefault(),$.splitActive(e.shiftKey?`down`:`right`);return}if(/^[1-9]$/.test(e.key)){e.preventDefault(),$.focusGroup(Number(e.key)-1);return}}let r=$.activeTab;if(e.key===`F5`&&e.altKey&&!e.ctrlKey&&!e.metaKey){$.navigateChange(e.shiftKey?-1:1)&&e.preventDefault();return}let i=_i;if(_i=``,!n&&r?.diff&&!e.ctrlKey&&!e.metaKey&&!e.altKey){if(i&&e.key===`c`){e.preventDefault(),$.navigateChange(i===`]`?1:-1);return}if(e.key===`]`||e.key===`[`){e.preventDefault(),_i=e.key;return}}if(!n&&(e.ctrlKey||e.metaKey)&&!e.altKey&&r?.file.kind===`image`){let t=[`+`,`=`].includes(e.key)?`.image-zoom-in`:[`-`,`_`].includes(e.key)?`.image-zoom-out`:e.key===`0`?`.image-fit`:null;t&&(e.preventDefault(),r.pane.element.querySelector(t)?.click())}});var zi=Ir({onSearch:Oi,onScroll:e=>{let t=$.activeTab;if(!t||t.file.kind!==`html`||t.mode!==`viewer`)return!1;let n=t.pane.element.querySelector(`iframe`);return n?.contentWindow?(n.contentWindow.postMessage({type:`fzv:scroll`,key:e},`*`),!0):!1},onHintActivate:e=>!(e instanceof HTMLIFrameElement)||!$.frameTab(e.contentWindow)?!1:($.activateFrame(e),e.contentWindow?.postMessage({type:`fzv:show-hints`},`*`),!0),onReload:()=>{Q.open||$.reload()},getScrollRoot:()=>Q.open?ti:[...$.activeTab?.pane.element.querySelectorAll(`.source-preview, .viewer-surface, .pdf-scroll, .diff-scroll`)??[]].find(e=>e.getClientRects().length>0)??null}),Bi=new $r({openFile:e=>{$.open(e),Ui.afterOpen()},refresh:()=>void Ri()}),Vi=new Xr({openChange:e=>{$.openDiff(e),Ui.afterOpen()},openFile:e=>{Ai(e),Ui.afterOpen()},refresh:()=>void ji()}),Hi={id:`scm`,title:`Source Control`,icon:`source-control`,keybinding:`Ctrl+Shift+G`,element:Vi.element,actions:Vi.actions,focus:()=>Vi.focus()},Ui=new Hr(Z(`activity-bar`),Z(`sidebar`),Z(`sidebar-title`),Z(`sidebar-actions`),Z(`sidebar-content`),Z(`sidebar-sash`)),$=new Nr(Z(`preview`),()=>{zi.cancel();let e=$.activeTab;document.title=e?`${e.file.name} — fzv`:`fzv`;let n=$.tabs.length;Z(`tab-count`).textContent=`${n} open tab${n===1?``:`s`}`,Ti(),Bi.reveal(e&&e.diff?.stage!==`index`?e.file.path:null),Vi.setActive(e?t(e.file.path,e.diff):null),wi()},(e,t)=>void Ci(e,t),e=>void Ai(e));Ui.add({id:`explorer`,title:`Explorer`,icon:`files`,keybinding:`Ctrl+Shift+E`,element:Bi.element,actions:Bi.actions,focus:()=>Bi.focus()}),Z(`status-branch`).addEventListener(`click`,()=>Ui.show(`scm`)),window.addEventListener(`focus`,()=>void ji()),window.addEventListener(`message`,e=>{if(e.origin!==`null`)return;let t=$.frameTab(e.source);t&&(e.data?.type===`fzv:focus`?$.activateFrame(t.pane.element.querySelector(`iframe`)):t===$.activeTab&&e.data?.type===`fzv:shortcut`&&(e.data.key===`/`&&Oi(),e.data.key===`r`&&$.reload(),e.data.key===`f`&&!Q.open&&($.focus(),zi.showHints())))}),Ii(`initial`);export{T as t};
|