UNPKG

dd-trace

Version:

Datadog APM tracing client for JavaScript

1 lines 27.4 kB
(()=>{var e={"./@datadog/source-map/lib/array-set.js":function(e,n,r){var t=r("./@datadog/source-map/lib/util.js"),o=Object.prototype.hasOwnProperty,i="undefined"!=typeof Map;function s(){this._array=[],this._set=i?new Map:Object.create(null)}s.fromArray=function(e,n){for(var r=new s,t=0,o=e.length;t<o;t++)r.add(e[t],n);return r},s.prototype.size=function(){return i?this._set.size:Object.getOwnPropertyNames(this._set).length},s.prototype.add=function(e,n){var r=i?e:t.toSetString(e),s=i?this.has(e):o.call(this._set,r),a=this._array.length;(!s||n)&&this._array.push(e),s||(i?this._set.set(e,a):this._set[r]=a)},s.prototype.has=function(e){if(i)return this._set.has(e);var n=t.toSetString(e);return o.call(this._set,n)},s.prototype.indexOf=function(e){if(i){var n=this._set.get(e);if(n>=0)return n}else{var r=t.toSetString(e);if(o.call(this._set,r))return this._set[r]}throw Error('"'+e+'" is not in the set.')},s.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw Error("No element indexed by "+e)},s.prototype.toArray=function(){return this._array.slice()},n.ArraySet=s},"./@datadog/source-map/lib/base64-vlq.js":function(e,n,r){var t=r("./@datadog/source-map/lib/base64.js");n.encode=function(e){var n,r="",o=e<0?(-e<<1)+1:(e<<1)+0;do n=31&o,(o>>>=5)>0&&(n|=32),r+=t.encode(n);while(o>0);return r},n.decode=function(e,n,r){var o,i,s,a,u=e.length,l=0,c=0;do{if(n>=u)throw Error("Expected more digits in base 64 VLQ value.");if(-1===(a=t.decode(e.charCodeAt(n++))))throw Error("Invalid base64 digit: "+e.charAt(n-1));s=!!(32&a),a&=31,l+=a<<c,c+=5}while(s);i=(o=l)>>1,r.value=(1&o)==1?-i:i,r.rest=n}},"./@datadog/source-map/lib/base64.js":function(e,n){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");n.encode=function(e){if(0<=e&&e<r.length)return r[e];throw TypeError("Must be between 0 and 63: "+e)},n.decode=function(e){return 65<=e&&e<=90?e-65:97<=e&&e<=122?e-97+26:48<=e&&e<=57?e-48+52:43==e?62:47==e?63:-1}},"./@datadog/source-map/lib/binary-search.js":function(e,n){n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(e,r,t,o){if(0===r.length)return -1;var i=function e(r,t,o,i,s,a){var u=Math.floor((t-r)/2)+r,l=s(o,i[u],!0);return 0===l?u:l>0?t-u>1?e(u,t,o,i,s,a):a==n.LEAST_UPPER_BOUND?t<i.length?t:-1:u:u-r>1?e(r,u,o,i,s,a):a==n.LEAST_UPPER_BOUND?u:r<0?-1:r}(-1,r.length,e,r,t,o||n.GREATEST_LOWER_BOUND);if(i<0)return -1;for(;i-1>=0&&0===t(r[i],r[i-1],!0);)--i;return i}},"./@datadog/source-map/lib/mapping-list.js":function(e,n,r){var t=r("./@datadog/source-map/lib/util.js");function o(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}o.prototype.unsortedForEach=function(e,n){this._array.forEach(e,n)},o.prototype.add=function(e){var n,r,o,i,s;(n=this._last,r=n.generatedLine,o=e.generatedLine,i=n.generatedColumn,s=e.generatedColumn,o>r||o==r&&s>=i||0>=t.compareByGeneratedPositionsInflated(n,e))?this._last=e:this._sorted=!1,this._array.push(e)},o.prototype.toArray=function(){return this._sorted||(this._array.sort(t.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},n.MappingList=o},"./@datadog/source-map/lib/quick-sort.js":function(e,n){function r(e,n,r){var t=e[n];e[n]=e[r],e[r]=t}n.quickSort=function(e,n){!function e(n,t,o,i){if(o<i){var s=Math.round(o+Math.random()*(i-o)),a=o-1;r(n,s,i);for(var u=n[i],l=o;l<i;l++)0>=t(n[l],u)&&r(n,a+=1,l);r(n,a+1,l);var c=a+1;e(n,t,o,c-1),e(n,t,c+1,i)}}(e,n,0,e.length-1)}},"./@datadog/source-map/lib/source-map-consumer.js":function(e,n,r){var t=r("./@datadog/source-map/lib/util.js"),o=r("./@datadog/source-map/lib/binary-search.js"),i=r("./@datadog/source-map/lib/array-set.js").ArraySet,s=r("./@datadog/source-map/lib/base64-vlq.js"),a=r("./@datadog/source-map/lib/quick-sort.js").quickSort;function u(e,n){var r=e;return"string"==typeof e&&(r=t.parseSourceMapInput(e)),null!=r.sections?new g(r,n):new l(r,n)}function l(e,n){var r=e;"string"==typeof e&&(r=t.parseSourceMapInput(e));var o=t.getArg(r,"version"),s=t.getArg(r,"sources"),a=t.getArg(r,"names",[]),u=t.getArg(r,"sourceRoot",null),l=t.getArg(r,"sourcesContent",null),c=t.getArg(r,"mappings"),g=t.getArg(r,"file",null);if(o!=this._version)throw Error("Unsupported version: "+o);u&&(u=t.normalize(u)),s=s.map(String).map(t.normalize).map(function(e){return u&&t.isAbsolute(u)&&t.isAbsolute(e)?t.relative(u,e):e}),this._names=i.fromArray(a.map(String),!0),this._sources=i.fromArray(s,!0),this._absoluteSources=this._sources.toArray().map(function(e){return t.computeSourceURL(u,e,n)}),this.sourceRoot=u,this.sourcesContent=l,this._mappings=c,this._sourceMapURL=n,this.file=g}function c(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function g(e,n){var r=e;"string"==typeof e&&(r=t.parseSourceMapInput(e));var o=t.getArg(r,"version"),s=t.getArg(r,"sections");if(o!=this._version)throw Error("Unsupported version: "+o);this._sources=new i,this._names=new i;var a={line:-1,column:0};this._sections=s.map(function(e){if(e.url)throw Error("Support for url field in sections not implemented.");var r=t.getArg(e,"offset"),o=t.getArg(r,"line"),i=t.getArg(r,"column");if(o<a.line||o===a.line&&i<a.column)throw Error("Section offsets must be ordered and non-overlapping.");return a=r,{generatedOffset:{generatedLine:o+1,generatedColumn:i+1},consumer:new u(t.getArg(e,"map"),n)}})}u.fromSourceMap=function(e,n){return l.fromSourceMap(e,n)},u.prototype._version=3,u.prototype.__generatedMappings=null,Object.defineProperty(u.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),u.prototype.__originalMappings=null,Object.defineProperty(u.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),u.prototype._charIsMappingSeparator=function(e,n){var r=e.charAt(n);return";"===r||","===r},u.prototype._parseMappings=function(e,n){throw Error("Subclasses must implement _parseMappings")},u.GENERATED_ORDER=1,u.ORIGINAL_ORDER=2,u.GREATEST_LOWER_BOUND=1,u.LEAST_UPPER_BOUND=2,u.prototype.eachMapping=function(e,n,r){switch(r||u.GENERATED_ORDER){case u.GENERATED_ORDER:o=this._generatedMappings;break;case u.ORIGINAL_ORDER:o=this._originalMappings;break;default:throw Error("Unknown order of iteration.")}var o,i=this.sourceRoot;o.map(function(e){var n=null===e.source?null:this._sources.at(e.source);return{source:n=t.computeSourceURL(i,n,this._sourceMapURL),generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:null===e.name?null:this._names.at(e.name)}},this).forEach(e,n||null)},u.prototype.allGeneratedPositionsFor=function(e){var n=t.getArg(e,"line"),r={source:t.getArg(e,"source"),originalLine:n,originalColumn:t.getArg(e,"column",0)};if(r.source=this._findSourceIndex(r.source),r.source<0)return[];var i=[],s=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",t.compareByOriginalPositions,o.LEAST_UPPER_BOUND);if(s>=0){var a=this._originalMappings[s];if(void 0===e.column)for(var u=a.originalLine;a&&a.originalLine===u;)i.push({line:t.getArg(a,"generatedLine",null),column:t.getArg(a,"generatedColumn",null),lastColumn:t.getArg(a,"lastGeneratedColumn",null)}),a=this._originalMappings[++s];else for(var l=a.originalColumn;a&&a.originalLine===n&&a.originalColumn==l;)i.push({line:t.getArg(a,"generatedLine",null),column:t.getArg(a,"generatedColumn",null),lastColumn:t.getArg(a,"lastGeneratedColumn",null)}),a=this._originalMappings[++s]}return i},n.SourceMapConsumer=u,l.prototype=Object.create(u.prototype),l.prototype.consumer=u,l.prototype._findSourceIndex=function(e){var n,r=e;if(null!=this.sourceRoot&&(r=t.relative(this.sourceRoot,r)),this._sources.has(r))return this._sources.indexOf(r);for(n=0;n<this._absoluteSources.length;++n)if(this._absoluteSources[n]==e)return n;return -1},l.fromSourceMap=function(e,n){var r=Object.create(l.prototype),o=r._names=i.fromArray(e._names.toArray(),!0),s=r._sources=i.fromArray(e._sources.toArray(),!0);r.sourceRoot=e._sourceRoot,r.sourcesContent=e._generateSourcesContent(r._sources.toArray(),r.sourceRoot),r.file=e._file,r._sourceMapURL=n,r._absoluteSources=r._sources.toArray().map(function(e){return t.computeSourceURL(r.sourceRoot,e,n)});for(var u=e._mappings.toArray().slice(),g=r.__generatedMappings=[],p=r.__originalMappings=[],h=0,d=u.length;h<d;h++){var f=u[h],m=new c;m.generatedLine=f.generatedLine,m.generatedColumn=f.generatedColumn,f.source&&(m.source=s.indexOf(f.source),m.originalLine=f.originalLine,m.originalColumn=f.originalColumn,f.name&&(m.name=o.indexOf(f.name)),p.push(m)),g.push(m)}return a(r.__originalMappings,t.compareByOriginalPositions),r},l.prototype._version=3,Object.defineProperty(l.prototype,"sources",{get:function(){return this._absoluteSources.slice()}}),l.prototype._parseMappings=function(e,n){for(var r,o,i,u,l,g=1,p=0,h=0,d=0,f=0,m=0,_=e.length,v=0,y={},C={},S=[],A=[];v<_;)if(";"===e.charAt(v))g++,v++,p=0;else if(","===e.charAt(v))v++;else{for((r=new c).generatedLine=g,u=v;u<_&&!this._charIsMappingSeparator(e,u);u++);if(i=y[o=e.slice(v,u)])v+=o.length;else{for(i=[];v<u;)s.decode(e,v,C),l=C.value,v=C.rest,i.push(l);if(2===i.length)throw Error("Found a source, but no line and column");if(3===i.length)throw Error("Found a source and line, but no column");y[o]=i}r.generatedColumn=p+i[0],p=r.generatedColumn,i.length>1&&(r.source=f+i[1],f+=i[1],r.originalLine=h+i[2],h=r.originalLine,r.originalLine+=1,r.originalColumn=d+i[3],d=r.originalColumn,i.length>4&&(r.name=m+i[4],m+=i[4])),A.push(r),"number"==typeof r.originalLine&&S.push(r)}a(A,t.compareByGeneratedPositionsDeflated),this.__generatedMappings=A,a(S,t.compareByOriginalPositions),this.__originalMappings=S},l.prototype._findMapping=function(e,n,r,t,i,s){if(e[r]<=0)throw TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[t]<0)throw TypeError("Column must be greater than or equal to 0, got "+e[t]);return o.search(e,n,i,s)},l.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var n=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var r=this._generatedMappings[e+1];if(n.generatedLine===r.generatedLine){n.lastGeneratedColumn=r.generatedColumn-1;continue}}n.lastGeneratedColumn=1/0}},l.prototype.originalPositionFor=function(e){var n={generatedLine:t.getArg(e,"line"),generatedColumn:t.getArg(e,"column")},r=this._findMapping(n,this._generatedMappings,"generatedLine","generatedColumn",t.compareByGeneratedPositionsDeflated,t.getArg(e,"bias",u.GREATEST_LOWER_BOUND));if(r>=0){var o=this._generatedMappings[r];if(o.generatedLine===n.generatedLine){var i=t.getArg(o,"source",null);null!==i&&(i=this._sources.at(i),i=t.computeSourceURL(this.sourceRoot,i,this._sourceMapURL));var s=t.getArg(o,"name",null);return null!==s&&(s=this._names.at(s)),{source:i,line:t.getArg(o,"originalLine",null),column:t.getArg(o,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}},l.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e})},l.prototype.sourceContentFor=function(e,n){if(!this.sourcesContent)return null;var r,o=this._findSourceIndex(e);if(o>=0)return this.sourcesContent[o];var i=e;if(null!=this.sourceRoot&&(i=t.relative(this.sourceRoot,i)),null!=this.sourceRoot&&(r=t.urlParse(this.sourceRoot))){var s=i.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(s))return this.sourcesContent[this._sources.indexOf(s)];if((!r.path||"/"==r.path)&&this._sources.has("/"+i))return this.sourcesContent[this._sources.indexOf("/"+i)]}if(n)return null;throw Error('"'+i+'" is not in the SourceMap.')},l.prototype.generatedPositionFor=function(e){var n=t.getArg(e,"source");if((n=this._findSourceIndex(n))<0)return{line:null,column:null,lastColumn:null};var r={source:n,originalLine:t.getArg(e,"line"),originalColumn:t.getArg(e,"column")},o=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",t.compareByOriginalPositions,t.getArg(e,"bias",u.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===r.source)return{line:t.getArg(i,"generatedLine",null),column:t.getArg(i,"generatedColumn",null),lastColumn:t.getArg(i,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},g.prototype=Object.create(u.prototype),g.prototype.constructor=u,g.prototype._version=3,Object.defineProperty(g.prototype,"sources",{get:function(){for(var e=[],n=0;n<this._sections.length;n++)for(var r=0;r<this._sections[n].consumer.sources.length;r++)e.push(this._sections[n].consumer.sources[r]);return e}}),g.prototype.originalPositionFor=function(e){var n={generatedLine:t.getArg(e,"line"),generatedColumn:t.getArg(e,"column")},r=o.search(n,this._sections,function(e,n){var r=e.generatedLine-n.generatedOffset.generatedLine;return r||e.generatedColumn-n.generatedOffset.generatedColumn}),i=this._sections[r];return i?i.consumer.originalPositionFor({line:n.generatedLine-(i.generatedOffset.generatedLine-1),column:n.generatedColumn-(i.generatedOffset.generatedLine===n.generatedLine?i.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}},g.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})},g.prototype.sourceContentFor=function(e,n){for(var r=0;r<this._sections.length;r++){var t=this._sections[r].consumer.sourceContentFor(e,!0);if(t)return t}if(n)return null;throw Error('"'+e+'" is not in the SourceMap.')},g.prototype.generatedPositionFor=function(e){for(var n=0;n<this._sections.length;n++){var r=this._sections[n];if(-1!==r.consumer._findSourceIndex(t.getArg(e,"source"))){var o=r.consumer.generatedPositionFor(e);if(o)return{line:o.line+(r.generatedOffset.generatedLine-1),column:o.column+(r.generatedOffset.generatedLine===o.line?r.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}},g.prototype._parseMappings=function(e,n){this.__generatedMappings=[],this.__originalMappings=[];for(var r=0;r<this._sections.length;r++)for(var o=this._sections[r],i=o.consumer._generatedMappings,s=0;s<i.length;s++){var u=i[s],l=o.consumer._sources.at(u.source);l=t.computeSourceURL(o.consumer.sourceRoot,l,this._sourceMapURL),this._sources.add(l),l=this._sources.indexOf(l);var c=null;u.name&&(c=o.consumer._names.at(u.name),this._names.add(c),c=this._names.indexOf(c));var g={source:l,generatedLine:u.generatedLine+(o.generatedOffset.generatedLine-1),generatedColumn:u.generatedColumn+(o.generatedOffset.generatedLine===u.generatedLine?o.generatedOffset.generatedColumn-1:0),originalLine:u.originalLine,originalColumn:u.originalColumn,name:c};this.__generatedMappings.push(g),"number"==typeof g.originalLine&&this.__originalMappings.push(g)}a(this.__generatedMappings,t.compareByGeneratedPositionsDeflated),a(this.__originalMappings,t.compareByOriginalPositions)}},"./@datadog/source-map/lib/source-map-generator.js":function(e,n,r){var t=r("./@datadog/source-map/lib/base64-vlq.js"),o=r("./@datadog/source-map/lib/util.js"),i=r("./@datadog/source-map/lib/array-set.js").ArraySet,s=r("./@datadog/source-map/lib/mapping-list.js").MappingList;function a(e){e||(e={}),this._file=o.getArg(e,"file",null),this._sourceRoot=o.getArg(e,"sourceRoot",null),this._skipValidation=o.getArg(e,"skipValidation",!1),this._sources=new i,this._names=new i,this._mappings=new s,this._sourcesContents=null}a.prototype._version=3,a.fromSourceMap=function(e){var n=e.sourceRoot,r=new a({file:e.file,sourceRoot:n});return e.eachMapping(function(e){var t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=n&&(t.source=o.relative(n,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),r.addMapping(t)}),e.sources.forEach(function(t){var i=t;null!==n&&(i=o.relative(n,t)),r._sources.has(i)||r._sources.add(i);var s=e.sourceContentFor(t);null!=s&&r.setSourceContent(t,s)}),r},a.prototype.addMapping=function(e){var n=o.getArg(e,"generated"),r=o.getArg(e,"original",null),t=o.getArg(e,"source",null),i=o.getArg(e,"name",null);this._skipValidation||this._validateMapping(n,r,t,i),null!=t&&(t=String(t),this._sources.has(t)||this._sources.add(t)),null!=i&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:t,name:i})},a.prototype.setSourceContent=function(e,n){var r=e;null!=this._sourceRoot&&(r=o.relative(this._sourceRoot,r)),null!=n?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[o.toSetString(r)]=n):this._sourcesContents&&(delete this._sourcesContents[o.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},a.prototype.applySourceMap=function(e,n,r){var t=n;if(null==n){if(null==e.file)throw Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');t=e.file}var s=this._sourceRoot;null!=s&&(t=o.relative(s,t));var a=new i,u=new i;this._mappings.unsortedForEach(function(n){if(n.source===t&&null!=n.originalLine){var i=e.originalPositionFor({line:n.originalLine,column:n.originalColumn});null!=i.source&&(n.source=i.source,null!=r&&(n.source=o.join(r,n.source)),null!=s&&(n.source=o.relative(s,n.source)),n.originalLine=i.line,n.originalColumn=i.column,null!=i.name&&(n.name=i.name))}var l=n.source;null==l||a.has(l)||a.add(l);var c=n.name;null==c||u.has(c)||u.add(c)},this),this._sources=a,this._names=u,e.sources.forEach(function(n){var t=e.sourceContentFor(n);null!=t&&(null!=r&&(n=o.join(r,n)),null!=s&&(n=o.relative(s,n)),this.setSourceContent(n,t))},this)},a.prototype._validateMapping=function(e,n,r,t){if(n&&"number"!=typeof n.line&&"number"!=typeof n.column)throw Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!e||!("line"in e)||!("column"in e)||!(e.line>0)||!(e.column>=0)||n||r||t){if(!e||!("line"in e)||!("column"in e)||!n||!("line"in n)||!("column"in n)||!(e.line>0)||!(e.column>=0)||!(n.line>0)||!(n.column>=0)||!r)throw Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:n,name:t}))}},a.prototype._serializeMappings=function(){for(var e,n,r,i,s=0,a=1,u=0,l=0,c=0,g=0,p="",h=this._mappings.toArray(),d=0,f=h.length;d<f;d++){if(n=h[d],e="",n.generatedLine!==a)for(s=0;n.generatedLine!==a;)e+=";",a++;else if(d>0){if(!o.compareByGeneratedPositionsInflated(n,h[d-1]))continue;e+=","}e+=t.encode(n.generatedColumn-s),s=n.generatedColumn,null!=n.source&&(i=this._sources.indexOf(n.source),e+=t.encode(i-g),g=i,e+=t.encode(n.originalLine-1-l),l=n.originalLine-1,e+=t.encode(n.originalColumn-u),u=n.originalColumn,null!=n.name&&(r=this._names.indexOf(n.name),e+=t.encode(r-c),c=r)),p+=e}return p},a.prototype._generateSourcesContent=function(e,n){return e.map(function(e){if(!this._sourcesContents)return null;null!=n&&(e=o.relative(n,e));var r=o.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},a.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},a.prototype.toString=function(){return JSON.stringify(this.toJSON())},n.SourceMapGenerator=a},"./@datadog/source-map/lib/source-node.js":function(e,n,r){var t=r("./@datadog/source-map/lib/source-map-generator.js").SourceMapGenerator,o=r("./@datadog/source-map/lib/util.js"),i=/(\r?\n)/,s="$$$isSourceNode$$$";function a(e,n,r,t,o){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==n?null:n,this.source=null==r?null:r,this.name=null==o?null:o,this[s]=!0,null!=t&&this.add(t)}a.fromStringWithSourceMap=function(e,n,r){var t=new a,s=e.split(i),u=0,l=function(){return e()+(e()||"");function e(){return u<s.length?s[u++]:void 0}},c=1,g=0,p=null;return n.eachMapping(function(e){if(null!==p)if(c<e.generatedLine)h(p,l()),c++,g=0;else{var n=s[u]||"",r=n.substr(0,e.generatedColumn-g);s[u]=n.substr(e.generatedColumn-g),g=e.generatedColumn,h(p,r),p=e;return}for(;c<e.generatedLine;)t.add(l()),c++;if(g<e.generatedColumn){var n=s[u]||"";t.add(n.substr(0,e.generatedColumn)),s[u]=n.substr(e.generatedColumn),g=e.generatedColumn}p=e},this),u<s.length&&(p&&h(p,l()),t.add(s.splice(u).join(""))),n.sources.forEach(function(e){var i=n.sourceContentFor(e);null!=i&&(null!=r&&(e=o.join(r,e)),t.setSourceContent(e,i))}),t;function h(e,n){if(null===e||void 0===e.source)t.add(n);else{var i=r?o.join(r,e.source):e.source;t.add(new a(e.originalLine,e.originalColumn,i,n,e.name))}}},a.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(e){this.add(e)},this);else if(e[s]||"string"==typeof e)e&&this.children.push(e);else throw TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this},a.prototype.prepend=function(e){if(Array.isArray(e))for(var n=e.length-1;n>=0;n--)this.prepend(e[n]);else if(e[s]||"string"==typeof e)this.children.unshift(e);else throw TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this},a.prototype.walk=function(e){for(var n,r=0,t=this.children.length;r<t;r++)(n=this.children[r])[s]?n.walk(e):""!==n&&e(n,{source:this.source,line:this.line,column:this.column,name:this.name})},a.prototype.join=function(e){var n,r,t=this.children.length;if(t>0){for(r=0,n=[];r<t-1;r++)n.push(this.children[r]),n.push(e);n.push(this.children[r]),this.children=n}return this},a.prototype.replaceRight=function(e,n){var r=this.children[this.children.length-1];return r[s]?r.replaceRight(e,n):"string"==typeof r?this.children[this.children.length-1]=r.replace(e,n):this.children.push("".replace(e,n)),this},a.prototype.setSourceContent=function(e,n){this.sourceContents[o.toSetString(e)]=n},a.prototype.walkSourceContents=function(e){for(var n=0,r=this.children.length;n<r;n++)this.children[n][s]&&this.children[n].walkSourceContents(e);for(var t=Object.keys(this.sourceContents),n=0,r=t.length;n<r;n++)e(o.fromSetString(t[n]),this.sourceContents[t[n]])},a.prototype.toString=function(){var e="";return this.walk(function(n){e+=n}),e},a.prototype.toStringWithSourceMap=function(e){var n={code:"",line:1,column:0},r=new t(e),o=!1,i=null,s=null,a=null,u=null;return this.walk(function(e,t){n.code+=e,null!==t.source&&null!==t.line&&null!==t.column?((i!==t.source||s!==t.line||a!==t.column||u!==t.name)&&r.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:n.line,column:n.column},name:t.name}),i=t.source,s=t.line,a=t.column,u=t.name,o=!0):o&&(r.addMapping({generated:{line:n.line,column:n.column}}),i=null,o=!1);for(var l=0,c=e.length;l<c;l++)10===e.charCodeAt(l)?(n.line++,n.column=0,l+1===c?(i=null,o=!1):o&&r.addMapping({source:t.source,original:{line:t.line,column:t.column},generated:{line:n.line,column:n.column},name:t.name})):n.column++}),this.walkSourceContents(function(e,n){r.setSourceContent(e,n)}),{code:n.code,map:r}},n.SourceNode=a},"./@datadog/source-map/lib/util.js":function(e,n){n.getArg=function(e,n,r){if(n in e)return e[n];if(3==arguments.length)return r;throw Error('"'+n+'" is a required argument.')};var r=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,t=/^data:.+\,.+$/;function o(e){var n=e.match(r);return n?{scheme:n[1],auth:n[2],host:n[3],port:n[4],path:n[5]}:null}function i(e){var n="";return e.scheme&&(n+=e.scheme+":"),n+="//",e.auth&&(n+=e.auth+"@"),e.host&&(n+=e.host),e.port&&(n+=":"+e.port),e.path&&(n+=e.path),n}function s(e){var r=e,t=o(e);if(t){if(!t.path)return e;r=t.path}for(var s,a=n.isAbsolute(r),u=r.split(/\/+/),l=0,c=u.length-1;c>=0;c--)"."===(s=u[c])?u.splice(c,1):".."===s?l++:l>0&&(""===s?(u.splice(c+1,l),l=0):(u.splice(c,2),l--));return(""===(r=u.join("/"))&&(r=a?"/":"."),t)?(t.path=r,i(t)):r}function a(e,n){""===e&&(e="."),""===n&&(n=".");var r=o(n),a=o(e);if(a&&(e=a.path||"/"),r&&!r.scheme)return a&&(r.scheme=a.scheme),i(r);if(r||n.match(t))return n;if(a&&!a.host&&!a.path)return a.host=n,i(a);var u="/"===n.charAt(0)?n:s(e.replace(/\/+$/,"")+"/"+n);return a?(a.path=u,i(a)):u}n.urlParse=o,n.urlGenerate=i,n.normalize=s,n.join=a,n.isAbsolute=function(e){return"/"===e.charAt(0)||r.test(e)},n.relative=function(e,n){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==n.indexOf(e+"/");){var t=e.lastIndexOf("/");if(t<0||(e=e.slice(0,t)).match(/^([^\/]+:\/)?\/*$/))return n;++r}return Array(r+1).join("../")+n.substr(e.length+1)};var u=!("__proto__"in Object.create(null));function l(e){return e}function c(e){if(!e)return!1;var n=e.length;if(n<9||95!==e.charCodeAt(n-1)||95!==e.charCodeAt(n-2)||111!==e.charCodeAt(n-3)||116!==e.charCodeAt(n-4)||111!==e.charCodeAt(n-5)||114!==e.charCodeAt(n-6)||112!==e.charCodeAt(n-7)||95!==e.charCodeAt(n-8)||95!==e.charCodeAt(n-9))return!1;for(var r=n-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function g(e,n){return e===n?0:null===e?1:null===n?-1:e>n?1:-1}n.toSetString=u?l:function(e){return c(e)?"$"+e:e},n.fromSetString=u?l:function(e){return c(e)?e.slice(1):e},n.compareByOriginalPositions=function(e,n,r){var t=g(e.source,n.source);return 0!==t||0!=(t=e.originalLine-n.originalLine)||0!=(t=e.originalColumn-n.originalColumn)||r||0!=(t=e.generatedColumn-n.generatedColumn)||0!=(t=e.generatedLine-n.generatedLine)?t:g(e.name,n.name)},n.compareByGeneratedPositionsDeflated=function(e,n,r){var t=e.generatedLine-n.generatedLine;return 0!==t||0!=(t=e.generatedColumn-n.generatedColumn)||r||0!==(t=g(e.source,n.source))||0!=(t=e.originalLine-n.originalLine)||0!=(t=e.originalColumn-n.originalColumn)?t:g(e.name,n.name)},n.compareByGeneratedPositionsInflated=function(e,n){var r=e.generatedLine-n.generatedLine;return 0!==r||0!=(r=e.generatedColumn-n.generatedColumn)||0!==(r=g(e.source,n.source))||0!=(r=e.originalLine-n.originalLine)||0!=(r=e.originalColumn-n.originalColumn)?r:g(e.name,n.name)},n.parseSourceMapInput=function(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))},n.computeSourceURL=function(e,n,r){if(n=n||"",e&&("/"!==e[e.length-1]&&"/"!==n[0]&&(e+="/"),n=e+n),r){var t=o(r);if(!t)throw Error("sourceMapURL could not be parsed");if(t.path){var u=t.path.lastIndexOf("/");u>=0&&(t.path=t.path.substring(0,u+1))}n=a(i(t),n)}return s(n)}}},n={};function r(t){var o=n[t];if(void 0!==o)return o.exports;var i=n[t]={exports:{}};return e[t](i,i.exports,r),i.exports}var t={};t.SourceMapGenerator=r("./@datadog/source-map/lib/source-map-generator.js").SourceMapGenerator,t.SourceMapConsumer=r("./@datadog/source-map/lib/source-map-consumer.js").SourceMapConsumer,t.SourceNode=r("./@datadog/source-map/lib/source-node.js").SourceNode,module.exports=t})();