17 lines
280 KiB
JavaScript
Raw Normal View History

(function(){"use strict";class ai{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Fe.isErrorNoTelemetry(t)?new Fe(t.message+`
`+t.stack):new Error(t.message+`
`+t.stack):t},0)}}emit(t){this.listeners.forEach(n=>{n(t)})}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}}const Tn=new ai;function Bn(e){qn(e)||Tn.onUnexpectedError(e)}function ha(e){qn(e)||Tn.onUnexpectedExternalError(e)}function Vn(e){if(e instanceof Error){const{name:t,message:n}=e,s=e.stacktrace||e.stack;return{$isError:!0,name:t,message:n,stack:s,noTelemetry:Fe.isErrorNoTelemetry(e)}}return e}const _t="Canceled";function qn(e){return e instanceof li?!0:e instanceof Error&&e.name===_t&&e.message===_t}class li extends Error{constructor(){super(_t),this.name=this.message}}function fa(){const e=new Error(_t);return e.name=e.message,e}function da(e){return e?new Error(`Illegal argument: ${e}`):new Error("Illegal argument")}function ma(e){return e?new Error(`Illegal state: ${e}`):new Error("Illegal state")}class ga extends Error{constructor(t){super("NotSupported"),t&&(this.message=t)}}class Fe extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Fe)return t;const n=new Fe;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}}class de extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,de.prototype)}}function ui(e,t){const n=this;let s=!1,i;return function(){if(s)return i;if(s=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var pt;(function(e){function t(_){return _&&typeof _=="object"&&typeof _[Symbol.iterator]=="function"}e.is=t;const n=Object.freeze([]);function s(){return n}e.empty=s;function*i(_){yield _}e.single=i;function r(_){return t(_)?_:i(_)}e.wrap=r;function o(_){return _||n}e.from=o;function*l(_){for(let L=_.length-1;L>=0;L--)yield _[L]}e.reverse=l;function u(_){return!_||_[Symbol.iterator]().next().done===!0}e.isEmpty=u;function c(_){return _[Symbol.iterator]().next().value}e.first=c;function h(_,L){for(const x of _)if(L(x))return!0;return!1}e.some=h;function f(_,L){for(const x of _)if(L(x))return x}e.find=f;function*d(_,L){for(const x of _)L(x)&&(yield x)}e.filter=d;function*g(_,L){let x=0;for(const A of _)yield L(A,x++)}e.map=g;function*b(..._){for(const L of _)yield*L}e.concat=b;function m(_,L,x){let A=x;for(const E of _)A=L(A,E);return A}e.reduce=m;function*v(_,L,x=_.length){for(L<0&&(L+=_.length),x<0?x+=_.length:x>_.length&&(x=_.length);L<x;L++)yield _[L]}e.slice=v;function N(_,L=Number.POSITIVE_INFINITY){const x=[];if(L===0)return[x,_];const A=_[Symbol.iterator]();for(let E=0;E<L;E++){const R=A.next();if(R.done)return[x,e.empty()];x.push(R.value)}return[x,{[Symbol.iterator](){return A}}]}e.consume=N;async function S(_){const L=[];for await(const x of _)L.push(x);return Promise.resolve(L)}e.asyncToArray=S})(pt||(pt={}));const ci=!1;let K=null;function hi(e){K=e}if(ci){const e="__is_disposable_tracked__";hi(new class{trackDisposable(t){const n=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==pe.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==pe.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Qe(e){return K?.trackDisposable(e),e}function Je(e){K?.markAsDisposed(e)}function xt(e,t){K?.setParent(e,t)}function fi(e,t){if(K)for(const n of e)K.setParent(n,t)}function ba(e){return K?.markAsSingleton(e),e}function _a(e){return typeof e.dispose=="function"&&e.dispose.length===0}function Ht(e){if(pt.is(e)){const t=[];for(const n of e)if(n)try{n.dispose()}catch(s){t.push(s)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function di(...e){const t=vt(()=>Ht(e));return fi(e,t),t}function vt(e){const t=Qe({dispose:ui(()=>{Je(t),e()})});return t}class De{constructor(){this._toDispose=new Set,this._isDisposed=!1,Qe(this)}dispose(){this._isDisposed||(Je(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDi
`).slice(2).join(`
`))}}class Nt{constructor(t){this.value=t}}const pi=2,xi=(e,t)=>{if(e instanceof Nt)t(e);else for(let n=0;n<e.length;n++){const s=e[n];s&&t(s)}},Ye=gi?new FinalizationRegistry(e=>{typeof e=="string"&&(console.warn("[LEAKING LISTENER] GC'ed a listener that was NOT yet disposed. This is where is was created:"),console.warn(e))}):void 0;class ee{constructor(t){var n,s,i,r,o;this._size=0,this._options=t,this._leakageMon=Wn>0||!((n=this._options)===null||n===void 0)&&n.leakWarningThreshold?new _i((i=(s=this._options)===null||s===void 0?void 0:s.leakWarningThreshold)!==null&&i!==void 0?i:Wn):void 0,this._perfMon=!((r=this._options)===null||r===void 0)&&r._profName?new Pe(this._options._profName):void 0,this._deliveryQueue=(o=this._options)===null||o===void 0?void 0:o.deliveryQueue}dispose(){var t,n,s,i;if(!this._disposed){if(this._disposed=!0,((t=this._deliveryQueue)===null||t===void 0?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners){if(zn){const r=this._listeners;queueMicrotask(()=>{xi(r,o=>{var l;return(l=o.stack)===null||l===void 0?void 0:l.print()})})}this._listeners=void 0,this._size=0}(s=(n=this._options)===null||n===void 0?void 0:n.onDidRemoveLastListener)===null||s===void 0||s.call(n),(i=this._leakageMon)===null||i===void 0||i.dispose()}}get event(){var t;return(t=this._event)!==null&&t!==void 0||(this._event=(n,s,i)=>{var r,o,l,u,c;if(this._leakageMon&&this._size>this._leakageMon.threshold*3)return console.warn(`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far`),pe.None;if(this._disposed)return pe.None;s&&(n=n.bind(s));const h=new Nt(n);let f,d;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(h.stack=Xe.create(),f=this._leakageMon.check(h.stack,this._size+1)),zn&&(h.stack=d??Xe.create()),this._listeners?this._listeners instanceof Nt?((c=this._deliveryQueue)!==null&&c!==void 0||(this._deliveryQueue=new Hn),this._listeners=[this._listeners,h]):this._listeners.push(h):((o=(r=this._options)===null||r===void 0?void 0:r.onWillAddFirstListener)===null||o===void 0||o.call(r,this),this._listeners=h,(u=(l=this._options)===null||l===void 0?void 0:l.onDidAddFirstListener)===null||u===void 0||u.call(l,this)),this._size++;const g=vt(()=>{Ye?.unregister(g),f?.(),this._removeListener(h)});if(i instanceof De?i.add(g):Array.isArray(i)&&i.push(g),Ye){const b=new Error().stack.split(`
`).slice(2).join(`
`).trim();Ye.register(g,b,g)}return g}),this._event}_removeListener(t){var n,s,i,r;if((s=(n=this._options)===null||n===void 0?void 0:n.onWillRemoveListener)===null||s===void 0||s.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(r=(i=this._options)===null||i===void 0?void 0:i.onDidRemoveLastListener)===null||r===void 0||r.call(i,this),this._size=0;return}const o=this._listeners,l=o.indexOf(t);if(l===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,o[l]=void 0;const u=this._deliveryQueue.current===this;if(this._size*pi<=o.length){let c=0;for(let h=0;h<o.length;h++)o[h]?o[c++]=o[h]:u&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);o.length=c}}_deliver(t,n){var s;if(!t)return;const i=((s=this._options)===null||s===void 0?void 0:s.onListenerError)||Bn;if(!i){t.value(n);return}try{t.value(n)}catch(r){i(r)}}_deliverQueue(t){const n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){var n,s,i,r;if(!((n=this._deliveryQueue)===null||n===void 0)&&n.current&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)===null||s===void 0||s.stop()),(i=this._perfMon)===null||i===void 0||i.start(this._size),this._listeners)if(this._listeners instanceof Nt)this._deliver(this._listeners,t);else{const o=this._deliveryQueue;o.enqueue(this,t,this._listeners.length),this._deliverQueue(o)}(r=this._perfMon)===null||r===void 0||r.stop()}hasListeners(){return this._size>0}}const wa=()=>new Hn;class Hn{constructor(){this.i=-1,this.end=0}enqueue(t,n,s){this.i=0,this.end=s,this.current=t,this.value=n}reset(){this.i=this.end,this.current=void 0,this.value=void 0}}class vi extends ee{constructor(t){super(t),this._isPaused=0,this._eventQueue=new Un,this._mergeFn=t?.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){if(this._eventQueue.size>0){const t=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(t))}}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(t){this._size&&(this._isPaused!==0?this._eventQueue.push(t):super.fire(t))}}class Na extends vi{constructor(t){var n;super(t),this._delay=(n=t.delay)!==null&&n!==void 0?n:100}fire(t){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(t)}}class Sa extends ee{constructor(t){super(t),this._queuedEvents=[],this._mergeFn=t?.merge}fire(t){this.hasListeners()&&(this._queuedEvents.push(t),this._queuedEvents.length===1&&queueMicrotask(()=>{this._mergeFn?super.fire(this._mergeFn(this._queuedEvents)):this._queuedEvents.forEach(n=>super.fire(n)),this._queuedEvents=[]}))}}class Ca{constructor(){this.hasListeners=!1,this.events=[],this.emitter=new ee({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(t){const n={event:t,listener:null};this.events.push(n),this.hasListeners&&this.hook(n);const s=()=>{this.hasListeners&&this.unhook(n);const i=this.events.indexOf(n);this.events.splice(i,1)};return toDisposable(createSingleCallFunction(s))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(t=>this.hook(t))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(t=>this.unhook(t))}hook(t){t.listener=t.event(n=>this.emitter.fire(n))}unhook(t){var n;(n=t.listener)===null||n===void 0||n.dispose(),t.listener=null}dispose(){var t;this.emitter.dispose();for(const n of this.events)(t=n.listener)===null||t===void 0||t.dispose();this.events=[]}}class Aa{constructor(){this.buffers=[]}wrapEvent(t){return(n,s,i)=>t(r=>{const o=this.buffers[this.buffers.length-1];o?o.push(()=>n.call(s,r)):n.call(s,r)},void 0,i)}bufferEvents(t){const n=[];this.buffers.push(n);const s=t();return this.buffers.pop(),n.forEach(i=>i()),s}}class ya{constructor(){this.listening=!1,this.inputEvent=wt.None,this.in
`)>=0;let n=null;try{n=strings.createRegExp(this.searchString,this.isRegex,{matchCase:this.matchCase,wholeWord:!1,multiline:t,global:!0,unicode:!0})}catch{return null}if(!n)return null;let s=!this.isRegex&&!t;return s&&this.searchString.toLowerCase()!==this.searchString.toUpperCase()&&(s=this.matchCase),new SearchData(n,this.wordSeparators?getMapForWordSeparators(this.wordSeparators,[]):null,s?this.searchString:null)}}function xo(e){if(!e||e.length===0)return!1;for(let t=0,n=e.length;t<n;t++){const s=e.charCodeAt(t);if(s===10)return!0;if(s===92){if(t++,t>=n)break;const i=e.charCodeAt(t);if(i===110||i===114||i===87)return!0}}return!1}function ut(e,t,n){if(!n)return new FindMatch(e,null);const s=[];for(let i=0,r=t.length;i<r;i++)s[i]=t[i];return new FindMatch(e,s)}class Ps{constructor(t){const n=[];let s=0;for(let i=0,r=t.length;i<r;i++)t.charCodeAt(i)===10&&(n[s++]=i);this._lineFeedsOffsets=n}findLineFeedCountBeforeOffset(t){const n=this._lineFeedsOffsets;let s=0,i=n.length-1;if(i===-1||t<=n[0])return 0;for(;s<i;){const r=s+((i-s)/2>>0);n[r]>=t?i=r-1:n[r+1]>=t?(s=r,i=r):s=r+1}return s+1}}class k0{static findMatches(t,n,s,i,r){const o=n.parseSearchRequest();return o?o.regex.multiline?this._doFindMatchesMultiline(t,s,new ct(o.wordSeparators,o.regex),i,r):this._doFindMatchesLineByLine(t,s,o,i,r):[]}static _getMultilineMatchRange(t,n,s,i,r,o){let l,u=0;i?(u=i.findLineFeedCountBeforeOffset(r),l=n+r+u):l=n+r;let c;if(i){const g=i.findLineFeedCountBeforeOffset(r+o.length)-u;c=l+o.length+g}else c=l+o.length;const h=t.getPositionAt(l),f=t.getPositionAt(c);return new Range(h.lineNumber,h.column,f.lineNumber,f.column)}static _doFindMatchesMultiline(t,n,s,i,r){const o=t.getOffsetAt(n.getStartPosition()),l=t.getValueInRange(n,1),u=t.getEOL()===`\r
`?new Ps(l):null,c=[];let h=0,f;for(s.reset(0);f=s.next(l);)if(c[h++]=ut(this._getMultilineMatchRange(t,o,l,u,f.index,f[0]),f,i),h>=r)return c;return c}static _doFindMatchesLineByLine(t,n,s,i,r){const o=[];let l=0;if(n.startLineNumber===n.endLineNumber){const c=t.getLineContent(n.startLineNumber).substring(n.startColumn-1,n.endColumn-1);return l=this._findMatchesInLine(s,c,n.startLineNumber,n.startColumn-1,l,o,i,r),o}const u=t.getLineContent(n.startLineNumber).substring(n.startColumn-1);l=this._findMatchesInLine(s,u,n.startLineNumber,n.startColumn-1,l,o,i,r);for(let c=n.startLineNumber+1;c<n.endLineNumber&&l<r;c++)l=this._findMatchesInLine(s,t.getLineContent(c),c,0,l,o,i,r);if(l<r){const c=t.getLineContent(n.endLineNumber).substring(0,n.endColumn-1);l=this._findMatchesInLine(s,c,n.endLineNumber,0,l,o,i,r)}return o}static _findMatchesInLine(t,n,s,i,r,o,l,u){const c=t.wordSeparators;if(!l&&t.simpleSearch){const d=t.simpleSearch,g=d.length,b=n.length;let m=-g;for(;(m=n.indexOf(d,m+g))!==-1;)if((!c||Is(c,n,b,m,g))&&(o[r++]=new FindMatch(new Range(s,m+1+i,s,m+1+g+i),null),r>=u))return r;return r}const h=new ct(t.wordSeparators,t.regex);let f;h.reset(0);do if(f=h.next(n),f&&(o[r++]=ut(new Range(s,f.index+1+i,s,f.index+1+f[0].length+i),f,l),r>=u))return r;while(f);return r}static findNextMatch(t,n,s,i){const r=n.parseSearchRequest();if(!r)return null;const o=new ct(r.wordSeparators,r.regex);return r.regex.multiline?this._doFindNextMatchMultiline(t,s,o,i):this._doFindNextMatchLineByLine(t,s,o,i)}static _doFindNextMatchMultiline(t,n,s,i){const r=new Position(n.lineNumber,1),o=t.getOffsetAt(r),l=t.getLineCount(),u=t.getValueInRange(new Range(r.lineNumber,r.column,l,t.getLineMaxColumn(l)),1),c=t.getEOL()===`\r
`?new Ps(u):null;s.reset(n.column-1);const h=s.next(u);return h?ut(this._getMultilineMatchRange(t,o,u,c,h.index,h[0]),h,i):n.lineNumber!==1||n.column!==1?this._doFindNextMatchMultiline(t,new Position(1,1),s,i):null}static _doFindNextMatchLineByLine(t,n,s,i){const r=t.getLineCount(),o=n.lineNumber,l=t.getLineContent(o),u=this._findFirstMatchInLine(s,l,o,n.column,i);if(u)return u;for(let c=1;c<=r;c++){const h=(o+c-1)%r,f=t.getLineContent(h+1),d=this._findFirstMatchInLine(s,f,h+1,1,i);if(d)return d}return null}static _findFirstMatchInLine(t,n,s,i,r){t.reset(i-1);const o=t.next(n);return o?ut(new Range(s,o.index+1,s,o.index+1+o[0].length),o,r):null}static findPreviousMatch(t,n,s,i){const r=n.parseSearchRequest();if(!r)return null;const o=new ct(r.wordSeparators,r.regex);return r.regex.multiline?this._doFindPreviousMatchMultiline(t,s,o,i):this._doFindPreviousMatchLineByLine(t,s,o,i)}static _doFindPreviousMatchMultiline(t,n,s,i){const r=this._doFindMatchesMultiline(t,new Range(1,1,n.lineNumber,n.column),s,i,10*po);if(r.length>0)return r[r.length-1];const o=t.getLineCount();return n.lineNumber!==o||n.column!==t.getLineMaxColumn(o)?this._doFindPreviousMatchMultiline(t,new Position(o,t.getLineMaxColumn(o)),s,i):null}static _doFindPreviousMatchLineByLine(t,n,s,i){const r=t.getLineCount(),o=n.lineNumber,l=t.getLineContent(o).substring(0,n.column-1),u=this._findLastMatchInLine(s,l,o,i);if(u)return u;for(let c=1;c<=r;c++){const h=(r+o-c-1)%r,f=t.getLineContent(h+1),d=this._findLastMatchInLine(s,f,h+1,i);if(d)return d}return null}static _findLastMatchInLine(t,n,s,i){let r=null,o;for(t.reset(0);o=t.next(n);)r=ut(new Range(s,o.index+1,s,o.index+1+o[0].length),o,i);return r}}function vo(e,t,n,s,i){if(s===0)return!0;const r=t.charCodeAt(s-1);if(e.get(r)!==0||r===13||r===10)return!0;if(i>0){const o=t.charCodeAt(s);if(e.get(o)!==0)return!0}return!1}function Lo(e,t,n,s,i){if(s+i===n)return!0;const r=t.charCodeAt(s+i);if(e.get(r)!==0||r===13||r===10)return!0;if(i>0){const o=t.charCodeAt(s+i-1);if(e.get(o)!==0)return!0}return!1}function Is(e,t,n,s,i){return vo(e,t,n,s,i)&&Lo(e,t,n,s,i)}class ct{constructor(t,n){this._wordSeparators=t,this._searchRegex=n,this._prevMatchStartIndex=-1,this._prevMatchLength=0}reset(t){this._searchRegex.lastIndex=t,this._prevMatchStartIndex=-1,this._prevMatchLength=0}next(t){const n=t.length;let s;do{if(this._prevMatchStartIndex+this._prevMatchLength===n||(s=this._searchRegex.exec(t),!s))return null;const i=s.index,r=s[0].length;if(i===this._prevMatchStartIndex&&r===this._prevMatchLength){if(r===0){n1(t,n,this._searchRegex.lastIndex)>65535?this._searchRegex.lastIndex+=2:this._searchRegex.lastIndex+=1;continue}return null}if(this._prevMatchStartIndex=i,this._prevMatchLength=r,!this._wordSeparators||Is(this._wordSeparators,t,n,i,r))return s}while(s);return null}}function F0(e,t){if(!e)throw new Error(t?`Assertion failed (${t})`:"Assertion Failed")}function wo(e,t="Unreachable"){throw new Error(t)}function D0(e){e||onUnexpectedError(new BugIndicatingError("Soft Assertion Failed"))}function Vt(e){if(!e()){debugger;e(),Bn(new de("Assertion Failed"))}}function Ts(e,t){let n=0;for(;n<e.length-1;){const s=e[n],i=e[n+1];if(!t(s,i))return!1;n++}return!0}class No{static computeUnicodeHighlights(t,n,s){const i=s?s.startLineNumber:1,r=s?s.endLineNumber:t.getLineCount(),o=new Bs(n),l=o.getCandidateCodePoints();let u;l==="allNonBasicAscii"?u=new RegExp("[^\\t\\n\\r\\x20-\\x7E]","g"):u=new RegExp(`${So(Array.from(l))}`,"g");const c=new ct(null,u),h=[];let f=!1,d,g=0,b=0,m=0;e:for(let v=i,N=r;v<=N;v++){const S=t.getLineContent(v),_=S.length;c.reset(0);do if(d=c.next(S),d){let L=d.index,x=d.index+d[0].length;if(L>0){const U=S.charCodeAt(L-1);et(U)&&L--}if(x+1<_){const U=S.charCodeAt(x-1);et(U)&&x++}const A=S.substring(L,x);let E=gn(L+1,C1,S,0);E&&E.endColumn<=L+1&&(E=null);const R=o.shouldHighlightNonBasicASCII(A,E?E.word:null);if(R!==0){if(R===3?g++:R===2?b++:R===1?m++:wo(R),h.length>=1e3){f=!0;break e}h.push(new D(v,L+1,v,x+1))}}while(d)}return{ranges:h,hasMore:f,ambiguousCharacterCount:g,invisibleCharacterCount:b,nonBasicAsciiCh
`||e===" "}class qt{constructor(t,n,s){this.changes=t,this.moves=n,this.hitTimeout=s}}class Co{constructor(t,n){this.lineRangeMapping=t,this.changes=n}}class P{static addRange(t,n){let s=0;for(;s<n.length&&n[s].endExclusive<t.start;)s++;let i=s;for(;i<n.length&&n[i].start<=t.endExclusive;)i++;if(s===i)n.splice(s,0,t);else{const r=Math.min(t.start,n[s].start),o=Math.max(t.endExclusive,n[i-1].endExclusive);n.splice(s,i-s,new P(r,o))}}static tryCreate(t,n){if(!(t>n))return new P(t,n)}static ofLength(t){return new P(0,t)}static ofStartAndLength(t,n){return new P(t,t+n)}constructor(t,n){if(this.start=t,this.endExclusive=n,t>n)throw new de(`Invalid range: ${this.toString()}`)}get isEmpty(){return this.start===this.endExclusive}delta(t){return new P(this.start+t,this.endExclusive+t)}deltaStart(t){return new P(this.start+t,this.endExclusive)}deltaEnd(t){return new P(this.start,this.endExclusive+t)}get length(){return this.endExclusive-this.start}toString(){return`[${this.start}, ${this.endExclusive})`}contains(t){return this.start<=t&&t<this.endExclusive}join(t){return new P(Math.min(this.start,t.start),Math.max(this.endExclusive,t.endExclusive))}intersect(t){const n=Math.max(this.start,t.start),s=Math.min(this.endExclusive,t.endExclusive);if(n<=s)return new P(n,s)}intersects(t){const n=Math.max(this.start,t.start),s=Math.min(this.endExclusive,t.endExclusive);return n<s}isBefore(t){return this.endExclusive<=t.start}isAfter(t){return this.start>=t.endExclusive}slice(t){return t.slice(this.start,this.endExclusive)}substring(t){return t.substring(this.start,this.endExclusive)}clip(t){if(this.isEmpty)throw new de(`Invalid clipping range: ${this.toString()}`);return Math.max(this.start,Math.min(this.endExclusive-1,t))}clipCyclic(t){if(this.isEmpty)throw new de(`Invalid clipping range: ${this.toString()}`);return t<this.start?this.endExclusive-(this.start-t)%this.length:t>=this.endExclusive?this.start+(t-this.start)%this.length:t}forEach(t){for(let n=this.start;n<this.endExclusive;n++)t(n)}}class qs{constructor(){this._sortedRanges=[]}addRange(t){let n=0;for(;n<this._sortedRanges.length&&this._sortedRanges[n].endExclusive<t.start;)n++;let s=n;for(;s<this._sortedRanges.length&&this._sortedRanges[s].start<=t.endExclusive;)s++;if(n===s)this._sortedRanges.splice(n,0,t);else{const i=Math.min(t.start,this._sortedRanges[n].start),r=Math.max(t.endExclusive,this._sortedRanges[s-1].endExclusive);this._sortedRanges.splice(n,s-n,new P(i,r))}}toString(){return this._sortedRanges.map(t=>t.toString()).join(", ")}intersectsStrict(t){let n=0;for(;n<this._sortedRanges.length&&this._sortedRanges[n].endExclusive<=t.start;)n++;return n<this._sortedRanges.length&&this._sortedRanges[n].start<t.endExclusive}intersectWithRange(t){const n=new qs;for(const s of this._sortedRanges){const i=s.intersect(t);i&&n.addRange(i)}return n}intersectWithRangeLength(t){return this.intersectWithRange(t).length}get length(){return this._sortedRanges.reduce((t,n)=>t+n.length,0)}}function P0(e,t,n){const s=Ao(e,t);if(s!==-1)return e[s]}function Ao(e,t,n=e.length-1){for(let s=n;s>=0;s--){const i=e[s];if(t(i))return s}return-1}function We(e,t){const n=ht(e,t);return n===-1?void 0:e[n]}function ht(e,t,n=0,s=e.length){let i=n,r=s;for(;i<r;){const o=Math.floor((i+r)/2);t(e[o])?i=o+1:r=o}return i-1}function yo(e,t){const n=En(e,t);return n===e.length?void 0:e[n]}function En(e,t,n=0,s=e.length){let i=n,r=s;for(;i<r;){const o=Math.floor((i+r)/2);t(e[o])?r=o:i=o+1}return i}class ft{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(ft.assertInvariants){if(this._prevFindLastPredicate){for(const s of this._array)if(this._prevFindLastPredicate(s)&&!t(s))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}const n=ht(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}}ft.assertInvariants=!1;function Eo(e,t){if(e.length===0)return;let n=e[0];for(let s=1;s<e.length;s++){const i=e[s];t(i,n)>0&&(n=i)}re
`);this.histogram[l]=(this.histogram[l]||0)+1}this.totalCount=i}computeSimilarity(t){var n,s;let i=0;const r=Math.max(this.histogram.length,t.histogram.length);for(let o=0;o<r;o++)i+=Math.abs(((n=this.histogram[o])!==null&&n!==void 0?n:0)-((s=t.histogram[o])!==null&&s!==void 0?s:0));return 1-i/(this.totalCount+t.totalCount)}}$e.chrKeys=new Map;class Io{compute(t,n,s=mt.instance,i){if(t.length===0||n.length===0)return _e.trivial(t,n);const r=new kn(t.length,n.length),o=new kn(t.length,n.length),l=new kn(t.length,n.length);for(let b=0;b<t.length;b++)for(let m=0;m<n.length;m++){if(!s.isValid())return _e.trivialTimedOut(t,n);const v=b===0?0:r.get(b-1,m),N=m===0?0:r.get(b,m-1);let S;t.getElement(b)===n.getElement(m)?(b===0||m===0?S=0:S=r.get(b-1,m-1),b>0&&m>0&&o.get(b-1,m-1)===3&&(S+=l.get(b-1,m-1)),S+=i?i(b,m):1):S=-1;const _=Math.max(v,N,S);if(_===S){const L=b>0&&m>0?l.get(b-1,m-1):0;l.set(b,m,L+1),o.set(b,m,3)}else _===v?(l.set(b,m,0),o.set(b,m,1)):_===N&&(l.set(b,m,0),o.set(b,m,2));r.set(b,m,_)}const u=[];let c=t.length,h=n.length;function f(b,m){(b+1!==c||m+1!==h)&&u.push(new O(new P(b+1,c),new P(m+1,h))),c=b,h=m}let d=t.length-1,g=n.length-1;for(;d>=0&&g>=0;)o.get(d,g)===3?(f(d,g),d--,g--):o.get(d,g)===1?d--:g--;return f(-1,-1),u.reverse(),new _e(u,!1)}}class Hs{compute(t,n,s=mt.instance){if(t.length===0||n.length===0)return _e.trivial(t,n);const i=t,r=n;function o(m,v){for(;m<i.length&&v<r.length&&i.getElement(m)===r.getElement(v);)m++,v++;return m}let l=0;const u=new To;u.set(0,o(0,0));const c=new Bo;c.set(0,u.get(0)===0?null:new Os(null,0,0,u.get(0)));let h=0;e:for(;;){if(l++,!s.isValid())return _e.trivialTimedOut(i,r);const m=-Math.min(l,r.length+l%2),v=Math.min(l,i.length+l%2);for(h=m;h<=v;h+=2){let N=0;const S=h===v?-1:u.get(h+1),_=h===m?-1:u.get(h-1)+1;N++;const L=Math.min(Math.max(S,_),i.length),x=L-h;if(N++,L>i.length||x>r.length)continue;const A=o(L,x);u.set(h,A);const E=L===S?c.get(h+1):c.get(h-1);if(c.set(h,A!==L?new Os(E,L,x,A-L):E),u.get(h)===i.length&&u.get(h)-h===r.length)break e}}let f=c.get(h);const d=[];let g=i.length,b=r.length;for(;;){const m=f?f.x+f.length:0,v=f?f.y+f.length:0;if((m!==g||v!==b)&&d.push(new O(new P(m,g),new P(v,b))),!f)break;g=f.x,b=f.y,f=f.prev}return d.reverse(),new _e(d,!1)}}class Os{constructor(t,n,s,i){this.prev=t,this.x=n,this.y=s,this.length=i}}class To{constructor(){this.positiveArr=new Int32Array(10),this.negativeArr=new Int32Array(10)}get(t){return t<0?(t=-t-1,this.negativeArr[t]):this.positiveArr[t]}set(t,n){if(t<0){if(t=-t-1,t>=this.negativeArr.length){const s=this.negativeArr;this.negativeArr=new Int32Array(s.length*2),this.negativeArr.set(s)}this.negativeArr[t]=n}else{if(t>=this.positiveArr.length){const s=this.positiveArr;this.positiveArr=new Int32Array(s.length*2),this.positiveArr.set(s)}this.positiveArr[t]=n}}}class Bo{constructor(){this.positiveArr=[],this.negativeArr=[]}get(t){return t<0?(t=-t-1,this.negativeArr[t]):this.positiveArr[t]}set(t,n){t<0?(t=-t-1,this.negativeArr[t]=n):this.positiveArr[t]=n}}class Ut{constructor(t,n,s){this.lines=t,this.considerWhitespaceChanges=s,this.elements=[],this.firstCharOffsetByLine=[],this.additionalOffsetByLine=[];let i=!1;n.start>0&&n.endExclusive>=t.length&&(n=new P(n.start-1,n.endExclusive),i=!0),this.lineRange=n,this.firstCharOffsetByLine[0]=0;for(let r=this.lineRange.start;r<this.lineRange.endExclusive;r++){let o=t[r],l=0;if(i)l=o.length,o="",i=!1;else if(!s){const u=o.trimStart();l=o.length-u.length,o=u.trimEnd()}this.additionalOffsetByLine.push(l);for(let u=0;u<o.length;u++)this.elements.push(o.charCodeAt(u));r<t.length-1&&(this.elements.push(10),this.firstCharOffsetByLine[r-this.lineRange.start+1]=this.elements.length)}this.additionalOffsetByLine.push(0)}toString(){return`Slice: "${this.text}"`}get text(){return this.getText(new P(0,this.length))}getText(t){return this.elements.slice(t.start,t.endExclusive).map(n=>String.fromCharCode(n)).join("")}getElement(t){return this.elements[t]}get length(){return this.elements.length}getBoundaryScore(t){const n=Gs(t>0?this.elements[t-1]:-1),s=Gs(t<this.elements.length?this.eleme
`).length>=15&&Uo(f,g=>g.length>=2)>=2}),o=Oo(e,o),o}function Uo(e,t){let n=0;for(const s of e)t(s)&&n++;return n}function zo(e,t,n,s){const i=[],r=e.filter(u=>u.modified.isEmpty&&u.original.length>=3).map(u=>new $e(u.original,t,u)),o=new Set(e.filter(u=>u.original.isEmpty&&u.modified.length>=3).map(u=>new $e(u.modified,n,u))),l=new Set;for(const u of r){let c=-1,h;for(const f of o){const d=u.computeSimilarity(f);d>c&&(c=d,h=f)}if(c>.9&&h&&(o.delete(h),i.push(new ce(u.range,h.range)),l.add(u.source),l.add(h.source)),!s.isValid())return{moves:i,excludedChanges:l}}return{moves:i,excludedChanges:l}}function Wo(e,t,n,s,i,r){const o=[],l=new bo;for(const d of e)for(let g=d.original.startLineNumber;g<d.original.endLineNumberExclusive-2;g++){const b=`${t[g-1]}:${t[g+1-1]}:${t[g+2-1]}`;l.add(b,{range:new I(g,g+3)})}const u=[];e.sort(Dt(d=>d.modified.startLineNumber,it));for(const d of e){let g=[];for(let b=d.modified.startLineNumber;b<d.modified.endLineNumberExclusive-2;b++){const m=`${n[b-1]}:${n[b+1-1]}:${n[b+2-1]}`,v=new I(b,b+3),N=[];l.forEach(m,({range:S})=>{for(const L of g)if(L.originalLineRange.endLineNumberExclusive+1===S.endLineNumberExclusive&&L.modifiedLineRange.endLineNumberExclusive+1===v.endLineNumberExclusive){L.originalLineRange=new I(L.originalLineRange.startLineNumber,S.endLineNumberExclusive),L.modifiedLineRange=new I(L.modifiedLineRange.startLineNumber,v.endLineNumberExclusive),N.push(L);return}const _={modifiedLineRange:v,originalLineRange:S};u.push(_),N.push(_)}),g=N}if(!r.isValid())return[]}u.sort(Br(Dt(d=>d.modifiedLineRange.length,it)));const c=new fe,h=new fe;for(const d of u){const g=d.modifiedLineRange.startLineNumber-d.originalLineRange.startLineNumber,b=c.subtractFrom(d.modifiedLineRange),m=h.subtractFrom(d.originalLineRange).getWithDelta(g),v=b.getIntersection(m);for(const N of v.ranges){if(N.length<3)continue;const S=N,_=N.delta(-g);o.push(new ce(_,S)),c.addRange(S),h.addRange(_)}}o.sort(Dt(d=>d.original.startLineNumber,it));const f=new ft(e);for(let d=0;d<o.length;d++){const g=o[d],b=f.findLastMonotonous(A=>A.original.startLineNumber<=g.original.startLineNumber),m=We(e,A=>A.modified.startLineNumber<=g.modified.startLineNumber),v=Math.max(g.original.startLineNumber-b.original.startLineNumber,g.modified.startLineNumber-m.modified.startLineNumber),N=f.findLastMonotonous(A=>A.original.startLineNumber<g.original.endLineNumberExclusive),S=We(e,A=>A.modified.startLineNumber<g.modified.endLineNumberExclusive),_=Math.max(N.original.endLineNumberExclusive-g.original.endLineNumberExclusive,S.modified.endLineNumberExclusive-g.modified.endLineNumberExclusive);let L;for(L=0;L<v;L++){const A=g.original.startLineNumber-L-1,E=g.modified.startLineNumber-L-1;if(A>s.length||E>i.length||c.contains(E)||h.contains(A)||!js(s[A-1],i[E-1],r))break}L>0&&(h.addRange(new I(g.original.startLineNumber-L,g.original.startLineNumber)),c.addRange(new I(g.modified.startLineNumber-L,g.modified.startLineNumber)));let x;for(x=0;x<_;x++){const A=g.original.endLineNumberExclusive+x,E=g.modified.endLineNumberExclusive+x;if(A>s.length||E>i.length||c.contains(E)||h.contains(A)||!js(s[A-1],i[E-1],r))break}x>0&&(h.addRange(new I(g.original.endLineNumberExclusive,g.original.endLineNumberExclusive+x)),c.addRange(new I(g.modified.endLineNumberExclusive,g.modified.endLineNumberExclusive+x))),(L>0||x>0)&&(o[d]=new ce(new I(g.original.startLineNumber-L,g.original.endLineNumberExclusive+x),new I(g.modified.startLineNumber-L,g.modified.endLineNumberExclusive+x)))}return o}function js(e,t,n){if(e.trim()===t.trim())return!0;if(e.length>300&&t.length>300)return!1;const i=new Hs().compute(new Ut([e],new P(0,1),!1),new Ut([t],new P(0,1),!1),n);let r=0;const o=O.invert(i.diffs,e.length);for(const h of o)h.seq1Range.forEach(f=>{Fn(e.charCodeAt(f))||r++});function l(h){let f=0;for(let d=0;d<e.length;d++)Fn(h.charCodeAt(d))||f++;return f}const u=l(e.length>t.length?e:t);return r/u>.6&&u>10}function Ho(e){if(e.length===0)return e;e.sort(Dt(n=>n.original.startLineNumber,it));const t=[e[0]];for(let n=1;n<e.length;n++){const s=t[t.length-1],i=e[n],r=i.original
`)}isStronglyEqual(t,n){return this.lines[t]===this.lines[n]}}function Zs(e){let t=0;for(;t<e.length&&(e.charCodeAt(t)===32||e.charCodeAt(t)===9);)t++;return t}class Yo{constructor(){this.dynamicProgrammingDiffing=new Io,this.myersDiffingAlgorithm=new Hs}computeDiff(t,n,s){if(t.length<=1&&Mr(t,n,(x,A)=>x===A))return new qt([],[],!1);if(t.length===1&&t[0].length===0||n.length===1&&n[0].length===0)return new qt([new be(new I(1,t.length+1),new I(1,n.length+1),[new He(new D(1,1,t.length,t[0].length+1),new D(1,1,n.length,n[0].length+1))])],[],!1);const i=s.maxComputationTimeMs===0?mt.instance:new Po(s.maxComputationTimeMs),r=!s.ignoreTrimWhitespace,o=new Map;function l(x){let A=o.get(x);return A===void 0&&(A=o.size,o.set(x,A)),A}const u=t.map(x=>l(x.trim())),c=n.map(x=>l(x.trim())),h=new Ys(u,t),f=new Ys(c,n),d=h.length+f.length<1700?this.dynamicProgrammingDiffing.compute(h,f,i,(x,A)=>t[x]===n[A]?n[A].length===0?.1:1+Math.log(1+n[A].length):.99):this.myersDiffingAlgorithm.compute(h,f);let g=d.diffs,b=d.hitTimeout;g=Qs(h,f,g),g=Jo(h,f,g);const m=[],v=x=>{if(r)for(let A=0;A<x;A++){const E=N+A,R=S+A;if(t[E]!==n[R]){const U=this.refineDiff(t,n,new O(new P(E,E+1),new P(R,R+1)),i,r);for(const j of U.mappings)m.push(j);U.hitTimeout&&(b=!0)}}};let N=0,S=0;for(const x of g){Vt(()=>x.seq1Range.start-N===x.seq2Range.start-S);const A=x.seq1Range.start-N;v(A),N=x.seq1Range.endExclusive,S=x.seq2Range.endExclusive;const E=this.refineDiff(t,n,x,i,r);E.hitTimeout&&(b=!0);for(const R of E.mappings)m.push(R)}v(t.length-N);const _=Ks(m,t,n);let L=[];return s.computeMoves&&(L=this.computeMoves(_,t,n,u,c,i,r)),Vt(()=>{function x(E,R){if(E.lineNumber<1||E.lineNumber>R.length)return!1;const U=R[E.lineNumber-1];return!(E.column<1||E.column>U.length+1)}function A(E,R){return!(E.startLineNumber<1||E.startLineNumber>R.length+1||E.endLineNumberExclusive<1||E.endLineNumberExclusive>R.length+1)}for(const E of _){if(!E.innerChanges)return!1;for(const R of E.innerChanges)if(!(x(R.modifiedRange.getStartPosition(),n)&&x(R.modifiedRange.getEndPosition(),n)&&x(R.originalRange.getStartPosition(),t)&&x(R.originalRange.getEndPosition(),t)))return!1;if(!A(E.modified,n)||!A(E.original,t))return!1}return!0}),new qt(_,L,b)}computeMoves(t,n,s,i,r,o,l){return qo(t,n,s,i,r,o).map(h=>{const f=this.refineDiff(n,s,new O(h.original.toOffsetRange(),h.modified.toOffsetRange()),o,l),d=Ks(f.mappings,n,s,!0);return new Co(h,d)})}refineDiff(t,n,s,i,r){const o=new Ut(t,s.seq1Range,r),l=new Ut(n,s.seq2Range,r),u=o.length+l.length<500?this.dynamicProgrammingDiffing.compute(o,l,i):this.myersDiffingAlgorithm.compute(o,l,i);let c=u.diffs;return c=Qs(o,l,c),c=jo(o,l,c),c=Go(o,l,c),c=Xo(o,l,c),{mappings:c.map(f=>new He(o.translateRange(f.seq1Range),l.translateRange(f.seq2Range))),hitTimeout:u.hitTimeout}}}function Ks(e,t,n,s=!1){const i=[];for(const r of Fr(e.map(o=>Zo(o,t,n)),(o,l)=>o.original.overlapOrTouch(l.original)||o.modified.overlapOrTouch(l.modified))){const o=r[0],l=r[r.length-1];i.push(new be(o.original.join(l.original),o.modified.join(l.modified),r.map(u=>u.innerChanges[0])))}return Vt(()=>!s&&i.length>0&&(i[0].modified.startLineNumber!==i[0].original.startLineNumber||n.length-i[i.length-1].modified.endLineNumberExclusive!==t.length-i[i.length-1].original.endLineNumberExclusive)?!1:Ts(i,(r,o)=>o.original.startLineNumber-r.original.endLineNumberExclusive===o.modified.startLineNumber-r.modified.endLineNumberExclusive&&r.original.endLineNumberExclusive<o.original.startLineNumber&&r.modified.endLineNumberExclusive<o.modified.startLineNumber)),i}function Zo(e,t,n){let s=0,i=0;e.modifiedRange.endColumn===1&&e.originalRange.endColumn===1&&e.originalRange.startLineNumber+s<=e.originalRange.endLineNumber&&e.modifiedRange.startLineNumber+s<=e.modifiedRange.endLineNumber&&(i=-1),e.modifiedRange.startColumn-1>=n[e.modifiedRange.startLineNumber-1].length&&e.originalRange.startColumn-1>=t[e.originalRange.startLineNumber-1].length&&e.originalRange.startLineNumber<=e.originalRange.endLineNumber+i&&e.modifiedRange.startLineNumber<=e.modifiedRange.endLineNumber+i&&(s=1);const r=new I(e.original