lightstep-tracer
Version:
> ❗ **This instrumentation is no longer recommended**. Please review [documentation on setting up and configuring the OpenTelemetry Node.js Launcher](https://github.com/lightstep/otel-launcher-node) or [OpenTelemetry JS (Browser)](https://github.com/open-
1 lines • 98.9 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.lightstep=e():t.lightstep=e()}(self,(()=>(()=>{var t={31:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if(t)for(var r in t)hasOwnProperty.call(t,r)&&e(t[r],r)},t.exports=e.default},843:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LS_META_TRACE_KEY=e.LS_META_TRACER_GUID_KEY=e.LS_META_TRACER_CREATE=e.LS_META_SP_START=e.LS_META_SP_FINISH=e.LS_META_SPAN_KEY=e.LS_META_PROPAGATION_KEY=e.LS_META_INJECT=e.LS_META_EXTRACT=e.LS_META_EVENT_KEY=e.LOG_WARN=e.LOG_STRING_TO_LEVEL=e.LOG_LEVEL_TO_STRING=e.LOG_INFO=e.LOG_FATAL=e.LOG_ERROR=e.LIGHTSTEP_APP_URL_PREFIX=e.JOIN_ID_PREFIX=e.FORMAT_B3=e.CLOCK_STATE_REFRESH_INTERVAL_MS=void 0,e.LOG_INFO=0,e.LOG_WARN=1,e.LOG_ERROR=2,e.LOG_FATAL=3,e.LOG_LEVEL_TO_STRING={LOG_INFO:"I",LOG_WARN:"W",LOG_ERROR:"E",LOG_FATAL:"F"};e.LOG_STRING_TO_LEVEL={I:0,W:1,E:2,F:3},e.CLOCK_STATE_REFRESH_INTERVAL_MS=350,e.LIGHTSTEP_APP_URL_PREFIX="https://app.lightstep.com",e.JOIN_ID_PREFIX="join:",e.LS_META_EVENT_KEY="lightstep.meta_event",e.LS_META_PROPAGATION_KEY="lightstep.propagation_format",e.LS_META_TRACE_KEY="lightstep.trace_id",e.LS_META_SPAN_KEY="lightstep.span_id",e.LS_META_TRACER_GUID_KEY="lightstep.tracer_guid",e.LS_META_EXTRACT="lightstep.extract_span",e.LS_META_INJECT="lightstep.inject_span",e.LS_META_SP_START="lightstep.span_start",e.LS_META_SP_FINISH="lightstep.span_finish",e.LS_META_TRACER_CREATE="lightstep.tracer_create",e.FORMAT_B3="format.b3"},261:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=r(295);function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var i=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._accessToken=e}var e,r;return e=t,(r=[{key:"getAccessToken",value:function(){return void 0===this._accessToken||null===this._accessToken||0===this._accessToken.length?"empty":this._accessToken}},{key:"toThrift",value:function(){return new n.crouton_thrift.Auth({access_token:this._accessToken})}}])&&o(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.default=i,t.exports=e.default},69:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.toBoolean=function(t){return!!t},e.toNumber=function(t){return Number(t)},e.toString=function(t){return""+t}},34:(t,e,r)=>{"use strict";var n,o=(n=r(31))&&n.__esModule?n:{default:n};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var a=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options={}}var e,r;return e=t,(r=[{key:"setOptions",value:function(t){var e=this;(0,o.default)(t,(function(t,r){e.options[r]=t}))}}])&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();t.exports=new a},618:(t,e,r)=>{"use strict";var n=r(295);function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var i=r(843),a=r(69),s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._runtime=e,this._record=new n.crouton_thrift.LogRecord({timestamp_micros:e._platform.nowMicros(),runtime_guid:null,span_guid:null,stable_name:null,message:null,level:null,thread_id:null,filename:null,line_number:null,stack_frames:null,payload_json:null,error_flag:null})}var e,r;return e=t,(r=[{key:"record",value:function(){return this._record}},{key:"end",value:function(){this._runtime._addLogRecord(this._record)}},{key:"timestamp",value:function(t){return this._record.timestamp_micros=a.toNumber(t),this}},{key:"message",value:function(t){return this._record.message=a.toString(t),this}},{key:"level",value:function(t){return this._record.level=i.LOG_LEVEL_TO_STRING[t]||null,t>=i.LOG_ERROR&&this.error(!0),this}},{key:"span",value:function(t){return void 0!==t&&(this._record.span_guid=a.toString(t)),this}},{key:"name",value:function(t){return this._record.stable_name=a.toString(t),this}},{key:"error",value:function(t){return this._record.error_flag=a.toBoolean(t),this}},{key:"payload",value:function(t){return void 0!==t&&(this._record.payload_json=this._encodePayload(t)),this}},{key:"_encodePayload",value:function(t){var e=null;try{e=JSON.stringify(t)}catch(t){return}return e}}])&&o(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();t.exports=s},489:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n,o=r(295),i=(n=r(31))&&n.__esModule?n:{default:n},a=function(t,e){if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var r=s(e);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if("default"!==i&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}(r(69));function s(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return(s=function(t){return t?r:e})(t)}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var u=function(){function t(e,r,n,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),o instanceof Error&&(o={stack:o.stack,message:o.message}),this._logFieldKeyHardLimit=e,this._logFieldValueHardLimit=r,this._timestampMicros=n,this._fields=o,this._keysOverLimit=0,this._valuesOverLimit=0}var e,r;return e=t,(r=[{key:"_clearOverLimits",value:function(){this._keysOverLimit=0,this._valuesOverLimit=0}},{key:"getNumKeysOverLimit",value:function(){return this._keysOverLimit}},{key:"getNumValuesOverLimit",value:function(){return this._valuesOverLimit}},{key:"toThrift",value:function(){var t=this;this._clearOverLimits();var e=[];return(0,i.default)(this._fields,(function(r,n){if(n&&r){var i=t.getFieldKey(n),a=t.getFieldValue(r);e.push(new o.crouton_thrift.KeyValue({Key:i,Value:a}))}})),new o.crouton_thrift.LogRecord({timestamp_micros:this._timestampMicros,fields:e})}},{key:"getFieldKey",value:function(t){var e=a.toString(t);return e.length>this._logFieldKeyHardLimit&&(this._keysOverLimit+=1,e="".concat(e.substr(0,this._logFieldKeyHardLimit),"...")),e}},{key:"getFieldValue",value:function(t){var e=null;if(t instanceof Error)try{e=JSON.stringify(t,Object.getOwnPropertyNames(t))}catch(t){e="Could not encode value. Exception: ".concat(t)}else if(t instanceof Object)try{e=JSON.stringify(t,null," ")}catch(t){e="Could not encode value. Exception: ".concat(t)}else e=a.toString(t);return e.length>this._logFieldValueHardLimit&&(this._valuesOverLimit+=1,e="".concat(e.substr(0,this._logFieldValueHardLimit),"...")),e}}])&&c(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.default=u,t.exports=e.default},638:(t,e,r)=>{"use strict";t.exports=r(933).crouton_thrift},933:t=>{"use strict";var e,r;e={},void 0===(r={})&&(r={}),r.KeyValue=function(t){if(this.Key=null,this.Value=null,t){if(void 0===t.Key)throw new e.TProtocolException(e.TProtocolExceptionType.UNKNOWN,"Required field Key is unset!");if(this.Key=t.Key,void 0===t.Value)throw new e.TProtocolException(e.TProtocolExceptionType.UNKNOWN,"Required field Value is unset!");this.Value=t.Value}},r.KeyValue.prototype={},r.KeyValue.prototype.read=!1,r.KeyValue.prototype.write=!1,r.NamedCounter=function(t){if(this.Name=null,this.Value=null,t){if(void 0===t.Name)throw new e.TProtocolException(e.TProtocolExceptionType.UNKNOWN,"Required field Name is unset!");if(this.Name=t.Name,void 0===t.Value)throw new e.TProtocolException(e.TProtocolExceptionType.UNKNOWN,"Required field Value is unset!");this.Value=t.Value}},r.NamedCounter.prototype={},r.NamedCounter.prototype.read=!1,r.NamedCounter.prototype.write=!1,r.Runtime=function(t){this.guid=null,this.start_micros=null,this.group_name=null,this.attrs=null,t&&(void 0!==t.guid&&(this.guid=t.guid),void 0!==t.start_micros&&(this.start_micros=t.start_micros),void 0!==t.group_name&&(this.group_name=t.group_name),void 0!==t.attrs&&(this.attrs=t.attrs))},r.Runtime.prototype={},r.Runtime.prototype.read=!1,r.Runtime.prototype.write=!1,r.LogRecord=function(t){this.timestamp_micros=null,this.fields=null,this.runtime_guid=null,this.span_guid=null,this.stable_name=null,this.message=null,this.level=null,this.thread_id=null,this.filename=null,this.line_number=null,this.stack_frames=null,this.payload_json=null,this.error_flag=null,t&&(void 0!==t.timestamp_micros&&(this.timestamp_micros=t.timestamp_micros),void 0!==t.fields&&(this.fields=t.fields),void 0!==t.runtime_guid&&(this.runtime_guid=t.runtime_guid),void 0!==t.span_guid&&(this.span_guid=t.span_guid),void 0!==t.stable_name&&(this.stable_name=t.stable_name),void 0!==t.message&&(this.message=t.message),void 0!==t.level&&(this.level=t.level),void 0!==t.thread_id&&(this.thread_id=t.thread_id),void 0!==t.filename&&(this.filename=t.filename),void 0!==t.line_number&&(this.line_number=t.line_number),void 0!==t.stack_frames&&(this.stack_frames=t.stack_frames),void 0!==t.payload_json&&(this.payload_json=t.payload_json),void 0!==t.error_flag&&(this.error_flag=t.error_flag))},r.LogRecord.prototype={},r.LogRecord.prototype.read=!1,r.LogRecord.prototype.write=!1,r.TraceJoinId=function(t){if(this.TraceKey=null,this.Value=null,t){if(void 0===t.TraceKey)throw new e.TProtocolException(e.TProtocolExceptionType.UNKNOWN,"Required field TraceKey is unset!");if(this.TraceKey=t.TraceKey,void 0===t.Value)throw new e.TProtocolException(e.TProtocolExceptionType.UNKNOWN,"Required field Value is unset!");this.Value=t.Value}},r.TraceJoinId.prototype={},r.TraceJoinId.prototype.read=!1,r.TraceJoinId.prototype.write=!1,r.SpanRecord=function(t){this.span_guid=null,this.trace_guid=null,this.runtime_guid=null,this.span_name=null,this.join_ids=null,this.oldest_micros=null,this.youngest_micros=null,this.attributes=null,this.error_flag=null,this.log_records=null,t&&(void 0!==t.span_guid&&(this.span_guid=t.span_guid),void 0!==t.trace_guid&&(this.trace_guid=t.trace_guid),void 0!==t.runtime_guid&&(this.runtime_guid=t.runtime_guid),void 0!==t.span_name&&(this.span_name=t.span_name),void 0!==t.join_ids&&(this.join_ids=t.join_ids),void 0!==t.oldest_micros&&(this.oldest_micros=t.oldest_micros),void 0!==t.youngest_micros&&(this.youngest_micros=t.youngest_micros),void 0!==t.attributes&&(this.attributes=t.attributes),void 0!==t.error_flag&&(this.error_flag=t.error_flag),void 0!==t.log_records&&(this.log_records=t.log_records))},r.SpanRecord.prototype={},r.SpanRecord.prototype.read=!1,r.SpanRecord.prototype.write=!1,r.Auth=function(t){this.access_token=null,t&&void 0!==t.access_token&&(this.access_token=t.access_token)},r.Auth.prototype={},r.Auth.prototype.read=!1,r.Auth.prototype.write=!1,r.Timing=function(t){this.receive_micros=null,this.transmit_micros=null,t&&(void 0!==t.receive_micros&&(this.receive_micros=t.receive_micros),void 0!==t.transmit_micros&&(this.transmit_micros=t.transmit_micros))},r.Timing.prototype={},r.Timing.prototype.read=!1,r.Timing.prototype.write=!1,r.SampleCount=function(t){this.oldest_micros=null,this.youngest_micros=null,this.count=null,t&&(void 0!==t.oldest_micros&&(this.oldest_micros=t.oldest_micros),void 0!==t.youngest_micros&&(this.youngest_micros=t.youngest_micros),void 0!==t.count&&(this.count=t.count))},r.SampleCount.prototype={},r.SampleCount.prototype.read=!1,r.SampleCount.prototype.write=!1,r.MetricsSample=function(t){if(this.name=null,this.int64_value=null,this.double_value=null,t){if(void 0===t.name)throw new e.TProtocolException(e.TProtocolExceptionType.UNKNOWN,"Required field name is unset!");this.name=t.name,void 0!==t.int64_value&&(this.int64_value=t.int64_value),void 0!==t.double_value&&(this.double_value=t.double_value)}},r.MetricsSample.prototype={},r.MetricsSample.prototype.read=!1,r.MetricsSample.prototype.write=!1,r.Metrics=function(t){this.counts=null,this.gauges=null,t&&(void 0!==t.counts&&(this.counts=t.counts),void 0!==t.gauges&&(this.gauges=t.gauges))},r.Metrics.prototype={},r.Metrics.prototype.read=!1,r.Metrics.prototype.write=!1,r.ReportRequest=function(t){this.runtime=null,this.span_records=null,this.log_records=null,this.timestamp_offset_micros=null,this.oldest_micros=null,this.youngest_micros=null,this.counters=null,this.internal_logs=null,this.internal_metrics=null,t&&(void 0!==t.runtime&&(this.runtime=t.runtime),void 0!==t.span_records&&(this.span_records=t.span_records),void 0!==t.log_records&&(this.log_records=t.log_records),void 0!==t.timestamp_offset_micros&&(this.timestamp_offset_micros=t.timestamp_offset_micros),void 0!==t.oldest_micros&&(this.oldest_micros=t.oldest_micros),void 0!==t.youngest_micros&&(this.youngest_micros=t.youngest_micros),void 0!==t.counters&&(this.counters=t.counters),void 0!==t.internal_logs&&(this.internal_logs=t.internal_logs),void 0!==t.internal_metrics&&(this.internal_metrics=t.internal_metrics))},r.ReportRequest.prototype={},r.ReportRequest.prototype.read=!1,r.ReportRequest.prototype.write=!1,r.Command=function(t){this.disable=null,t&&void 0!==t.disable&&(this.disable=t.disable)},r.Command.prototype={},r.Command.prototype.read=!1,r.Command.prototype.write=!1,r.ReportResponse=function(t){this.commands=null,this.timing=null,t&&(void 0!==t.commands&&(this.commands=t.commands),void 0!==t.timing&&(this.timing=t.timing))},r.ReportResponse.prototype={},r.ReportResponse.prototype.read=!1,r.ReportResponse.prototype.write=!1,t.exports.crouton_thrift=r,t.exports.Thrift={}},250:(t,e,r)=>{"use strict";var n=r(714),o=function(){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope)return null;if(!n.isBrowser())return null;var t=document.getElementsByTagName("SCRIPT");return t.length>0?t[t.length-1]:null}();t.exports={parseScriptElementOptions:n.isBrowser()?function(t,e){if(o){var r=o.dataset,n=r.access_token;"string"==typeof n&&n.length>0&&(t.access_token=n);var i=r.component_name;"string"==typeof i&&i.length>0&&(t.component_name=i);var a=r.collector_host;"string"==typeof a&&a.length>0&&(t.collector_host=a);var s=r.collector_port;s&&(t.collector_port=parseInt(s,10));var c=r.collector_path;"string"==typeof c&&c.length>0&&(t.collector_path=c);var u=r.collector_encryption;u&&(t.collector_encryption=u);var l=r.enable;"string"==typeof l&&("true"===l?t.enable=!0:"false"===l&&(t.enable=!1));var p=r.verbosity;"string"==typeof p&&(t.verbosity=parseInt(p,10));var f=r.init_global_tracer;"string"==typeof f&&("true"===f?e.init_global_tracer=!0:"false"===f&&(e.init_global_tracer=!1)),"string"==typeof r.xhr_instrumentation&&"true"===r.xhr_instrumentation&&(t.xhr_instrumentation=!0),"string"==typeof r.instrument_page_load&&"true"===r.instrument_page_load&&(t.instrument_page_load=!0)}}:function(t,e){},parseURLQueryOptions:n.isBrowser()?function(t){var e=function(t){var e={},r=window.location.href.indexOf("?");if(r<0)return e;var n=window.location.href.slice(r+1);n.indexOf("#")>=0&&(n=n.slice(0,n.indexOf("#")));for(var o=n.replace(/\+/,"%20").split("&"),i=0;i<o.length;i++){var a=o[i].split("=");e[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return e}();if(e.lightstep_verbosity)try{t.verbosity=parseInt(e.lightstep_verbosity,10)}catch(t){}e.lightstep_log_to_console&&(t.log_to_console=!0)}:function(t){return{}}}},733:(t,e,r)=>{"use strict";function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var o=r(250),i=r(714),a="lightstep_session_id",s=604800,c=function(){if(window.performance&&window.performance.now&&window.performance.timing&&window.performance.timing.navigationStart){var t=performance.timing.navigationStart;return function(){return Math.floor(1e3*(t+performance.now()))}}return function(){return 1e3*Date.now()}}(),u=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,u,l;return e=t,u=[{key:"name",value:function(){return"browser"}},{key:"nowMicros",value:function(){return c()}},{key:"runtimeGUID",value:function(t){var e=encodeURIComponent("".concat("lightstep_guid","/").concat(t)),r=i.cookie(e)||this._generateLongUUID();i.cookie(e,r,s,"/");var n=i.cookie(a)||this._generateLongUUID();return i.cookie(a,n,s,"/"),r}},{key:"generateUUID",value:function(){return this._generateLongUUID()}},{key:"_generateLongUUID",value:function(){var t="00000000".concat(Math.abs(4294967295*Math.random()|0).toString(16)).substr(-8),e="00000000".concat(Math.abs(4294967295*Math.random()|0).toString(16)).substr(-8);return"".concat(t).concat(e)}},{key:"onBeforeExit",value:function(){if(i.isBrowser()){for(var t,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];(t=window).addEventListener.apply(t,["beforeunload"].concat(r))}}},{key:"plugins",value:function(t){return[r(792),r(49),r(921)]}},{key:"options",value:function(t){var e={},r={};return o.parseScriptElementOptions(e,r),o.parseURLQueryOptions(e,r),e}},{key:"tracerTags",value:function(){return{"lightstep.tracer_platform":"browser"}}},{key:"fatal",value:function(t){throw new Error(t)}},{key:"localStoreGet",value:function(t){try{if(!window.sessionStorage)return null}catch(t){return null}try{return JSON.parse(sessionStorage.getItem("lightstep/".concat(t)))}catch(t){return null}}},{key:"localStoreSet",value:function(t,e){try{if(!window.sessionStorage)return}catch(t){return}try{sessionStorage.setItem("lightstep/".concat(t),JSON.stringify(e))}catch(t){}}}],l=[{key:"initLibrary",value:function(e){var r={},n={};o.parseScriptElementOptions(r,n),n.init_global_tracer&&t.initGlobalTracer(e,r)}},{key:"initGlobalTracer",value:function(t,e){"object"==typeof window&&"object"==typeof window.opentracing&&opentracing.initGlobalTracer(new t.Tracer(e))}}],u&&n(e.prototype,u),l&&n(e,l),Object.defineProperty(e,"prototype",{writable:!1}),t}();t.exports=u},720:(t,e,r)=>{"use strict";t.exports=r(933).Thrift},374:(t,e)=>{"use strict";function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._host="",this._port=0,this._path="",this._encryption=""}var e,n;return e=t,(n=[{key:"ensureConnection",value:function(t){this._host=t.collector_host,this._port=t.collector_port,this._path=t.collector_path,this._encryption=t.collector_encryption}},{key:"report",value:function(t,e,r,n){try{t?this._reportAsyncScript(e,r,n):this._reportAJAX(e,r,n)}catch(t){return n(t,null)}}},{key:"_reportAJAX",value:function(t,e,r){var n=JSON.stringify(e.toThrift()),o="none"===this._encryption?"http":"https",i="".concat(o,"://").concat(this._host,":").concat(this._port).concat(this._path,"/api/v0/reports"),a=new XMLHttpRequest;a.open("POST",i),a.setRequestHeader("LightStep-Access-Token",t.getAccessToken()),a.setRequestHeader("Content-Type","application/json"),a.onreadystatechange=function(){if(4===this.readyState){var t=null,e=null;if(200!==this.status)t=new Error("status code = ".concat(this.status));else if(this.responseText)try{e=JSON.parse(this.responseText)}catch(e){t=e}else t=new Error("unexpected empty response");return r(t,e)}},a.send(n)}},{key:"_reportAsyncScript",value:function(t,e,r){var n=JSON.stringify(t.toThrift()),o=JSON.stringify(e.toThrift()),i="none"===this._encryption?"http":"https",a="".concat(i,"://").concat(this._host,":").concat(this._port).concat(this._path,"/_rpc/v1/reports/uri_encoded")+"?auth=".concat(encodeURIComponent(n))+"&report=".concat(encodeURIComponent(o)),s=document.createElement("script");s.async=!0,s.defer=!0,s.src=a,s.type="text/javascript";var c=document.getElementsByTagName("head")[0];return c&&c.appendChild(s),r(null,null)}}])&&r(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.default=n,t.exports=e.default},714:t=>{"use strict";function e(){return"undefined"!=typeof document}t.exports={cookie:e()?function(t,e,r,n,o,i){if(arguments.length>1){var a=t+"="+encodeURIComponent(e)+(r?"; expires="+new Date(+new Date+1e3*r).toUTCString():"")+(n?"; path="+n:"")+(o?"; domain="+o:"")+(i?"; secure":"");return document.cookie=a,a}return decodeURIComponent((("; "+document.cookie).split("; "+t+"=")[1]||"").split(";")[0])}:function(){return null},isBrowser:e}},938:(t,e)=>{"use strict";function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._tracer=e,this._name=r}var e,n;return e=t,(n=[{key:"inject",value:function(t,e){return this._tracer._error("Unsupported format: ".concat(this._name)),null}},{key:"extract",value:function(t){this._tracer._error("Unsupported format: ".concat(this._name))}}])&&r(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.default=n,t.exports=e.default},255:(t,e,r)=>{"use strict";var n;function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t,e){return i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},i(t,e)}function a(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},s(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var c=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e)}(l,t);var e,r,n,c,u=(n=l,c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=s(n);if(c){var r=s(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return a(this,t)});function l(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l),(e=u.call(this,t))._carrierPrefix="x-b3-",e}return e=l,(r=[{key:"inject",value:function(t,e){var r=this;if(e){if("object"==typeof e){var n=t.traceGUID();return 32===n.length&&"0000000000000000"===n.substr(0,16)&&(n=n.substr(16)),e["".concat(this._carrierPrefix,"spanid")]=t._guid,e["".concat(this._carrierPrefix,"traceid")]=n,t._sampled?e["".concat(this._carrierPrefix,"sampled")]="1":e["".concat(this._carrierPrefix,"sampled")]="0",t.forEachBaggageItem((function(t,n){e["".concat(r._baggagePrefix).concat(t)]=n})),e}this._tracer._error("Unexpected '".concat(typeof e,"' FORMAT_TEXT_MAP carrier in call to inject"))}else this._tracer._error("Unexpected null carrier in call to inject")}}])&&o(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),l}(((n=r(683))&&n.__esModule?n:{default:n}).default);e.default=c,t.exports=e.default},976:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=a(r(31)),o=a(r(970)),i=a(r(683));function a(t){return t&&t.__esModule?t:{default:t}}function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var c=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._tracer=e,this._baggagePrefix=i.default,this._carrierPrefix="x-datadog-"}var e,r;return e=t,(r=[{key:"inject",value:function(t,e){var r=this;if(e){if("object"==typeof e)return e["".concat(this._carrierPrefix,"parent-id")]=parseInt(t._guid,16).toString(),e["".concat(this._carrierPrefix,"trace-id")]=parseInt(t.traceGUID(),16).toString(),t._sampled?e["".concat(this._carrierPrefix,"sampling-priority")]="1":e["".concat(this._carrierPrefix,"sampling-priority")]="0",t.forEachBaggageItem((function(t,n){e["".concat(r._baggagePrefix).concat(t)]=n})),e;this._tracer._error("Unexpected '".concat(typeof e,"' FORMAT_TEXT_MAP carrier in call to inject"))}else this._tracer._error("Unexpected null carrier in call to inject")}},{key:"extract",value:function(t){var e=this,r=0,i=null,a=null,s=!0;if((0,n.default)(t,(function(t,n){if((n=n.toLowerCase()).substr(0,e._carrierPrefix.length)===e._carrierPrefix)switch(n.substr(e._carrierPrefix.length)){case"trace-id":r++,a=parseInt(t,10).toString(16);break;case"parent-id":r++,i=parseInt(t,10).toString(16);break;case"sampling-priority":0===t&&(s=!1);break;default:e._tracer._error("Unrecognized carrier key '".concat(n,"' with recognized prefix. Ignoring."))}})),0===r)return null;if(r<2)return this._tracer._error("Only found a partial SpanContext: ".concat(t)),null;var c=new o.default(i,a,s);return(0,n.default)(t,(function(t,r){if((r=r.toLowerCase()).substr(0,e._baggagePrefix.length)===e._baggagePrefix){var n=r.substr(e._baggagePrefix.length);c.setBaggageItem(n,t)}})),c}}])&&s(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.default=c,t.exports=e.default},683:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=i(r(31)),o=i(r(970));function i(t){return t&&t.__esModule?t:{default:t}}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._tracer=e,this._carrierPrefix="ot-tracer-",this._baggagePrefix="ot-baggage-"}var e,r;return e=t,(r=[{key:"inject",value:function(t,e){var r=this;if(e){if("object"==typeof e)return e["".concat(this._carrierPrefix,"spanid")]=t._guid,e["".concat(this._carrierPrefix,"traceid")]=t._traceGUID,e["".concat(this._carrierPrefix,"sampled")]="true",t.forEachBaggageItem((function(t,n){e["".concat(r._baggagePrefix).concat(t)]=n})),e;this._tracer._error("Unexpected '".concat(typeof e,"' FORMAT_TEXT_MAP carrier in call to inject"))}else this._tracer._error("Unexpected null carrier in call to inject")}},{key:"extract",value:function(t){var e=this,r=0,i=null,a=null,s=!0;if((0,n.default)(t,(function(t,n){if((n=n.toLowerCase()).substr(0,e._carrierPrefix.length)===e._carrierPrefix)switch(n.substr(e._carrierPrefix.length)){case"traceid":r++,a=t;break;case"spanid":r++,i=t;break;case"sampled":switch(t){case 0:case"0":case!1:case"false":s=!1;break;default:s=!0}break;default:e._tracer._error("Unrecognized carrier key '".concat(n,"' with recognized prefix. Ignoring."))}})),0===r)return null;if(r<2)return this._tracer._error("Only found a partial SpanContext: ".concat(t)),null;var c=new o.default(i,a,s);return(0,n.default)(t,(function(t,r){if((r=r.toLowerCase()).substr(0,e._baggagePrefix.length)===e._baggagePrefix){var n=r.substr(e._baggagePrefix.length);c.setBaggageItem(n,t)}})),c}}])&&a(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.default=s,t.exports=e.default},676:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n,o=r(295),i=(n=r(31))&&n.__esModule?n:{default:n},a=function(t,e){if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var r=s(e);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if("default"!==i&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}(r(69));function s(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return(s=function(t){return t?r:e})(t)}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var u=function(){function t(e,r,n,o,i,a,s){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._runtime=e,this._oldestMicros=r,this._youngestMicros=n,this._spanRecords=o,this._internalLogs=i,this._counters=a,this._timestampOffsetMicros=s}var e,r;return e=t,(r=[{key:"getSpanRecords",value:function(){return this._spanRecords}},{key:"getInternalLogs",value:function(){return this._internalLogs}},{key:"getCounters",value:function(){return this._counters}},{key:"toThrift",value:function(){var t=this;(0,i.default)(this._spanRecords,(function(e){e.runtime_guid=t._runtimeGUID}));var e=[];(0,i.default)(this._counters,(function(t,r){0!==t&&e.push(new o.crouton_thrift.MetricsSample({name:a.toString(r),double_value:a.toNumber(t)}))}));var r=[];return(0,i.default)(this._spanRecords,(function(t){r.push(t._toThrift())})),new o.crouton_thrift.ReportRequest({runtime:this._runtime.toThrift(),oldest_micros:this._oldestMicros,youngest_micros:this._youngestMicros,span_records:r,internal_logs:this._internalLogs,internal_metrics:new o.crouton_thrift.Metrics({counts:e}),timestamp_offset_micros:this._timestampOffsetMicros})}}])&&c(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.default=u,t.exports=e.default},102:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n,o=r(295),i=(n=r(31))&&n.__esModule?n:{default:n},a=function(t,e){if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var r=s(e);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if("default"!==i&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}(r(69));function s(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return(s=function(t){return t?r:e})(t)}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var u=function(){function t(e,r,n,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._runtimeGUID=e,this._startMicros=r,this._componentName=n,this._attributes=o}var e,r;return e=t,(r=[{key:"toThrift",value:function(){var t=[];return(0,i.default)(this._attributes,(function(e,r){t.push(new o.crouton_thrift.KeyValue({Key:a.toString(r),Value:a.toString(e)}))})),new o.crouton_thrift.Runtime({guid:this._runtimeGUID,start_micros:this._startMicros,group_name:this._componentName,attrs:t})}}])&&c(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.default=u,t.exports=e.default},970:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n,o=(n=r(31))&&n.__esModule?n:{default:n};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var a=function(){function t(e,r,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._baggage={},this._guid=e,this._sampled=!0,!1===n&&(this._sampled=n),this._upperTraceGUID="0000000000000000",this._traceGUID=r,this._traceGUID&&32===this._traceGUID.length&&(this._upperTraceGUID=r.substr(0,16),this._traceGUID=r.substr(16))}var e,r;return e=t,(r=[{key:"setBaggageItem",value:function(t,e){this._baggage[t]=e}},{key:"getBaggageItem",value:function(t){return this._baggage[t]}},{key:"toTraceId",value:function(){return this._traceGUID}},{key:"toSpanId",value:function(){return this._guid}},{key:"forEachBaggageItem",value:function(t){(0,o.default)(this._baggage,(function(e,r){t(r,e)}))}},{key:"traceGUID",value:function(){return"".concat(this._upperTraceGUID).concat(this._traceGUID)}}])&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.default=a,t.exports=e.default},405:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=f(r(725)),o=f(r(69)),i=f(r(843)),a=l(r(31)),s=r(295),c=l(r(489)),u=l(r(278));function l(t){return t&&t.__esModule?t:{default:t}}function p(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return(p=function(t){return t?r:e})(t)}function f(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var r=p(e);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if("default"!==i&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function _(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function h(t,e){return h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},h(t,e)}function g(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}var v=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}(f,t);var e,r,n,l,p=(n=f,l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=y(n);if(l){var r=y(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return g(this,t)});function f(t,e,r){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,f),n=p.call(this),console.assert("object"==typeof t,"Invalid runtime"),n._tracerImp=t,n._ctx=r,n._ended=!1,n._operationName=e,n._tags={},n._beginMicros=t._platform.nowMicros(),n._endMicros=0,n._errorFlag=!1,n._log_records=null,n}return e=f,(r=[{key:"_tracer",value:function(){return this._tracerImp}},{key:"_context",value:function(){return this._ctx}},{key:"_setOperationName",value:function(t){this._operationName="".concat(t)}},{key:"_setBaggageItem",value:function(t,e){this._ctx.setBaggageItem(t,e)}},{key:"_getBaggageItem",value:function(t){return this._ctx.getBaggageItem(t)}},{key:"_addTags",value:function(t){var e=this;(0,a.default)(t,(function(t,r){e._tags[r]=t}))}},{key:"_log",value:function(t,e){var r=this;if("object"==typeof t){var n=e?1e3*e:r._tracerImp._platform.nowMicros(),o=new c.default(r._tracerImp.getLogFieldKeyHardLimit(),r._tracerImp.getLogFieldValueHardLimit(),n,t);r._log_records=r._log_records||[],r._log_records.push(o),r._tracerImp.emit("log_added",o)}else r._tracerImp._error("Span.log() expects an object as its first argument")}},{key:"_finish",value:function(t){return this.end(t)}},{key:"getOperationName",value:function(){return this._operationName}},{key:"guid",value:function(){return this._ctx._guid}},{key:"traceGUID",value:function(){return this._ctx._traceGUID}},{key:"parentGUID",value:function(){return this._tags.parent_span_guid}},{key:"setParentGUID",value:function(t){return this._tags.parent_span_guid=o.toString(t),this}},{key:"beginMicros",value:function(){return this._beginMicros}},{key:"setBeginMicros",value:function(t){return this._beginMicros=t,this}},{key:"endMicros",value:function(){return this._endMicros}},{key:"setEndMicros",value:function(t){return this._endMicros=t,this}},{key:"isSampled",value:function(){return this._ctx._sampled}},{key:"generateTraceURL",value:function(){var t;t=this._beginMicros>0&&this._endMicros>0?Math.floor((this._beginMicros+this._endMicros)/2):this._tracerImp._platform.nowMicros();var e=i.LIGHTSTEP_APP_URL_PREFIX,r=encodeURIComponent(this._tracerImp.options().access_token),n=encodeURIComponent(this.guid());return"".concat(e,"/").concat(r,"/trace?span_guid=").concat(n,"&at_micros=").concat(t)}},{key:"getTags",value:function(){return this._tags}},{key:"end",value:function(t){var e;this._ended||(this._ended=!0,void 0!==t&&this.setEndMicros(Math.floor(1e3*t)),0===this._endMicros&&this.setEndMicros(this._tracerImp._platform.nowMicros()),u.default.shouldSendMetaSpan(this._tracer().options(),this.getTags())&&this._tracerImp.startSpan(i.LS_META_SP_FINISH,{tags:(e={},_(e,i.LS_META_EVENT_KEY,!0),_(e,i.LS_META_TRACE_KEY,this.traceGUID()),_(e,i.LS_META_SPAN_KEY,this.guid()),e)}).finish(),this.isSampled()&&this._tracerImp._addSpanRecord(this))}},{key:"_toThrift",value:function(){var t=this,e=[];(0,a.default)(this._tags,(function(t,r){e.push(new s.crouton_thrift.KeyValue({Key:o.toString(r),Value:o.toString(t)}))}));var r=[];return(0,a.default)(this._log_records,(function(e){var n=e.toThrift();t._tracerImp._counters["logs.keys.over_limit"]+=e.getNumKeysOverLimit(),t._tracerImp._counters["logs.values.over_limit"]+=e.getNumValuesOverLimit(),r.push(n)})),new s.crouton_thrift.SpanRecord({span_guid:this.guid(),trace_guid:this.traceGUID(),runtime_guid:this._tracerImp.guid(),span_name:this._operationName,oldest_micros:this._beginMicros,youngest_micros:this._endMicros,attributes:e,error_flag:this._errorFlag,log_records:r})}}])&&d(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),f}(n.Span);e.default=v,t.exports=e.default},90:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=h(r(729)),o=function(t,e){if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var r=d(e);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if("default"!==i&&Object.prototype.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}(r(725)),i=h(r(970)),a=h(r(405)),s=h(r(31)),c=r(295),u=h(r(261)),l=h(r(102)),p=h(r(676)),f=h(r(938)),_=h(r(683));function d(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return(d=function(t){return t?r:e})(t)}function h(t){return t&&t.__esModule?t:{default:t}}function g(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?g(Object(r),!0).forEach((function(e){v(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function v(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function m(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function b(t,e){return b=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},b(t,e)}function O(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return w(t)}function w(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function T(t){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},T(t)}var E=r(344),S=r(618),k=r(69),R=r(843),M=r(34),P=r(147),x=r(278),j=null,A=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&b(t,e)}(L,t);var e,d,h,g,A=(h=L,g=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=T(h);if(g){var r=T(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return O(this,t)});function L(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,L),(e=A.call(this))._delegateEventEmitterMethods(),t=t||{},j||(M.setOptions(t),j=w(e)),e._platform=new c.Platform(w(e)),e._runtimeGUID=t.guid||e.override_runtime_guid||null,e._plugins={},e._options={},e._optionDescs=[],e._makeOptionsTable(),e._opentracing=o,t.opentracing_module&&(e._opentracing=t.opentracing_module);var n=e._platform.nowMicros();e._startMicros=n,e._auth=null,e._runtime=null;var i={warn:function(t,r){e._warn(t,r)},error:function(t,r){e._error(t,r)}};return t&&(e._transport=t.override_transport),e._propagators={},e._propagators[e._opentracing.FORMAT_HTTP_HEADERS]=new _.default(w(e)),e._propagators[e._opentracing.FORMAT_TEXT_MAP]=new _.default(w(e)),e._propagators[e._opentracing.FORMAT_BINARY]=new f.default(w(e),e._opentracing.FORMAT_BINARY),t&&t.propagators&&(e._propagators=y(y({},e._propagators),t.propagators)),e._reportingLoopActive=!1,e._first_report_has_run=!1,e._reportYoungestMicros=n,e._reportTimer=null,e._reportErrorStreak=0,e._lastVisibleErrorMillis=0,e._skippedVisibleErrors=0,e._activeRootSpanSet={},e._activeRootSpan=null,e._spanRecords=[],e._counters={"internal.errors":0,"internal.warnings":0,"spans.dropped":0,"logs.dropped":0,"logs.keys.over_limit":0,"logs.values.over_limit":0,"reports.errors.send":0},e._internalLogs=[],e._flushIsActive=!1,e.addPlugin(r(981)),e.addPlatformPlugins(t),e.setPlatformOptions(t),t&&e.options(t),void 0!==e._transport&&null!==e._transport||(e._options.transport,e._transport=new c.ThriftTransport(i),e._info("Using thrift transport per user-defined option.")),e._useClockState=!e._options.disable_clock_skew_correction,e._clockState=new E({nowMicros:function(){return e._platform.nowMicros()},localStoreGet:function(){var t="clock_state/".concat(e._options.collector_host);return e._platform.localStoreGet(t)},localStoreSet:function(t){var r="clock_state/".concat(e._options.collector_host);return e._platform.localStoreSet(r,t)}}),e._setupReportOnExit(),e._info("Tracer created with guid ".concat(e._runtimeGUID)),0===e._options.access_token.length&&e._warn("Access token not set -\n this requires a satellite with access token checking disabled,\n such as a developer satellite."),e.startPlugins(),e}return e=L,d=[{key:"_delegateEventEmitterMethods",value:function(){var t=this;this._ee=new n.default,(0,s.default)(["addListener","emit","eventNames","getMaxListeners","listenerCount","listeners","on","once","prependListener","prependOnceListener","removeAllListeners","removeListener","setMaxListeners"],(function(e){t[e]=function(){t._ee[e]&&t._ee[e].apply(t._ee,arguments)}}))}},{key:"_makeOptionsTable",value:function(){this.addOption("verbosity",{type:"int",min:0,max:9,defaultValue:1}),this.addOption("access_token",{type:"string",defaultValue:""}),this.addOption("component_name",{type:"string",defaultValue:""}),this.addOption("collector_host",{type:"string",defaultValue:"collector.lightstep.com"}),this.addOption("collector_port",{type:"int",defaultValue:443}),this.addOption("collector_path",{type:"string",defaultValue:""}),this.addOption("collector_encryption",{type:"string",defaultValue:"tls"}),this.addOption("tags",{type:"any",defaultValue:{}}),this.addOption("max_reporting_interval_millis",{type:"int",defaultValue:2500}),this.addOption("disable_clock_skew_correction",{type:"bool",defaultValue:!1}),this.addOption("transport",{type:"string",defaultValue:"thrift"}),this.addOption("disabled",{type:"bool",defaultValue:!1}),this.addOption("max_span_records",{type:"int",defaultValue:4096}),this.addOption("default_span_tags",{type:"any",defaultValue:{}}),this.addOption("report_timeout_millis",{type:"int",defaultValue:3e4}),this.addOption("gzip_json_requests",{type:"bool",defaultValue:!0}),this.addOption("disable_reporting_loop",{type:"bool",defaultValue:!1}),this.addOption("disable_report_on_exit",{type:"bool",defaultValue:!1}),this.addOption("delay_initial_report_millis",{type:"int",defaultValue:1e3}),this.addOption("error_throttle_millis",{type:"int",defaultValue:6e4}),this.addOption("logger",{type:"function",defaultValue:this._printToConsole.bind(this)}),this.addOption("clear_span_buffer_consecutive_errors",{type:"int",defaultValue:null}),this.addOption("certificate_verification",{type:"bool",defaultValue:!0}),this.addOption("override_transport",{type:"any",defaultValue:null}),this.addOption("silent",{type:"bool",defaultValue:!1}),this.addOption("log_field_key_hard_limit",{type:"int",defaultValue:256}),this.addOption("log_field_value_hard_limit",{type:"int",defaultValue:1024}),this.addOption("disable_meta_event_reporting",{type:"bool",defaultValue:!1})}},{key:"_startSpan",value:function(t,e){var r=this,n=null;if((e=e||{}).references)for(var o=0;o<e.references.length;o++){var c=e.references[o],u=c.type();if(u===this._opentracing.REFERENCE_CHILD_OF||u===this._opentracing.REFERENCE_FOLLOWS_FROM){var l=c.referencedContext();if(!l){this._error("Span reference has an invalid context",l);continue}n=l;break}}var p,f=n?n.traceGUID():this.generateTraceGUIDForRootSpan(),_=!n||n._sampled,d=new i.default(this._platform.generateUUID(),f,_),h=new a.default(this,t,d);return h.addTags(this._options.default_span_tags),(0,s.default)(e,(function(t,e){switch(e){case"references":break;case"startTime":h.setBeginMicros(Math.floor(1e3*t));break;case"tags":h.addTags(t);break;default:r._warn("Ignoring unknown field '".concat(e,"'"))}})),null!==n&&(h.setParentGUID(n._guid),n.forEachBaggageItem((function(t,e){return d.setBaggageItem(t,e)}))),this.emit("start_span",h),x.shouldSendMetaSpan(this.options(),h.getTags())&&this.startSpan(R.LS_META_SP_START,{tags:(p={},v(p,R.LS_META_EVENT_KEY,!0),v(p,R.LS_META_TRACE_KEY,h.traceGUID()),v(p,R.LS_META_SPAN_KEY,h.guid()),p)}).finish(),h}},{key:"_inject",value:function(t,e,r){var n;switch(!0===this.options().meta_event_reporting&&this.startSpan(R.LS_META_INJECT,{tags:(n={},v(n,R.LS_META_EVENT_KEY,!0),v(n,R.LS_META_TRACE_KEY,t._traceGUID),v(n,R.LS_META_SPAN_KEY,t._guid),v(n,R.LS_META_PROPAGATION_KEY,e),n)}).finish(),e){case this._opentracing.FORMAT_HTTP_HEADERS:this._propagators[this._opentracing.FORMAT_HTTP_HEADERS].inject(t,r);break;case this._opentracing.FORMAT_TEXT_MAP:this._propagators[this._opentracing.FORMAT_TEXT_MAP].inject(t,r);break;case this._opentracing.FORMAT_BINARY:this._propagators[this._opentracing.FORMAT_BINARY].inject(t,r);break;default:this._error("Unknown format: ".concat(e))}}},{key:"_extract",value:function(t,e){var r,n=null;switch(t){case this._opentracing.FORMAT_HTTP_HEADERS:n=this._propagators[this._opentracing.FORMAT_HTTP_HEADERS].extract(e);break;case this._opentracing.FORMAT_TEXT_MAP:n=this._propagators[this._opentracing.FORMAT_TEXT_MAP].extract(e);break;case this._opentracing.FORMAT_BINARY:n=this._propagators[this._opentracing.FORMAT_BINARY].extract(e);break;default:return this._error("Unsupported format: ".concat(t)),null}return!0===this.options().meta_event_reporting&&n&&this.startSpan(R.LS_META_EXTRACT,{tags:(r={},v(r,R.LS_META_EVENT_KEY,!0),v(r,R.LS_META_TRACE_KEY,n._traceGUID),v(r,R.LS_META_SPAN_KEY,n._guid),v(r,R.LS_META_PROPAGATION_KEY,t),r)}).finish(),n}},{key:"flush",value:function(t){if(t||(t=function(){}),this._options.disabled)return this._warn("Manual flush() called in disabled state."),t(null);this._flushReport(!0,!1,t)}},{key:"guid",value:function(){return this._runtimeGUID}},{key:"verbosity",value:function(){var t=this._options.verbosity;return void 0===t?1:t}},{key:"generateTraceGUIDForRootSpan",value:function(){var t=this._platform.generateUUID();return this._