@grafana/faro-web-tracing
Version:
Faro web tracing implementation.
1 lines • 111 kB
JavaScript
var GrafanaFaroWebTracing=function(t,e){"use strict";var n="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},r="1.9.0",o=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;var i=function(t){var e=new Set([t]),n=new Set,r=t.match(o);if(!r)return function(){return!1};var i=+r[1],a=+r[2],s=+r[3];if(null!=r[4])return function(e){return e===t};function u(t){return n.add(t),!1}function c(t){return e.add(t),!0}return function(t){if(e.has(t))return!0;if(n.has(t))return!1;var r=t.match(o);if(!r)return u(t);var l=+r[1],p=+r[2],f=+r[3];return null!=r[4]||i!==l?u(t):0===i?a===p&&s<=f?c(t):u(t):a<=p?c(t):u(t)}}(r),a=r.split(".")[0],s=Symbol.for("opentelemetry.js.api."+a),u=n;function c(t,e,n,o){var i;void 0===o&&(o=!1);var a=u[s]=null!==(i=u[s])&&void 0!==i?i:{version:r};if(!o&&a[t]){var c=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return n.error(c.stack||c.message),!1}if(a.version!==r){c=new Error("@opentelemetry/api: Registration of version v"+a.version+" for "+t+" does not match previously registered API v"+r);return n.error(c.stack||c.message),!1}return a[t]=e,n.debug("@opentelemetry/api: Registered a global for "+t+" v"+r+"."),!0}function l(t){var e,n,r=null===(e=u[s])||void 0===e?void 0:e.version;if(r&&i(r))return null===(n=u[s])||void 0===n?void 0:n[t]}function p(t,e){e.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+r+".");var n=u[s];n&&delete n[t]}var f,d=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},h=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},_=function(){function t(t){this._namespace=t.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return v("debug",this._namespace,t)},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return v("error",this._namespace,t)},t.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return v("info",this._namespace,t)},t.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return v("warn",this._namespace,t)},t.prototype.verbose=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return v("verbose",this._namespace,t)},t}();function v(t,e,n){var r=l("diag");if(r)return n.unshift(e),r[t].apply(r,h([],d(n),!1))}!function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"}(f||(f={}));var y=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},g=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},E=function(){function t(){function t(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=l("diag");if(r)return r[t].apply(r,g([],y(e),!1))}}var e=this;e.setLogger=function(t,n){var r,o,i;if(void 0===n&&(n={logLevel:f.INFO}),t===e){var a=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return e.error(null!==(r=a.stack)&&void 0!==r?r:a.message),!1}"number"==typeof n&&(n={logLevel:n});var s=l("diag"),u=function(t,e){function n(n,r){var o=e[n];return"function"==typeof o&&t>=r?o.bind(e):function(){}}return t<f.NONE?t=f.NONE:t>f.ALL&&(t=f.ALL),e=e||{},{error:n("error",f.ERROR),warn:n("warn",f.WARN),info:n("info",f.INFO),debug:n("debug",f.DEBUG),verbose:n("verbose",f.VERBOSE)}}(null!==(o=n.logLevel)&&void 0!==o?o:f.INFO,t);if(s&&!n.suppressOverrideMessage){var p=null!==(i=(new Error).stack)&&void 0!==i?i:"<failed to generate stacktrace>";s.warn("Current logger will be overwritten from "+p),u.warn("Current logger will overwrite one already registered from "+p)}return c("diag",u,e,!0)},e.disable=function(){p("diag",e)},e.createComponentLogger=function(t){return new _(t)},e.verbose=t("verbose"),e.debug=t("debug"),e.info=t("info"),e.warn=t("warn"),e.error=t("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t}(),T=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},m=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},S=function(){function t(t){this._entries=t?new Map(t):new Map}return t.prototype.getEntry=function(t){var e=this._entries.get(t);if(e)return Object.assign({},e)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map((function(t){var e=T(t,2);return[e[0],e[1]]}))},t.prototype.setEntry=function(e,n){var r=new t(this._entries);return r._entries.set(e,n),r},t.prototype.removeEntry=function(e){var n=new t(this._entries);return n._entries.delete(e),n},t.prototype.removeEntries=function(){for(var e,n,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=new t(this._entries);try{for(var a=m(r),s=a.next();!s.done;s=a.next()){var u=s.value;i._entries.delete(u)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return i},t.prototype.clear=function(){return new t},t}(),O=Symbol("BaggageEntryMetadata"),b=E.instance();function R(t){return void 0===t&&(t={}),new S(new Map(Object.entries(t)))}function L(t){return Symbol.for(t)}var P,A,w=function t(e){var n=this;n._currentContext=e?new Map(e):new Map,n.getValue=function(t){return n._currentContext.get(t)},n.setValue=function(e,r){var o=new t(n._currentContext);return o._currentContext.set(e,r),o},n.deleteValue=function(e){var r=new t(n._currentContext);return r._currentContext.delete(e),r}},C=new w,N=(P=function(t,e){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},P(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}P(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),I=function(){function t(){}return t.prototype.createGauge=function(t,e){return G},t.prototype.createHistogram=function(t,e){return z},t.prototype.createCounter=function(t,e){return X},t.prototype.createUpDownCounter=function(t,e){return K},t.prototype.createObservableGauge=function(t,e){return W},t.prototype.createObservableCounter=function(t,e){return q},t.prototype.createObservableUpDownCounter=function(t,e){return Y},t.prototype.addBatchObservableCallback=function(t,e){},t.prototype.removeBatchObservableCallback=function(t){},t}(),x=function(){},M=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e.prototype.add=function(t,e){},e}(x),D=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e.prototype.add=function(t,e){},e}(x),U=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e.prototype.record=function(t,e){},e}(x),j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e.prototype.record=function(t,e){},e}(x),B=function(){function t(){}return t.prototype.addCallback=function(t){},t.prototype.removeCallback=function(t){},t}(),k=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e}(B),F=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e}(B),H=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return N(e,t),e}(B),V=new I,X=new M,G=new U,z=new j,K=new D,q=new k,W=new F,Y=new H,$={get:function(t,e){if(null!=t)return t[e]},keys:function(t){return null==t?[]:Object.keys(t)}},Q={set:function(t,e,n){null!=t&&(t[e]=n)}},Z=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},J=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},tt=function(){function t(){}return t.prototype.active=function(){return C},t.prototype.with=function(t,e,n){for(var r=[],o=3;o<arguments.length;o++)r[o-3]=arguments[o];return e.call.apply(e,J([n],Z(r),!1))},t.prototype.bind=function(t,e){return e},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t}(),et=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},nt=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},rt="context",ot=new tt,it=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(t){return c(rt,t,E.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(t,e,n){for(var r,o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return(r=this._getContextManager()).with.apply(r,nt([t,e,n],et(o),!1))},t.prototype.bind=function(t,e){return this._getContextManager().bind(t,e)},t.prototype._getContextManager=function(){return l(rt)||ot},t.prototype.disable=function(){this._getContextManager().disable(),p(rt,E.instance())},t}();!function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"}(A||(A={}));var at="0000000000000000",st="00000000000000000000000000000000",ut={traceId:st,spanId:at,traceFlags:A.NONE},ct=function(){function t(t){void 0===t&&(t=ut),this._spanContext=t}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(t,e){return this},t.prototype.setAttributes=function(t){return this},t.prototype.addEvent=function(t,e){return this},t.prototype.addLink=function(t){return this},t.prototype.addLinks=function(t){return this},t.prototype.setStatus=function(t){return this},t.prototype.updateName=function(t){return this},t.prototype.end=function(t){},t.prototype.isRecording=function(){return!1},t.prototype.recordException=function(t,e){},t}(),lt=L("OpenTelemetry Context Key SPAN");function pt(t){return t.getValue(lt)||void 0}function ft(){return pt(it.getInstance().active())}function dt(t,e){return t.setValue(lt,e)}function ht(t){return t.deleteValue(lt)}function _t(t,e){return dt(t,new ct(e))}function vt(t){var e;return null===(e=pt(t))||void 0===e?void 0:e.spanContext()}var yt=/^([0-9a-f]{32})$/i,gt=/^[0-9a-f]{16}$/i;function Et(t){return yt.test(t)&&t!==st}function Tt(t){return Et(t.traceId)&&(e=t.spanId,gt.test(e)&&e!==at);var e}function mt(t){return new ct(t)}var St=it.getInstance(),Ot=function(){function t(){}return t.prototype.startSpan=function(t,e,n){if(void 0===n&&(n=St.active()),Boolean(null==e?void 0:e.root))return new ct;var r,o=n&&vt(n);return"object"==typeof(r=o)&&"string"==typeof r.spanId&&"string"==typeof r.traceId&&"number"==typeof r.traceFlags&&Tt(o)?new ct(o):new ct},t.prototype.startActiveSpan=function(t,e,n,r){var o,i,a;if(!(arguments.length<2)){2===arguments.length?a=e:3===arguments.length?(o=e,a=n):(o=e,i=n,a=r);var s=null!=i?i:St.active(),u=this.startSpan(t,o,s),c=dt(s,u);return St.with(c,a,void 0,u)}},t}();var bt,Rt,Lt,Pt=new Ot,At=function(){function t(t,e,n,r){this._provider=t,this.name=e,this.version=n,this.options=r}return t.prototype.startSpan=function(t,e,n){return this._getTracer().startSpan(t,e,n)},t.prototype.startActiveSpan=function(t,e,n,r){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},t.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):Pt},t}(),wt=new(function(){function t(){}return t.prototype.getTracer=function(t,e,n){return new Ot},t}()),Ct=function(){function t(){}return t.prototype.getTracer=function(t,e,n){var r;return null!==(r=this.getDelegateTracer(t,e,n))&&void 0!==r?r:new At(this,t,e,n)},t.prototype.getDelegate=function(){var t;return null!==(t=this._delegate)&&void 0!==t?t:wt},t.prototype.setDelegate=function(t){this._delegate=t},t.prototype.getDelegateTracer=function(t,e,n){var r;return null===(r=this._delegate)||void 0===r?void 0:r.getTracer(t,e,n)},t}();!function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"}(bt||(bt={})),function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"}(Rt||(Rt={})),function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"}(Lt||(Lt={}));var Nt=it.getInstance(),It=E.instance(),xt=new(function(){function t(){}return t.prototype.getMeter=function(t,e,n){return V},t}()),Mt="metrics",Dt=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalMeterProvider=function(t){return c(Mt,t,E.instance())},t.prototype.getMeterProvider=function(){return l(Mt)||xt},t.prototype.getMeter=function(t,e,n){return this.getMeterProvider().getMeter(t,e,n)},t.prototype.disable=function(){p(Mt,E.instance())},t}().getInstance(),Ut=function(){function t(){}return t.prototype.inject=function(t,e){},t.prototype.extract=function(t,e){return t},t.prototype.fields=function(){return[]},t}(),jt=L("OpenTelemetry Baggage Key");function Bt(t){return t.getValue(jt)||void 0}function kt(){return Bt(it.getInstance().active())}function Ft(t,e){return t.setValue(jt,e)}function Ht(t){return t.deleteValue(jt)}var Vt="propagation",Xt=new Ut,Gt=function(){function t(){this.createBaggage=R,this.getBaggage=Bt,this.getActiveBaggage=kt,this.setBaggage=Ft,this.deleteBaggage=Ht}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(t){return c(Vt,t,E.instance())},t.prototype.inject=function(t,e,n){return void 0===n&&(n=Q),this._getGlobalPropagator().inject(t,e,n)},t.prototype.extract=function(t,e,n){return void 0===n&&(n=$),this._getGlobalPropagator().extract(t,e,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){p(Vt,E.instance())},t.prototype._getGlobalPropagator=function(){return l(Vt)||Xt},t}(),zt=Gt.getInstance(),Kt="trace",qt=function(){function t(){this._proxyTracerProvider=new Ct,this.wrapSpanContext=mt,this.isSpanContextValid=Tt,this.deleteSpan=ht,this.getSpan=pt,this.getActiveSpan=ft,this.getSpanContext=vt,this.setSpan=dt,this.setSpanContext=_t}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(t){var e=c(Kt,this._proxyTracerProvider,E.instance());return e&&this._proxyTracerProvider.setDelegate(t),e},t.prototype.getTracerProvider=function(){return l(Kt)||this._proxyTracerProvider},t.prototype.getTracer=function(t,e){return this.getTracerProvider().getTracer(t,e)},t.prototype.disable=function(){p(Kt,E.instance()),this._proxyTracerProvider=new Ct},t}().getInstance();const Wt=L("OpenTelemetry SDK Context Key SUPPRESS_TRACING");var Yt;!function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"}(Yt||(Yt={}));const $t="[_0-9a-z-*/]",Qt=new RegExp(`^(?:${`[a-z]${$t}{0,255}`}|${`[a-z0-9]${$t}{0,240}@[a-z]${$t}{0,13}`})$`),Zt=/^[ -~]{0,255}[!-~]$/,Jt=/,|=/;let te=class t{_internalState=new Map;constructor(t){t&&this._parse(t)}set(t,e){const n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,e),n}unset(t){const e=this._clone();return e._internalState.delete(t),e}get(t){return this._internalState.get(t)}serialize(){return this._keys().reduce(((t,e)=>(t.push(e+"="+this.get(e)),t)),[]).join(",")}_parse(t){t.length>512||(this._internalState=t.split(",").reverse().reduce(((t,e)=>{const n=e.trim(),r=n.indexOf("=");if(-1!==r){const o=n.slice(0,r),i=n.slice(r+1,e.length);(function(t){return Qt.test(t)})(o)&&function(t){return Zt.test(t)&&!Jt.test(t)}(i)&&t.set(o,i)}return t}),new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){const e=new t;return e._internalState=new Map(this._internalState),e}};const ee="traceparent",ne="tracestate",re=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");let oe=class{inject(t,e,n){const r=qt.getSpanContext(t);if(!r||function(t){return!0===t.getValue(Wt)}(t)||!Tt(r))return;const o=`00-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||A.NONE).toString(16)}`;n.set(e,ee,o),r.traceState&&n.set(e,ne,r.traceState.serialize())}extract(t,e,n){const r=n.get(e,ee);if(!r)return t;const o=Array.isArray(r)?r[0]:r;if("string"!=typeof o)return t;const i=function(t){const e=re.exec(t);return e?"00"===e[1]&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}:null}(o);if(!i)return t;i.isRemote=!0;const a=n.get(e,ne);if(a){const t=Array.isArray(a)?a.join(","):a;i.traceState=new te("string"==typeof t?t:void 0)}return qt.setSpanContext(t,i)}fields(){return[ee,ne]}};function ie(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if("function"==typeof e){var n=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}var ae,se={},ue={};function ce(){if(ae)return ue;function t(t){return Object.keys(t).map((n=>e(n,t[n])))}function e(t,e){return{key:t,value:n(e)}}function n(t){const r=typeof t;return"string"===r?{stringValue:t}:"number"===r?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:"boolean"===r?{boolValue:t}:t instanceof Uint8Array?{bytesValue:t}:Array.isArray(t)?{arrayValue:{values:t.map(n)}}:"object"===r&&null!=t?{kvlistValue:{values:Object.entries(t).map((([t,n])=>e(t,n)))}}:{}}return ae=1,Object.defineProperty(ue,"__esModule",{value:!0}),ue.toAnyValue=ue.toKeyValue=ue.toAttributes=ue.createInstrumentationScope=ue.createResource=void 0,ue.createResource=function(e){return{attributes:t(e.attributes),droppedAttributesCount:0}},ue.createInstrumentationScope=function(t){return{name:t.name,version:t.version}},ue.toAttributes=t,ue.toKeyValue=e,ue.toAnyValue=n,ue}var le={},pe=L("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function fe(t){return t.setValue(pe,!0)}function de(t){return!0===t.getValue(pe)}var he="=",_e=";",ve=",",ye="baggage",ge=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};function Ee(t){return t.reduce((function(t,e){var n=""+t+(""!==t?ve:"")+e;return n.length>8192?t:n}),"")}function Te(t){return t.getAllEntries().map((function(t){var e=ge(t,2),n=e[0],r=e[1],o=encodeURIComponent(n)+"="+encodeURIComponent(r.value);return void 0!==r.metadata&&(o+=_e+r.metadata.toString()),o}))}function me(t){var e=t.split(_e);if(!(e.length<=0)){var n=e.shift();if(n){var r=n.indexOf(he);if(!(r<=0)){var o,i,a=decodeURIComponent(n.substring(0,r).trim()),s=decodeURIComponent(n.substring(r+1).trim());return e.length>0&&("string"!=typeof(i=e.join(_e))&&(b.error("Cannot create baggage metadata from unknown type: "+typeof i),i=""),o={__TYPE__:O,toString:function(){return i}}),{key:a,value:s,metadata:o}}}}}var Se=function(){function t(){}return t.prototype.inject=function(t,e,n){var r=zt.getBaggage(t);if(r&&!de(t)){var o=Ee(Te(r).filter((function(t){return t.length<=4096})).slice(0,180));o.length>0&&n.set(e,ye,o)}},t.prototype.extract=function(t,e,n){var r=n.get(e,ye),o=Array.isArray(r)?r.join(ve):r;if(!o)return t;var i={};return 0===o.length?t:(o.split(ve).forEach((function(t){var e=me(t);if(e){var n={value:e.value};e.metadata&&(n.metadata=e.metadata),i[e.key]=n}})),0===Object.entries(i).length?t:zt.setBaggage(t,zt.createBaggage(i)))},t.prototype.fields=function(){return[ye]},t}(),Oe=function(){function t(t,e){this._monotonicClock=e,this._epochMillis=t.now(),this._performanceMillis=e.now()}return t.prototype.now=function(){var t=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+t},t}(),be=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Re=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};function Le(t){var e,n,r={};if("object"!=typeof t||null==t)return r;try{for(var o=be(Object.entries(t)),i=o.next();!i.done;i=o.next()){var a=Re(i.value,2),s=a[0],u=a[1];Pe(s)?Ae(u)?Array.isArray(u)?r[s]=u.slice():r[s]=u:It.warn("Invalid attribute value set for key: "+s):It.warn("Invalid attribute key: "+s)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return r}function Pe(t){return"string"==typeof t&&t.length>0}function Ae(t){return null==t||(Array.isArray(t)?function(t){var e,n,r;try{for(var o=be(t),i=o.next();!i.done;i=o.next()){var a=i.value;if(null!=a){if(!r){if(we(a)){r=typeof a;continue}return!1}if(typeof a!==r)return!1}}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return!0}(t):we(t))}function we(t){switch(typeof t){case"number":case"boolean":case"string":return!0}return!1}function Ce(){return function(t){It.error(function(t){return"string"==typeof t?t:JSON.stringify(function(t){var e={},n=t;for(;null!==n;)Object.getOwnPropertyNames(n).forEach((function(t){if(!e[t]){var r=n[t];r&&(e[t]=String(r))}})),n=Object.getPrototypeOf(n);return e}(t))}(t))}}var Ne,Ie=Ce();function xe(t){try{Ie(t)}catch(t){}}!function(t){t.AlwaysOff="always_off",t.AlwaysOn="always_on",t.ParentBasedAlwaysOff="parentbased_always_off",t.ParentBasedAlwaysOn="parentbased_always_on",t.ParentBasedTraceIdRatio="parentbased_traceidratio",t.TraceIdRatio="traceidratio"}(Ne||(Ne={}));var Me=",",De=["OTEL_SDK_DISABLED"];function Ue(t){return De.indexOf(t)>-1}var je=["OTEL_BSP_EXPORT_TIMEOUT","OTEL_BSP_MAX_EXPORT_BATCH_SIZE","OTEL_BSP_MAX_QUEUE_SIZE","OTEL_BSP_SCHEDULE_DELAY","OTEL_BLRP_EXPORT_TIMEOUT","OTEL_BLRP_MAX_EXPORT_BATCH_SIZE","OTEL_BLRP_MAX_QUEUE_SIZE","OTEL_BLRP_SCHEDULE_DELAY","OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_ATTRIBUTE_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT","OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT","OTEL_SPAN_EVENT_COUNT_LIMIT","OTEL_SPAN_LINK_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT","OTEL_EXPORTER_OTLP_TIMEOUT","OTEL_EXPORTER_OTLP_TRACES_TIMEOUT","OTEL_EXPORTER_OTLP_METRICS_TIMEOUT","OTEL_EXPORTER_OTLP_LOGS_TIMEOUT","OTEL_EXPORTER_JAEGER_AGENT_PORT"];function Be(t){return je.indexOf(t)>-1}var ke=["OTEL_NO_PATCH_MODULES","OTEL_PROPAGATORS","OTEL_SEMCONV_STABILITY_OPT_IN"];function Fe(t){return ke.indexOf(t)>-1}var He=1/0,Ve=128,Xe={OTEL_SDK_DISABLED:!1,CONTAINER_NAME:"",ECS_CONTAINER_METADATA_URI_V4:"",ECS_CONTAINER_METADATA_URI:"",HOSTNAME:"",KUBERNETES_SERVICE_HOST:"",NAMESPACE:"",OTEL_BSP_EXPORT_TIMEOUT:3e4,OTEL_BSP_MAX_EXPORT_BATCH_SIZE:512,OTEL_BSP_MAX_QUEUE_SIZE:2048,OTEL_BSP_SCHEDULE_DELAY:5e3,OTEL_BLRP_EXPORT_TIMEOUT:3e4,OTEL_BLRP_MAX_EXPORT_BATCH_SIZE:512,OTEL_BLRP_MAX_QUEUE_SIZE:2048,OTEL_BLRP_SCHEDULE_DELAY:5e3,OTEL_EXPORTER_JAEGER_AGENT_HOST:"",OTEL_EXPORTER_JAEGER_AGENT_PORT:6832,OTEL_EXPORTER_JAEGER_ENDPOINT:"",OTEL_EXPORTER_JAEGER_PASSWORD:"",OTEL_EXPORTER_JAEGER_USER:"",OTEL_EXPORTER_OTLP_ENDPOINT:"",OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:"",OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:"",OTEL_EXPORTER_OTLP_LOGS_ENDPOINT:"",OTEL_EXPORTER_OTLP_HEADERS:"",OTEL_EXPORTER_OTLP_TRACES_HEADERS:"",OTEL_EXPORTER_OTLP_METRICS_HEADERS:"",OTEL_EXPORTER_OTLP_LOGS_HEADERS:"",OTEL_EXPORTER_OTLP_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_TRACES_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_METRICS_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_LOGS_TIMEOUT:1e4,OTEL_EXPORTER_ZIPKIN_ENDPOINT:"http://localhost:9411/api/v2/spans",OTEL_LOG_LEVEL:f.INFO,OTEL_NO_PATCH_MODULES:[],OTEL_PROPAGATORS:["tracecontext","baggage"],OTEL_RESOURCE_ATTRIBUTES:"",OTEL_SERVICE_NAME:"",OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT:He,OTEL_ATTRIBUTE_COUNT_LIMIT:Ve,OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT:He,OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT:Ve,OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT:He,OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT:Ve,OTEL_SPAN_EVENT_COUNT_LIMIT:128,OTEL_SPAN_LINK_COUNT_LIMIT:128,OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT:128,OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT:128,OTEL_TRACES_EXPORTER:"",OTEL_TRACES_SAMPLER:Ne.ParentBasedAlwaysOn,OTEL_TRACES_SAMPLER_ARG:"",OTEL_LOGS_EXPORTER:"",OTEL_EXPORTER_OTLP_INSECURE:"",OTEL_EXPORTER_OTLP_TRACES_INSECURE:"",OTEL_EXPORTER_OTLP_METRICS_INSECURE:"",OTEL_EXPORTER_OTLP_LOGS_INSECURE:"",OTEL_EXPORTER_OTLP_CERTIFICATE:"",OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE:"",OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE:"",OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE:"",OTEL_EXPORTER_OTLP_COMPRESSION:"",OTEL_EXPORTER_OTLP_TRACES_COMPRESSION:"",OTEL_EXPORTER_OTLP_METRICS_COMPRESSION:"",OTEL_EXPORTER_OTLP_LOGS_COMPRESSION:"",OTEL_EXPORTER_OTLP_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_TRACES_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_METRICS_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_LOGS_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE:"cumulative",OTEL_SEMCONV_STABILITY_OPT_IN:[]};function Ge(t,e,n){if(void 0!==n[t]){var r=String(n[t]);e[t]="true"===r.toLowerCase()}}function ze(t,e,n,r,o){if(void 0===r&&(r=-1/0),void 0===o&&(o=1/0),void 0!==n[t]){var i=Number(n[t]);isNaN(i)||(e[t]=i<r?r:i>o?o:i)}}function Ke(t,e,n,r){void 0===r&&(r=Me);var o=n[t];"string"==typeof o&&(e[t]=o.split(r).map((function(t){return t.trim()})))}var qe={ALL:f.ALL,VERBOSE:f.VERBOSE,DEBUG:f.DEBUG,INFO:f.INFO,WARN:f.WARN,ERROR:f.ERROR,NONE:f.NONE};function We(t,e,n){var r=n[t];if("string"==typeof r){var o=qe[r.toUpperCase()];null!=o&&(e[t]=o)}}function Ye(t){var e={};for(var n in Xe){var r=n;if("OTEL_LOG_LEVEL"===r)We(r,e,t);else if(Ue(r))Ge(r,e,t);else if(Be(r))ze(r,e,t);else if(Fe(r))Ke(r,e,t);else{var o=t[r];null!=o&&(e[r]=String(o))}}return e}var $e="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{};function Qe(){var t=Ye($e);return Object.assign({},Xe,t)}function Ze(){return Ye($e)}function Je(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}function tn(t){for(var e=new Uint8Array(t.length/2),n=0,r=0;r<t.length;r+=2){var o=Je(t.charCodeAt(r)),i=Je(t.charCodeAt(r+1));e[n++]=o<<4|i}return e}var en=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},nn=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))};var rn=function(){this.generateTraceId=an(16),this.generateSpanId=an(8)},on=Array(32);function an(t){return function(){for(var e=0;e<2*t;e++)on[e]=Math.floor(16*Math.random())+48,on[e]>=58&&(on[e]+=39);return String.fromCharCode.apply(null,on.slice(0,2*t))}}var sn,un=performance,cn="1.30.1",ln="exception.type",pn="exception.message",fn="http.method",dn="http.url",hn="http.host",_n="http.scheme",vn="http.status_code",yn="http.user_agent",gn="http.request_content_length_uncompressed",En="telemetry.sdk.name",Tn="telemetry.sdk.language",mn="telemetry.sdk.version",Sn=((sn={})[En]="opentelemetry",sn["process.runtime.name"]="browser",sn[Tn]="webjs",sn[mn]=cn,sn);function On(t){}var bn,Rn=Math.pow(10,6),Ln=Math.pow(10,9);function Pn(t){var e=t/1e3;return[Math.trunc(e),Math.round(t%1e3*Rn)]}function An(){var t=un.timeOrigin;if("number"!=typeof t){var e=un;t=e.timing&&e.timing.fetchStart}return t}function wn(t){return Dn(Pn(An()),Pn("number"==typeof t?t:un.now()))}function Cn(t){if(xn(t))return t;if("number"==typeof t)return t<An()?wn(t):Pn(t);if(t instanceof Date)return Pn(t.getTime());throw TypeError("Invalid input type")}function Nn(t,e){var n=e[0]-t[0],r=e[1]-t[1];return r<0&&(n-=1,r+=Ln),[n,r]}function In(t){return t[0]*Ln+t[1]}function xn(t){return Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]}function Mn(t){return xn(t)||"number"==typeof t||t instanceof Date}function Dn(t,e){var n=[t[0]+e[0],t[1]+e[1]];return n[1]>=Ln&&(n[1]-=Ln,n[0]+=1),n}!function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"}(bn||(bn={}));var Un=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},jn=function(){function t(t){var e;void 0===t&&(t={}),this._propagators=null!==(e=t.propagators)&&void 0!==e?e:[],this._fields=Array.from(new Set(this._propagators.map((function(t){return"function"==typeof t.fields?t.fields():[]})).reduce((function(t,e){return t.concat(e)}),[])))}return t.prototype.inject=function(t,e,n){var r,o;try{for(var i=Un(this._propagators),a=i.next();!a.done;a=i.next()){var s=a.value;try{s.inject(t,e,n)}catch(t){It.warn("Failed to inject with "+s.constructor.name+". Err: "+t.message)}}}catch(t){r={error:t}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}},t.prototype.extract=function(t,e,n){return this._propagators.reduce((function(t,r){try{return r.extract(t,e,n)}catch(t){It.warn("Failed to extract with "+r.constructor.name+". Err: "+t.message)}return t}),t)},t.prototype.fields=function(){return this._fields.slice()},t}(),Bn="[_0-9a-z-*/]",kn=new RegExp("^(?:"+("[a-z]"+Bn+"{0,255}")+"|"+("[a-z0-9]"+Bn+"{0,240}@[a-z]"+Bn+"{0,13}")+")$"),Fn=/^[ -~]{0,255}[!-~]$/,Hn=/,|=/;var Vn=function(){function t(t){this._internalState=new Map,t&&this._parse(t)}return t.prototype.set=function(t,e){var n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,e),n},t.prototype.unset=function(t){var e=this._clone();return e._internalState.delete(t),e},t.prototype.get=function(t){return this._internalState.get(t)},t.prototype.serialize=function(){var t=this;return this._keys().reduce((function(e,n){return e.push(n+"="+t.get(n)),e}),[]).join(",")},t.prototype._parse=function(t){t.length>512||(this._internalState=t.split(",").reverse().reduce((function(t,e){var n=e.trim(),r=n.indexOf("=");if(-1!==r){var o=n.slice(0,r),i=n.slice(r+1,e.length);(function(t){return kn.test(t)})(o)&&function(t){return Fn.test(t)&&!Hn.test(t)}(i)&&t.set(o,i)}return t}),new Map),this._internalState.size>32&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))},t.prototype._keys=function(){return Array.from(this._internalState.keys()).reverse()},t.prototype._clone=function(){var e=new t;return e._internalState=new Map(this._internalState),e},t}(),Xn="traceparent",Gn="tracestate",zn=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");function Kn(t){var e=zn.exec(t);return e?"00"===e[1]&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}:null}var qn,Wn=function(){function t(){}return t.prototype.inject=function(t,e,n){var r=qt.getSpanContext(t);if(r&&!de(t)&&Tt(r)){var o="00-"+r.traceId+"-"+r.spanId+"-0"+Number(r.traceFlags||A.NONE).toString(16);n.set(e,Xn,o),r.traceState&&n.set(e,Gn,r.traceState.serialize())}},t.prototype.extract=function(t,e,n){var r=n.get(e,Xn);if(!r)return t;var o=Array.isArray(r)?r[0]:r;if("string"!=typeof o)return t;var i=Kn(o);if(!i)return t;i.isRemote=!0;var a=n.get(e,Gn);if(a){var s=Array.isArray(a)?a.join(","):a;i.traceState=new Vn("string"==typeof s?s:void 0)}return qt.setSpanContext(t,i)},t.prototype.fields=function(){return[Xn,Gn]},t}(),Yn=L("OpenTelemetry SDK Context Key RPC_METADATA");!function(t){t.HTTP="http"}(qn||(qn={}));var $n,Qn,Zn=function(){function t(){}return t.prototype.shouldSample=function(){return{decision:bt.NOT_RECORD}},t.prototype.toString=function(){return"AlwaysOffSampler"},t}(),Jn=function(){function t(){}return t.prototype.shouldSample=function(){return{decision:bt.RECORD_AND_SAMPLED}},t.prototype.toString=function(){return"AlwaysOnSampler"},t}(),tr=function(){function t(t){var e,n,r,o;this._root=t.root,this._root||(xe(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new Jn),this._remoteParentSampled=null!==(e=t.remoteParentSampled)&&void 0!==e?e:new Jn,this._remoteParentNotSampled=null!==(n=t.remoteParentNotSampled)&&void 0!==n?n:new Zn,this._localParentSampled=null!==(r=t.localParentSampled)&&void 0!==r?r:new Jn,this._localParentNotSampled=null!==(o=t.localParentNotSampled)&&void 0!==o?o:new Zn}return t.prototype.shouldSample=function(t,e,n,r,o,i){var a=qt.getSpanContext(t);return a&&Tt(a)?a.isRemote?a.traceFlags&A.SAMPLED?this._remoteParentSampled.shouldSample(t,e,n,r,o,i):this._remoteParentNotSampled.shouldSample(t,e,n,r,o,i):a.traceFlags&A.SAMPLED?this._localParentSampled.shouldSample(t,e,n,r,o,i):this._localParentNotSampled.shouldSample(t,e,n,r,o,i):this._root.shouldSample(t,e,n,r,o,i)},t.prototype.toString=function(){return"ParentBased{root="+this._root.toString()+", remoteParentSampled="+this._remoteParentSampled.toString()+", remoteParentNotSampled="+this._remoteParentNotSampled.toString()+", localParentSampled="+this._localParentSampled.toString()+", localParentNotSampled="+this._localParentNotSampled.toString()+"}"},t}(),er=function(){function t(t){void 0===t&&(t=0),this._ratio=t,this._ratio=this._normalize(t),this._upperBound=Math.floor(4294967295*this._ratio)}return t.prototype.shouldSample=function(t,e){return{decision:Et(e)&&this._accumulate(e)<this._upperBound?bt.RECORD_AND_SAMPLED:bt.NOT_RECORD}},t.prototype.toString=function(){return"TraceIdRatioBased{"+this._ratio+"}"},t.prototype._normalize=function(t){return"number"!=typeof t||isNaN(t)?0:t>=1?1:t<=0?0:t},t.prototype._accumulate=function(t){for(var e=0,n=0;n<t.length/8;n++){var r=8*n;e=(e^parseInt(t.slice(r,r+8),16))>>>0}return e},t}(),nr="[object Object]",rr="[object Null]",or="[object Undefined]",ir=Function.prototype.toString,ar=ir.call(Object),sr=($n=Object.getPrototypeOf,Qn=Object,function(t){return $n(Qn(t))}),ur=Object.prototype,cr=ur.hasOwnProperty,lr=Symbol?Symbol.toStringTag:void 0,pr=ur.toString;function fr(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||function(t){if(null==t)return void 0===t?or:rr;return lr&&lr in Object(t)?function(t){var e=cr.call(t,lr),n=t[lr],r=!1;try{t[lr]=void 0,r=!0}catch(t){}var o=pr.call(t);r&&(e?t[lr]=n:delete t[lr]);return o}(t):function(t){return pr.call(t)}(t)}(t)!==nr)return!1;var e=sr(t);if(null===e)return!0;var n=cr.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&ir.call(n)===ar}var dr=20;function hr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=t.shift(),r=new WeakMap;t.length>0;)n=vr(n,t.shift(),0,r);return n}function _r(t){return gr(t)?t.slice():t}function vr(t,e,n,r){var o;if(void 0===n&&(n=0),!(n>dr)){if(n++,mr(t)||mr(e)||Er(e))o=_r(e);else if(gr(t)){if(o=t.slice(),gr(e))for(var i=0,a=e.length;i<a;i++)o.push(_r(e[i]));else if(Tr(e))for(i=0,a=(s=Object.keys(e)).length;i<a;i++){o[u=s[i]]=_r(e[u])}}else if(Tr(t))if(Tr(e)){if(!function(t,e){if(!fr(t)||!fr(e))return!1;return!0}(t,e))return e;o=Object.assign({},t);var s;for(i=0,a=(s=Object.keys(e)).length;i<a;i++){var u,c=e[u=s[i]];if(mr(c))void 0===c?delete o[u]:o[u]=c;else{var l=o[u],p=c;if(yr(t,u,r)||yr(e,u,r))delete o[u];else{if(Tr(l)&&Tr(p)){var f=r.get(l)||[],d=r.get(p)||[];f.push({obj:t,key:u}),d.push({obj:e,key:u}),r.set(l,f),r.set(p,d)}o[u]=vr(o[u],c,n,r)}}}}else o=e;return o}}function yr(t,e,n){for(var r=n.get(t[e])||[],o=0,i=r.length;o<i;o++){var a=r[o];if(a.key===e&&a.obj===t)return!0}return!1}function gr(t){return Array.isArray(t)}function Er(t){return"function"==typeof t}function Tr(t){return!mr(t)&&!gr(t)&&!Er(t)&&"object"==typeof t}function mr(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||void 0===t||t instanceof Date||t instanceof RegExp||null===t}var Sr=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Or=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return Sr(e,t),e}(Error);var br=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};function Rr(t,e){return"string"==typeof e?t===e:!!t.match(e)}function Lr(t,e){var n,r;if(!e)return!1;try{for(var o=br(e),i=o.next();!i.done;i=o.next()){if(Rr(t,i.value))return!0}}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}var Pr=function(){function t(){var t=this;this._promise=new Promise((function(e,n){t._resolve=e,t._reject=n}))}return Object.defineProperty(t.prototype,"promise",{get:function(){return this._promise},enumerable:!1,configurable:!0}),t.prototype.resolve=function(t){this._resolve(t)},t.prototype.reject=function(t){this._reject(t)},t}(),Ar=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},wr=function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))},Cr=function(){function t(t,e){this._callback=t,this._that=e,this._isCalled=!1,this._deferred=new Pr}return Object.defineProperty(t.prototype,"isCalled",{get:function(){return this._isCalled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"promise",{get:function(){return this._deferred.promise},enumerable:!1,configurable:!0}),t.prototype.call=function(){for(var t,e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];if(!this._isCalled){this._isCalled=!0;try{Promise.resolve((t=this._callback).call.apply(t,wr([this._that],Ar(n),!1))).then((function(t){return e._deferred.resolve(t)}),(function(t){return e._deferred.reject(t)}))}catch(t){this._deferred.reject(t)}}return this._deferred.promise},t}();var Nr,Ir,xr={getKeyPairs:Te,serializeKeyPairs:Ee,parseKeyPairsIntoRecord:function(t){return"string"!=typeof t||0===t.length?{}:t.split(ve).map((function(t){return me(t)})).filter((function(t){return void 0!==t&&t.value.length>0})).reduce((function(t,e){return t[e.key]=e.value,t}),{})},parsePairKeyValue:me},Mr={_export:function(t,e){return new Promise((function(n){Nt.with(fe(Nt.active()),(function(){t.export(e,(function(t){n(t)}))}))}))}},Dr=Object.freeze({__proto__:null,AlwaysOffSampler:Zn,AlwaysOnSampler:Jn,AnchoredClock:Oe,BindOnceFuture:Cr,CompositePropagator:jn,DEFAULT_ATTRIBUTE_COUNT_LIMIT:Ve,DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT:He,DEFAULT_ENVIRONMENT:Xe,DEFAULT_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT:128,DEFAULT_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT:128,get ExportResultCode(){return bn},ParentBasedSampler:tr,get RPCType(){return qn},RandomIdGenerator:rn,SDK_INFO:Sn,TRACE_PARENT_HEADER:Xn,TRACE_STATE_HEADER:Gn,TimeoutError:Or,TraceIdRatioBasedSampler:er,TraceState:Vn,get TracesSamplerValues(){return Ne},VERSION:cn,W3CBaggagePropagator:Se,W3CTraceContextPropagator:Wn,_globalThis:$e,addHrTimes:Dn,baggageUtils:xr,callWithTimeout:function(t,e){var n,r=new Promise((function(t,r){n=setTimeout((function(){r(new Or("Operation timed out."))}),e)}));return Promise.race([t,r]).then((function(t){return clearTimeout(n),t}),(function(t){throw clearTimeout(n),t}))},deleteRPCMetadata:function(t){return t.deleteValue(Yn)},getEnv:Qe,getEnvWithoutDefaults:Ze,getRPCMetadata:function(t){return t.getValue(Yn)},getTimeOrigin:An,globalErrorHandler:xe,hexToBase64:function(t){return btoa(String.fromCharCode.apply(String,nn([],en(tn(t)),!1)))},hexToBinary:tn,hrTime:wn,hrTimeDuration:Nn,hrTimeToMicroseconds:function(t){return 1e6*t[0]+t[1]/1e3},hrTimeToMilliseconds:function(t){return 1e3*t[0]+t[1]/1e6},hrTimeToNanoseconds:In,hrTimeToTimeStamp:function(t){var e=""+"0".repeat(9)+t[1]+"Z",n=e.substring(e.length-9-1);return new Date(1e3*t[0]).toISOString().replace("000Z",n)},internal:Mr,isAttributeKey:Pe,isAttributeValue:Ae,isTimeInput:Mn,isTimeInputHrTime:xn,isTracingSuppressed:de,isUrlIgnored:Lr,isWrapped:function(t){return"function"==typeof t&&"function"==typeof t.__original&&"function"==typeof t.__unwrap&&!0===t.__wrapped},loggingErrorHandler:Ce,merge:hr,millisToHrTime:Pn,otperformance:un,parseEnvironment:Ye,parseTraceParent:Kn,sanitizeAttributes:Le,setGlobalErrorHandler:function(t){Ie=t},setRPCMetadata:function(t,e){return t.setValue(Yn,e)},suppressTracing:fe,timeInputToHrTime:Cn,unrefTimer:On,unsuppressTracing:function(t){return t.deleteValue(pe)},urlMatches:Rr}),Ur=ie(Dr);function jr(){if(Nr)return le;Nr=1,Object.defineProperty(le,"__esModule",{value:!0}),le.getOtlpEncoder=le.encodeAsString=le.encodeAsLongBits=le.toLongBits=le.hrTimeToNanos=void 0;const t=Ur;function e(t){const e=BigInt(1e9);return BigInt(t[0])*e+BigInt(t[1])}function n(t){return{low:Number(BigInt.asUintN(32,t)),high:Number(BigInt.asUintN(32,t>>BigInt(32)))}}function r(t){return n(e(t))}function o(t){return e(t).toString()}le.hrTimeToNanos=e,le.toLongBits=n,le.encodeAsLongBits=r,le.encodeAsString=o;const i="undefined"!=typeof BigInt?o:t.hrTimeToNanoseconds;function a(t){return t}function s(e){if(void 0!==e)return(0,t.hexToBinary)(e)}const u={encodeHrTime:r,encodeSpanContext:t.hexToBinary,encodeOptionalSpanContext:s};return le.getOtlpEncoder=function(e){var n,o;if(void 0===e)return u;const c=null===(n=e.useLongBits)||void 0===n||n,l=null!==(o=e.useHex)&&void 0!==o&&o;return{encodeHrTime:c?r:i,encodeSpanContext:l?a:t.hexToBinary,encodeOptionalSpanContext:l?a:s}},le}function Br(){if(Ir)return se;Ir=1,Object.defineProperty(se,"__esModule",{value:!0}),se.createExportTraceServiceRequest=se.toOtlpSpanEvent=se.toOtlpLink=se.sdkSpanToOtlpSpan=void 0;const t=ce(),e=jr();function n(e,n){var i;const a=e.spanContext(),s=e.status;return{traceId:n.encodeSpanContext(a.traceId),spanId:n.encodeSpanContext(a.spanId),parentSpanId:n.encodeOptionalSpanContext(e.parentSpanId),traceState:null===(i=a.traceState)||void 0===i?void 0:i.serialize(),name:e.name,kind:null==e.kind?0:e.kind+1,startTimeUnixNano:n.encodeHrTime(e.startTime),endTimeUnixNano:n.encodeHrTime(e.endTime),attributes:(0,t.toAttributes)(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map((t=>o(t,n))),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map((t=>r(t,n))),droppedLinksCount:e.droppedLinksCount}}function r(e,n){var r;return{attributes:e.attributes?(0,t.toAttributes)(e.attributes):[],spanId:n.encodeSpanContext(e.context.spanId),traceId:n.encodeSpanContext(e.context.traceId),traceState:null===(r=e.context.traceState)||void 0===r?void 0:r.serialize(),droppedAttributesCount:e.droppedAttributesCount||0}}function o(e,n){return{attributes:e.attributes?(0,t.toAttributes)(e.attributes):[],name:e.name,timeUnixNano:n.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function i(e,r){const o=function(t){const e=new Map;for(const n of t){let t=e.get(n.resource);t||(t=new Map,e.set(n.resource,t));const r=`${n.instrumentationLibrary.name}@${n.instrumentationLibrary.version||""}:${n.instrumentationLibrary.schemaUrl||""}`;let o=t.get(r);o||(o=[],t.set(r,o)),o.push(n)}return e}(e),i=[],a=o.entries();let s=a.next();for(;!s.done;){const[e,o]=s.value,u=[],c=o.values();let l=c.next();for(;!l.done;){const e=l.value;if(e.length>0){const o=e.map((t=>n(t,r)));u.push({scope:(0,t.createInstrumentationScope)(e[0].instrumentationLibrary),spans:o,schemaUrl:e[0].instrumentationLibrary.schemaUrl})}l=c.next()}const p={resource:(0,t.createResource)(e),scopeSpans:u,schemaUrl:void 0};i.push(p),s=a.next()}return i}return se.sdkSpanToOtlpSpan=n,se.toOtlpLink=r,se.toOtlpSpanEvent=o,se.createExportTraceServiceRequest=function(t,n){return{resourceSpans:i(t,(0,e.getOtlpEncoder)(n))}},se}var kr,Fr=Br(),Hr={};function Vr(){return kr||(kr=1,function(t){var e;Object.defineProperty(t,"__esModule",{value:!0}),t.ESpanKind=void 0,(e=t.ESpanKind||(t.ESpanKind={}))[e.SPAN_KIND_UNSPECIFIED=0]="SPAN_KIND_UNSPECIFIED",e[e.SPAN_KIND_INTERNAL=1]="SPAN_KIND_INTERNAL",e[e.SPAN_KIND_SERVER=2]="SPAN_KIND_SERVER",e[e.SPAN_KIND_CLIENT=3]="SPAN_KIND_CLIENT",e[e.SPAN_KIND_PRODUCER=4]="SPAN_KIND_PRODUCER",e[e.SPAN_KIND_CONSUMER=5]="SPAN_KIND_CONSUMER"}(Hr)),Hr}var Xr=Vr();const Gr="user-action-end",zr="user-action-cancel";let Kr={};class qr{constructor(t){this.config=t}export(t,e){const n=Fr.createExportTraceServiceRequest(t,{useHex:!0,useLongBits:!1});this.config.api.pushTraces(n),function(t=[]){var e,n;for(const r of t){const{scopeSpans:t}=r;for(const r of t){const{scope:t,spans:o=[]}=r;for(const r of o){if(r.kind!==Xr.ESpanKind.SPAN_KIND_CLIENT)continue;const o={traceId:r.traceId.toString(),spanId:r.spanId.toString()},i={};for(const t of r.attributes)i[t.key]=String(Object.values(t.value)[0]);Number.isNaN(r.endTimeUnixNano)||Number.isNaN(r.startTimeUnixNano)||(i.duration_ns=String(Number(r.endTimeUnixNano)-Number(r.startTimeUnixNano)));const a=(null!==(e=null==t?void 0:t.name)&&void 0!==e?e:"").indexOf("-");let s="unknown";(null==t?void 0:t.name)&&(-1===a&&(s=null!==(n=t.name.split("/")[1])&&void 0!==n?n:t.name),a>-1&&(s=null==t?void 0:t.name.substring(a+1))),Kr.api.pushEvent(`faro.tracing.${s}`,i,void 0,{spanContext:o,timestampOverwriteMs:Number(r.endTimeUnixNano)/1e6,customPayloadTransformer:t=>{var e,n;return null!=i["faro.action.user.name"]&&null!=i["faro.action.user.parentId"]&&(t.action={name:i["faro.action.user.name"],parentId:i["faro.action.user.parentId"]},null===(e=t.attributes)||void 0===e||delete e["faro.action.user.name"],null===(n=t.attributes)||void 0===n||delete n["faro.action.user.parentId"]),t}})}}}}(n.resourceSpans),e({code:Yt.SUCCESS})}shutdown(){return Promise.resolve(void 0)}}var Wr="session.id";"function"==typeof SuppressedError&&SuppressedError;var Yr=function(){function t(){}return t.prototype.emit=function(t){},t}(),$r=new Yr,Qr=new(function(){function t(){}return t.prototype.getLogger=function(t,e,n){return new Yr},t}()),Zr=function(){function t(t,e,n,r){this._provider=t,this.name=e,this.version=n,this.options=r}return t.prototype.emit=function(t){this._getLogger().emit(t)},t.prototype._getLogger=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):$r},t}(),Jr=functi