@aaa_iii/fzv 0.2.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 +17 -1
- package/README.md +17 -1
- package/THIRD_PARTY_NOTICES.md +4 -1
- package/dist/client/assets/{c-BrjaNpVh.js → c-DbF230Kq.js} +1 -1
- package/dist/client/assets/{cpp-BIxKXcra.js → cpp-4Vg3XxcV.js} +1 -1
- package/dist/client/assets/{highlight-hBTJsM0d.js → highlight-CYo2BdOL.js} +4 -4
- package/dist/client/assets/index-BqkhaGwN.js +69 -0
- package/dist/client/assets/{index-CmRL0QNk.css → index-CUTCg_dk.css} +1 -1
- package/dist/client/assets/{java-D_0z2NwT.js → java-B44aWtXw.js} +1 -1
- package/dist/client/assets/{jsx-Dyxbavxn.js → jsx-CpUrIMpC.js} +1 -1
- package/dist/client/assets/{latex-D_hv-EHy.js → latex-DGDTr05l.js} +1 -1
- package/dist/client/assets/{lua-BkwxsP7-.js → lua-BG0o5O3J.js} +1 -1
- package/dist/client/assets/{pdf-CIufTche.js → pdf-Bl0IIfym.js} +1 -1
- package/dist/client/assets/{r-B-o4EwkG.js → r-DVnxg6z5.js} +1 -1
- package/dist/client/assets/{ruby-C11HOYlt.js → ruby-BZOK9uNJ.js} +1 -1
- package/dist/client/assets/{tsx-BIbTecDf.js → tsx-5hb28Oy_.js} +1 -1
- package/dist/client/assets/{typescript-BMg-mt7U.js → typescript-c0BGdOyD.js} +1 -1
- package/dist/client/assets/worker-12brr2uW.js +4 -0
- package/dist/client/assets/{xml-BQ9PLRGp.js → xml-CFUy4_Y5.js} +1 -1
- package/dist/client/index.html +105 -2
- package/dist/navigation.js +2 -2
- package/dist/server/cli.js +4 -2
- package/dist/server/git.js +131 -0
- package/dist/server/office.js +1 -1
- package/dist/server/server.js +26 -2
- package/dist/shared.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/index-DmtUQAD5.js +0 -69
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
(function(){function e(e,t,n=(e,t)=>e===t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!n(e[r],t[r]))return!1;return!0}function*t(e,t){let n,r;for(let i of e)r!==void 0&&t(r,i)?n.push(i):(n&&(yield n),n=[i]),r=i;n&&(yield n)}function n(e,t){for(let n=0;n<=e.length;n++)t(n===0?void 0:e[n-1],n===e.length?void 0:e[n])}function r(e,t){for(let n=0;n<e.length;n++)t(n===0?void 0:e[n-1],e[n],n+1===e.length?void 0:e[n+1])}function i(e,t){for(let n of t)e.push(n)}function a(e,t){return(n,r)=>t(e(n),e(r))}let o=(e,t)=>e-t;function s(e){return(t,n)=>-e(t,n)}function c(e){console.error(e)}var l=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function u(e){e()||(e(),c(new l(`Assertion Failed`)))}function d(e,t){let n=0;for(;n<e.length-1;){let r=e[n],i=e[n+1];if(!t(r,i))return!1;n++}return!0}var f=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 l(`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 l(`Invalid clipping range: ${this.toString()}`);return Math.max(this.start,Math.min(this.endExclusive-1,e))}clipCyclic(e){if(this.isEmpty)throw new l(`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 l(`Invalid join: ${this.toString()} and ${t.toString()}`);return new e(this.start,t.endExclusive)}},p=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}}},m=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 p(e.endLineNumber,e.endColumn)}getStartPosition(){return e.getStartPosition(this)}static getStartPosition(e){return new p(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 h(e,t){let n=g(e,t);return n===-1?void 0:e[n]}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])?i=n+1:a=n}return i-1}function _(e,t){let n=v(e,t);return n===e.length?void 0:e[n]}function v(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 y=class e{_array;static assertInvariants=!1;_findLastMonotonousLastIdx=0;_prevFindLastPredicate;constructor(e){this._array=e}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let e of this._array)if(this._prevFindLastPredicate(e)&&!t(e))throw Error(`MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.`)}this._prevFindLastPredicate=t}let n=g(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}},b=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=a(e=>e.startLineNumber,o);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 x(e[0].slice());for(let n=1;n<e.length;n++)t=t.getUnion(new x(e[n].slice()));return t.ranges}static join(t){if(t.length===0)throw new l(`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 l(`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 m(this.startLineNumber,1,this.endLineNumberExclusive-1,2**53-1)}toExclusiveRange(){return new m(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 f(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)}},x=class e{_normalizedRanges;constructor(e=[]){this._normalizedRanges=e}get ranges(){return this._normalizedRanges}addRange(e){if(e.length===0)return;let t=v(this._normalizedRanges,t=>t.endLineNumberExclusive>=e.startLineNumber),n=g(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=h(this._normalizedRanges,t=>t.startLineNumber<=e);return!!t&&t.endLineNumberExclusive>e}intersects(e){let t=h(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 b(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=v(this._normalizedRanges,e=>e.endLineNumberExclusive>=t.startLineNumber),r=g(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 b(a,t.startLineNumber)),a=t.endLineNumberExclusive}return a<t.endLineNumberExclusive&&i.push(new b(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)))}},S=class{},C=class extends S{lines;constructor(e){super(),this.lines=e}get length(){return{lineCount:this.lines.length-1}}getLineLength(e){return this.lines[e-1].length}},w=class{changes;moves;hitTimeout;constructor(e,t,n){this.changes=e,this.moves=t,this.hitTimeout=n}},T=class e{lineRangeMapping;changes;constructor(e,t){this.lineRangeMapping=e,this.changes=t}flip(){return new e(this.lineRangeMapping.flip(),this.changes.map(e=>e.flip()))}},E=class e{static inverse(t,n,r){let i=[],a=1,o=1;for(let n of t){let t=new e(new b(a,n.original.startLineNumber),new b(o,n.modified.startLineNumber));t.modified.isEmpty||i.push(t),a=n.original.endLineNumberExclusive,o=n.modified.endLineNumberExclusive}let s=new e(new b(a,n+1),new b(o,r+1));return s.modified.isEmpty||i.push(s),i}static clip(t,n,r){let i=[];for(let a of t){let t=a.original.intersect(n),o=a.modified.intersect(r);t&&!t.isEmpty&&o&&!o.isEmpty&&i.push(new e(t,o))}return i}original;modified;constructor(e,t){this.original=e,this.modified=t}toString(){return`{${this.original.toString()}->${this.modified.toString()}}`}flip(){return new e(this.modified,this.original)}join(t){return new e(this.original.join(t.original),this.modified.join(t.modified))}get changedLineCount(){return Math.max(this.original.length,this.modified.length)}toRangeMapping(){let e=this.original.toInclusiveRange(),t=this.modified.toInclusiveRange();if(e&&t)return new A(e,t);if(this.original.startLineNumber===1||this.modified.startLineNumber===1){if(this.modified.startLineNumber!==1||this.original.startLineNumber!==1)throw new l(`not a valid diff`);return new A(new m(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new m(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1))}return new A(new m(this.original.startLineNumber-1,2**53-1,this.original.endLineNumberExclusive-1,2**53-1),new m(this.modified.startLineNumber-1,2**53-1,this.modified.endLineNumberExclusive-1,2**53-1))}toRangeMapping2(e,t){if(O(this.original.endLineNumberExclusive,e)&&O(this.modified.endLineNumberExclusive,t))return new A(new m(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new m(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1));if(!this.original.isEmpty&&!this.modified.isEmpty)return new A(m.fromPositions(new p(this.original.startLineNumber,1),D(new p(this.original.endLineNumberExclusive-1,2**53-1),e)),m.fromPositions(new p(this.modified.startLineNumber,1),D(new p(this.modified.endLineNumberExclusive-1,2**53-1),t)));if(this.original.startLineNumber>1&&this.modified.startLineNumber>1)return new A(m.fromPositions(D(new p(this.original.startLineNumber-1,2**53-1),e),D(new p(this.original.endLineNumberExclusive-1,2**53-1),e)),m.fromPositions(D(new p(this.modified.startLineNumber-1,2**53-1),t),D(new p(this.modified.endLineNumberExclusive-1,2**53-1),t)));throw new l}};function D(e,t){if(e.lineNumber<1)return new p(1,1);if(e.lineNumber>t.length)return new p(t.length,t[t.length-1].length+1);let n=t[e.lineNumber-1];return e.column>n.length+1?new p(e.lineNumber,n.length+1):e}function O(e,t){return e>=1&&e<=t.length}var k=class e extends E{static fromRangeMappings(t){let n=b.join(t.map(e=>b.fromRangeInclusive(e.originalRange))),r=b.join(t.map(e=>b.fromRangeInclusive(e.modifiedRange)));return new e(n,r,t)}innerChanges;constructor(e,t,n){super(e,t),this.innerChanges=n}flip(){return new e(this.modified,this.original,this.innerChanges?.map(e=>e.flip()))}withInnerChangesFromLineRanges(){return new e(this.original,this.modified,[this.toRangeMapping()])}},A=class e{static join(e){if(e.length===0)throw new l(`Cannot join an empty list of range mappings`);let t=e[0];for(let n=1;n<e.length;n++)t=t.join(e[n]);return t}static assertSorted(e){for(let t=1;t<e.length;t++){let n=e[t-1],r=e[t];if(!(n.originalRange.getEndPosition().isBeforeOrEqual(r.originalRange.getStartPosition())&&n.modifiedRange.getEndPosition().isBeforeOrEqual(r.modifiedRange.getStartPosition())))throw new l(`Range mappings must be sorted`)}}originalRange;modifiedRange;constructor(e,t){this.originalRange=e,this.modifiedRange=t}toString(){return`{${this.originalRange.toString()}->${this.modifiedRange.toString()}}`}flip(){return new e(this.modifiedRange,this.originalRange)}join(t){return new e(this.originalRange.plusRange(t.originalRange),this.modifiedRange.plusRange(t.modifiedRange))}};function j(e,n,r,i=!1){let a=[];for(let i of t(e.map(e=>ee(e,n,r)),(e,t)=>e.original.intersectsOrTouches(t.original)||e.modified.intersectsOrTouches(t.modified))){let e=i[0],t=i[i.length-1];a.push(new k(e.original.join(t.original),e.modified.join(t.modified),i.map(e=>e.innerChanges[0])))}return u(()=>!i&&a.length>0&&(a[0].modified.startLineNumber!==a[0].original.startLineNumber||r.length.lineCount-a[a.length-1].modified.endLineNumberExclusive!==n.length.lineCount-a[a.length-1].original.endLineNumberExclusive)?!1:d(a,(e,t)=>t.original.startLineNumber-e.original.endLineNumberExclusive===t.modified.startLineNumber-e.modified.endLineNumberExclusive&&e.original.endLineNumberExclusive<t.original.startLineNumber&&e.modified.endLineNumberExclusive<t.modified.startLineNumber)),a}function ee(e,t,n){let r=0,i=0;return e.modifiedRange.endColumn===1&&e.originalRange.endColumn===1&&e.originalRange.startLineNumber+r<=e.originalRange.endLineNumber&&e.modifiedRange.startLineNumber+r<=e.modifiedRange.endLineNumber&&(i=-1),e.modifiedRange.startColumn-1>=n.getLineLength(e.modifiedRange.startLineNumber)&&e.originalRange.startColumn-1>=t.getLineLength(e.originalRange.startLineNumber)&&e.originalRange.startLineNumber<=e.originalRange.endLineNumber+i&&e.modifiedRange.startLineNumber<=e.modifiedRange.endLineNumber+i&&(r=1),new k(new b(e.originalRange.startLineNumber+r,e.originalRange.endLineNumber+1+i),new b(e.modifiedRange.startLineNumber+r,e.modifiedRange.endLineNumber+1+i),[e])}var M=class e{diffs;hitTimeout;static trivial(t,n){return new e([new N(f.ofLength(t.length),f.ofLength(n.length))],!1)}static trivialTimedOut(t,n){return new e([new N(f.ofLength(t.length),f.ofLength(n.length))],!0)}constructor(e,t){this.diffs=e,this.hitTimeout=t}},N=class e{seq1Range;seq2Range;static invert(t,r){let i=[];return n(t,(t,n)=>{i.push(e.fromOffsetPairs(t?t.getEndExclusives():P.zero,n?n.getStarts():new P(r,(t?t.seq2Range.endExclusive-t.seq1Range.endExclusive:0)+r)))}),i}static fromOffsetPairs(t,n){return new e(new f(t.offset1,n.offset1),new f(t.offset2,n.offset2))}static assertSorted(e){let t;for(let n of e){if(t&&!(t.seq1Range.endExclusive<=n.seq1Range.start&&t.seq2Range.endExclusive<=n.seq2Range.start))throw new l(`Sequence diffs must be sorted`);t=n}}constructor(e,t){this.seq1Range=e,this.seq2Range=t}swap(){return new e(this.seq2Range,this.seq1Range)}toString(){return`${this.seq1Range} <-> ${this.seq2Range}`}join(t){return new e(this.seq1Range.join(t.seq1Range),this.seq2Range.join(t.seq2Range))}delta(t){return t===0?this:new e(this.seq1Range.delta(t),this.seq2Range.delta(t))}deltaStart(t){return t===0?this:new e(this.seq1Range.deltaStart(t),this.seq2Range.deltaStart(t))}deltaEnd(t){return t===0?this:new e(this.seq1Range.deltaEnd(t),this.seq2Range.deltaEnd(t))}intersectsOrTouches(e){return this.seq1Range.intersectsOrTouches(e.seq1Range)||this.seq2Range.intersectsOrTouches(e.seq2Range)}intersect(t){let n=this.seq1Range.intersect(t.seq1Range),r=this.seq2Range.intersect(t.seq2Range);if(n&&r)return new e(n,r)}getStarts(){return new P(this.seq1Range.start,this.seq2Range.start)}getEndExclusives(){return new P(this.seq1Range.endExclusive,this.seq2Range.endExclusive)}},P=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}},F=class e{static instance=new e;isValid(){return!0}},te=class{timeout;startTime=Date.now();valid=!0;constructor(e){if(this.timeout=e,e<=0)throw new l(`timeout must be positive`)}isValid(){return!(Date.now()-this.startTime<this.timeout)&&this.valid&&(this.valid=!1),this.valid}disable(){this.timeout=2**53-1,this.isValid=()=>!0,this.valid=!0}};let I=/* @__PURE__ */ function(e){return e[e.Null=0]=`Null`,e[e.Backspace=8]=`Backspace`,e[e.Tab=9]=`Tab`,e[e.LineFeed=10]=`LineFeed`,e[e.CarriageReturn=13]=`CarriageReturn`,e[e.Space=32]=`Space`,e[e.ExclamationMark=33]=`ExclamationMark`,e[e.DoubleQuote=34]=`DoubleQuote`,e[e.Hash=35]=`Hash`,e[e.DollarSign=36]=`DollarSign`,e[e.PercentSign=37]=`PercentSign`,e[e.Ampersand=38]=`Ampersand`,e[e.SingleQuote=39]=`SingleQuote`,e[e.OpenParen=40]=`OpenParen`,e[e.CloseParen=41]=`CloseParen`,e[e.Asterisk=42]=`Asterisk`,e[e.Plus=43]=`Plus`,e[e.Comma=44]=`Comma`,e[e.Dash=45]=`Dash`,e[e.Period=46]=`Period`,e[e.Slash=47]=`Slash`,e[e.Digit0=48]=`Digit0`,e[e.Digit1=49]=`Digit1`,e[e.Digit2=50]=`Digit2`,e[e.Digit3=51]=`Digit3`,e[e.Digit4=52]=`Digit4`,e[e.Digit5=53]=`Digit5`,e[e.Digit6=54]=`Digit6`,e[e.Digit7=55]=`Digit7`,e[e.Digit8=56]=`Digit8`,e[e.Digit9=57]=`Digit9`,e[e.Colon=58]=`Colon`,e[e.Semicolon=59]=`Semicolon`,e[e.LessThan=60]=`LessThan`,e[e.Equals=61]=`Equals`,e[e.GreaterThan=62]=`GreaterThan`,e[e.QuestionMark=63]=`QuestionMark`,e[e.AtSign=64]=`AtSign`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.OpenSquareBracket=91]=`OpenSquareBracket`,e[e.Backslash=92]=`Backslash`,e[e.CloseSquareBracket=93]=`CloseSquareBracket`,e[e.Caret=94]=`Caret`,e[e.Underline=95]=`Underline`,e[e.BackTick=96]=`BackTick`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.OpenCurlyBrace=123]=`OpenCurlyBrace`,e[e.Pipe=124]=`Pipe`,e[e.CloseCurlyBrace=125]=`CloseCurlyBrace`,e[e.Tilde=126]=`Tilde`,e[e.NoBreakSpace=160]=`NoBreakSpace`,e[e.U_Combining_Grave_Accent=768]=`U_Combining_Grave_Accent`,e[e.U_Combining_Acute_Accent=769]=`U_Combining_Acute_Accent`,e[e.U_Combining_Circumflex_Accent=770]=`U_Combining_Circumflex_Accent`,e[e.U_Combining_Tilde=771]=`U_Combining_Tilde`,e[e.U_Combining_Macron=772]=`U_Combining_Macron`,e[e.U_Combining_Overline=773]=`U_Combining_Overline`,e[e.U_Combining_Breve=774]=`U_Combining_Breve`,e[e.U_Combining_Dot_Above=775]=`U_Combining_Dot_Above`,e[e.U_Combining_Diaeresis=776]=`U_Combining_Diaeresis`,e[e.U_Combining_Hook_Above=777]=`U_Combining_Hook_Above`,e[e.U_Combining_Ring_Above=778]=`U_Combining_Ring_Above`,e[e.U_Combining_Double_Acute_Accent=779]=`U_Combining_Double_Acute_Accent`,e[e.U_Combining_Caron=780]=`U_Combining_Caron`,e[e.U_Combining_Vertical_Line_Above=781]=`U_Combining_Vertical_Line_Above`,e[e.U_Combining_Double_Vertical_Line_Above=782]=`U_Combining_Double_Vertical_Line_Above`,e[e.U_Combining_Double_Grave_Accent=783]=`U_Combining_Double_Grave_Accent`,e[e.U_Combining_Candrabindu=784]=`U_Combining_Candrabindu`,e[e.U_Combining_Inverted_Breve=785]=`U_Combining_Inverted_Breve`,e[e.U_Combining_Turned_Comma_Above=786]=`U_Combining_Turned_Comma_Above`,e[e.U_Combining_Comma_Above=787]=`U_Combining_Comma_Above`,e[e.U_Combining_Reversed_Comma_Above=788]=`U_Combining_Reversed_Comma_Above`,e[e.U_Combining_Comma_Above_Right=789]=`U_Combining_Comma_Above_Right`,e[e.U_Combining_Grave_Accent_Below=790]=`U_Combining_Grave_Accent_Below`,e[e.U_Combining_Acute_Accent_Below=791]=`U_Combining_Acute_Accent_Below`,e[e.U_Combining_Left_Tack_Below=792]=`U_Combining_Left_Tack_Below`,e[e.U_Combining_Right_Tack_Below=793]=`U_Combining_Right_Tack_Below`,e[e.U_Combining_Left_Angle_Above=794]=`U_Combining_Left_Angle_Above`,e[e.U_Combining_Horn=795]=`U_Combining_Horn`,e[e.U_Combining_Left_Half_Ring_Below=796]=`U_Combining_Left_Half_Ring_Below`,e[e.U_Combining_Up_Tack_Below=797]=`U_Combining_Up_Tack_Below`,e[e.U_Combining_Down_Tack_Below=798]=`U_Combining_Down_Tack_Below`,e[e.U_Combining_Plus_Sign_Below=799]=`U_Combining_Plus_Sign_Below`,e[e.U_Combining_Minus_Sign_Below=800]=`U_Combining_Minus_Sign_Below`,e[e.U_Combining_Palatalized_Hook_Below=801]=`U_Combining_Palatalized_Hook_Below`,e[e.U_Combining_Retroflex_Hook_Below=802]=`U_Combining_Retroflex_Hook_Below`,e[e.U_Combining_Dot_Below=803]=`U_Combining_Dot_Below`,e[e.U_Combining_Diaeresis_Below=804]=`U_Combining_Diaeresis_Below`,e[e.U_Combining_Ring_Below=805]=`U_Combining_Ring_Below`,e[e.U_Combining_Comma_Below=806]=`U_Combining_Comma_Below`,e[e.U_Combining_Cedilla=807]=`U_Combining_Cedilla`,e[e.U_Combining_Ogonek=808]=`U_Combining_Ogonek`,e[e.U_Combining_Vertical_Line_Below=809]=`U_Combining_Vertical_Line_Below`,e[e.U_Combining_Bridge_Below=810]=`U_Combining_Bridge_Below`,e[e.U_Combining_Inverted_Double_Arch_Below=811]=`U_Combining_Inverted_Double_Arch_Below`,e[e.U_Combining_Caron_Below=812]=`U_Combining_Caron_Below`,e[e.U_Combining_Circumflex_Accent_Below=813]=`U_Combining_Circumflex_Accent_Below`,e[e.U_Combining_Breve_Below=814]=`U_Combining_Breve_Below`,e[e.U_Combining_Inverted_Breve_Below=815]=`U_Combining_Inverted_Breve_Below`,e[e.U_Combining_Tilde_Below=816]=`U_Combining_Tilde_Below`,e[e.U_Combining_Macron_Below=817]=`U_Combining_Macron_Below`,e[e.U_Combining_Low_Line=818]=`U_Combining_Low_Line`,e[e.U_Combining_Double_Low_Line=819]=`U_Combining_Double_Low_Line`,e[e.U_Combining_Tilde_Overlay=820]=`U_Combining_Tilde_Overlay`,e[e.U_Combining_Short_Stroke_Overlay=821]=`U_Combining_Short_Stroke_Overlay`,e[e.U_Combining_Long_Stroke_Overlay=822]=`U_Combining_Long_Stroke_Overlay`,e[e.U_Combining_Short_Solidus_Overlay=823]=`U_Combining_Short_Solidus_Overlay`,e[e.U_Combining_Long_Solidus_Overlay=824]=`U_Combining_Long_Solidus_Overlay`,e[e.U_Combining_Right_Half_Ring_Below=825]=`U_Combining_Right_Half_Ring_Below`,e[e.U_Combining_Inverted_Bridge_Below=826]=`U_Combining_Inverted_Bridge_Below`,e[e.U_Combining_Square_Below=827]=`U_Combining_Square_Below`,e[e.U_Combining_Seagull_Below=828]=`U_Combining_Seagull_Below`,e[e.U_Combining_X_Above=829]=`U_Combining_X_Above`,e[e.U_Combining_Vertical_Tilde=830]=`U_Combining_Vertical_Tilde`,e[e.U_Combining_Double_Overline=831]=`U_Combining_Double_Overline`,e[e.U_Combining_Grave_Tone_Mark=832]=`U_Combining_Grave_Tone_Mark`,e[e.U_Combining_Acute_Tone_Mark=833]=`U_Combining_Acute_Tone_Mark`,e[e.U_Combining_Greek_Perispomeni=834]=`U_Combining_Greek_Perispomeni`,e[e.U_Combining_Greek_Koronis=835]=`U_Combining_Greek_Koronis`,e[e.U_Combining_Greek_Dialytika_Tonos=836]=`U_Combining_Greek_Dialytika_Tonos`,e[e.U_Combining_Greek_Ypogegrammeni=837]=`U_Combining_Greek_Ypogegrammeni`,e[e.U_Combining_Bridge_Above=838]=`U_Combining_Bridge_Above`,e[e.U_Combining_Equals_Sign_Below=839]=`U_Combining_Equals_Sign_Below`,e[e.U_Combining_Double_Vertical_Line_Below=840]=`U_Combining_Double_Vertical_Line_Below`,e[e.U_Combining_Left_Angle_Below=841]=`U_Combining_Left_Angle_Below`,e[e.U_Combining_Not_Tilde_Above=842]=`U_Combining_Not_Tilde_Above`,e[e.U_Combining_Homothetic_Above=843]=`U_Combining_Homothetic_Above`,e[e.U_Combining_Almost_Equal_To_Above=844]=`U_Combining_Almost_Equal_To_Above`,e[e.U_Combining_Left_Right_Arrow_Below=845]=`U_Combining_Left_Right_Arrow_Below`,e[e.U_Combining_Upwards_Arrow_Below=846]=`U_Combining_Upwards_Arrow_Below`,e[e.U_Combining_Grapheme_Joiner=847]=`U_Combining_Grapheme_Joiner`,e[e.U_Combining_Right_Arrowhead_Above=848]=`U_Combining_Right_Arrowhead_Above`,e[e.U_Combining_Left_Half_Ring_Above=849]=`U_Combining_Left_Half_Ring_Above`,e[e.U_Combining_Fermata=850]=`U_Combining_Fermata`,e[e.U_Combining_X_Below=851]=`U_Combining_X_Below`,e[e.U_Combining_Left_Arrowhead_Below=852]=`U_Combining_Left_Arrowhead_Below`,e[e.U_Combining_Right_Arrowhead_Below=853]=`U_Combining_Right_Arrowhead_Below`,e[e.U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below=854]=`U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below`,e[e.U_Combining_Right_Half_Ring_Above=855]=`U_Combining_Right_Half_Ring_Above`,e[e.U_Combining_Dot_Above_Right=856]=`U_Combining_Dot_Above_Right`,e[e.U_Combining_Asterisk_Below=857]=`U_Combining_Asterisk_Below`,e[e.U_Combining_Double_Ring_Below=858]=`U_Combining_Double_Ring_Below`,e[e.U_Combining_Zigzag_Above=859]=`U_Combining_Zigzag_Above`,e[e.U_Combining_Double_Breve_Below=860]=`U_Combining_Double_Breve_Below`,e[e.U_Combining_Double_Breve=861]=`U_Combining_Double_Breve`,e[e.U_Combining_Double_Macron=862]=`U_Combining_Double_Macron`,e[e.U_Combining_Double_Macron_Below=863]=`U_Combining_Double_Macron_Below`,e[e.U_Combining_Double_Tilde=864]=`U_Combining_Double_Tilde`,e[e.U_Combining_Double_Inverted_Breve=865]=`U_Combining_Double_Inverted_Breve`,e[e.U_Combining_Double_Rightwards_Arrow_Below=866]=`U_Combining_Double_Rightwards_Arrow_Below`,e[e.U_Combining_Latin_Small_Letter_A=867]=`U_Combining_Latin_Small_Letter_A`,e[e.U_Combining_Latin_Small_Letter_E=868]=`U_Combining_Latin_Small_Letter_E`,e[e.U_Combining_Latin_Small_Letter_I=869]=`U_Combining_Latin_Small_Letter_I`,e[e.U_Combining_Latin_Small_Letter_O=870]=`U_Combining_Latin_Small_Letter_O`,e[e.U_Combining_Latin_Small_Letter_U=871]=`U_Combining_Latin_Small_Letter_U`,e[e.U_Combining_Latin_Small_Letter_C=872]=`U_Combining_Latin_Small_Letter_C`,e[e.U_Combining_Latin_Small_Letter_D=873]=`U_Combining_Latin_Small_Letter_D`,e[e.U_Combining_Latin_Small_Letter_H=874]=`U_Combining_Latin_Small_Letter_H`,e[e.U_Combining_Latin_Small_Letter_M=875]=`U_Combining_Latin_Small_Letter_M`,e[e.U_Combining_Latin_Small_Letter_R=876]=`U_Combining_Latin_Small_Letter_R`,e[e.U_Combining_Latin_Small_Letter_T=877]=`U_Combining_Latin_Small_Letter_T`,e[e.U_Combining_Latin_Small_Letter_V=878]=`U_Combining_Latin_Small_Letter_V`,e[e.U_Combining_Latin_Small_Letter_X=879]=`U_Combining_Latin_Small_Letter_X`,e[e.LINE_SEPARATOR=8232]=`LINE_SEPARATOR`,e[e.PARAGRAPH_SEPARATOR=8233]=`PARAGRAPH_SEPARATOR`,e[e.NEXT_LINE=133]=`NEXT_LINE`,e[e.U_CIRCUMFLEX=94]=`U_CIRCUMFLEX`,e[e.U_GRAVE_ACCENT=96]=`U_GRAVE_ACCENT`,e[e.U_DIAERESIS=168]=`U_DIAERESIS`,e[e.U_MACRON=175]=`U_MACRON`,e[e.U_ACUTE_ACCENT=180]=`U_ACUTE_ACCENT`,e[e.U_CEDILLA=184]=`U_CEDILLA`,e[e.U_MODIFIER_LETTER_LEFT_ARROWHEAD=706]=`U_MODIFIER_LETTER_LEFT_ARROWHEAD`,e[e.U_MODIFIER_LETTER_RIGHT_ARROWHEAD=707]=`U_MODIFIER_LETTER_RIGHT_ARROWHEAD`,e[e.U_MODIFIER_LETTER_UP_ARROWHEAD=708]=`U_MODIFIER_LETTER_UP_ARROWHEAD`,e[e.U_MODIFIER_LETTER_DOWN_ARROWHEAD=709]=`U_MODIFIER_LETTER_DOWN_ARROWHEAD`,e[e.U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING=722]=`U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING`,e[e.U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING=723]=`U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING`,e[e.U_MODIFIER_LETTER_UP_TACK=724]=`U_MODIFIER_LETTER_UP_TACK`,e[e.U_MODIFIER_LETTER_DOWN_TACK=725]=`U_MODIFIER_LETTER_DOWN_TACK`,e[e.U_MODIFIER_LETTER_PLUS_SIGN=726]=`U_MODIFIER_LETTER_PLUS_SIGN`,e[e.U_MODIFIER_LETTER_MINUS_SIGN=727]=`U_MODIFIER_LETTER_MINUS_SIGN`,e[e.U_BREVE=728]=`U_BREVE`,e[e.U_DOT_ABOVE=729]=`U_DOT_ABOVE`,e[e.U_RING_ABOVE=730]=`U_RING_ABOVE`,e[e.U_OGONEK=731]=`U_OGONEK`,e[e.U_SMALL_TILDE=732]=`U_SMALL_TILDE`,e[e.U_DOUBLE_ACUTE_ACCENT=733]=`U_DOUBLE_ACUTE_ACCENT`,e[e.U_MODIFIER_LETTER_RHOTIC_HOOK=734]=`U_MODIFIER_LETTER_RHOTIC_HOOK`,e[e.U_MODIFIER_LETTER_CROSS_ACCENT=735]=`U_MODIFIER_LETTER_CROSS_ACCENT`,e[e.U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR=741]=`U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR`,e[e.U_MODIFIER_LETTER_HIGH_TONE_BAR=742]=`U_MODIFIER_LETTER_HIGH_TONE_BAR`,e[e.U_MODIFIER_LETTER_MID_TONE_BAR=743]=`U_MODIFIER_LETTER_MID_TONE_BAR`,e[e.U_MODIFIER_LETTER_LOW_TONE_BAR=744]=`U_MODIFIER_LETTER_LOW_TONE_BAR`,e[e.U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR=745]=`U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR`,e[e.U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK=746]=`U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK`,e[e.U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK=747]=`U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK`,e[e.U_MODIFIER_LETTER_UNASPIRATED=749]=`U_MODIFIER_LETTER_UNASPIRATED`,e[e.U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD=751]=`U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD`,e[e.U_MODIFIER_LETTER_LOW_UP_ARROWHEAD=752]=`U_MODIFIER_LETTER_LOW_UP_ARROWHEAD`,e[e.U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD=753]=`U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD`,e[e.U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD=754]=`U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD`,e[e.U_MODIFIER_LETTER_LOW_RING=755]=`U_MODIFIER_LETTER_LOW_RING`,e[e.U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT=756]=`U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT`,e[e.U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT=757]=`U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT`,e[e.U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT=758]=`U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT`,e[e.U_MODIFIER_LETTER_LOW_TILDE=759]=`U_MODIFIER_LETTER_LOW_TILDE`,e[e.U_MODIFIER_LETTER_RAISED_COLON=760]=`U_MODIFIER_LETTER_RAISED_COLON`,e[e.U_MODIFIER_LETTER_BEGIN_HIGH_TONE=761]=`U_MODIFIER_LETTER_BEGIN_HIGH_TONE`,e[e.U_MODIFIER_LETTER_END_HIGH_TONE=762]=`U_MODIFIER_LETTER_END_HIGH_TONE`,e[e.U_MODIFIER_LETTER_BEGIN_LOW_TONE=763]=`U_MODIFIER_LETTER_BEGIN_LOW_TONE`,e[e.U_MODIFIER_LETTER_END_LOW_TONE=764]=`U_MODIFIER_LETTER_END_LOW_TONE`,e[e.U_MODIFIER_LETTER_SHELF=765]=`U_MODIFIER_LETTER_SHELF`,e[e.U_MODIFIER_LETTER_OPEN_SHELF=766]=`U_MODIFIER_LETTER_OPEN_SHELF`,e[e.U_MODIFIER_LETTER_LOW_LEFT_ARROW=767]=`U_MODIFIER_LETTER_LOW_LEFT_ARROW`,e[e.U_GREEK_LOWER_NUMERAL_SIGN=885]=`U_GREEK_LOWER_NUMERAL_SIGN`,e[e.U_GREEK_TONOS=900]=`U_GREEK_TONOS`,e[e.U_GREEK_DIALYTIKA_TONOS=901]=`U_GREEK_DIALYTIKA_TONOS`,e[e.U_GREEK_KORONIS=8125]=`U_GREEK_KORONIS`,e[e.U_GREEK_PSILI=8127]=`U_GREEK_PSILI`,e[e.U_GREEK_PERISPOMENI=8128]=`U_GREEK_PERISPOMENI`,e[e.U_GREEK_DIALYTIKA_AND_PERISPOMENI=8129]=`U_GREEK_DIALYTIKA_AND_PERISPOMENI`,e[e.U_GREEK_PSILI_AND_VARIA=8141]=`U_GREEK_PSILI_AND_VARIA`,e[e.U_GREEK_PSILI_AND_OXIA=8142]=`U_GREEK_PSILI_AND_OXIA`,e[e.U_GREEK_PSILI_AND_PERISPOMENI=8143]=`U_GREEK_PSILI_AND_PERISPOMENI`,e[e.U_GREEK_DASIA_AND_VARIA=8157]=`U_GREEK_DASIA_AND_VARIA`,e[e.U_GREEK_DASIA_AND_OXIA=8158]=`U_GREEK_DASIA_AND_OXIA`,e[e.U_GREEK_DASIA_AND_PERISPOMENI=8159]=`U_GREEK_DASIA_AND_PERISPOMENI`,e[e.U_GREEK_DIALYTIKA_AND_VARIA=8173]=`U_GREEK_DIALYTIKA_AND_VARIA`,e[e.U_GREEK_DIALYTIKA_AND_OXIA=8174]=`U_GREEK_DIALYTIKA_AND_OXIA`,e[e.U_GREEK_VARIA=8175]=`U_GREEK_VARIA`,e[e.U_GREEK_OXIA=8189]=`U_GREEK_OXIA`,e[e.U_GREEK_DASIA=8190]=`U_GREEK_DASIA`,e[e.U_IDEOGRAPHIC_FULL_STOP=12290]=`U_IDEOGRAPHIC_FULL_STOP`,e[e.U_LEFT_CORNER_BRACKET=12300]=`U_LEFT_CORNER_BRACKET`,e[e.U_RIGHT_CORNER_BRACKET=12301]=`U_RIGHT_CORNER_BRACKET`,e[e.U_LEFT_BLACK_LENTICULAR_BRACKET=12304]=`U_LEFT_BLACK_LENTICULAR_BRACKET`,e[e.U_RIGHT_BLACK_LENTICULAR_BRACKET=12305]=`U_RIGHT_BLACK_LENTICULAR_BRACKET`,e[e.U_OVERLINE=8254]=`U_OVERLINE`,e[e.UTF8_BOM=65279]=`UTF8_BOM`,e[e.U_FULLWIDTH_SEMICOLON=65307]=`U_FULLWIDTH_SEMICOLON`,e[e.U_FULLWIDTH_COMMA=65292]=`U_FULLWIDTH_COMMA`,e}({});var L=class{width;height;array=[];constructor(e,t){this.width=e,this.height=t,this.array=Array(e*t)}get(e,t){return this.array[e+t*this.width]}set(e,t,n){this.array[e+t*this.width]=n}};function R(e){return e===I.Space||e===I.Tab}var z=class e{range;lines;source;static chrKeys=/* @__PURE__ */ new Map;static getKey(e){let t=this.chrKeys.get(e);return t===void 0&&(t=this.chrKeys.size,this.chrKeys.set(e,t)),t}totalCount;histogram=[];constructor(t,n,r){this.range=t,this.lines=n,this.source=r;let i=0;for(let r=t.startLineNumber-1;r<t.endLineNumberExclusive-1;r++){let t=n[r];for(let n=0;n<t.length;n++){i++;let r=t[n],a=e.getKey(r);this.histogram[a]=(this.histogram[a]||0)+1}i++;let a=e.getKey(`
|
|
2
|
+
`);this.histogram[a]=(this.histogram[a]||0)+1}this.totalCount=i}computeSimilarity(e){let t=0,n=Math.max(this.histogram.length,e.histogram.length);for(let r=0;r<n;r++)t+=Math.abs((this.histogram[r]??0)-(e.histogram[r]??0));return 1-t/(this.totalCount+e.totalCount)}},ne=class{compute(e,t,n=F.instance,r){if(e.length===0||t.length===0)return M.trivial(e,t);let i=new L(e.length,t.length),a=new L(e.length,t.length),o=new L(e.length,t.length);for(let s=0;s<e.length;s++)for(let c=0;c<t.length;c++){if(!n.isValid())return M.trivialTimedOut(e,t);let l=s===0?0:i.get(s-1,c),u=c===0?0:i.get(s,c-1),d;e.getElement(s)===t.getElement(c)?(d=s===0||c===0?0:i.get(s-1,c-1),s>0&&c>0&&a.get(s-1,c-1)===3&&(d+=o.get(s-1,c-1)),d+=r?r(s,c):1):d=-1;let f=Math.max(l,u,d);if(f===d){let e=s>0&&c>0?o.get(s-1,c-1):0;o.set(s,c,e+1),a.set(s,c,3)}else f===l?(o.set(s,c,0),a.set(s,c,1)):f===u&&(o.set(s,c,0),a.set(s,c,2));i.set(s,c,f)}let s=[],c=e.length,l=t.length;function u(e,t){(e+1!==c||t+1!==l)&&s.push(new N(new f(e+1,c),new f(t+1,l))),c=e,l=t}let d=e.length-1,p=t.length-1;for(;d>=0&&p>=0;)a.get(d,p)===3?(u(d,p),d--,p--):a.get(d,p)===1?d--:p--;return u(-1,-1),s.reverse(),new M(s,!1)}},B=class{compute(e,t,n=F.instance){if(e.length===0||t.length===0)return M.trivial(e,t);let r=e,i=t;function a(e,t){for(;e<r.length&&t<i.length&&r.getElement(e)===i.getElement(t);)e++,t++;return e}let o=0,s=new re;s.set(0,a(0,0));let c=new ie;c.set(0,s.get(0)===0?null:new V(null,0,0,s.get(0)));let l=0;loop:for(;;){if(o++,!n.isValid())return M.trivialTimedOut(r,i);let e=-Math.min(o,i.length+o%2),t=Math.min(o,r.length+o%2);for(l=e;l<=t;l+=2){let n=0,o=l===t?-1:s.get(l+1),u=l===e?-1:s.get(l-1)+1;n++;let d=Math.min(Math.max(o,u),r.length),f=d-l;if(n++,d>r.length||f>i.length)continue;let p=a(d,f);s.set(l,p);let m=d===o?c.get(l+1):c.get(l-1);if(c.set(l,p===d?m:new V(m,d,f,p-d)),s.get(l)===r.length&&s.get(l)-l===i.length)break loop}}let u=c.get(l),d=[],p=r.length,m=i.length;for(;;){let e=u?u.x+u.length:0,t=u?u.y+u.length:0;if((e!==p||t!==m)&&d.push(new N(new f(e,p),new f(t,m))),!u)break;p=u.x,m=u.y,u=u.prev}return d.reverse(),new M(d,!1)}},V=class{prev;x;y;length;constructor(e,t,n,r){this.prev=e,this.x=t,this.y=n,this.length=r}},re=class{positiveArr=/* @__PURE__ */ new Int32Array(10);negativeArr=/* @__PURE__ */ new Int32Array(10);get(e){return e<0?(e=-e-1,this.negativeArr[e]):this.positiveArr[e]}set(e,t){if(e<0){if(e=-e-1,e>=this.negativeArr.length){let e=this.negativeArr;this.negativeArr=new Int32Array(e.length*2),this.negativeArr.set(e)}this.negativeArr[e]=t}else{if(e>=this.positiveArr.length){let e=this.positiveArr;this.positiveArr=new Int32Array(e.length*2),this.positiveArr.set(e)}this.positiveArr[e]=t}}},ie=class{positiveArr=[];negativeArr=[];get(e){return e<0?(e=-e-1,this.negativeArr[e]):this.positiveArr[e]}set(e,t){e<0?(e=-e-1,this.negativeArr[e]=t):this.positiveArr[e]=t}},ae=class{map=/* @__PURE__ */ new Map;add(e,t){let n=this.map.get(e);n||(n=/* @__PURE__ */ new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||/* @__PURE__ */ new Set}},H=class{lines;range;considerWhitespaceChanges;elements=[];firstElementOffsetByLineIdx=[];lineStartOffsets=[];trimmedWsLengthsByLineIdx=[];constructor(e,t,n){this.lines=e,this.range=t,this.considerWhitespaceChanges=n,this.firstElementOffsetByLineIdx.push(0);for(let t=this.range.startLineNumber;t<=this.range.endLineNumber;t++){let r=e[t-1],i=0;t===this.range.startLineNumber&&this.range.startColumn>1&&(i=this.range.startColumn-1,r=r.substring(i)),this.lineStartOffsets.push(i);let a=0;if(!n){let e=r.trimStart();a=r.length-e.length,r=e.trimEnd()}this.trimmedWsLengthsByLineIdx.push(a);let o=t===this.range.endLineNumber?Math.min(this.range.endColumn-1-i-a,r.length):r.length;for(let e=0;e<o;e++)this.elements.push(r.charCodeAt(e));t<this.range.endLineNumber&&(this.elements.push(10),this.firstElementOffsetByLineIdx.push(this.elements.length))}}toString(){return`Slice: "${this.text}"`}get text(){return this.getText(new f(0,this.length))}getText(e){return this.elements.slice(e.start,e.endExclusive).map(e=>String.fromCharCode(e)).join(``)}getElement(e){return this.elements[e]}get length(){return this.elements.length}getBoundaryScore(e){let t=q(e>0?this.elements[e-1]:-1),n=q(e<this.elements.length?this.elements[e]:-1);if(t===G.LineBreakCR&&n===G.LineBreakLF)return 0;if(t===G.LineBreakLF)return 150;let r=0;return t!==n&&(r+=10,t===G.WordLower&&n===G.WordUpper&&(r+=1)),r+=K(t),r+=K(n),r}translateOffset(e,t=`right`){let n=g(this.firstElementOffsetByLineIdx,t=>t<=e),r=e-this.firstElementOffsetByLineIdx[n];return new p(this.range.startLineNumber+n,1+this.lineStartOffsets[n]+r+(r===0&&t===`left`?0:this.trimmedWsLengthsByLineIdx[n]))}translateRange(e){let t=this.translateOffset(e.start,`right`),n=this.translateOffset(e.endExclusive,`left`);return n.isBefore(t)?m.fromPositions(n,n):m.fromPositions(t,n)}findWordContaining(e){if(e<0||e>=this.elements.length||!U(this.elements[e]))return;let t=e;for(;t>0&&U(this.elements[t-1]);)t--;let n=e;for(;n<this.elements.length&&U(this.elements[n]);)n++;return new f(t,n)}findSubWordContaining(e){if(e<0||e>=this.elements.length||!U(this.elements[e]))return;let t=e;for(;t>0&&U(this.elements[t-1])&&!W(this.elements[t]);)t--;let n=e;for(;n<this.elements.length&&U(this.elements[n])&&!W(this.elements[n]);)n++;return new f(t,n)}countLinesIn(e){return this.translateOffset(e.endExclusive).lineNumber-this.translateOffset(e.start).lineNumber}isStronglyEqual(e,t){return this.elements[e]===this.elements[t]}extendToFullLines(e){return new f(h(this.firstElementOffsetByLineIdx,t=>t<=e.start)??0,_(this.firstElementOffsetByLineIdx,t=>e.endExclusive<=t)??this.elements.length)}};function U(e){return e>=I.a&&e<=I.z||e>=I.A&&e<=I.Z||e>=I.Digit0&&e<=I.Digit9}function W(e){return e>=I.A&&e<=I.Z}var G=/* @__PURE__ */ 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}(G||{});let oe={[G.WordLower]:0,[G.WordUpper]:0,[G.WordNumber]:0,[G.End]:10,[G.Other]:2,[G.Separator]:30,[G.Space]:3,[G.LineBreakCR]:10,[G.LineBreakLF]:10};function K(e){return oe[e]}function q(e){return e===I.LineFeed?G.LineBreakLF:e===I.CarriageReturn?G.LineBreakCR:R(e)?G.Space:e>=I.a&&e<=I.z?G.WordLower:e>=I.A&&e<=I.Z?G.WordUpper:e>=I.Digit0&&e<=I.Digit9?G.WordNumber:e===-1?G.End:e===I.Comma||e===I.Semicolon?G.Separator:G.Other}function se(e,t,n,r,a,o){let{moves:s,excludedChanges:c}=le(e,t,n,o);if(!o.isValid())return[];let l=ue(e.filter(e=>!c.has(e)),r,a,t,n,o);return i(s,l),s=de(s),s=s.filter(e=>{let n=e.original.toOffsetRange().slice(t).map(e=>e.trim());return n.join(`
|
|
3
|
+
`).length>=15&&ce(n,e=>e.length>=2)>=2}),s=fe(e,s),s}function ce(e,t){let n=0;for(let r of e)t(r)&&n++;return n}function le(e,t,n,r){let i=[],a=e.filter(e=>e.modified.isEmpty&&e.original.length>=3).map(e=>new z(e.original,t,e)),o=new Set(e.filter(e=>e.original.isEmpty&&e.modified.length>=3).map(e=>new z(e.modified,n,e))),s=/* @__PURE__ */ new Set;for(let e of a){let t=-1,n;for(let r of o){let i=e.computeSimilarity(r);i>t&&(t=i,n=r)}if(t>.9&&n&&(o.delete(n),i.push(new E(e.range,n.range)),s.add(e.source),s.add(n.source)),!r.isValid())return{moves:i,excludedChanges:s}}return{moves:i,excludedChanges:s}}function ue(e,t,n,r,i,c){let l=[],u=new ae;for(let n of e)for(let e=n.original.startLineNumber;e<n.original.endLineNumberExclusive-2;e++){let n=`${t[e-1]}:${t[e+1-1]}:${t[e+2-1]}`;u.add(n,{range:new b(e,e+3)})}let d=[];e.sort(a(e=>e.modified.startLineNumber,o));for(let t of e){let e=[];for(let r=t.modified.startLineNumber;r<t.modified.endLineNumberExclusive-2;r++){let t=`${n[r-1]}:${n[r+1-1]}:${n[r+2-1]}`,i=new b(r,r+3),a=[];u.forEach(t,({range:t})=>{for(let n of e)if(n.originalLineRange.endLineNumberExclusive+1===t.endLineNumberExclusive&&n.modifiedLineRange.endLineNumberExclusive+1===i.endLineNumberExclusive){n.originalLineRange=new b(n.originalLineRange.startLineNumber,t.endLineNumberExclusive),n.modifiedLineRange=new b(n.modifiedLineRange.startLineNumber,i.endLineNumberExclusive),a.push(n);return}let n={modifiedLineRange:i,originalLineRange:t};d.push(n),a.push(n)}),e=a}if(!c.isValid())return[]}d.sort(s(a(e=>e.modifiedLineRange.length,o)));let f=new x,p=new x;for(let e of d){let t=e.modifiedLineRange.startLineNumber-e.originalLineRange.startLineNumber,n=f.subtractFrom(e.modifiedLineRange),r=p.subtractFrom(e.originalLineRange).getWithDelta(t),i=n.getIntersection(r);for(let e of i.ranges){if(e.length<3)continue;let n=e,r=e.delta(-t);l.push(new E(r,n)),f.addRange(n),p.addRange(r)}}l.sort(a(e=>e.original.startLineNumber,o));let m=new y(e);for(let t=0;t<l.length;t++){let n=l[t],a=m.findLastMonotonous(e=>e.original.startLineNumber<=n.original.startLineNumber),o=h(e,e=>e.modified.startLineNumber<=n.modified.startLineNumber),s=Math.max(n.original.startLineNumber-a.original.startLineNumber,n.modified.startLineNumber-o.modified.startLineNumber),u=m.findLastMonotonous(e=>e.original.startLineNumber<n.original.endLineNumberExclusive),d=h(e,e=>e.modified.startLineNumber<n.modified.endLineNumberExclusive),g=Math.max(u.original.endLineNumberExclusive-n.original.endLineNumberExclusive,d.modified.endLineNumberExclusive-n.modified.endLineNumberExclusive),_=0;for(;_<s;_++){let e=n.original.startLineNumber-_-1,t=n.modified.startLineNumber-_-1;if(e>r.length||t>i.length||f.contains(t)||p.contains(e)||!J(r[e-1],i[t-1],c))break}_>0&&(p.addRange(new b(n.original.startLineNumber-_,n.original.startLineNumber)),f.addRange(new b(n.modified.startLineNumber-_,n.modified.startLineNumber)));let v=0;for(;v<g;v++){let e=n.original.endLineNumberExclusive+v,t=n.modified.endLineNumberExclusive+v;if(e>r.length||t>i.length||f.contains(t)||p.contains(e)||!J(r[e-1],i[t-1],c))break}v>0&&(p.addRange(new b(n.original.endLineNumberExclusive,n.original.endLineNumberExclusive+v)),f.addRange(new b(n.modified.endLineNumberExclusive,n.modified.endLineNumberExclusive+v))),(_>0||v>0)&&(l[t]=new E(new b(n.original.startLineNumber-_,n.original.endLineNumberExclusive+v),new b(n.modified.startLineNumber-_,n.modified.endLineNumberExclusive+v)))}return l}function J(e,t,n){if(e.trim()===t.trim())return!0;if(e.length>300&&t.length>300)return!1;let r=new B().compute(new H([e],new m(1,1,1,e.length),!1),new H([t],new m(1,1,1,t.length),!1),n),i=0,a=N.invert(r.diffs,e.length);for(let t of a)t.seq1Range.forEach(t=>{R(e.charCodeAt(t))||i++});function o(t){let n=0;for(let r=0;r<e.length;r++)R(t.charCodeAt(r))||n++;return n}let s=o(e.length>t.length?e:t);return i/s>.6&&s>10}function de(e){if(e.length===0)return e;e.sort(a(e=>e.original.startLineNumber,o));let t=[e[0]];for(let n=1;n<e.length;n++){let r=t[t.length-1],i=e[n],a=i.original.startLineNumber-r.original.endLineNumberExclusive,o=i.modified.startLineNumber-r.modified.endLineNumberExclusive;a>=0&&o>=0&&a+o<=2?t[t.length-1]=r.join(i):t.push(i)}return t}function fe(e,t){let n=new y(e);return t=t.filter(t=>(n.findLastMonotonous(e=>e.original.startLineNumber<t.original.endLineNumberExclusive)||new E(new b(1,1),new b(1,1)))!==h(e,e=>e.modified.startLineNumber<t.modified.endLineNumberExclusive)),t}function Y(e,t,n){let r=n;return r=X(e,t,r),r=X(e,t,r),r=pe(e,t,r),r}function X(e,t,n){if(n.length===0)return n;let r=[];r.push(n[0]);for(let i=1;i<n.length;i++){let a=r[r.length-1],o=n[i];if(o.seq1Range.isEmpty||o.seq2Range.isEmpty){let n=o.seq1Range.start-a.seq1Range.endExclusive,i=1;for(;i<=n&&e.getElement(o.seq1Range.start-i)===e.getElement(o.seq1Range.endExclusive-i)&&t.getElement(o.seq2Range.start-i)===t.getElement(o.seq2Range.endExclusive-i);i++);if(i--,i===n){r[r.length-1]=new N(new f(a.seq1Range.start,o.seq1Range.endExclusive-n),new f(a.seq2Range.start,o.seq2Range.endExclusive-n));continue}o=o.delta(-i)}r.push(o)}let i=[];for(let n=0;n<r.length-1;n++){let a=r[n+1],o=r[n];if(o.seq1Range.isEmpty||o.seq2Range.isEmpty){let i=a.seq1Range.start-o.seq1Range.endExclusive,s=0;for(;s<i&&e.isStronglyEqual(o.seq1Range.start+s,o.seq1Range.endExclusive+s)&&t.isStronglyEqual(o.seq2Range.start+s,o.seq2Range.endExclusive+s);s++);if(s===i){r[n+1]=new N(new f(o.seq1Range.start+i,a.seq1Range.endExclusive),new f(o.seq2Range.start+i,a.seq2Range.endExclusive));continue}s>0&&(o=o.delta(s))}i.push(o)}return r.length>0&&i.push(r[r.length-1]),i}function pe(e,t,n){if(!e.getBoundaryScore||!t.getBoundaryScore)return n;for(let r=0;r<n.length;r++){let i=r>0?n[r-1]:void 0,a=n[r],o=r+1<n.length?n[r+1]:void 0,s=new f(i?i.seq1Range.endExclusive+1:0,o?o.seq1Range.start-1:e.length),c=new f(i?i.seq2Range.endExclusive+1:0,o?o.seq2Range.start-1:t.length);a.seq1Range.isEmpty?n[r]=Z(a,e,t,s,c):a.seq2Range.isEmpty&&(n[r]=Z(a.swap(),t,e,c,s).swap())}return n}function Z(e,t,n,r,i){let a=1;for(;e.seq1Range.start-a>=r.start&&e.seq2Range.start-a>=i.start&&n.isStronglyEqual(e.seq2Range.start-a,e.seq2Range.endExclusive-a)&&a<100;)a++;a--;let o=0;for(;e.seq1Range.start+o<r.endExclusive&&e.seq2Range.endExclusive+o<i.endExclusive&&n.isStronglyEqual(e.seq2Range.start+o,e.seq2Range.endExclusive+o)&&o<100;)o++;if(a===0&&o===0)return e;let s=0,c=-1;for(let r=-a;r<=o;r++){let i=e.seq2Range.start+r,a=e.seq2Range.endExclusive+r,o=e.seq1Range.start+r,l=t.getBoundaryScore(o)+n.getBoundaryScore(i)+n.getBoundaryScore(a);l>c&&(c=l,s=r)}return e.delta(s)}function me(e,t,n){let r=[];for(let e of n){let t=r[r.length-1];t&&(e.seq1Range.start-t.seq1Range.endExclusive<=2||e.seq2Range.start-t.seq2Range.endExclusive<=2)?r[r.length-1]=new N(t.seq1Range.join(e.seq1Range),t.seq2Range.join(e.seq2Range)):r.push(e)}return r}function Q(e,t,n,r,i=!1){let a=N.invert(n,e.length),o=[],s=new P(0,0);function c(n,c){if(n.offset1<s.offset1||n.offset2<s.offset2)return;let l=r(e,n.offset1),u=r(t,n.offset2);if(!l||!u)return;let d=new N(l,u),f=d.intersect(c),p=f.seq1Range.length,m=f.seq2Range.length;for(;a.length>0;){let n=a[0];if(!(n.seq1Range.intersects(d.seq1Range)||n.seq2Range.intersects(d.seq2Range)))break;let i=new N(r(e,n.seq1Range.start),r(t,n.seq2Range.start)),o=i.intersect(n);if(p+=o.seq1Range.length,m+=o.seq2Range.length,d=d.join(i),d.seq1Range.endExclusive>=n.seq1Range.endExclusive)a.shift();else break}(i&&p+m<d.seq1Range.length+d.seq2Range.length||p+m<(d.seq1Range.length+d.seq2Range.length)*2/3)&&o.push(d),s=d.getEndExclusives()}for(;a.length>0;){let e=a.shift();e.seq1Range.isEmpty||(c(e.getStarts(),e),c(e.getEndExclusives().delta(-1),e))}return he(n,o)}function he(e,t){let n=[];for(;e.length>0||t.length>0;){let r=e[0],i=t[0],a;a=r&&(!i||r.seq1Range.start<i.seq1Range.start)?e.shift():t.shift(),n.length>0&&n[n.length-1].seq1Range.endExclusive>=a.seq1Range.start?n[n.length-1]=n[n.length-1].join(a):n.push(a)}return n}function ge(e,t,n){let r=n;if(r.length===0)return r;let i=0,a;do{a=!1;let t=[r[0]];for(let n=1;n<r.length;n++){let i=r[n],s=t[t.length-1];function o(t,n){let r=new f(s.seq1Range.endExclusive,i.seq1Range.start);return e.getText(r).replace(/\s/g,``).length<=4&&(t.seq1Range.length+t.seq2Range.length>5||n.seq1Range.length+n.seq2Range.length>5)}o(s,i)?(a=!0,t[t.length-1]=t[t.length-1].join(i)):t.push(i)}r=t}while(i++<10&&a);return r}function _e(e,t,n){let i=n;if(i.length===0)return i;let a=0,o;do{o=!1;let n=[i[0]];for(let r=1;r<i.length;r++){let a=i[r],c=n[n.length-1];function s(n,r){let i=new f(c.seq1Range.endExclusive,a.seq1Range.start);if(e.countLinesIn(i)>5||i.length>500)return!1;let o=e.getText(i).trim();if(o.length>20||o.split(/\r\n|\r|\n/).length>1)return!1;let s=e.countLinesIn(n.seq1Range),l=n.seq1Range.length,u=t.countLinesIn(n.seq2Range),d=n.seq2Range.length,p=e.countLinesIn(r.seq1Range),m=r.seq1Range.length,h=t.countLinesIn(r.seq2Range),g=r.seq2Range.length;function _(e){return Math.min(e,130)}return(_(s*40+l)**1.5+_(u*40+d)**1.5)**1.5+(_(p*40+m)**1.5+_(h*40+g)**1.5)**1.5>(130**1.5)**1.5*1.3}s(c,a)?(o=!0,n[n.length-1]=n[n.length-1].join(a)):n.push(a)}i=n}while(a++<10&&o);let c=[];return r(i,(t,n,r)=>{let i=n;function a(e){return e.length>0&&e.trim().length<=3&&n.seq1Range.length+n.seq2Range.length>100}let o=e.extendToFullLines(n.seq1Range),s=e.getText(new f(o.start,n.seq1Range.start));a(s)&&(i=i.deltaStart(-s.length));let l=e.getText(new f(n.seq1Range.endExclusive,o.endExclusive));a(l)&&(i=i.deltaEnd(l.length));let u=N.fromOffsetPairs(t?t.getEndExclusives():P.zero,r?r.getStarts():P.max),d=i.intersect(u);c.length>0&&d.getStarts().equals(c[c.length-1].getEndExclusives())?c[c.length-1]=c[c.length-1].join(d):c.push(d)}),c}var ve=class{trimmedHash;lines;constructor(e,t){this.trimmedHash=e,this.lines=t}getElement(e){return this.trimmedHash[e]}get length(){return this.trimmedHash.length}getBoundaryScore(e){return 1e3-((e===0?0:$(this.lines[e-1]))+(e===this.lines.length?0:$(this.lines[e])))}getText(e){return this.lines.slice(e.start,e.endExclusive).join(`
|
|
4
|
+
`)}isStronglyEqual(e,t){return this.lines[e]===this.lines[t]}};function $(e){let t=0;for(;t<e.length&&(e.charCodeAt(t)===I.Space||e.charCodeAt(t)===I.Tab);)t++;return t}var ye=class{dynamicProgrammingDiffing=new ne;myersDiffingAlgorithm=new B;computeDiff(t,n,r){if(t.length<=1&&e(t,n,(e,t)=>e===t))return new w([],[],!1);if(t.length===1&&t[0].length===0||n.length===1&&n[0].length===0)return new w([new k(new b(1,t.length+1),new b(1,n.length+1),[new A(new m(1,1,t.length,t[t.length-1].length+1),new m(1,1,n.length,n[n.length-1].length+1))])],[],!1);let i=r.maxComputationTimeMs===0?F.instance:new te(r.maxComputationTimeMs),a=!r.ignoreTrimWhitespace,o=/* @__PURE__ */ new Map;function s(e){let t=o.get(e);return t===void 0&&(t=o.size,o.set(e,t)),t}let c=t.map(e=>s(e.trim())),l=n.map(e=>s(e.trim())),d=new ve(c,t),p=new ve(l,n),h=d.length+p.length<1700?this.dynamicProgrammingDiffing.compute(d,p,i,(e,r)=>t[e]===n[r]?n[r].length===0?.1:1+Math.log(1+n[r].length):.99):this.myersDiffingAlgorithm.compute(d,p,i),g=h.diffs,_=h.hitTimeout;g=Y(d,p,g),g=ge(d,p,g);let v=[],y=e=>{if(a)for(let o=0;o<e;o++){let e=x+o,s=S+o;if(t[e]!==n[s]){let o=this.refineDiff(t,n,new N(new f(e,e+1),new f(s,s+1)),i,a,r);for(let e of o.mappings)v.push(e);o.hitTimeout&&(_=!0)}}},x=0,S=0;for(let e of g){u(()=>e.seq1Range.start-x===e.seq2Range.start-S),y(e.seq1Range.start-x),x=e.seq1Range.endExclusive,S=e.seq2Range.endExclusive;let o=this.refineDiff(t,n,e,i,a,r);o.hitTimeout&&(_=!0);for(let e of o.mappings)v.push(e)}y(t.length-x);let T=j(v,new C(t),new C(n)),E=[];return r.computeMoves&&(E=this.computeMoves(T,t,n,c,l,i,a,r)),u(()=>{function e(e,t){if(e.lineNumber<1||e.lineNumber>t.length)return!1;let n=t[e.lineNumber-1];return!(e.column<1||e.column>n.length+1)}function r(e,t){return!(e.startLineNumber<1||e.startLineNumber>t.length+1||e.endLineNumberExclusive<1||e.endLineNumberExclusive>t.length+1)}for(let i of T){if(!i.innerChanges)return!1;for(let r of i.innerChanges)if(!(e(r.modifiedRange.getStartPosition(),n)&&e(r.modifiedRange.getEndPosition(),n)&&e(r.originalRange.getStartPosition(),t)&&e(r.originalRange.getEndPosition(),t)))return!1;if(!r(i.modified,n)||!r(i.original,t))return!1}return!0}),new w(T,E,_)}computeMoves(e,t,n,r,i,a,o,s){return se(e,t,n,r,i,a).map(e=>new T(e,j(this.refineDiff(t,n,new N(e.original.toOffsetRange(),e.modified.toOffsetRange()),a,o,s).mappings,new C(t),new C(n),!0)))}refineDiff(e,t,n,r,i,a){let o=be(n).toRangeMapping2(e,t),s=new H(e,o.originalRange,i),c=new H(t,o.modifiedRange,i),l=s.length+c.length<500?this.dynamicProgrammingDiffing.compute(s,c,r):this.myersDiffingAlgorithm.compute(s,c,r),u=l.diffs;return u=Y(s,c,u),u=Q(s,c,u,(e,t)=>e.findWordContaining(t)),a.extendToSubwords&&(u=Q(s,c,u,(e,t)=>e.findSubWordContaining(t),!0)),u=me(s,c,u),u=_e(s,c,u),{mappings:u.map(e=>new A(s.translateRange(e.seq1Range),c.translateRange(e.seq2Range))),hitTimeout:l.hitTimeout}}};function be(e){return new E(new b(e.seq1Range.start+1,e.seq1Range.endExclusive+1),new b(e.seq2Range.start+1,e.seq2Range.endExclusive+1))}function xe(e,t,n){let r=new ye().computeDiff(e,t,{...n,computeMoves:!1,extendToSubwords:!1}),i=e=>[e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn];return{quitEarly:r.hitTimeout,changes:r.changes.map(e=>({original:[e.original.startLineNumber,e.original.endLineNumberExclusive],modified:[e.modified.startLineNumber,e.modified.endLineNumberExclusive],inner:(e.innerChanges??[]).map(e=>({original:i(e.originalRange),modified:i(e.modifiedRange)}))}))}}self.addEventListener(`message`,e=>{let{original:t,modified:n,options:r}=e.data;self.postMessage(xe(t,n,r))})})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./java-
|
|
1
|
+
import{t as e}from"./java-B44aWtXw.js";var t=Object.freeze(JSON.parse(`{"displayName":"XML","name":"xml","patterns":[{"begin":"(<\\\\?)\\\\s*([-0-9A-Z_a-z]+)","captures":{"1":{"name":"punctuation.definition.tag.xml"},"2":{"name":"entity.name.tag.xml"}},"end":"(\\\\?>)","name":"meta.tag.preprocessor.xml","patterns":[{"match":" ([-A-Za-z]+)","name":"entity.other.attribute-name.xml"},{"include":"#doublequotedString"},{"include":"#singlequotedString"}]},{"begin":"(<!)(DOCTYPE)\\\\s+([:A-Z_a-z][-.0-:A-Z_a-z]*)","captures":{"1":{"name":"punctuation.definition.tag.xml"},"2":{"name":"keyword.other.doctype.xml"},"3":{"name":"variable.language.documentroot.xml"}},"end":"\\\\s*(>)","name":"meta.tag.sgml.doctype.xml","patterns":[{"include":"#internalSubset"}]},{"include":"#comments"},{"begin":"(<)((?:([-0-9A-Z_a-z]+)(:))?([-0-:A-Z_a-z]+))(?=(\\\\s[^>]*)?></\\\\2>)","beginCaptures":{"1":{"name":"punctuation.definition.tag.xml"},"2":{"name":"entity.name.tag.xml"},"3":{"name":"entity.name.tag.namespace.xml"},"4":{"name":"punctuation.separator.namespace.xml"},"5":{"name":"entity.name.tag.localname.xml"}},"end":"(>)(</)((?:([-0-9A-Z_a-z]+)(:))?([-0-:A-Z_a-z]+))(>)","endCaptures":{"1":{"name":"punctuation.definition.tag.xml"},"2":{"name":"punctuation.definition.tag.xml"},"3":{"name":"entity.name.tag.xml"},"4":{"name":"entity.name.tag.namespace.xml"},"5":{"name":"punctuation.separator.namespace.xml"},"6":{"name":"entity.name.tag.localname.xml"},"7":{"name":"punctuation.definition.tag.xml"}},"name":"meta.tag.no-content.xml","patterns":[{"include":"#tagStuff"}]},{"begin":"(</?)(?:([-.\\\\w]+)((:)))?([-.:\\\\w]+)","captures":{"1":{"name":"punctuation.definition.tag.xml"},"2":{"name":"entity.name.tag.namespace.xml"},"3":{"name":"entity.name.tag.xml"},"4":{"name":"punctuation.separator.namespace.xml"},"5":{"name":"entity.name.tag.localname.xml"}},"end":"(/?>)","name":"meta.tag.xml","patterns":[{"include":"#tagStuff"}]},{"include":"#entity"},{"include":"#bare-ampersand"},{"begin":"<%@","beginCaptures":{"0":{"name":"punctuation.section.embedded.begin.xml"}},"end":"%>","endCaptures":{"0":{"name":"punctuation.section.embedded.end.xml"}},"name":"source.java-props.embedded.xml","patterns":[{"match":"page|include|taglib","name":"keyword.other.page-props.xml"}]},{"begin":"<%[!=]?(?!--)","beginCaptures":{"0":{"name":"punctuation.section.embedded.begin.xml"}},"end":"(?!--)%>","endCaptures":{"0":{"name":"punctuation.section.embedded.end.xml"}},"name":"source.java.embedded.xml","patterns":[{"include":"source.java"}]},{"begin":"<!\\\\[CDATA\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.xml"}},"end":"]]>","endCaptures":{"0":{"name":"punctuation.definition.string.end.xml"}},"name":"string.unquoted.cdata.xml"}],"repository":{"EntityDecl":{"begin":"(<!)(ENTITY)\\\\s+(%\\\\s+)?([:A-Z_a-z][-.0-:A-Z_a-z]*)(\\\\s+(?:SYSTEM|PUBLIC)\\\\s+)?","captures":{"1":{"name":"punctuation.definition.tag.xml"},"2":{"name":"keyword.other.entity.xml"},"3":{"name":"punctuation.definition.entity.xml"},"4":{"name":"variable.language.entity.xml"},"5":{"name":"keyword.other.entitytype.xml"}},"end":"(>)","patterns":[{"include":"#doublequotedString"},{"include":"#singlequotedString"}]},"bare-ampersand":{"match":"&","name":"invalid.illegal.bad-ampersand.xml"},"comments":{"patterns":[{"begin":"<%--","captures":{"0":{"name":"punctuation.definition.comment.xml"},"end":"--%>","name":"comment.block.xml"}},{"begin":"<!--","captures":{"0":{"name":"punctuation.definition.comment.xml"}},"end":"-->","name":"comment.block.xml","patterns":[{"begin":"--(?!>)","captures":{"0":{"name":"invalid.illegal.bad-comments-or-CDATA.xml"}}}]}]},"doublequotedString":{"begin":"\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.xml"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.xml"}},"name":"string.quoted.double.xml","patterns":[{"include":"#entity"},{"include":"#bare-ampersand"}]},"entity":{"captures":{"1":{"name":"punctuation.definition.constant.xml"},"3":{"name":"punctuation.definition.constant.xml"}},"match":"(&)([:A-Z_a-z][-.0-:A-Z_a-z]*|#[0-9]+|#x\\\\h+)(;)","name":"constant.character.entity.xml"},"internalSubset":{"begin":"(\\\\[)","captures":{"1":{"name":"punctuation.definition.constant.xml"}},"end":"(])","name":"meta.internalsubset.xml","patterns":[{"include":"#EntityDecl"},{"include":"#parameterEntity"},{"include":"#comments"}]},"parameterEntity":{"captures":{"1":{"name":"punctuation.definition.constant.xml"},"3":{"name":"punctuation.definition.constant.xml"}},"match":"(%)([:A-Z_a-z][-.0-:A-Z_a-z]*)(;)","name":"constant.character.parameter-entity.xml"},"singlequotedString":{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.xml"}},"end":"'","endCaptures":{"0":{"name":"punctuation.definition.string.end.xml"}},"name":"string.quoted.single.xml","patterns":[{"include":"#entity"},{"include":"#bare-ampersand"}]},"tagStuff":{"patterns":[{"captures":{"1":{"name":"entity.other.attribute-name.namespace.xml"},"2":{"name":"entity.other.attribute-name.xml"},"3":{"name":"punctuation.separator.namespace.xml"},"4":{"name":"entity.other.attribute-name.localname.xml"}},"match":"(?:^|\\\\s+)(?:([-.\\\\w]+)((:)))?([-.:\\\\w]+)\\\\s*="},{"include":"#doublequotedString"},{"include":"#singlequotedString"}]}},"scopeName":"text.xml","embeddedLangs":["java"]}`)),n=[...e,t];export{n as default};
|
package/dist/client/index.html
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
/>
|
|
11
11
|
<title>fzv</title>
|
|
12
12
|
<link rel="icon" href="data:," />
|
|
13
|
-
<script type="module" crossorigin src="/_fzv/assets/index-
|
|
14
|
-
<link rel="stylesheet" crossorigin href="/_fzv/assets/index-
|
|
13
|
+
<script type="module" crossorigin src="/_fzv/assets/index-BqkhaGwN.js"></script>
|
|
14
|
+
<link rel="stylesheet" crossorigin href="/_fzv/assets/index-CUTCg_dk.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
17
17
|
<header class="topbar">
|
|
@@ -32,6 +32,32 @@
|
|
|
32
32
|
</button>
|
|
33
33
|
</header>
|
|
34
34
|
<div class="workspace" id="workspace">
|
|
35
|
+
<nav
|
|
36
|
+
id="activity-bar"
|
|
37
|
+
class="activity-bar"
|
|
38
|
+
aria-label="Active View Switcher"
|
|
39
|
+
hidden
|
|
40
|
+
></nav>
|
|
41
|
+
<aside
|
|
42
|
+
id="sidebar"
|
|
43
|
+
class="sidebar"
|
|
44
|
+
aria-labelledby="sidebar-title"
|
|
45
|
+
hidden
|
|
46
|
+
>
|
|
47
|
+
<div class="sidebar-title">
|
|
48
|
+
<h2 id="sidebar-title"></h2>
|
|
49
|
+
<div id="sidebar-actions" class="sidebar-actions"></div>
|
|
50
|
+
</div>
|
|
51
|
+
<div id="sidebar-content" class="sidebar-content"></div>
|
|
52
|
+
</aside>
|
|
53
|
+
<div
|
|
54
|
+
id="sidebar-sash"
|
|
55
|
+
class="sidebar-sash"
|
|
56
|
+
role="separator"
|
|
57
|
+
aria-orientation="vertical"
|
|
58
|
+
aria-label="Resize side bar"
|
|
59
|
+
hidden
|
|
60
|
+
></div>
|
|
35
61
|
<main id="main" class="main" tabindex="-1">
|
|
36
62
|
<div
|
|
37
63
|
id="preview"
|
|
@@ -43,6 +69,15 @@
|
|
|
43
69
|
</div>
|
|
44
70
|
<footer class="statusbar">
|
|
45
71
|
<span><span class="status-dot"></span> Read only</span
|
|
72
|
+
><button
|
|
73
|
+
id="status-branch"
|
|
74
|
+
class="status-item"
|
|
75
|
+
type="button"
|
|
76
|
+
title="Show Source Control"
|
|
77
|
+
hidden
|
|
78
|
+
>
|
|
79
|
+
<i class="codicon codicon-git-branch" aria-hidden="true"></i
|
|
80
|
+
><span id="status-branch-name"></span></button
|
|
46
81
|
><span id="status-project">Loading project…</span
|
|
47
82
|
><span id="tab-count">0 open tabs</span>
|
|
48
83
|
</footer>
|
|
@@ -153,6 +188,74 @@
|
|
|
153
188
|
<i class="codicon codicon-code" aria-hidden="true"></i> Source
|
|
154
189
|
</button>
|
|
155
190
|
</div>
|
|
191
|
+
<button
|
|
192
|
+
id="open-changes"
|
|
193
|
+
class="toolbar-button"
|
|
194
|
+
aria-label="Open changes"
|
|
195
|
+
title="Open Changes"
|
|
196
|
+
hidden
|
|
197
|
+
>
|
|
198
|
+
<i class="codicon codicon-git-compare" aria-hidden="true"></i>
|
|
199
|
+
</button>
|
|
200
|
+
<div
|
|
201
|
+
id="diff-actions"
|
|
202
|
+
class="diff-actions"
|
|
203
|
+
role="group"
|
|
204
|
+
aria-label="Diff"
|
|
205
|
+
hidden
|
|
206
|
+
>
|
|
207
|
+
<button
|
|
208
|
+
id="previous-change"
|
|
209
|
+
class="toolbar-button"
|
|
210
|
+
aria-label="Previous change"
|
|
211
|
+
title="Previous Change ([c)"
|
|
212
|
+
>
|
|
213
|
+
<i class="codicon codicon-arrow-up" aria-hidden="true"></i>
|
|
214
|
+
</button>
|
|
215
|
+
<button
|
|
216
|
+
id="next-change"
|
|
217
|
+
class="toolbar-button"
|
|
218
|
+
aria-label="Next change"
|
|
219
|
+
title="Next Change (]c)"
|
|
220
|
+
>
|
|
221
|
+
<i class="codicon codicon-arrow-down" aria-hidden="true"></i>
|
|
222
|
+
</button>
|
|
223
|
+
<button
|
|
224
|
+
id="diff-inline"
|
|
225
|
+
class="toolbar-button"
|
|
226
|
+
aria-label="Inline view"
|
|
227
|
+
aria-pressed="false"
|
|
228
|
+
title="Toggle Inline View"
|
|
229
|
+
>
|
|
230
|
+
<i class="codicon codicon-diff-single" aria-hidden="true"></i>
|
|
231
|
+
</button>
|
|
232
|
+
<button
|
|
233
|
+
id="diff-collapse"
|
|
234
|
+
class="toolbar-button"
|
|
235
|
+
aria-label="Collapse unchanged regions"
|
|
236
|
+
aria-pressed="false"
|
|
237
|
+
title="Collapse Unchanged Regions"
|
|
238
|
+
>
|
|
239
|
+
<i class="codicon codicon-fold" aria-hidden="true"></i>
|
|
240
|
+
</button>
|
|
241
|
+
<button
|
|
242
|
+
id="diff-whitespace"
|
|
243
|
+
class="toolbar-button"
|
|
244
|
+
aria-label="Show leading and trailing whitespace differences"
|
|
245
|
+
aria-pressed="true"
|
|
246
|
+
title="Show Leading/Trailing Whitespace Differences"
|
|
247
|
+
>
|
|
248
|
+
<i class="codicon codicon-whitespace" aria-hidden="true"></i>
|
|
249
|
+
</button>
|
|
250
|
+
<button
|
|
251
|
+
id="open-changed-file"
|
|
252
|
+
class="toolbar-button"
|
|
253
|
+
aria-label="Open file"
|
|
254
|
+
title="Open File"
|
|
255
|
+
>
|
|
256
|
+
<i class="codicon codicon-go-to-file" aria-hidden="true"></i>
|
|
257
|
+
</button>
|
|
258
|
+
</div>
|
|
156
259
|
<button
|
|
157
260
|
id="split-right"
|
|
158
261
|
class="toolbar-button"
|
package/dist/navigation.js
CHANGED
|
@@ -90,7 +90,7 @@ export function installNavigation(options = {}) {
|
|
|
90
90
|
['Escape', 'Cancel hints or close this help'],
|
|
91
91
|
];
|
|
92
92
|
if (!options.bridgeWorkspace) {
|
|
93
|
-
bindings.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']);
|
|
93
|
+
bindings.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']);
|
|
94
94
|
}
|
|
95
95
|
const list = document.createElement('div');
|
|
96
96
|
Object.assign(list.style, {
|
|
@@ -132,7 +132,7 @@ export function installNavigation(options = {}) {
|
|
|
132
132
|
cancel();
|
|
133
133
|
const root = document.querySelector('dialog[open]') ?? document.body;
|
|
134
134
|
const targets = [
|
|
135
|
-
...root.querySelectorAll('a[href], button:not(:disabled), input:not(:disabled):not([type="hidden"]), textarea:not(:disabled), select:not(:disabled), summary, [role="button"], [tabindex]:not([tabindex="-1"]), [contenteditable]:not([contenteditable="false"]), iframe'),
|
|
135
|
+
...root.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'),
|
|
136
136
|
].filter((target) => {
|
|
137
137
|
if (target.matches(':disabled') ||
|
|
138
138
|
target.closest('[hidden], [inert], [aria-disabled="true"]'))
|
package/dist/server/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import { parseArgs } from 'node:util';
|
|
|
3
3
|
import { createViewer } from './server.js';
|
|
4
4
|
import { PRODUCT_NAME, VERSION } from '../shared.js';
|
|
5
5
|
import { projectPort, viewerUrls } from './network.js';
|
|
6
|
-
import { findOfficeConverter, OFFICE_CONVERTER_NAMES } from './office.js';
|
|
6
|
+
import { findOfficeConverter, OFFICE_CONVERTER_NAMES, which, } from './office.js';
|
|
7
7
|
const HELP = `${PRODUCT_NAME} — the file viewer for agent-driven development
|
|
8
8
|
|
|
9
9
|
Usage: ${PRODUCT_NAME} [--root PATH] [--host HOST] [--port PORT] [--watch] [--allow-html-network] [--office-converter PATH]
|
|
@@ -52,12 +52,14 @@ async function main() {
|
|
|
52
52
|
(!/^\d+$/.test(values.port) || Number(values.port) > 65535))
|
|
53
53
|
throw new Error('--port must be an integer between 0 and 65535.');
|
|
54
54
|
const officeConverter = await findOfficeConverter(values['office-converter']);
|
|
55
|
+
const git = (await which('git', process.env)) ?? null;
|
|
55
56
|
const { server, catalog } = await createViewer({
|
|
56
57
|
root: values.root ?? process.cwd(),
|
|
57
58
|
host: values.host,
|
|
58
59
|
watch: values.watch,
|
|
59
60
|
allowHtmlNetwork: values['allow-html-network'],
|
|
60
61
|
officeConverter,
|
|
62
|
+
git,
|
|
61
63
|
});
|
|
62
64
|
server.on('watchError', (error) => {
|
|
63
65
|
console.error(`${PRODUCT_NAME}: file watching stopped: ${error.message}`);
|
|
@@ -88,7 +90,7 @@ async function main() {
|
|
|
88
90
|
const office = officeConverter
|
|
89
91
|
? `${OFFICE_CONVERTER_NAMES[officeConverter.kind]} (${officeConverter.command})`
|
|
90
92
|
: 'unavailable; install ibisOffice or LibreOffice';
|
|
91
|
-
console.log(`\n ${PRODUCT_NAME} ${VERSION}\n Project ${catalog.root}\n${urls.map((url) => ` Viewer ${url}`).join('\n')}\n Office ${office}\n\n Press Ctrl+C to stop.\n`);
|
|
93
|
+
console.log(`\n ${PRODUCT_NAME} ${VERSION}\n Project ${catalog.root}\n${urls.map((url) => ` Viewer ${url}`).join('\n')}\n Office ${office}\n Git ${git ?? 'unavailable; install git for Source Control'}\n\n Press Ctrl+C to stop.\n`);
|
|
92
94
|
});
|
|
93
95
|
server.listen(port, values.host);
|
|
94
96
|
const stop = () => {
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { MAX_FILE_SIZE } from '../shared.js';
|
|
3
|
+
import { FileUnavailable, isVisibleRelative, previewKind } from './catalog.js';
|
|
4
|
+
const TIMEOUT = 10_000;
|
|
5
|
+
class GitCommandError extends Error {
|
|
6
|
+
}
|
|
7
|
+
/** Read-only access to the repository containing the project root.
|
|
8
|
+
* Every git path is mapped back to a project path and checked with the same
|
|
9
|
+
* visibility rules as the file catalog; paths outside the root are dropped. */
|
|
10
|
+
export class GitRepository {
|
|
11
|
+
command;
|
|
12
|
+
root;
|
|
13
|
+
constructor(command, root) {
|
|
14
|
+
this.command = command;
|
|
15
|
+
this.root = root;
|
|
16
|
+
}
|
|
17
|
+
run(args, maxBuffer = 32 * 1024 * 1024) {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
execFile(this.command,
|
|
20
|
+
// Never take index.lock, never start an fsmonitor hook, and never prompt.
|
|
21
|
+
['--no-optional-locks', '-c', 'core.fsmonitor=false', ...args], {
|
|
22
|
+
cwd: this.root,
|
|
23
|
+
encoding: 'buffer',
|
|
24
|
+
maxBuffer,
|
|
25
|
+
timeout: TIMEOUT,
|
|
26
|
+
windowsHide: true,
|
|
27
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: '0', LC_ALL: 'C' },
|
|
28
|
+
}, (error, stdout) => error ? reject(new GitCommandError(error.message)) : resolve(stdout));
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** The project root's path inside the work tree, with a trailing slash. */
|
|
32
|
+
async prefix() {
|
|
33
|
+
try {
|
|
34
|
+
const [inside, prefix] = (await this.run(['rev-parse', '--is-inside-work-tree', '--show-prefix']))
|
|
35
|
+
.toString('utf8')
|
|
36
|
+
.split('\n');
|
|
37
|
+
return inside === 'true' ? (prefix ?? '') : null;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async status() {
|
|
44
|
+
const prefix = await this.prefix();
|
|
45
|
+
if (prefix === null)
|
|
46
|
+
return { available: false };
|
|
47
|
+
const fields = (await this.run([
|
|
48
|
+
'status',
|
|
49
|
+
'-z',
|
|
50
|
+
'--porcelain=v1',
|
|
51
|
+
'--branch',
|
|
52
|
+
'--untracked-files=all',
|
|
53
|
+
'--',
|
|
54
|
+
'.',
|
|
55
|
+
]))
|
|
56
|
+
.toString('utf8')
|
|
57
|
+
.split('\0');
|
|
58
|
+
const project = (repositoryPath) => {
|
|
59
|
+
if (!repositoryPath.startsWith(prefix))
|
|
60
|
+
return null;
|
|
61
|
+
const relative = repositoryPath.slice(prefix.length);
|
|
62
|
+
return isVisibleRelative(relative) ? relative : null;
|
|
63
|
+
};
|
|
64
|
+
let branch = null;
|
|
65
|
+
const changes = [];
|
|
66
|
+
for (let index = 0; index < fields.length; index++) {
|
|
67
|
+
const field = fields[index];
|
|
68
|
+
if (field.startsWith('## ')) {
|
|
69
|
+
// "## main...origin/main [ahead 1]", "## No commits yet on main", or "## HEAD (no branch)".
|
|
70
|
+
const head = field.slice(3).replace(/^No commits yet on /, '');
|
|
71
|
+
branch = head.startsWith('HEAD (no branch)')
|
|
72
|
+
? null
|
|
73
|
+
: head.split('...')[0].split(' ')[0];
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (field.length < 4)
|
|
77
|
+
continue;
|
|
78
|
+
const x = field[0];
|
|
79
|
+
const y = field[1];
|
|
80
|
+
const path = project(field.slice(3));
|
|
81
|
+
// Renames and copies are followed by their source path.
|
|
82
|
+
const source = x === 'R' || x === 'C' ? fields[++index] : undefined;
|
|
83
|
+
if (!path)
|
|
84
|
+
continue;
|
|
85
|
+
const kind = previewKind(path);
|
|
86
|
+
const add = (stage, status, from) => {
|
|
87
|
+
const originalPath = from === undefined ? null : project(from);
|
|
88
|
+
changes.push({
|
|
89
|
+
path,
|
|
90
|
+
...(originalPath ? { originalPath } : {}),
|
|
91
|
+
stage,
|
|
92
|
+
status,
|
|
93
|
+
kind,
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
if (x === '?' && y === '?')
|
|
97
|
+
add('worktree', '?');
|
|
98
|
+
else if (x === 'U' ||
|
|
99
|
+
y === 'U' ||
|
|
100
|
+
(x === 'A' && y === 'A') ||
|
|
101
|
+
(x === 'D' && y === 'D'))
|
|
102
|
+
add('worktree', 'U');
|
|
103
|
+
else {
|
|
104
|
+
if (x !== ' ')
|
|
105
|
+
add('index', x, source);
|
|
106
|
+
if (y !== ' ')
|
|
107
|
+
add('worktree', y);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return { available: true, branch, changes };
|
|
111
|
+
}
|
|
112
|
+
/** Reads a project file as stored in HEAD or the index, without filters. */
|
|
113
|
+
async read(relative, revision) {
|
|
114
|
+
const kind = previewKind(relative);
|
|
115
|
+
if (!isVisibleRelative(relative) || (kind !== 'text' && kind !== 'html'))
|
|
116
|
+
throw new FileUnavailable();
|
|
117
|
+
const prefix = await this.prefix();
|
|
118
|
+
if (prefix === null)
|
|
119
|
+
throw new FileUnavailable();
|
|
120
|
+
const object = `${revision === 'HEAD' ? 'HEAD' : ':0'}:${prefix}${relative}`;
|
|
121
|
+
try {
|
|
122
|
+
const size = Number((await this.run(['cat-file', '-s', object])).toString('utf8').trim());
|
|
123
|
+
if (!Number.isSafeInteger(size) || size > MAX_FILE_SIZE)
|
|
124
|
+
throw new FileUnavailable();
|
|
125
|
+
return await this.run(['cat-file', 'blob', object], MAX_FILE_SIZE + 1);
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
throw new FileUnavailable();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
package/dist/server/office.js
CHANGED
|
@@ -26,7 +26,7 @@ async function executable(filename) {
|
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
async function which(name, env) {
|
|
29
|
+
export async function which(name, env) {
|
|
30
30
|
const extensions = process.platform === 'win32'
|
|
31
31
|
? (env.PATHEXT ?? '.EXE').split(';').filter(Boolean)
|
|
32
32
|
: [''];
|
package/dist/server/server.js
CHANGED
|
@@ -6,10 +6,11 @@ import path from 'node:path';
|
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
import { pipeline } from 'node:stream/promises';
|
|
8
8
|
import { Catalog, contentType, FileUnavailable, isVisibleRelative, } from './catalog.js';
|
|
9
|
+
import { GitRepository } from './git.js';
|
|
9
10
|
import { OfficeConversionError, OfficeRenderer } from './office.js';
|
|
10
11
|
import { installNavigation } from '../navigation.js';
|
|
11
12
|
const UI_ROOT = fileURLToPath(new URL('../client/', import.meta.url));
|
|
12
|
-
const UI_CSP = "default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; worker-src 'self'; style-src 'self'; img-src 'self' data: blob:; font-src 'self'; frame-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; form-action 'none'";
|
|
13
|
+
const UI_CSP = "default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; worker-src 'self'; style-src 'self'; img-src 'self' http: https: data: blob:; font-src 'self'; frame-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; form-action 'none'";
|
|
13
14
|
export const PREVIEW_CSP = "sandbox allow-scripts; default-src 'none'; img-src http: https: data: blob:; style-src http: https: data: 'unsafe-inline'; font-src http: https: data:; media-src http: https: data: blob:; script-src 'unsafe-inline'; connect-src 'none'; object-src 'none'; frame-src 'none'; form-action 'none'; base-uri 'self'; frame-ancestors 'self'";
|
|
14
15
|
export const NETWORK_PREVIEW_CSP = "sandbox allow-scripts; default-src 'none'; img-src http: https: data: blob:; style-src http: https: data: 'unsafe-inline'; font-src http: https: data:; media-src http: https: data: blob:; script-src 'unsafe-inline' http: https:; connect-src http: https:; object-src 'none'; frame-src 'none'; form-action 'none'; base-uri 'self'; frame-ancestors 'self'";
|
|
15
16
|
function reply(req, res, status, type, body) {
|
|
@@ -131,6 +132,7 @@ export async function createViewer(options) {
|
|
|
131
132
|
const office = options.officeConverter
|
|
132
133
|
? new OfficeRenderer(options.officeConverter)
|
|
133
134
|
: undefined;
|
|
135
|
+
const git = options.git ? new GitRepository(options.git, catalog.root) : null;
|
|
134
136
|
const eventClients = new Set();
|
|
135
137
|
let reloadTimer;
|
|
136
138
|
// Unknown or excessive changes are sent as null so clients refresh every tab.
|
|
@@ -247,7 +249,11 @@ export async function createViewer(options) {
|
|
|
247
249
|
reply(req, res, 400, 'text/plain', 'Too many file paths\n');
|
|
248
250
|
return;
|
|
249
251
|
}
|
|
250
|
-
const project = {
|
|
252
|
+
const project = {
|
|
253
|
+
...catalog.project,
|
|
254
|
+
watch: watchEnabled,
|
|
255
|
+
git: git !== null,
|
|
256
|
+
};
|
|
251
257
|
const body = url.pathname === '/api/project'
|
|
252
258
|
? project
|
|
253
259
|
: url.pathname === '/api/session-files'
|
|
@@ -256,6 +262,24 @@ export async function createViewer(options) {
|
|
|
256
262
|
reply(req, res, 200, 'application/json; charset=utf-8', JSON.stringify(body));
|
|
257
263
|
return;
|
|
258
264
|
}
|
|
265
|
+
if (url.pathname === '/api/git/status' ||
|
|
266
|
+
url.pathname === '/api/git/file') {
|
|
267
|
+
if (req.headers.origin && req.headers.origin !== origin.origin) {
|
|
268
|
+
reply(req, res, 403, 'text/plain', 'Origin not allowed\n');
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (!git)
|
|
272
|
+
throw new FileUnavailable();
|
|
273
|
+
if (url.pathname === '/api/git/status') {
|
|
274
|
+
reply(req, res, 200, 'application/json; charset=utf-8', JSON.stringify(await git.status()));
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
const revision = url.searchParams.get('revision');
|
|
278
|
+
if (revision !== 'HEAD' && revision !== 'index')
|
|
279
|
+
throw new FileUnavailable();
|
|
280
|
+
reply(req, res, 200, 'text/plain; charset=utf-8', await git.read(url.searchParams.get('path') ?? '', revision));
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
259
283
|
if (url.pathname === '/preview-html') {
|
|
260
284
|
const relative = url.searchParams.get('path') ?? '';
|
|
261
285
|
const file = await catalog.openFile(relative);
|
package/dist/shared.js
CHANGED