UNPKG

cloudstudio

Version:

Run VS Code on a remote server.

2 lines 28.7 kB
(()=>{"use strict";var e={800:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.config=t.loadMessageBundle=t.localize=t.format=t.setPseudo=t.isPseudo=t.isString=t.isNumber=t.isDefined=t.BundleFormat=t.MessageFormat=void 0;var o,r,i,a=n(926);function s(e){return void 0!==e}(i=t.MessageFormat||(t.MessageFormat={})).file="file",i.bundle="bundle",i.both="both",(r=t.BundleFormat||(t.BundleFormat={})).standalone="standalone",r.languagePack="languagePack",function(e){e.is=function(e){var t=e;return t&&s(t.key)&&s(t.comment)}}(o||(o={})),t.isDefined=s;var c=Object.prototype.toString;function l(e,n){return t.isPseudo&&(e="["+e.replace(/[aouei]/g,"$&$&")+"]"),0===n.length?e:e.replace(/\{(\d+)\}/g,(function(e,t){var o=t[0],r=n[o],i=e;return"string"==typeof r?i=r:"number"!=typeof r&&"boolean"!=typeof r&&null!=r||(i=String(r)),i}))}t.isNumber=function(e){return"[object Number]"===c.call(e)},t.isString=function(e){return"[object String]"===c.call(e)},t.isPseudo=!1,t.setPseudo=function(e){t.isPseudo=e},t.format=l,t.localize=function(e,t){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];return l(t,n)},t.loadMessageBundle=function(e){return(0,a.default)().loadMessageBundle(e)},t.config=function(e){return(0,a.default)().config(e)}},926:(e,t)=>{var n;function o(){if(void 0===n)throw new Error("No runtime abstraction layer installed");return n}Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.install=function(e){if(void 0===e)throw new Error("No runtime abstraction layer provided");n=e}}(o||(o={})),t.default=o},472:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.config=t.loadMessageBundle=t.BundleFormat=t.MessageFormat=void 0;var o,r,i=n(622),a=n(747),s=n(926),c=n(800),l=n(800);function u(e){return JSON.parse(a.readFileSync(e,"utf8"))}function d(e){return function(t,n){for(var o=[],r=2;r<arguments.length;r++)o[r-2]=arguments[r];return(0,c.isNumber)(t)?t>=e.length?void console.error("Broken localize call found. Index out of bounds. Stacktrace is\n: ".concat(new Error("").stack)):(0,c.format)(e[t],o):(0,c.isString)(n)?(console.warn("Message ".concat(n," didn't get externalized correctly.")),(0,c.format)(n,o)):void console.error("Broken localize call found. Stacktrace is\n: ".concat(new Error("").stack))}}function g(e,t){return o[e]=t,t}function h(e){try{return function(e){var t=u(i.join(e,"nls.metadata.json")),n=Object.create(null);for(var o in t){var r=t[o];n[o]=r.messages}return n}(e)}catch(e){return void console.log("Generating default bundle from meta data failed.",e)}}function f(e,t){var n;if(!0===r.languagePackSupport&&void 0!==r.cacheRoot&&void 0!==r.languagePackId&&void 0!==r.translationsConfigFile&&void 0!==r.translationsConfig)try{n=function(e,t){var n,o,s,l=i.join(r.cacheRoot,"".concat(e.id,"-").concat(e.hash,".json")),d=!1,g=!1;try{return n=JSON.parse(a.readFileSync(l,{encoding:"utf8",flag:"r"})),o=l,s=new Date,a.utimes(o,s,s,(function(){})),n}catch(e){if("ENOENT"===e.code)g=!0;else{if(!(e instanceof SyntaxError))throw e;console.log("Syntax error parsing message bundle: ".concat(e.message,".")),a.unlink(l,(function(e){e&&console.error("Deleting corrupted bundle ".concat(l," failed."))})),d=!0}}if(!(n=function(e,t){var n=r.translationsConfig[e.id];if(n){var o=u(n).contents,a=u(i.join(t,"nls.metadata.json")),s=Object.create(null);for(var l in a){var d=a[l],g=o["".concat(e.outDir,"/").concat(l)];if(g){for(var h=[],f=0;f<d.keys.length;f++){var m=d.keys[f],p=g[(0,c.isString)(m)?m:m.key];void 0===p&&(p=d.messages[f]),h.push(p)}s[l]=h}else s[l]=d.messages}return s}}(e,t))||d)return n;if(g)try{a.writeFileSync(l,JSON.stringify(n),{encoding:"utf8",flag:"wx"})}catch(e){if("EEXIST"===e.code)return n;throw e}return n}(e,t)}catch(e){console.log("Load or create bundle failed ",e)}if(!n){if(r.languagePackSupport)return h(t);var o=function(e){for(var t=r.language;t;){var n=i.join(e,"nls.bundle.".concat(t,".json"));if(a.existsSync(n))return n;var o=t.lastIndexOf("-");t=o>0?t.substring(0,o):void 0}if(void 0===t&&(n=i.join(e,"nls.bundle.json"),a.existsSync(n)))return n}(t);if(o)try{return u(o)}catch(e){console.log("Loading in the box message bundle failed.",e)}n=h(t)}return n}function m(e){if(!e)return c.localize;var t=i.extname(e);if(t&&(e=e.substr(0,e.length-t.length)),r.messageFormat===c.MessageFormat.both||r.messageFormat===c.MessageFormat.bundle){var n=function(e){for(var t,n=i.dirname(e);t=i.join(n,"nls.metadata.header.json"),!a.existsSync(t);){var o=i.dirname(n);if(o===n){t=void 0;break}n=o}return t}(e);if(n){var s=i.dirname(n),l=o[s];if(void 0===l)try{var h=JSON.parse(a.readFileSync(n,"utf8"));try{var m=f(h,s);l=g(s,m?{header:h,nlsBundle:m}:null)}catch(e){console.error("Failed to load nls bundle",e),l=g(s,null)}}catch(e){console.error("Failed to read header file",e),l=g(s,null)}if(l){var p=e.substr(s.length+1).replace(/\\/g,"/"),w=l.nlsBundle[p];return void 0===w?(console.error("Messages for file ".concat(e," not found. See console for details.")),function(){return"Messages not found."}):d(w)}}}if(r.messageFormat===c.MessageFormat.both||r.messageFormat===c.MessageFormat.file)try{var v=u(function(e){var t;if(r.cacheLanguageResolution&&t)t=t;else{if(c.isPseudo||!r.language)t=".nls.json";else for(var n=r.language;n;){var o=".nls."+n+".json";if(a.existsSync(e+o)){t=o;break}var i=n.lastIndexOf("-");i>0?n=n.substring(0,i):(t=".nls.json",n=null)}r.cacheLanguageResolution&&(t=t)}return e+t}(e));return Array.isArray(v)?d(v):(0,c.isDefined)(v.messages)&&(0,c.isDefined)(v.keys)?d(v.messages):(console.error("String bundle '".concat(e,"' uses an unsupported format.")),function(){return"File bundle has unsupported format. See console for details"})}catch(e){"ENOENT"!==e.code&&console.error("Failed to load single file bundle",e)}return console.error("Failed to load message bundle for file ".concat(e)),function(){return"Failed to load message bundle. See console for details."}}function p(e){return e&&((0,c.isString)(e.locale)&&(r.locale=e.locale.toLowerCase(),r.language=r.locale,o=Object.create(null)),void 0!==e.messageFormat&&(r.messageFormat=e.messageFormat),e.bundleFormat===c.BundleFormat.standalone&&!0===r.languagePackSupport&&(r.languagePackSupport=!1)),(0,c.setPseudo)("pseudo"===r.locale),m}Object.defineProperty(t,"MessageFormat",{enumerable:!0,get:function(){return l.MessageFormat}}),Object.defineProperty(t,"BundleFormat",{enumerable:!0,get:function(){return l.BundleFormat}}),function(){if(r={locale:void 0,language:void 0,languagePackSupport:!1,cacheLanguageResolution:!0,messageFormat:c.MessageFormat.bundle},(0,c.isString)(process.env.VSCODE_NLS_CONFIG))try{var e=JSON.parse(process.env.VSCODE_NLS_CONFIG),t=void 0;if(e.availableLanguages){var n=e.availableLanguages["*"];(0,c.isString)(n)&&(t=n)}if((0,c.isString)(e.locale)&&(r.locale=e.locale.toLowerCase()),void 0===t?r.language=r.locale:"en"!==t&&(r.language=t),function(e){return!0===e||!1===e}(e._languagePackSupport)&&(r.languagePackSupport=e._languagePackSupport),(0,c.isString)(e._cacheRoot)&&(r.cacheRoot=e._cacheRoot),(0,c.isString)(e._languagePackId)&&(r.languagePackId=e._languagePackId),(0,c.isString)(e._translationsConfigFile)){r.translationsConfigFile=e._translationsConfigFile;try{r.translationsConfig=u(r.translationsConfigFile)}catch(t){if(e._corruptedFile){var s=i.dirname(e._corruptedFile);a.exists(s,(function(t){t&&a.writeFile(e._corruptedFile,"corrupted","utf8",(function(e){console.error(e)}))}))}}}}catch(e){}(0,c.setPseudo)("pseudo"===r.locale),o=Object.create(null)}(),t.loadMessageBundle=m,t.config=p,s.default.install(Object.freeze({loadMessageBundle:m,config:p}))},78:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(549),r=(0,n(472).loadMessageBundle)();t.default=class{constructor(e){this.tracker=e.createTracker("codelens")}begin(e){this.config=e,this.config.enableCodeLens&&this.registerCodeLensProvider()}configurationUpdated(e){!1===e.enableCodeLens&&this.codeLensRegistrationHandle?(this.codeLensRegistrationHandle.dispose(),this.codeLensRegistrationHandle=null):!0!==e.enableCodeLens||this.codeLensRegistrationHandle||this.registerCodeLensProvider(),this.config=e}dispose(){this.codeLensRegistrationHandle&&(this.codeLensRegistrationHandle.dispose(),this.codeLensRegistrationHandle=null)}async provideCodeLenses(e,t){if(!this.config||!this.config.enableCodeLens)return null;const n=await this.tracker.getConflicts(e),i=n?.length??0;if(o.commands.executeCommand("setContext","mergeConflictsCount",i),!i)return null;const a=[];return n.forEach((e=>{const t={command:"merge-conflict.accept.current",title:r("acceptCurrentChange","Accept Current Change"),arguments:["known-conflict",e]},n={command:"merge-conflict.accept.incoming",title:r("acceptIncomingChange","Accept Incoming Change"),arguments:["known-conflict",e]},i={command:"merge-conflict.accept.both",title:r("acceptBothChanges","Accept Both Changes"),arguments:["known-conflict",e]},s={command:"merge-conflict.compare",title:r("compareChanges","Compare Changes"),arguments:[e]};a.push(new o.CodeLens(e.range,t),new o.CodeLens(e.range.with(e.range.start.with({character:e.range.start.character+1})),n),new o.CodeLens(e.range.with(e.range.start.with({character:e.range.start.character+2})),i),new o.CodeLens(e.range.with(e.range.start.with({character:e.range.start.character+3})),s))})),a}registerCodeLensProvider(){this.codeLensRegistrationHandle=o.languages.registerCodeLensProvider([{scheme:"file"},{scheme:"vscode-vfs"},{scheme:"untitled"},{scheme:"vscode-userdata"}],this)}}},30:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(549),r=n(986),i=(0,n(472).loadMessageBundle)();var a;!function(e){e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards"}(a||(a={})),t.default=class{constructor(e){this.disposables=[],this.tracker=e.createTracker("commands")}begin(){this.disposables.push(this.registerTextEditorCommand("merge-conflict.accept.current",this.acceptCurrent),this.registerTextEditorCommand("merge-conflict.accept.incoming",this.acceptIncoming),this.registerTextEditorCommand("merge-conflict.accept.selection",this.acceptSelection),this.registerTextEditorCommand("merge-conflict.accept.both",this.acceptBoth),this.registerTextEditorCommand("merge-conflict.accept.all-current",this.acceptAllCurrent,this.acceptAllCurrentResources),this.registerTextEditorCommand("merge-conflict.accept.all-incoming",this.acceptAllIncoming,this.acceptAllIncomingResources),this.registerTextEditorCommand("merge-conflict.accept.all-both",this.acceptAllBoth),this.registerTextEditorCommand("merge-conflict.next",this.navigateNext),this.registerTextEditorCommand("merge-conflict.previous",this.navigatePrevious),this.registerTextEditorCommand("merge-conflict.compare",this.compare))}registerTextEditorCommand(e,t,n){return o.commands.registerCommand(e,((...e)=>{if(n&&e.length&&e.every((e=>e&&e.resourceUri)))return n.call(this,e.map((e=>e.resourceUri)));const r=o.window.activeTextEditor;return r&&t.call(this,r,...e)}))}acceptCurrent(e,...t){return this.accept(0,e,...t)}acceptIncoming(e,...t){return this.accept(1,e,...t)}acceptBoth(e,...t){return this.accept(2,e,...t)}acceptAllCurrent(e){return this.acceptAll(0,e)}acceptAllIncoming(e){return this.acceptAll(1,e)}acceptAllCurrentResources(e){return this.acceptAllResources(0,e)}acceptAllIncomingResources(e){return this.acceptAllResources(1,e)}acceptAllBoth(e){return this.acceptAll(2,e)}async compare(e,t){if(!t&&!(t=await this.findConflictContainingSelection(e)))return void o.window.showWarningMessage(i("cursorNotInConflict","Editor cursor is not within a merge conflict"));const n=await this.tracker.getConflicts(e.document);if(!n)return void o.window.showWarningMessage(i("cursorNotInConflict","Editor cursor is not within a merge conflict"));const a=e.document.uri.scheme;let s=t.current.content;const c=n.map((e=>[e.current.content,e.range])),l=n.map((e=>[e.incoming.content,e.range])),u=e.document.uri.with({scheme:r.default.scheme,query:JSON.stringify({scheme:a,range:s,ranges:c})});s=t.incoming.content;const d=u.with({query:JSON.stringify({scheme:a,ranges:l})});let g=0;for(const e of n){if(e.range.isEqual(t.range))break;g+=e.range.end.line-e.range.start.line-(e.incoming.content.end.line-e.incoming.content.start.line)}const h=new o.Range(t.range.start.line-g,t.range.start.character,t.range.start.line-g,t.range.start.character),f=e.document.uri.path,m=f.substring(f.lastIndexOf("/")+1),p=i("compareChangesTitle","{0}: Current Changes ↔ Incoming Changes",m),w=o.workspace.getConfiguration("merge-conflict").get("diffViewPosition"),v={viewColumn:"Beside"===w?o.ViewColumn.Beside:o.ViewColumn.Active,selection:h};"Below"===w&&await o.commands.executeCommand("workbench.action.newGroupBelow"),await o.commands.executeCommand("vscode.diff",u,d,p,v)}navigateNext(e){return this.navigate(e,a.Forwards)}navigatePrevious(e){return this.navigate(e,a.Backwards)}async acceptSelection(e){const t=await this.findConflictContainingSelection(e);if(!t)return void o.window.showWarningMessage(i("cursorNotInConflict","Editor cursor is not within a merge conflict"));let n,r=t.splitter;if(t.commonAncestors.length>0&&(r=t.commonAncestors[0].header),e.selection.active.isBefore(r.start))n=0;else{if(!e.selection.active.isAfter(t.splitter.end))return e.selection.active.isBefore(t.splitter.start)?void o.window.showWarningMessage(i("cursorOnCommonAncestorsRange",'Editor cursor is within the common ancestors block, please move it to either the "current" or "incoming" block')):void o.window.showWarningMessage(i("cursorOnSplitterRange",'Editor cursor is within the merge conflict splitter, please move it to either the "current" or "incoming" block'));n=1}this.tracker.forget(e.document),t.commitEdit(n,e)}dispose(){this.disposables.forEach((e=>e.dispose())),this.disposables=[]}async navigate(e,t){const n=await this.findConflictForNavigation(e,t);if(n)n.canNavigate?n.conflict&&(e.selection=new o.Selection(n.conflict.range.start,n.conflict.range.start),e.revealRange(n.conflict.range,o.TextEditorRevealType.Default)):o.window.showWarningMessage(i("noOtherConflictsInThisFile","No other merge conflicts within this file"));else{if(o.workspace.getConfiguration("merge-conflict").get("autoNavigateNextConflict.enabled"))return;o.window.showWarningMessage(i("noConflicts","No merge conflicts found in this file"))}}async accept(e,t,...n){let r;r="known-conflict"===n[0]?n[1]:await this.findConflictContainingSelection(t),r?(this.tracker.forget(t.document),r.commitEdit(e,t),o.workspace.getConfiguration("merge-conflict").get("autoNavigateNextConflict.enabled")&&this.navigateNext(t)):o.window.showWarningMessage(i("cursorNotInConflict","Editor cursor is not within a merge conflict"))}async acceptAll(e,t){const n=await this.tracker.getConflicts(t.document);n&&0!==n.length?(this.tracker.forget(t.document),await t.edit((o=>n.forEach((n=>{n.applyEdit(e,t.document,o)}))))):o.window.showWarningMessage(i("noConflicts","No merge conflicts found in this file"))}async acceptAllResources(e,t){const n=await Promise.all(t.map((e=>o.workspace.openTextDocument(e)))),r=new o.WorkspaceEdit;for(const t of n){const n=await this.tracker.getConflicts(t);n&&0!==n.length&&(this.tracker.forget(t),n.forEach((n=>{n.applyEdit(e,t,{replace:(e,n)=>r.replace(t.uri,e,n)})})))}o.workspace.applyEdit(r)}async findConflictContainingSelection(e,t){if(t||(t=await this.tracker.getConflicts(e.document)),!t||0===t.length)return null;for(const n of t)if(n.range.contains(e.selection.active))return n;return null}async findConflictForNavigation(e,t,n){if(n||(n=await this.tracker.getConflicts(e.document)),!n||0===n.length)return null;const o=e.selection.active;if(1===n.length)return n[0].range.contains(o)?{canNavigate:!1}:{canNavigate:!0,conflict:n[0]};let r,i,s;if(t===a.Forwards)r=e=>o.isBefore(e.range.start),i=()=>n[0],s=n;else{if(t!==a.Backwards)throw new Error(`Unsupported direction ${t}`);r=e=>o.isAfter(e.range.start),i=()=>n[n.length-1],s=n.slice().reverse()}for(const e of s)if(r(e)&&!e.range.contains(o))return{canNavigate:!0,conflict:e};return{canNavigate:!0,conflict:i()}}}},986:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(549);class r{constructor(e){this.context=e}begin(){this.context.subscriptions.push(o.workspace.registerTextDocumentContentProvider(r.scheme,this))}dispose(){}async provideTextDocumentContent(e){try{const{scheme:t,ranges:n}=JSON.parse(e.query),r=await o.workspace.openTextDocument(e.with({scheme:t,query:""}));let i="",a=new o.Position(0,0);n.forEach((e=>{const[t,n]=e,[s,c]=t,[l,u]=n;i+=r.getText(new o.Range(a.line,a.character,l.line,l.character)),i+=r.getText(new o.Range(s.line,s.character,c.line,c.character)),a=new o.Position(u.line,u.character)}));const s=r.lineAt(r.lineCount-1).range.end;return i+=r.getText(new o.Range(a.line,a.character,s.line,s.character)),i}catch(e){return await o.window.showErrorMessage("Unable to show comparison"),null}}}t.default=r,r.scheme="merge-conflict.conflict-diff"},286:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Delayer=void 0,t.Delayer=class{constructor(e){this.defaultDelay=e,this.timeout=null,this.completionPromise=null,this.onSuccess=null,this.task=null}trigger(e,t=this.defaultDelay){return this.task=e,t>=0&&this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((e=>{this.onSuccess=e})).then((()=>{this.completionPromise=null,this.onSuccess=null;const e=this.task();return this.task=null,e}))),(t>=0||null===this.timeout)&&(this.timeout=setTimeout((()=>{this.timeout=null,this.onSuccess(void 0)}),t>=0?t:this.defaultDelay)),this.completionPromise}forceDelivery(){if(!this.completionPromise)return null;this.cancelTimeout();const e=this.completionPromise;return this.onSuccess(void 0),e}isTriggered(){return null!==this.timeout}cancel(){this.cancelTimeout(),this.completionPromise=null}cancelTimeout(){null!==this.timeout&&(clearTimeout(this.timeout),this.timeout=null)}}},807:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentMergeConflict=void 0,t.DocumentMergeConflict=class{constructor(e){this.range=e.range,this.current=e.current,this.incoming=e.incoming,this.commonAncestors=e.commonAncestors,this.splitter=e.splitter}commitEdit(e,t,n){return n?(this.applyEdit(e,t.document,n),Promise.resolve(!0)):t.edit((n=>this.applyEdit(e,t.document,n)))}applyEdit(e,t,n){if(0===e){const e=t.getText(this.current.content);this.replaceRangeWithContent(e,n)}else if(1===e){const e=t.getText(this.incoming.content);this.replaceRangeWithContent(e,n)}else if(2===e){const e=t.getText(this.current.content),o=t.getText(this.incoming.content);n.replace(this.range,e.concat(o))}}replaceRangeWithContent(e,t){this.isNewlineOnly(e)?t.replace(this.range,""):t.replace(this.range,e)}isNewlineOnly(e){return"\n"===e||"\r\n"===e}}},387:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(53),r=n(286);class i{constructor(e,t){this.origins=new Set,this.origins.add(t),this.delayTask=new r.Delayer(e)}addOrigin(e){this.origins.add(e)}hasOrigin(e){return this.origins.has(e)}}class a{constructor(e,t){this.parent=e,this.origin=t}getConflicts(e){return this.parent.getConflicts(e,this.origin)}isPending(e){return this.parent.isPending(e,this.origin)}forget(e){this.parent.forget(e)}}t.default=class{constructor(){this.cache=new Map,this.delayExpireTime=0}getConflicts(e,t){const n=this.getCacheKey(e);if(!n)return Promise.resolve(this.getConflictsOrEmpty(e,[t]));let o=this.cache.get(n);return o?o.addOrigin(t):(o=new i(this.delayExpireTime,t),this.cache.set(n,o)),o.delayTask.trigger((()=>{const t=this.getConflictsOrEmpty(e,Array.from(o.origins));return this.cache?.delete(n),t}))}isPending(e,t){if(!e)return!1;const n=this.getCacheKey(e);if(!n)return!1;const o=this.cache.get(n);return!!o&&o.hasOrigin(t)}createTracker(e){return new a(this,e)}forget(e){const t=this.getCacheKey(e);t&&this.cache.delete(t)}dispose(){this.cache.clear()}getConflictsOrEmpty(e,t){return o.MergeConflictParser.containsConflict(e)?o.MergeConflictParser.scanDocument(e):[]}getCacheKey(e){return e.uri?e.uri.toString():null}}},53:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MergeConflictParser=void 0;const o=n(549),r=n(807),i="<<<<<<<",a="|||||||",s=">>>>>>>";class c{static scanDocument(e){let t=null;const n=[];for(let o=0;o<e.lineCount;o++){const r=e.lineAt(o);if(r&&!r.isEmptyOrWhitespace)if(r.text.startsWith(i)){if(null!==t){t=null;break}t={startHeader:r,commonAncestors:[]}}else if(t&&!t.splitter&&r.text.startsWith(a))t.commonAncestors.push(r);else if(t&&!t.splitter&&"======="===r.text)t.splitter=r;else if(t&&r.text.startsWith(s)){t.endFooter=r;const o=c.scanItemTolMergeConflictDescriptor(e,t);null!==o&&n.push(o),t=null}}return n.filter(Boolean).map((e=>new r.DocumentMergeConflict(e)))}static scanItemTolMergeConflictDescriptor(e,t){if(!t.startHeader||!t.splitter||!t.endFooter)return null;const n=t.commonAncestors[0]||t.splitter;return{current:{header:t.startHeader.range,decoratorContent:new o.Range(t.startHeader.rangeIncludingLineBreak.end,c.shiftBackOneCharacter(e,n.range.start,t.startHeader.rangeIncludingLineBreak.end)),content:new o.Range(t.startHeader.rangeIncludingLineBreak.end,n.range.start),name:t.startHeader.text.substring(i.length+1)},commonAncestors:t.commonAncestors.map(((n,r,i)=>{const s=i[r+1]||t.splitter;return{header:n.range,decoratorContent:new o.Range(n.rangeIncludingLineBreak.end,c.shiftBackOneCharacter(e,s.range.start,n.rangeIncludingLineBreak.end)),content:new o.Range(n.rangeIncludingLineBreak.end,s.range.start),name:n.text.substring(a.length+1)}})),splitter:t.splitter.range,incoming:{header:t.endFooter.range,decoratorContent:new o.Range(t.splitter.rangeIncludingLineBreak.end,c.shiftBackOneCharacter(e,t.endFooter.range.start,t.splitter.rangeIncludingLineBreak.end)),content:new o.Range(t.splitter.rangeIncludingLineBreak.end,t.endFooter.range.start),name:t.endFooter.text.substring(s.length+1)},range:new o.Range(t.startHeader.range.start,t.endFooter.rangeIncludingLineBreak.end)}}static containsConflict(e){if(!e)return!1;const t=e.getText();return t.includes(i)&&t.includes(s)}static shiftBackOneCharacter(e,t,n){if(t.isEqual(n))return t;let r=t.line,i=t.character-1;return i<0&&(r--,i=e.lineAt(r).range.end.character),new o.Position(r,i)}}t.MergeConflictParser=c},330:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(549),r=(0,n(472).loadMessageBundle)();t.default=class{constructor(e,t){this.context=e,this.decorations={},this.decorationUsesWholeLine=!0,this.updating=new Map,this.tracker=t.createTracker("decorator")}begin(e){this.config=e,this.registerDecorationTypes(e),o.window.visibleTextEditors.forEach((e=>this.applyDecorations(e))),o.workspace.onDidOpenTextDocument((e=>{this.applyDecorationsFromEvent(e)}),null,this.context.subscriptions),o.workspace.onDidChangeTextDocument((e=>{this.applyDecorationsFromEvent(e.document)}),null,this.context.subscriptions),o.window.onDidChangeVisibleTextEditors((e=>{e.forEach((e=>this.applyDecorations(e)))}),null,this.context.subscriptions)}configurationUpdated(e){this.config=e,this.registerDecorationTypes(e),o.window.visibleTextEditors.forEach((e=>{this.removeDecorations(e),this.applyDecorations(e)}))}registerDecorationTypes(e){Object.keys(this.decorations).forEach((e=>this.decorations[e].dispose())),this.decorations={},e.enableDecorations&&e.enableEditorOverview&&((e.enableDecorations||e.enableEditorOverview)&&(this.decorations["current.content"]=o.window.createTextEditorDecorationType(this.generateBlockRenderOptions("merge.currentContentBackground","editorOverviewRuler.currentContentForeground",e)),this.decorations["incoming.content"]=o.window.createTextEditorDecorationType(this.generateBlockRenderOptions("merge.incomingContentBackground","editorOverviewRuler.incomingContentForeground",e)),this.decorations["commonAncestors.content"]=o.window.createTextEditorDecorationType(this.generateBlockRenderOptions("merge.commonContentBackground","editorOverviewRuler.commonContentForeground",e))),e.enableDecorations&&(this.decorations["current.header"]=o.window.createTextEditorDecorationType({isWholeLine:this.decorationUsesWholeLine,backgroundColor:new o.ThemeColor("merge.currentHeaderBackground"),color:new o.ThemeColor("editor.foreground"),outlineStyle:"solid",outlineWidth:"1pt",outlineColor:new o.ThemeColor("merge.border"),after:{contentText:" "+r("currentChange","(Current Change)"),color:new o.ThemeColor("descriptionForeground")}}),this.decorations["commonAncestors.header"]=o.window.createTextEditorDecorationType({isWholeLine:this.decorationUsesWholeLine,backgroundColor:new o.ThemeColor("merge.commonHeaderBackground"),color:new o.ThemeColor("editor.foreground"),outlineStyle:"solid",outlineWidth:"1pt",outlineColor:new o.ThemeColor("merge.border")}),this.decorations.splitter=o.window.createTextEditorDecorationType({color:new o.ThemeColor("editor.foreground"),outlineStyle:"solid",outlineWidth:"1pt",outlineColor:new o.ThemeColor("merge.border"),isWholeLine:this.decorationUsesWholeLine}),this.decorations["incoming.header"]=o.window.createTextEditorDecorationType({backgroundColor:new o.ThemeColor("merge.incomingHeaderBackground"),color:new o.ThemeColor("editor.foreground"),outlineStyle:"solid",outlineWidth:"1pt",outlineColor:new o.ThemeColor("merge.border"),isWholeLine:this.decorationUsesWholeLine,after:{contentText:" "+r("incomingChange","(Incoming Change)"),color:new o.ThemeColor("descriptionForeground")}})))}dispose(){Object.keys(this.decorations).forEach((e=>{this.decorations[e].dispose()})),this.decorations={}}generateBlockRenderOptions(e,t,n){const r={};return n.enableDecorations&&(r.backgroundColor=new o.ThemeColor(e),r.isWholeLine=this.decorationUsesWholeLine),n.enableEditorOverview&&(r.overviewRulerColor=new o.ThemeColor(t),r.overviewRulerLane=o.OverviewRulerLane.Full),r}applyDecorationsFromEvent(e){for(const t of o.window.visibleTextEditors)t.document===e&&this.applyDecorations(t)}async applyDecorations(e){if(e&&e.document&&this.config&&(this.config.enableDecorations||this.config.enableEditorOverview)&&!this.updating.get(e))try{this.updating.set(e,!0);const t=await this.tracker.getConflicts(e.document);if(-1===o.window.visibleTextEditors.indexOf(e))return;if(0===t.length)return void this.removeDecorations(e);const n={},r=(e,t)=>{n[e]=n[e]||[],n[e].push(t)};t.forEach((e=>{e.current.decoratorContent.isEmpty||r("current.content",e.current.decoratorContent),e.incoming.decoratorContent.isEmpty||r("incoming.content",e.incoming.decoratorContent),e.commonAncestors.forEach((e=>{e.decoratorContent.isEmpty||r("commonAncestors.content",e.decoratorContent)})),this.config.enableDecorations&&(r("current.header",e.current.header),r("splitter",e.splitter),r("incoming.header",e.incoming.header),e.commonAncestors.forEach((e=>{r("commonAncestors.header",e.header)})))})),Object.keys(n).forEach((t=>{const o=this.decorations[t];o&&e.setDecorations(o,n[t])}))}finally{this.updating.delete(e)}}removeDecorations(e){Object.keys(this.decorations).forEach((t=>{const n=this.decorations[t];n&&e.setDecorations(n,[])}))}}},574:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const o=n(549),r=n(387),i=n(78),a=n(30),s=n(986),c=n(330);t.default=class{constructor(e){this.context=e,this.services=[]}begin(){const e=this.createExtensionConfiguration(),t=new r.default;this.services.push(t,new a.default(t),new i.default(t),new s.default(this.context),new c.default(this.context,t)),this.services.forEach((t=>{t.begin&&t.begin instanceof Function&&t.begin(e)})),o.workspace.onDidChangeConfiguration((()=>{this.services.forEach((e=>{e.configurationUpdated&&e.configurationUpdated instanceof Function&&e.configurationUpdated(this.createExtensionConfiguration())}))}))}createExtensionConfiguration(){const e=o.workspace.getConfiguration("merge-conflict"),t=e.get("codeLens.enabled",!0),n=e.get("decorators.enabled",!0);return{enableCodeLens:t,enableDecorations:n,enableEditorOverview:n}}dispose(){this.services.forEach((e=>e.dispose())),this.services=[]}}},747:e=>{e.exports=require("fs")},622:e=>{e.exports=require("path")},549:e=>{e.exports=require("vscode")}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}var o={};(()=>{var e=o;Object.defineProperty(e,"__esModule",{value:!0}),e.deactivate=e.activate=void 0;const t=n(574);e.activate=function(e){const n=new t.default(e);n.begin(),e.subscriptions.push(n)},e.deactivate=function(){}})();var r=exports;for(var i in o)r[i]=o[i];o.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})(); //# sourceMappingURL=https://ticino.blob.core.windows.net/sourcemaps/a711c3b7ecbf5dae1e178a62074ae55c6a2930fe/extensions/merge-conflict/dist/mergeConflictMain.js.map