var Common;!function(e){!function(e){"use strict";class n{constructor(e,n){this.urls=n;this._fileMappings=[];this._allMappings=[];e&&e.forEach(e=>{this._fileMappings[e.file]||(this._fileMappings[e.file]=[]);this._fileMappings[e.file].push(e);this._allMappings.push(e)});this._fileMappings.forEach(e=>{e.sort((e,n)=>e.sourceLine!==n.sourceLine?e.sourceLine-n.sourceLine:e.sourceColumn!==n.sourceColumn?e.sourceColumn-n.sourceColumn:e.generatedLine!==n.generatedLine?e.generatedLine-n.generatedLine:e.generatedColumn-n.generatedColumn)})}get allMappings(){return this._allMappings}static binarySearch(e,n,i){for(var a=e.length-1,r=0;r<=a;){var t=r+a>>1,l=i(e[t],n.line,n.column);if(l>0)r=t+1;else{if(!(l<0)){a=t;break}a=t-1}}for(var o=Math.max(Math.min(e.length-1,a),0);o+1<e.length&&0===i(e[o+1],n.line,n.column);)o++;return o}static binaryCompareSource(e,n,i){return e.sourceLine===n?i-e.sourceColumn:n-e.sourceLine}static binaryCompareGenerated(e,n,i){return e.generatedLine===n?i-e.generatedColumn:n-e.generatedLine}isValid(){return this._fileMappings&&this._fileMappings.length>0}hasOriginalPosition(i){var a=new e.Position(i.line,i.column,i.file),r=this._allMappings;if(r.length>0){var t=r[n.binarySearch(r,a,n.binaryCompareGenerated)];return i.line===t.generatedLine}return!0}getOriginalPosition(i){var a=new e.Position(i.line,i.column,i.file),r=this._allMappings;if(r.length>0){var t=n.binarySearch(r,a,n.binaryCompareGenerated);a.line=Math.max(r[t].sourceLine,0);a.column=Math.max(r[t].sourceColumn,0);a.file=Math.min(Math.max(r[t].file,0),this._fileMappings.length-1)}return a}getGeneratedPosition(i){var a=new e.Position(i.line,i.column,i.file),r=this._fileMappings[a.file];if(r&&r.length>0){var t=n.binarySearch(r,a,n.binaryCompareSource);a.line=Math.max(r[t].generatedLine,0);a.column=Math.max(r[t].generatedColumn,0)}return a}}e.SourcemapMappings=n}(e.FormatService||(e.FormatService={}))}(Common||(Common={}));
