dd-trace
Version:
Datadog APM tracing client for JavaScript
1 lines • 3.82 kB
JavaScript
(()=>{var e={"./source-map/lib/url.js"(e,t,r){"use strict";e.exports="function"==typeof URL?URL:r("url").URL},url(e){"use strict";e.exports=require("url")}},t={};function __webpack_require__(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,__webpack_require__),i.exports}var r={};(()=>{let e=__webpack_require__("./source-map/lib/url.js");r.getArg=function(e,t,r){if(t in e)return e[t];if(3==arguments.length)return r;throw Error('"'+t+'" is a required argument.')};let t=!("__proto__"in Object.create(null));function identity(e){return e}function toSetString(e){return isProtoString(e)?"$"+e:e}function fromSetString(e){return isProtoString(e)?e.slice(1):e}function isProtoString(e){if(!e)return!1;let t=e.length;if(t<9||95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(let r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function strcmp(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}r.toSetString=t?identity:toSetString,r.fromSetString=t?identity:fromSetString,r.compareByGeneratedPositionsInflated=function(e,t){let r=e.generatedLine-t.generatedLine;return 0!==r||0!=(r=e.generatedColumn-t.generatedColumn)||0!==(r=strcmp(e.source,t.source))||0!=(r=e.originalLine-t.originalLine)||0!=(r=e.originalColumn-t.originalColumn)?r:strcmp(e.name,t.name)},r.parseSourceMapInput=function(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))};let n="http:",i=`${n}//host`;function createSafeHandler(t){return r=>{let o=getURLType(r),a=buildSafeBase(r),u=new e(r,a);t(u);let l=u.toString();return"absolute"===o?l:"scheme-relative"===o?l.slice(n.length):"path-absolute"===o?l.slice(i.length):computeRelativeURL(a,l)}}function withBase(t,r){return new e(t,r).toString()}function buildUniqueSegment(e,t){let r=0;for(;;){let n=e+r++;if(-1===t.indexOf(n))return n}}function buildSafeBase(e){let t=e.split("..").length-1,r=buildUniqueSegment("p",e),n=`${i}/`;for(let e=0;e<t;e++)n+=`${r}/`;return n}let o=/^[A-Za-z0-9\+\-\.]+:/;function getURLType(e){return"/"===e[0]?"/"===e[1]?"scheme-relative":"path-absolute":o.test(e)?"absolute":"path-relative"}function computeRelativeURL(t,r){"string"==typeof t&&(t=new e(t)),"string"==typeof r&&(r=new e(r));let n=r.pathname.split("/"),i=t.pathname.split("/");for(i.length>0&&!i[i.length-1]&&i.pop();n.length>0&&i.length>0&&n[0]===i[0];)n.shift(),i.shift();return i.map(()=>"..").concat(n).join("/")+r.search+r.hash}let a=createSafeHandler(e=>{e.pathname=e.pathname.replace(/\/?$/,"/")}),u=createSafeHandler(t=>{t.href=new e(".",t.toString()).toString()}),l=createSafeHandler(e=>{});function join(e,t){let r=getURLType(t),o=getURLType(e);if(e=a(e),"absolute"===r)return withBase(t,void 0);if("absolute"===o)return withBase(t,e);if("scheme-relative"===r)return l(t);if("scheme-relative"===o)return withBase(t,withBase(e,i)).slice(n.length);if("path-absolute"===r)return l(t);if("path-absolute"===o)return withBase(t,withBase(e,i)).slice(i.length);let u=buildSafeBase(t+e),s=withBase(t,withBase(e,u));return computeRelativeURL(u,s)}function relativeIfPossible(t,r){if(getURLType(t)!==getURLType(r))return null;let n=buildSafeBase(t+r),i=new e(t,n),o=new e(r,n);try{new e("",o.toString())}catch(e){return null}return o.protocol!==i.protocol||o.user!==i.user||o.password!==i.password||o.hostname!==i.hostname||o.port!==i.port?null:computeRelativeURL(i,o)}r.normalize=l,r.join=join,r.relative=function(e,t){let r=relativeIfPossible(e,t);return"string"==typeof r?r:l(t)},r.computeSourceURL=function(e,t,r){e&&"path-absolute"===getURLType(t)&&(t=t.replace(/^\//,""));let n=l(t||"");return e&&(n=join(e,n)),r&&(n=join(u(r),n)),n}})(),module.exports=r})();