posthog-js 1.366.1 → 1.366.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/logs.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(){"use strict";function t(t,r,e,i,n,o,s){try{var u=t[o](s),a=u.value}catch(t){return void e(t)}u.done?r(a):Promise.resolve(a).then(i,n)}function r(r){return function(){var e=this,i=arguments;return new Promise((function(n,o){var s=r.apply(e,i);function u(r){t(s,n,o,u,a,"next",r)}function a(r){t(s,n,o,u,a,"throw",r)}u(void 0)}))}}function e(){return e=Object.assign?Object.assign.bind():function(t){for(var r=1;arguments.length>r;r++){var e=arguments[r];for(var i in e)({}).hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},e.apply(null,arguments)}class i{emit(t){}}var n=new i,o=new class{getLogger(t,r,e){return new i}};class s{constructor(t,r,e,i){this.te=t,this.name=r,this.version=e,this.options=i}emit(t){this.re().emit(t)}re(){if(this.ne)return this.ne;var t=this.te.ie(this.name,this.version,this.options);return t?(this.ne=t,this.ne):n}}class u{getLogger(t,r,e){var i;return null!==(i=this.ie(t,r,e))&&void 0!==i?i:new s(this,t,r,e)}oe(){var t;return null!==(t=this.ne)&&void 0!==t?t:o}ae(t){this.ne=t}ie(t,r,e){var i;return null===(i=this.ne)||void 0===i?void 0:i.getLogger(t,r,e)}}var a="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},c=Symbol.for("io.opentelemetry.js.api.logs"),l=a;class h{constructor(){this.se=new u}static getInstance(){return this._instance||(this._instance=new h),this._instance}setGlobalLoggerProvider(t){return l[c]?this.getLoggerProvider():(l[c]=(1,r=t,e=o,t=>1===t?r:e),this.se.ae(t),t);var r,e}getLoggerProvider(){var t,r;return null!==(r=null===(t=l[c])||void 0===t?void 0:t.call(l,1))&&void 0!==r?r:this.se}getLogger(t,r,e){return this.getLoggerProvider().getLogger(t,r,e)}disable(){delete l[c],this.se=new u}}var f=h.getInstance();class v{constructor(t){this.ne=void 0,this.ne=t}export(t,r){this.ne.export(t,r)}forceFlush(){return this.ne.forceFlush()}shutdown(){return this.ne.shutdown()}}class d extends Error{constructor(t,r,e){super(t),this.code=void 0,this.name="OTLPExporterError",this.data=void 0,this.data=e,this.code=r}}function m(t){if(Number.isFinite(t)&&t>0)return t;throw new Error("Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '"+t+"')")}class y{constructor(t){this.ue=void 0,this.le=[],this.ue=t}pushPromise(t){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this.le.push(t);var r=()=>{var r=this.le.indexOf(t);this.le.splice(r,1)};t.then(r,r)}hasReachedLimit(){return this.le.length>=this.ue}awaitAll(){var t=this;return r((function*(){yield Promise.all(t.le)}))()}}function b(t){return new y(t.concurrencyLimit)}var g="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},p="1.9.0",w=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,S=function(t){var r=new Set([t]),e=new Set,i=t.match(w);if(!i)return function(){return!1};var n=+i[1],o=+i[2],s=+i[3];if(null!=i[4])return function(r){return r===t};function u(t){return e.add(t),!1}function a(t){return r.add(t),!0}return function(t){if(r.has(t))return!0;if(e.has(t))return!1;var i=t.match(w);if(!i)return u(t);var c=+i[2],l=+i[3];return null!=i[4]||n!==+i[1]?u(t):0===n?o!==c||s>l?u(t):a(t):o>c?u(t):a(t)}}(p),j=p.split(".")[0],L=Symbol.for("opentelemetry.js.api."+j),O=g;function T(t,r,e,i){var n;void 0===i&&(i=!1);var o=O[L]=null!==(n=O[L])&&void 0!==n?n:{version:p};if(!i&&o[t]){var s=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return e.error(s.stack||s.message),!1}return o.version!==p?(s=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+t+" does not match previously registered API v"+p),e.error(s.stack||s.message),!1):(o[t]=r,e.debug("@opentelemetry/api: Registered a global for "+t+" v"+p+"."),!0)}function x(t){var r,e,i=null===(r=O[L])||void 0===r?void 0:r.version;if(i&&S(i))return null===(e=O[L])||void 0===e?void 0:e[t]}function E(t,r){r.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+p+".");var e=O[L];e&&delete e[t]}var A,R=function(){function t(t){this.ce=t.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var t=[],r=0;arguments.length>r;r++)t[r]=arguments[r];return P("debug",this.ce,t)},t.prototype.error=function(){for(var t=[],r=0;arguments.length>r;r++)t[r]=arguments[r];return P("error",this.ce,t)},t.prototype.info=function(){for(var t=[],r=0;arguments.length>r;r++)t[r]=arguments[r];return P("info",this.ce,t)},t.prototype.warn=function(){for(var t=[],r=0;arguments.length>r;r++)t[r]=arguments[r];return P("warn",this.ce,t)},t.prototype.verbose=function(){for(var t=[],r=0;arguments.length>r;r++)t[r]=arguments[r];return P("verbose",this.ce,t)},t}();function P(t,r,e){var i=x("diag");if(i)return e.unshift(r),i[t].apply(i,function(t,r,e){if(e||2===arguments.length)for(var i,n=0,o=r.length;o>n;n++)!i&&n in r||(i||(i=[].slice.call(r,0,n)),i[n]=r[n]);return t.concat(i||[].slice.call(r))}([],function(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var i,n,o=e.call(t),s=[];try{for(;(void 0===r||r-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(n)throw n.error}}return s}(e),!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"}(A||(A={}));var N=function(){function t(){function t(t){return function(){for(var r=[],e=0;arguments.length>e;e++)r[e]=arguments[e];var i=x("diag");if(i)return i[t].apply(i,function(t,r,e){if(e||2===arguments.length)for(var i,n=0,o=r.length;o>n;n++)!i&&n in r||(i||(i=[].slice.call(r,0,n)),i[n]=r[n]);return t.concat(i||[].slice.call(r))}([],function(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var i,n,o=e.call(t),s=[];try{for(;(void 0===r||r-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(n)throw n.error}}return s}(r),!1))}}var r=this;r.setLogger=function(t,e){var i,n,o;if(void 0===e&&(e={logLevel:A.INFO}),t===r){var s=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error(null!==(i=s.stack)&&void 0!==i?i:s.message),!1}"number"==typeof e&&(e={logLevel:e});var u=x("diag"),a=function(t,r){function e(e,i){var n=r[e];return"function"!=typeof n||i>t?function(){}:n.bind(r)}return A.NONE>t?t=A.NONE:t>A.ALL&&(t=A.ALL),r=r||{},{error:e("error",A.ERROR),warn:e("warn",A.WARN),info:e("info",A.INFO),debug:e("debug",A.DEBUG),verbose:e("verbose",A.VERBOSE)}}(null!==(n=e.logLevel)&&void 0!==n?n:A.INFO,t);if(u&&!e.suppressOverrideMessage){var c=null!==(o=(new Error).stack)&&void 0!==o?o:"<failed to generate stacktrace>";u.warn("Current logger will be overwritten from "+c),a.warn("Current logger will overwrite one already registered from "+c)}return T("diag",a,r,!0)},r.disable=function(){E("diag",r)},r.createComponentLogger=function(t){return new R(t)},r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t}();function C(t){return Symbol.for(t)}var I,M=new function t(r){var e=this;e.de=r?new Map(r):new Map,e.getValue=function(t){return e.de.get(t)},e.setValue=function(r,i){var n=new t(e.de);return n.de.set(r,i),n},e.deleteValue=function(r){var i=new t(e.de);return i.de.delete(r),i}},U=function(){function t(){}return t.prototype.active=function(){return M},t.prototype.with=function(t,r,e){for(var i=[],n=3;arguments.length>n;n++)i[n-3]=arguments[n];return r.call.apply(r,function(t,r,e){if(e||2===arguments.length)for(var i,n=0,o=r.length;o>n;n++)!i&&n in r||(i||(i=[].slice.call(r,0,n)),i[n]=r[n]);return t.concat(i||[].slice.call(r))}([e],function(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var i,n,o=e.call(t),s=[];try{for(;(void 0===r||r-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(n)throw n.error}}return s}(i),!1))},t.prototype.bind=function(t,r){return r},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t}(),k="context",B=new U,D=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(t){return T(k,t,N.instance())},t.prototype.active=function(){return this.he().active()},t.prototype.with=function(t,r,e){for(var i,n=[],o=3;arguments.length>o;o++)n[o-3]=arguments[o];return(i=this.he()).with.apply(i,function(t,r,e){if(e||2===arguments.length)for(var i,n=0,o=r.length;o>n;n++)!i&&n in r||(i||(i=[].slice.call(r,0,n)),i[n]=r[n]);return t.concat(i||[].slice.call(r))}([t,r,e],function(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var i,n,o=e.call(t),s=[];try{for(;(void 0===r||r-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(n)throw n.error}}return s}(n),!1))},t.prototype.bind=function(t,r){return this.he().bind(t,r)},t.prototype.he=function(){return x(k)||B},t.prototype.disable=function(){this.he().disable(),E(k,N.instance())},t}();!function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"}(I||(I={}));var _="0000000000000000",F="00000000000000000000000000000000",q={traceId:F,spanId:_,traceFlags:I.NONE},H=function(){function t(t){void 0===t&&(t=q),this.ve=t}return t.prototype.spanContext=function(){return this.ve},t.prototype.setAttribute=function(t,r){return this},t.prototype.setAttributes=function(t){return this},t.prototype.addEvent=function(t,r){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,r){},t}(),z=C("OpenTelemetry Context Key SPAN");function V(t){return t.getValue(z)||void 0}function X(){return V(D.getInstance().active())}function G(t,r){return t.setValue(z,r)}function J(t){return t.deleteValue(z)}function W(t,r){return G(t,new H(r))}function K(t){var r;return null===(r=V(t))||void 0===r?void 0:r.spanContext()}var Q=/^([0-9a-f]{32})$/i,Y=/^[0-9a-f]{16}$/i;function Z(t){return Q.test(e=t.traceId)&&e!==F&&Y.test(r=t.spanId)&&r!==_;var r,e}function tt(t){return new H(t)}var rt=D.getInstance(),et=function(){function t(){}return t.prototype.startSpan=function(t,r,e){if(void 0===e&&(e=rt.active()),Boolean(null==r?void 0:r.root))return new H;var i,n=e&&K(e);return"object"==typeof(i=n)&&"string"==typeof i.spanId&&"string"==typeof i.traceId&&"number"==typeof i.traceFlags&&Z(n)?new H(n):new H},t.prototype.startActiveSpan=function(t,r,e,i){var n,o,s;if(arguments.length>=2){2===arguments.length?s=r:3===arguments.length?(n=r,s=e):(n=r,o=e,s=i);var u=null!=o?o:rt.active(),a=this.startSpan(t,n,u),c=G(u,a);return rt.with(c,s,void 0,a)}},t}(),it=new et,nt=function(){function t(t,r,e,i){this.te=t,this.name=r,this.version=e,this.options=i}return t.prototype.startSpan=function(t,r,e){return this.fe().startSpan(t,r,e)},t.prototype.startActiveSpan=function(t,r,e,i){var n=this.fe();return Reflect.apply(n.startActiveSpan,n,arguments)},t.prototype.fe=function(){if(this.ne)return this.ne;var t=this.te.getDelegateTracer(this.name,this.version,this.options);return t?(this.ne=t,this.ne):it},t}(),ot=new(function(){function t(){}return t.prototype.getTracer=function(t,r,e){return new et},t}()),st=function(){function t(){}return t.prototype.getTracer=function(t,r,e){var i;return null!==(i=this.getDelegateTracer(t,r,e))&&void 0!==i?i:new nt(this,t,r,e)},t.prototype.getDelegate=function(){var t;return null!==(t=this.ne)&&void 0!==t?t:ot},t.prototype.setDelegate=function(t){this.ne=t},t.prototype.getDelegateTracer=function(t,r,e){var i;return null===(i=this.ne)||void 0===i?void 0:i.getTracer(t,r,e)},t}(),ut=D.getInstance(),at=N.instance(),ct="trace",lt=function(){function t(){this.pe=new st,this.wrapSpanContext=tt,this.isSpanContextValid=Z,this.deleteSpan=J,this.getSpan=V,this.getActiveSpan=X,this.getSpanContext=K,this.setSpan=G,this.setSpanContext=W}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(t){var r=T(ct,this.pe,N.instance());return r&&this.pe.setDelegate(t),r},t.prototype.getTracerProvider=function(){return x(ct)||this.pe},t.prototype.getTracer=function(t,r){return this.getTracerProvider().getTracer(t,r)},t.prototype.disable=function(){E(ct,N.instance()),this.pe=new st},t}().getInstance(),ht=C("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function ft(t){return null==t||(Array.isArray(t)?function(t){var r;for(var e of t)if(null!=e){var i=typeof e;if(i!==r){if(!r){if(vt(i)){r=i;continue}return!1}return!1}}return!0}(t):vt(typeof t))}function vt(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}function dt(t){try{(t=>{at.error(function(t){return"string"==typeof t?t:JSON.stringify(function(t){for(var r={},e=t;null!==e;)Object.getOwnPropertyNames(e).forEach((t=>{if(!r[t]){var i=e[t];i&&(r[t]=String(i))}})),e=Object.getPrototypeOf(e);return r}(t))}(t))})(t)}catch(t){}}var mt,yt=performance,bt="telemetry.sdk.language",gt="telemetry.sdk.name",pt="telemetry.sdk.version",wt={[gt]:"opentelemetry","process.runtime.name":"browser",[bt]:"webjs",[pt]:"2.2.0"},St=Math.pow(10,6),jt=Math.pow(10,9);function Lt(t){return[Math.trunc(t/1e3),Math.round(t%1e3*St)]}function Ot(){var t=yt.timeOrigin;return"number"!=typeof t&&(t=yt.timing&&yt.timing.fetchStart),t}function Tt(t){if(o=t,Array.isArray(o)&&2===o.length&&"number"==typeof o[0]&&"number"==typeof o[1])return t;if("number"==typeof t)return t<Ot()?(r=t,e=Lt(Ot()),i=Lt("number"==typeof r?r:yt.now()),jt>(n=[e[0]+i[0],e[1]+i[1]])[1]||(n[1]-=jt,n[0]+=1),n):Lt(t);var r,e,i,n,o;if(t instanceof Date)return Lt(t.getTime());throw TypeError("Invalid input type")}!function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"}(mt||(mt={}));var xt="[object Object]",Et="[object Null]",At="[object Undefined]",Rt=function(){}.toString,Pt=Rt.call(Object),Nt=Object.getPrototypeOf,Ct=Object.prototype,It=Ct.hasOwnProperty,Mt=Symbol?Symbol.toStringTag:void 0,Ut=Ct.toString;function kt(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||function(t){return null==t?void 0===t?At:Et:Mt&&Mt in Object(t)?function(t){var r=It.call(t,Mt),e=t[Mt],i=!1;try{t[Mt]=void 0,i=!0}catch(t){}var n=Ut.call(t);return i&&(r?t[Mt]=e:delete t[Mt]),n}(t):function(t){return Ut.call(t)}(t)}(t)!==xt)return!1;var r=Nt(t);if(null===r)return!0;var e=It.call(r,"constructor")&&r.constructor;return"function"==typeof e&&e instanceof e&&Rt.call(e)===Pt}function Bt(t){return Ft(t)?t.slice():t}function Dt(t,r,e,i){var n;if(void 0===e&&(e=0),20>=e){if(e++,zt(t)||zt(r)||qt(r))n=Bt(r);else if(Ft(t)){if(n=t.slice(),Ft(r))for(var o=0,s=r.length;s>o;o++)n.push(Bt(r[o]));else if(Ht(r))for(var u=Object.keys(r),a=0,c=u.length;c>a;a++){var l=u[a];n[l]=Bt(r[l])}}else if(Ht(t))if(Ht(r)){if(!function(t,r){return!(!kt(t)||!kt(r))}(t,r))return r;n=Object.assign({},t);for(var h=Object.keys(r),f=0,v=h.length;v>f;f++){var d=h[f],m=r[d];if(zt(m))void 0===m?delete n[d]:n[d]=m;else{var y=n[d],b=m;if(_t(t,d,i)||_t(r,d,i))delete n[d];else{if(Ht(y)&&Ht(b)){var g=i.get(y)||[],p=i.get(b)||[];g.push({obj:t,key:d}),p.push({obj:r,key:d}),i.set(y,g),i.set(b,p)}n[d]=Dt(n[d],m,e,i)}}}}else n=r;return n}}function _t(t,r,e){for(var i=e.get(t[r])||[],n=0,o=i.length;o>n;n++){var s=i[n];if(s.key===r&&s.obj===t)return!0}return!1}function Ft(t){return Array.isArray(t)}function qt(t){return"function"==typeof t}function Ht(t){return!zt(t)&&!Ft(t)&&!qt(t)&&"object"==typeof t}function zt(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||void 0===t||t instanceof Date||t instanceof RegExp||null===t}class Vt extends Error{constructor(t){super(t),Object.setPrototypeOf(this,Vt.prototype)}}function Xt(t,r){var e,i=new Promise((function(t,i){e=setTimeout((function(){i(new Vt("Operation timed out."))}),r)}));return Promise.race([t,i]).then((t=>(clearTimeout(e),t)),(t=>{throw clearTimeout(e),t}))}class Gt{constructor(){this.me=void 0,this.ye=void 0,this.ge=void 0,this.me=new Promise(((t,r)=>{this.ye=t,this.ge=r}))}get promise(){return this.me}resolve(t){this.ye(t)}reject(t){this.ge(t)}}class Jt{constructor(t,r){this.be=void 0,this.we=void 0,this.Ce=!1,this.Ie=new Gt,this.be=t,this.we=r}get isCalled(){return this.Ce}get promise(){return this.Ie.promise}call(){if(!this.Ce){this.Ce=!0;try{for(var t=arguments.length,r=new Array(t),e=0;t>e;e++)r[e]=arguments[e];Promise.resolve(this.be.call(this.we,...r)).then((t=>this.Ie.resolve(t)),(t=>this.Ie.reject(t)))}catch(t){this.Ie.reject(t)}}return this.Ie.promise}}var Wt={Se:(t,r)=>new Promise((e=>{ut.with(function(t){return t.setValue(ht,!0)}(ut.active()),(()=>{t.export(r,(t=>{e(t)}))}))}))};class Kt{constructor(t,r,e,i,n){this.ke=void 0,this.xe=void 0,this.Ae=void 0,this.Te=void 0,this.Ne=void 0,this.Re=void 0,this.ke=t,this.xe=r,this.Ae=e,this.Te=i,this.Ne=n,this.Re=at.createComponentLogger({namespace:"OTLPExportDelegate"})}export(t,r){if(this.Re.debug("items to be sent",t),this.Te.hasReachedLimit())r({code:mt.FAILED,error:new Error("Concurrent export limit reached")});else{var e=this.xe.serializeRequest(t);null!=e?this.Te.pushPromise(this.ke.send(e,this.Ne).then((t=>{if("success"!==t.status)r("failure"===t.status&&t.error?{code:mt.FAILED,error:t.error}:"retryable"===t.status?{code:mt.FAILED,error:new d("Export failed with retryable status")}:{code:mt.FAILED,error:new d("Export failed with unknown error")});else{if(null!=t.data)try{this.Ae.handleResponse(this.xe.deserializeResponse(t.data))}catch(r){this.Re.warn("Export succeeded but could not deserialize response - is the response specification compliant?",r,t.data)}r({code:mt.SUCCESS})}}),(t=>r({code:mt.FAILED,error:t})))):r({code:mt.FAILED,error:new Error("Nothing to send")})}}forceFlush(){return this.Te.awaitAll()}shutdown(){var t=this;return r((function*(){t.Re.debug("shutdown started"),yield t.forceFlush(),t.ke.shutdown()}))()}}function $t(t,r,e){return i={transport:e,serializer:r,promiseHandler:b(t)},new Kt(i.transport,i.serializer,{handleResponse(t){null!=t&&function(t){return{}.hasOwnProperty.call(t,"partialSuccess")}(t)&&null!=t.partialSuccess&&0!==Object.keys(t.partialSuccess).length&&at.warn("Received Partial Success response:",JSON.stringify(t.partialSuccess))}},i.promiseHandler,{timeout:t.timeoutMillis}.timeout);var i}function Qt(t){return 48>t||t>57?97>t||t>102?t-55:t-87:t-48}function Yt(t){for(var r=new Uint8Array(t.length/2),e=0,i=0;t.length>i;i+=2){var n=Qt(t.charCodeAt(i)),o=Qt(t.charCodeAt(i+1));r[e++]=n<<4|o}return r}function Zt(t){var r=BigInt(1e9);return BigInt(Math.trunc(t[0]))*r+BigInt(Math.trunc(t[1]))}function tr(t){var r;return r=Zt(t),{low:Number(BigInt.asUintN(32,r)),high:Number(BigInt.asUintN(32,r>>BigInt(32)))}}var rr="undefined"!=typeof BigInt?function(t){return Zt(t).toString()}:function(t){return t[0]*jt+t[1]};function er(t){return t}function ir(t){if(void 0!==t)return Yt(t)}var nr={encodeHrTime:tr,encodeSpanContext:Yt,encodeOptionalSpanContext:ir};function or(t,r){return{key:t,value:sr(r)}}function sr(t){var 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(sr)}}:"object"===r&&null!=t?{kvlistValue:{values:Object.entries(t).map((t=>{var[r,e]=t;return or(r,e)}))}}:{}}function ur(t,r){var e=function(t){var r=new Map;for(var e of t){var{resource:i,instrumentationScope:{name:n,version:o="",schemaUrl:s=""}}=e,u=r.get(i);u||(u=new Map,r.set(i,u));var a=n+"@"+o+":"+s,c=u.get(a);c||u.set(a,c=[]),c.push(e)}return r}(t);return Array.from(e,(t=>{var[e,i]=t,n=function(t){var r,e={attributes:(r=t.attributes,Object.keys(r).map((t=>or(t,r[t])))),droppedAttributesCount:0},i=t.schemaUrl;return i&&""!==i&&(e.schemaUrl=i),e}(e);return{resource:n,scopeLogs:Array.from(i,(t=>{var e,[,i]=t;return{scope:(e=i[0].instrumentationScope,{name:e.name,version:e.version}),logRecords:i.map((t=>function(t,r){var e,i,n,o;return{timeUnixNano:r.encodeHrTime(t.hrTime),observedTimeUnixNano:r.encodeHrTime(t.hrTimeObserved),severityNumber:t.severityNumber,severityText:t.severityText,body:sr(t.body),eventName:t.eventName,attributes:(o=t.attributes,Object.keys(o).map((t=>or(t,o[t])))),droppedAttributesCount:t.droppedAttributesCount,flags:null==(e=t.spanContext)?void 0:e.traceFlags,traceId:r.encodeOptionalSpanContext(null==(i=t.spanContext)?void 0:i.traceId),spanId:r.encodeOptionalSpanContext(null==(n=t.spanContext)?void 0:n.spanId)}}(t,r))),schemaUrl:i[0].instrumentationScope.schemaUrl}})),schemaUrl:n.schemaUrl}}))}var ar=t=>null!==t&&"object"==typeof t&&"function"==typeof t.then;class cr{static FromAttributeList(t,r){var e=new cr({},r);return e.Me=hr(t),e._e=t.filter((t=>{var[r,e]=t;return ar(e)})).length>0,e}constructor(t,r){var e;this.Me=void 0,this._e=!1,this.Ee=void 0,this.Oe=void 0;var i=null!==(e=t.attributes)&&void 0!==e?e:{};this.Me=Object.entries(i).map((t=>{var[r,e]=t;return ar(e)&&(this._e=!0),[r,e]})),this.Me=hr(this.Me),this.Ee=function(t){if("string"==typeof t||void 0===t)return t;at.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}(null==r?void 0:r.schemaUrl)}get asyncAttributesPending(){return this._e}waitForAsyncAttributes(){var t=this;return r((function*(){if(t.asyncAttributesPending){for(var r=0;t.Me.length>r;r++){var[e,i]=t.Me[r];t.Me[r]=[e,ar(i)?yield i:i]}t._e=!1}}))()}get attributes(){if(this.asyncAttributesPending&&at.error("Accessing resource attributes before async attributes settled"),this.Oe)return this.Oe;var t={};for(var[r,e]of this.Me){var i;ar(e)?at.debug("Unsettled resource attribute "+r+" skipped"):null!=e&&(null!==(i=t[r])&&void 0!==i||(t[r]=e))}return this._e||(this.Oe=t),t}getRawAttributes(){return this.Me}get schemaUrl(){return this.Ee}merge(t){if(null==t)return this;var r,e,i,n,o=(n=null==(e=t)?void 0:e.schemaUrl,void 0===(i=null==(r=this)?void 0:r.schemaUrl)||""===i?n:void 0===n||""===n||i===n?i:void at.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',i,n)),s=o?{schemaUrl:o}:void 0;return cr.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],s)}}function lr(t,r){return cr.FromAttributeList(Object.entries(t),r)}function hr(t){return t.map((t=>{var[r,e]=t;return ar(e)?[r,e.catch((t=>{at.debug("promise rejection for resource attribute: %s - %s",r,t)}))]:[r,e]}))}var fr={serializeRequest(t){var r,e,i=(r=t,e=function(t){var r,e;if(void 0===t)return nr;var i=null===(r=t.useLongBits)||void 0===r||r,n=null!==(e=t.useHex)&&void 0!==e&&e;return{encodeHrTime:i?tr:rr,encodeSpanContext:n?er:Yt,encodeOptionalSpanContext:n?er:ir}}({useHex:!0,useLongBits:!1}),{resourceLogs:ur(r,e)});return(new TextEncoder).encode(JSON.stringify(i))},deserializeResponse(t){if(0===t.length)return{};var r=new TextDecoder;return JSON.parse(r.decode(t))}};class vr{constructor(t){this.ke=void 0,this.ke=t}retry(t,r,e){return new Promise(((i,n)=>{setTimeout((()=>{this.ke.send(t,r).then(i,n)}),e)}))}send(t,e){var i=this;return r((function*(){for(var r=Date.now()+e,n=yield i.ke.send(t,e),o=5,s=1e3;"retryable"===n.status&&o>0;){var u;o--;var a=Math.max(Math.min(s,5e3)+(.4*Math.random()-.2),0);s*=1.5;var c=null!==(u=n.retryInMillis)&&void 0!==u?u:a,l=r-Date.now();if(c>l)return n;n=yield i.retry(t,l,c)}return n}))()}shutdown(){return this.ke.shutdown()}}function dr(t){return new vr(t.transport)}function mr(t){return[429,502,503,504].includes(t)}function yr(t){if(null!=t){var r=Number.parseInt(t,10);if(Number.isInteger(r))return r>0?1e3*r:-1;var e=new Date(t).getTime()-Date.now();return 0>e?0:e}}class br{constructor(t){this.Fe=void 0,this.Fe=t}send(t,e){var i=this;return r((function*(){var r=yield i.Fe.headers();return yield new Promise((n=>{var o=new XMLHttpRequest;o.timeout=e,o.open("POST",i.Fe.url),Object.entries(r).forEach((t=>{var[r,e]=t;o.setRequestHeader(r,e)})),o.ontimeout=t=>{n({status:"failure",error:new Error("XHR request timed out")})},o.onreadystatechange=()=>{200>o.status||o.status>299?o.status&&mr(o.status)?n({status:"retryable",retryInMillis:yr(o.getResponseHeader("Retry-After"))}):0!==o.status&&n({status:"failure",error:new Error("XHR request failed with non-retryable status")}):(at.debug("XHR success"),n({status:"success"}))},o.onabort=()=>{n({status:"failure",error:new Error("XHR request aborted")})},o.onerror=()=>{n({status:"failure",error:new Error("XHR request errored")})},o.send(t)}))}))()}shutdown(){}}class gr{constructor(t){this.Le=void 0,this.Le=t}send(t){var e=this;return r((function*(){var r=(yield e.Le.headers())["Content-Type"];return new Promise((i=>{navigator.sendBeacon(e.Le.url,new Blob([t],{type:r}))?(at.debug("SendBeacon success"),i({status:"success"})):i({status:"failure",error:new Error("SendBeacon failed")})}))}))()}shutdown(){}}class pr{constructor(t){this.Fe=void 0,this.Fe=t}send(t,e){var i=this;return r((function*(){var r=new AbortController,n=setTimeout((()=>r.abort()),e);try{var o,s=!!globalThis.location,u=new URL(i.Fe.url),a=yield fetch(u.href,{method:"POST",headers:yield i.Fe.headers(),body:t,signal:r.signal,keepalive:s,mode:s?(null==(o=globalThis.location)?void 0:o.origin)===u.origin?"same-origin":"cors":"no-cors"});return 200>a.status||a.status>299?mr(a.status)?{status:"retryable",retryInMillis:yr(a.headers.get("Retry-After"))}:{status:"failure",error:new Error("Fetch request failed with non-retryable status")}:(at.debug("response success"),{status:"success"})}catch(t){return"AbortError"===(null==t?void 0:t.name)?{status:"failure",error:new Error("Fetch request timed out",{cause:t})}:{status:"failure",error:new Error("Fetch request errored",{cause:t})}}finally{clearTimeout(n)}}))()}shutdown(){}}function wr(t,r){return $t(t,r,dr({transport:(e=t,new br(e))}));var e}function Sr(t,r){return $t(t,r,dr({transport:(e=t,new pr(e))}));var e}function jr(t,r){return $t(t,r,dr({transport:(e={url:t.url,headers:t.headers},new gr(e))}));var e}function Lr(t){if(null!=t)try{var r,e=null==(r=globalThis.location)?void 0:r.href;return new URL(t,e).href}catch(r){throw new Error("Configuration: Could not parse user-provided export URL: '"+t+"'")}}function Or(t){return"function"==typeof t.headers?t.headers:function(t){if(null!=t)return r((function*(){return t}))}(t.headers)}function Tr(t,i,n){return o={url:t.url,timeoutMillis:t.timeoutMillis,headers:Or(t),concurrencyLimit:t.concurrencyLimit},s={},u=function(t,i){return e({},{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"},{headers:(n=r((function*(){return t})),function(){return n.apply(this,arguments)}),url:"http://localhost:4318/"+i});var n}(n,i),e({},function(t,r,e){var i,n,o,s,u,a;return{timeoutMillis:m(null!==(i=null!==(n=t.timeoutMillis)&&void 0!==n?n:r.timeoutMillis)&&void 0!==i?i:e.timeoutMillis),concurrencyLimit:null!==(o=null!==(s=t.concurrencyLimit)&&void 0!==s?s:r.concurrencyLimit)&&void 0!==o?o:e.concurrencyLimit,compression:null!==(u=null!==(a=t.compression)&&void 0!==a?a:r.compression)&&void 0!==u?u:e.compression}}(o,s,u),{headers:(l=o.headers,h=s.headers,f=u.headers,r((function*(){var t=e({},yield f()),r={};return null!=h&&Object.assign(r,yield h()),null!=l&&Object.assign(r,function(t){var r={};return Object.entries(null!=t?t:{}).forEach((t=>{var[e,i]=t;void 0!==i?r[e]=String(i):at.warn('Header "'+e+'" has invalid value ('+i+") and will be ignored")})),r}(yield l())),Object.assign(r,t)}))),url:null!==(a=null!==(c=Lr(o.url))&&void 0!==c?c:s.url)&&void 0!==a?a:u.url});var o,s,u,a,c,l,h,f}function xr(t,r,e,i){return(t.headers||"function"!=typeof navigator.sendBeacon?void 0!==globalThis.fetch?Sr:wr:jr)(Tr(t,e,i),r)}class Er extends v{constructor(t){void 0===t&&(t={}),super(xr(t,fr,"v1/logs",{"Content-Type":"application/json"}))}}class Ar{set severityText(t){this.Be()||(this.Ze=t)}get severityText(){return this.Ze}set severityNumber(t){this.Be()||(this.De=t)}get severityNumber(){return this.De}set body(t){this.Be()||(this.Pe=t)}get body(){return this.Pe}get eventName(){return this.Ve}set eventName(t){this.Be()||(this.Ve=t)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(t,r,e){this.hrTime=void 0,this.hrTimeObserved=void 0,this.spanContext=void 0,this.resource=void 0,this.instrumentationScope=void 0,this.attributes={},this.Ze=void 0,this.De=void 0,this.Pe=void 0,this.Ve=void 0,this.totalAttributesCount=0,this.qe=!1,this.je=void 0;var{timestamp:i,observedTimestamp:n,eventName:o,severityNumber:s,severityText:u,body:a,attributes:c={},context:l}=e,h=Date.now();if(this.hrTime=Tt(null!=i?i:h),this.hrTimeObserved=Tt(null!=n?n:h),l){var f=lt.getSpanContext(l);f&&Z(f)&&(this.spanContext=f)}this.severityNumber=s,this.severityText=u,this.body=a,this.resource=t.resource,this.instrumentationScope=r,this.je=t.logRecordLimits,this.Ve=o,this.setAttributes(c)}setAttribute(t,r){return this.Be()||null===r?this:0===t.length?(at.warn("Invalid attribute key: "+t),this):ft(r)||"object"==typeof r&&!Array.isArray(r)&&Object.keys(r).length>0?(this.totalAttributesCount+=1,Object.keys(this.attributes).length<this.je.attributeCountLimit||{}.hasOwnProperty.call(this.attributes,t)?(this.attributes[t]=ft(r)?this.He(r):r,this):(1===this.droppedAttributesCount&&at.warn("Dropping extra attributes."),this)):(at.warn("Invalid attribute value set for key: "+t),this)}setAttributes(t){for(var[r,e]of Object.entries(t))this.setAttribute(r,e);return this}setBody(t){return this.body=t,this}setEventName(t){return this.eventName=t,this}setSeverityNumber(t){return this.severityNumber=t,this}setSeverityText(t){return this.severityText=t,this}Ye(){this.qe=!0}He(t){var r=this.je.attributeValueLengthLimit;return r>0?"string"==typeof t?this.Ge(t,r):Array.isArray(t)?t.map((t=>"string"==typeof t?this.Ge(t,r):t)):t:(at.warn("Attribute value limit must be positive, got "+r),t)}Ge(t,r){return t.length>r?t.substring(0,r):t}Be(){return this.qe&&at.warn("Can not execute the operation on emitted log record"),this.qe}}class Rr{constructor(t,r){this.instrumentationScope=void 0,this.We=void 0,this.instrumentationScope=t,this.We=r}emit(t){var r=t.context||ut.active(),i=new Ar(this.We,this.instrumentationScope,e({context:r},t));this.We.activeProcessor.onEmit(i,r),i.Ye()}}class Pr{forceFlush(){return Promise.resolve()}onEmit(t,r){}shutdown(){return Promise.resolve()}}class Nr{constructor(t,r){this.processors=void 0,this.forceFlushTimeoutMillis=void 0,this.processors=t,this.forceFlushTimeoutMillis=r}forceFlush(){var t=this;return r((function*(){var r=t.forceFlushTimeoutMillis;yield Promise.all(t.processors.map((t=>Xt(t.forceFlush(),r))))}))()}onEmit(t,r){this.processors.forEach((e=>e.onEmit(t,r)))}shutdown(){var t=this;return r((function*(){yield Promise.all(t.processors.map((t=>t.shutdown())))}))()}}class Cr{constructor(t,r,e,i){this.resource=void 0,this.forceFlushTimeoutMillis=void 0,this.logRecordLimits=void 0,this.processors=void 0,this.loggers=new Map,this.activeProcessor=void 0,this.registeredLogRecordProcessors=[],this.resource=t,this.forceFlushTimeoutMillis=r,this.logRecordLimits=e,this.processors=i,i.length>0?(this.registeredLogRecordProcessors=i,this.activeProcessor=new Nr(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Pr}}class Ir{constructor(t){var r,e,i;void 0===t&&(t={}),this.Ue=void 0,this.We=void 0;var n,o,s,u,a,c,l,h=function(){for(var t=arguments.length,r=new Array(t),e=0;t>e;e++)r[e]=arguments[e];for(var i=r.shift(),n=new WeakMap;r.length>0;)i=Dt(i,r.shift(),0,n);return i}({},{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},includeTraceContext:!0},t),f=null!==(r=t.resource)&&void 0!==r?r:lr({"service.name":"unknown_service",[bt]:wt[bt],[gt]:wt[gt],[pt]:wt[pt]});this.We=new Cr(f,h.forceFlushTimeoutMillis,{attributeCountLimit:null!==(o=null!==(s=null!==(u=(n=h.logRecordLimits).attributeCountLimit)&&void 0!==u?u:void 0)&&void 0!==s?s:void 0)&&void 0!==o?o:128,attributeValueLengthLimit:null!==(a=null!==(c=null!==(l=n.attributeValueLengthLimit)&&void 0!==l?l:void 0)&&void 0!==c?c:void 0)&&void 0!==a?a:1/0},null!==(e=null==(i=t)?void 0:i.processors)&&void 0!==e?e:[]),this.Ue=new Jt(this.ze,this)}getLogger(t,r,e){if(this.Ue.isCalled)return at.warn("A shutdown LoggerProvider cannot provide a Logger"),n;t||at.warn("Logger requested without instrumentation scope name.");var i=t||"unknown",o=i+"@"+(r||"")+":"+((null==e?void 0:e.schemaUrl)||"");return this.We.loggers.has(o)||this.We.loggers.set(o,new Rr({name:i,version:r,schemaUrl:null==e?void 0:e.schemaUrl},this.We)),this.We.loggers.get(o)}forceFlush(){return this.Ue.isCalled?(at.warn("invalid attempt to force flush after LoggerProvider shutdown"),this.Ue.promise):this.We.activeProcessor.forceFlush()}shutdown(){return this.Ue.isCalled?(at.warn("shutdown may only be called once per LoggerProvider"),this.Ue.promise):this.Ue.call()}ze(){return this.We.activeProcessor.shutdown()}}class Mr{constructor(t,r){var e,i,n,o,s,u,a,c;this.Xe=void 0,this.Ke=void 0,this.Je=void 0,this.Qe=void 0,this.$e=void 0,this.et=!1,this.tt=[],this.rt=void 0,this.Ue=void 0,this.Xe=t,this.Ke=null!==(e=null!==(i=null==r?void 0:r.maxExportBatchSize)&&void 0!==i?i:void 0)&&void 0!==e?e:512,this.Je=null!==(n=null!==(o=null==r?void 0:r.maxQueueSize)&&void 0!==o?o:void 0)&&void 0!==n?n:2048,this.Qe=null!==(s=null!==(u=null==r?void 0:r.scheduledDelayMillis)&&void 0!==u?u:void 0)&&void 0!==s?s:5e3,this.$e=null!==(a=null!==(c=null==r?void 0:r.exportTimeoutMillis)&&void 0!==c?c:void 0)&&void 0!==a?a:3e4,this.Ue=new Jt(this.ze,this),this.Ke>this.Je&&(at.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this.Ke=this.Je)}onEmit(t){this.Ue.isCalled||this.nt(t)}forceFlush(){return this.Ue.isCalled?this.Ue.promise:this.it()}shutdown(){return this.Ue.call()}ze(){var t=this;return r((function*(){t.onShutdown(),yield t.it(),yield t.Xe.shutdown()}))()}nt(t){this.Je>this.tt.length&&(this.tt.push(t),this.ot())}it(){return new Promise(((t,r)=>{for(var e=[],i=Math.ceil(this.tt.length/this.Ke),n=0;i>n;n++)e.push(this.st());Promise.all(e).then((()=>{t()})).catch(r)}))}st(){return this.ut(),0===this.tt.length?Promise.resolve():new Promise(((t,r)=>{Xt(this.Se(this.tt.splice(0,this.Ke)),this.$e).then((()=>t())).catch(r)}))}ot(){if(!this.et){var t=()=>{this.et=!0,this.st().then((()=>{this.et=!1,this.tt.length>0&&(this.ut(),this.ot())})).catch((t=>{this.et=!1,dt(t)}))};if(this.tt.length>=this.Ke)return t();void 0===this.rt&&(this.rt=setTimeout((()=>t()),this.Qe),"number"!=typeof this.rt&&this.rt.unref())}}ut(){void 0!==this.rt&&(clearTimeout(this.rt),this.rt=void 0)}Se(t){var r=()=>Wt.Se(this.Xe,t).then((t=>{var r;t.code!==mt.SUCCESS&&dt(null!==(r=t.error)&&void 0!==r?r:new Error("BatchLogRecordProcessor: log record export failed (status "+t+")"))})).catch(dt),e=t.map((t=>t.resource)).filter((t=>t.asyncAttributesPending));return 0===e.length?r():Promise.all(e.map((t=>null==t.waitForAsyncAttributes?void 0:t.waitForAsyncAttributes()))).then(r,dt)}}class Ur extends Mr{constructor(t,r){super(t,r),this.ct=void 0,this.dt=void 0,this.ht(r)}onShutdown(){"undefined"!=typeof document&&(this.ct&&document.removeEventListener("visibilitychange",this.ct),this.dt&&document.removeEventListener("pagehide",this.dt))}ht(t){!0!==(null==t?void 0:t.disableAutoFlushOnDocumentHide)&&"undefined"!=typeof document&&(this.ct=()=>{"hidden"===document.visibilityState&&this.forceFlush()},this.dt=()=>{this.forceFlush()},document.addEventListener("visibilitychange",this.ct),document.addEventListener("pagehide",this.dt))}}var kr="undefined"!=typeof window?window:void 0,Br="undefined"!=typeof globalThis?globalThis:kr;"undefined"==typeof self&&(Br.self=Br),"undefined"==typeof File&&(Br.File=function(){}),null!=Br&&Br.XMLHttpRequest&&new Br.XMLHttpRequest;var Dr=null!=kr?kr:{},_r={}.toString,Fr=Array.isArray||function(t){return"[object Array]"===_r.call(t)},qr=t=>t===Object(t)&&!Fr(t),Hr=1e4,zr=function(t,r,e,i,n,o){if(void 0===r&&(r=""),void 0===e&&(e={}),void 0===i&&(i=50),void 0===n&&(n=Hr),void 0===o&&(o=new WeakSet),o.has(t))return e[r||"circular"]="[Circular]",e;for(var s in o.add(t),t)if({}.hasOwnProperty.call(t,s)){var u=t[s],a=r?r+"."+s:s;if(qr(u))zr(u,a,e,i,n,o);else{if(i-=1,n-=String(u).length,n-=a.length,0>=i||0>=n)return void(e.attributes_truncated=!0);e[a]=u}}return e},Vr={log:"INFO",warn:"WARNING",error:"ERROR",debug:"DEBUG",info:"INFO"};Dr.__PosthogExtensions__=Dr.__PosthogExtensions__||{},Dr.__PosthogExtensions__.logs={initializeLogs(t){(t=>{var r,i={"service.name":(null==(r=t.config.logs)?void 0:r.serviceName)||"posthog-browser-logs",host:Dr.location.host};if(t.sessionManager){var{sessionId:n,windowId:o}=t.sessionManager.checkAndGetSessionAndWindowId(!0);i=e({},i,{"session.id":n,"window.id":o})}f.setGlobalLoggerProvider(new Ir({resource:lr(i),processors:[new Ur(new Er({url:t.config.api_host+"/i/v1/logs?token="+t.config.token,headers:{"Content-Type":"text/plain"}}))]}))})(t);var r=f.getLogger("console"),i={};if(t.sessionManager){var{sessionStartTimestamp:n,lastActivityTimestamp:o}=t.sessionManager.checkAndGetSessionAndWindowId(!0);i={sessionStartTimestamp:n.toString(),lastActivityTimestamp:o.toString()}}var s=function(n){var o;Dr.console[n]=(o=Dr.console[n],function(){for(var s=arguments.length,u=new Array(s),a=0;s>a;a++)u[a]=arguments[a];if(u.length>0){var c=u.map((t=>{return JSON.stringify(t,(r=new WeakSet,(t,i)=>{if(i instanceof Error)return e({},i,{name:i.name,message:i.message,stack:i.stack});if("object"==typeof i&&null!==i){if(r.has(i))return"[Circular]";r.add(i)}return i}));var r})).join(" ");c.length>Hr&&(c=c.slice(0,Hr)+"...",i.body_truncated="true"),r.emit({severityText:Vr[n],body:c,attributes:e({"log.source":"console."+n,distinct_id:t.get_distinct_id(),"location.href":Dr.location.href},i,qr(u[0])?zr(u[0]):{})}),o.apply(Dr.console,u)}})};for(var u of["debug","log","warn","error","info"])s(u)}}}();
1
+ !function(){"use strict";function t(t,r,e,i,n,o,s){try{var u=t[o](s),a=u.value}catch(t){return void e(t)}u.done?r(a):Promise.resolve(a).then(i,n)}function r(r){return function(){var e=this,i=arguments;return new Promise((function(n,o){var s=r.apply(e,i);function u(r){t(s,n,o,u,a,"next",r)}function a(r){t(s,n,o,u,a,"throw",r)}u(void 0)}))}}function e(){return e=Object.assign?Object.assign.bind():function(t){for(var r=1;arguments.length>r;r++){var e=arguments[r];for(var i in e)({}).hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},e.apply(null,arguments)}class i{emit(t){}}var n=new i,o=new class{getLogger(t,r,e){return new i}};class s{constructor(t,r,e,i){this.te=t,this.name=r,this.version=e,this.options=i}emit(t){this.re().emit(t)}re(){if(this.ne)return this.ne;var t=this.te.ie(this.name,this.version,this.options);return t?(this.ne=t,this.ne):n}}class u{getLogger(t,r,e){var i;return null!==(i=this.ie(t,r,e))&&void 0!==i?i:new s(this,t,r,e)}oe(){var t;return null!==(t=this.ne)&&void 0!==t?t:o}ae(t){this.ne=t}ie(t,r,e){var i;return null===(i=this.ne)||void 0===i?void 0:i.getLogger(t,r,e)}}var a="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},c=Symbol.for("io.opentelemetry.js.api.logs"),l=a;class h{constructor(){this.se=new u}static getInstance(){return this._instance||(this._instance=new h),this._instance}setGlobalLoggerProvider(t){return l[c]?this.getLoggerProvider():(l[c]=(1,r=t,e=o,t=>1===t?r:e),this.se.ae(t),t);var r,e}getLoggerProvider(){var t,r;return null!==(r=null===(t=l[c])||void 0===t?void 0:t.call(l,1))&&void 0!==r?r:this.se}getLogger(t,r,e){return this.getLoggerProvider().getLogger(t,r,e)}disable(){delete l[c],this.se=new u}}var f=h.getInstance();class v{constructor(t){this.ne=void 0,this.ne=t}export(t,r){this.ne.export(t,r)}forceFlush(){return this.ne.forceFlush()}shutdown(){return this.ne.shutdown()}}class d extends Error{constructor(t,r,e){super(t),this.code=void 0,this.name="OTLPExporterError",this.data=void 0,this.data=e,this.code=r}}function m(t){if(Number.isFinite(t)&&t>0)return t;throw new Error("Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '"+t+"')")}class y{constructor(t){this.ue=void 0,this.le=[],this.ue=t}pushPromise(t){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this.le.push(t);var r=()=>{var r=this.le.indexOf(t);this.le.splice(r,1)};t.then(r,r)}hasReachedLimit(){return this.le.length>=this.ue}awaitAll(){var t=this;return r((function*(){yield Promise.all(t.le)}))()}}function b(t){return new y(t.concurrencyLimit)}var g="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},p="1.9.0",w=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,S=function(t){var r=new Set([t]),e=new Set,i=t.match(w);if(!i)return function(){return!1};var n=+i[1],o=+i[2],s=+i[3];if(null!=i[4])return function(r){return r===t};function u(t){return e.add(t),!1}function a(t){return r.add(t),!0}return function(t){if(r.has(t))return!0;if(e.has(t))return!1;var i=t.match(w);if(!i)return u(t);var c=+i[2],l=+i[3];return null!=i[4]||n!==+i[1]?u(t):0===n?o!==c||s>l?u(t):a(t):o>c?u(t):a(t)}}(p),j=p.split(".")[0],L=Symbol.for("opentelemetry.js.api."+j),O=g;function T(t,r,e,i){var n;void 0===i&&(i=!1);var o=O[L]=null!==(n=O[L])&&void 0!==n?n:{version:p};if(!i&&o[t]){var s=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return e.error(s.stack||s.message),!1}return o.version!==p?(s=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+t+" does not match previously registered API v"+p),e.error(s.stack||s.message),!1):(o[t]=r,e.debug("@opentelemetry/api: Registered a global for "+t+" v"+p+"."),!0)}function x(t){var r,e,i=null===(r=O[L])||void 0===r?void 0:r.version;if(i&&S(i))return null===(e=O[L])||void 0===e?void 0:e[t]}function E(t,r){r.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+p+".");var e=O[L];e&&delete e[t]}var A,R=function(){function t(t){this.ce=t.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var t=[],r=0;arguments.length>r;r++)t[r]=arguments[r];return P("debug",this.ce,t)},t.prototype.error=function(){for(var t=[],r=0;arguments.length>r;r++)t[r]=arguments[r];return P("error",this.ce,t)},t.prototype.info=function(){for(var t=[],r=0;arguments.length>r;r++)t[r]=arguments[r];return P("info",this.ce,t)},t.prototype.warn=function(){for(var t=[],r=0;arguments.length>r;r++)t[r]=arguments[r];return P("warn",this.ce,t)},t.prototype.verbose=function(){for(var t=[],r=0;arguments.length>r;r++)t[r]=arguments[r];return P("verbose",this.ce,t)},t}();function P(t,r,e){var i=x("diag");if(i)return e.unshift(r),i[t].apply(i,function(t,r,e){if(e||2===arguments.length)for(var i,n=0,o=r.length;o>n;n++)!i&&n in r||(i||(i=[].slice.call(r,0,n)),i[n]=r[n]);return t.concat(i||[].slice.call(r))}([],function(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var i,n,o=e.call(t),s=[];try{for(;(void 0===r||r-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(n)throw n.error}}return s}(e),!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"}(A||(A={}));var N=function(){function t(){function t(t){return function(){for(var r=[],e=0;arguments.length>e;e++)r[e]=arguments[e];var i=x("diag");if(i)return i[t].apply(i,function(t,r,e){if(e||2===arguments.length)for(var i,n=0,o=r.length;o>n;n++)!i&&n in r||(i||(i=[].slice.call(r,0,n)),i[n]=r[n]);return t.concat(i||[].slice.call(r))}([],function(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var i,n,o=e.call(t),s=[];try{for(;(void 0===r||r-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(n)throw n.error}}return s}(r),!1))}}var r=this;r.setLogger=function(t,e){var i,n,o;if(void 0===e&&(e={logLevel:A.INFO}),t===r){var s=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error(null!==(i=s.stack)&&void 0!==i?i:s.message),!1}"number"==typeof e&&(e={logLevel:e});var u=x("diag"),a=function(t,r){function e(e,i){var n=r[e];return"function"!=typeof n||i>t?function(){}:n.bind(r)}return A.NONE>t?t=A.NONE:t>A.ALL&&(t=A.ALL),r=r||{},{error:e("error",A.ERROR),warn:e("warn",A.WARN),info:e("info",A.INFO),debug:e("debug",A.DEBUG),verbose:e("verbose",A.VERBOSE)}}(null!==(n=e.logLevel)&&void 0!==n?n:A.INFO,t);if(u&&!e.suppressOverrideMessage){var c=null!==(o=(new Error).stack)&&void 0!==o?o:"<failed to generate stacktrace>";u.warn("Current logger will be overwritten from "+c),a.warn("Current logger will overwrite one already registered from "+c)}return T("diag",a,r,!0)},r.disable=function(){E("diag",r)},r.createComponentLogger=function(t){return new R(t)},r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t}();function C(t){return Symbol.for(t)}var I,M=new function t(r){var e=this;e.de=r?new Map(r):new Map,e.getValue=function(t){return e.de.get(t)},e.setValue=function(r,i){var n=new t(e.de);return n.de.set(r,i),n},e.deleteValue=function(r){var i=new t(e.de);return i.de.delete(r),i}},U=function(){function t(){}return t.prototype.active=function(){return M},t.prototype.with=function(t,r,e){for(var i=[],n=3;arguments.length>n;n++)i[n-3]=arguments[n];return r.call.apply(r,function(t,r,e){if(e||2===arguments.length)for(var i,n=0,o=r.length;o>n;n++)!i&&n in r||(i||(i=[].slice.call(r,0,n)),i[n]=r[n]);return t.concat(i||[].slice.call(r))}([e],function(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var i,n,o=e.call(t),s=[];try{for(;(void 0===r||r-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(n)throw n.error}}return s}(i),!1))},t.prototype.bind=function(t,r){return r},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t}(),k="context",B=new U,D=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(t){return T(k,t,N.instance())},t.prototype.active=function(){return this.he().active()},t.prototype.with=function(t,r,e){for(var i,n=[],o=3;arguments.length>o;o++)n[o-3]=arguments[o];return(i=this.he()).with.apply(i,function(t,r,e){if(e||2===arguments.length)for(var i,n=0,o=r.length;o>n;n++)!i&&n in r||(i||(i=[].slice.call(r,0,n)),i[n]=r[n]);return t.concat(i||[].slice.call(r))}([t,r,e],function(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var i,n,o=e.call(t),s=[];try{for(;(void 0===r||r-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(n)throw n.error}}return s}(n),!1))},t.prototype.bind=function(t,r){return this.he().bind(t,r)},t.prototype.he=function(){return x(k)||B},t.prototype.disable=function(){this.he().disable(),E(k,N.instance())},t}();!function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"}(I||(I={}));var _="0000000000000000",F="00000000000000000000000000000000",q={traceId:F,spanId:_,traceFlags:I.NONE},H=function(){function t(t){void 0===t&&(t=q),this.ve=t}return t.prototype.spanContext=function(){return this.ve},t.prototype.setAttribute=function(t,r){return this},t.prototype.setAttributes=function(t){return this},t.prototype.addEvent=function(t,r){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,r){},t}(),z=C("OpenTelemetry Context Key SPAN");function V(t){return t.getValue(z)||void 0}function X(){return V(D.getInstance().active())}function G(t,r){return t.setValue(z,r)}function J(t){return t.deleteValue(z)}function W(t,r){return G(t,new H(r))}function K(t){var r;return null===(r=V(t))||void 0===r?void 0:r.spanContext()}var Q=/^([0-9a-f]{32})$/i,Y=/^[0-9a-f]{16}$/i;function Z(t){return Q.test(e=t.traceId)&&e!==F&&Y.test(r=t.spanId)&&r!==_;var r,e}function tt(t){return new H(t)}var rt=D.getInstance(),et=function(){function t(){}return t.prototype.startSpan=function(t,r,e){if(void 0===e&&(e=rt.active()),Boolean(null==r?void 0:r.root))return new H;var i,n=e&&K(e);return"object"==typeof(i=n)&&"string"==typeof i.spanId&&"string"==typeof i.traceId&&"number"==typeof i.traceFlags&&Z(n)?new H(n):new H},t.prototype.startActiveSpan=function(t,r,e,i){var n,o,s;if(arguments.length>=2){2===arguments.length?s=r:3===arguments.length?(n=r,s=e):(n=r,o=e,s=i);var u=null!=o?o:rt.active(),a=this.startSpan(t,n,u),c=G(u,a);return rt.with(c,s,void 0,a)}},t}(),it=new et,nt=function(){function t(t,r,e,i){this.te=t,this.name=r,this.version=e,this.options=i}return t.prototype.startSpan=function(t,r,e){return this.fe().startSpan(t,r,e)},t.prototype.startActiveSpan=function(t,r,e,i){var n=this.fe();return Reflect.apply(n.startActiveSpan,n,arguments)},t.prototype.fe=function(){if(this.ne)return this.ne;var t=this.te.getDelegateTracer(this.name,this.version,this.options);return t?(this.ne=t,this.ne):it},t}(),ot=new(function(){function t(){}return t.prototype.getTracer=function(t,r,e){return new et},t}()),st=function(){function t(){}return t.prototype.getTracer=function(t,r,e){var i;return null!==(i=this.getDelegateTracer(t,r,e))&&void 0!==i?i:new nt(this,t,r,e)},t.prototype.getDelegate=function(){var t;return null!==(t=this.ne)&&void 0!==t?t:ot},t.prototype.setDelegate=function(t){this.ne=t},t.prototype.getDelegateTracer=function(t,r,e){var i;return null===(i=this.ne)||void 0===i?void 0:i.getTracer(t,r,e)},t}(),ut=D.getInstance(),at=N.instance(),ct="trace",lt=function(){function t(){this.pe=new st,this.wrapSpanContext=tt,this.isSpanContextValid=Z,this.deleteSpan=J,this.getSpan=V,this.getActiveSpan=X,this.getSpanContext=K,this.setSpan=G,this.setSpanContext=W}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(t){var r=T(ct,this.pe,N.instance());return r&&this.pe.setDelegate(t),r},t.prototype.getTracerProvider=function(){return x(ct)||this.pe},t.prototype.getTracer=function(t,r){return this.getTracerProvider().getTracer(t,r)},t.prototype.disable=function(){E(ct,N.instance()),this.pe=new st},t}().getInstance(),ht=C("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function ft(t){return null==t||(Array.isArray(t)?function(t){var r;for(var e of t)if(null!=e){var i=typeof e;if(i!==r){if(!r){if(vt(i)){r=i;continue}return!1}return!1}}return!0}(t):vt(typeof t))}function vt(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}function dt(t){try{(t=>{at.error(function(t){return"string"==typeof t?t:JSON.stringify(function(t){for(var r={},e=t;null!==e;)Object.getOwnPropertyNames(e).forEach((t=>{if(!r[t]){var i=e[t];i&&(r[t]=String(i))}})),e=Object.getPrototypeOf(e);return r}(t))}(t))})(t)}catch(t){}}var mt,yt=performance,bt="telemetry.sdk.language",gt="telemetry.sdk.name",pt="telemetry.sdk.version",wt={[gt]:"opentelemetry","process.runtime.name":"browser",[bt]:"webjs",[pt]:"2.2.0"},St=Math.pow(10,6),jt=Math.pow(10,9);function Lt(t){return[Math.trunc(t/1e3),Math.round(t%1e3*St)]}function Ot(){var t=yt.timeOrigin;return"number"!=typeof t&&(t=yt.timing&&yt.timing.fetchStart),t}function Tt(t){if(o=t,Array.isArray(o)&&2===o.length&&"number"==typeof o[0]&&"number"==typeof o[1])return t;if("number"==typeof t)return t<Ot()?(r=t,e=Lt(Ot()),i=Lt("number"==typeof r?r:yt.now()),jt>(n=[e[0]+i[0],e[1]+i[1]])[1]||(n[1]-=jt,n[0]+=1),n):Lt(t);var r,e,i,n,o;if(t instanceof Date)return Lt(t.getTime());throw TypeError("Invalid input type")}!function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"}(mt||(mt={}));var xt="[object Object]",Et="[object Null]",At="[object Undefined]",Rt=function(){}.toString,Pt=Rt.call(Object),Nt=Object.getPrototypeOf,Ct=Object.prototype,It=Ct.hasOwnProperty,Mt=Symbol?Symbol.toStringTag:void 0,Ut=Ct.toString;function kt(t){if(!function(t){return null!=t&&"object"==typeof t}(t)||function(t){return null==t?void 0===t?At:Et:Mt&&Mt in Object(t)?function(t){var r=It.call(t,Mt),e=t[Mt],i=!1;try{t[Mt]=void 0,i=!0}catch(t){}var n=Ut.call(t);return i&&(r?t[Mt]=e:delete t[Mt]),n}(t):function(t){return Ut.call(t)}(t)}(t)!==xt)return!1;var r=Nt(t);if(null===r)return!0;var e=It.call(r,"constructor")&&r.constructor;return"function"==typeof e&&e instanceof e&&Rt.call(e)===Pt}function Bt(t){return Ft(t)?t.slice():t}function Dt(t,r,e,i){var n;if(void 0===e&&(e=0),20>=e){if(e++,zt(t)||zt(r)||qt(r))n=Bt(r);else if(Ft(t)){if(n=t.slice(),Ft(r))for(var o=0,s=r.length;s>o;o++)n.push(Bt(r[o]));else if(Ht(r))for(var u=Object.keys(r),a=0,c=u.length;c>a;a++){var l=u[a];n[l]=Bt(r[l])}}else if(Ht(t))if(Ht(r)){if(!function(t,r){return!(!kt(t)||!kt(r))}(t,r))return r;n=Object.assign({},t);for(var h=Object.keys(r),f=0,v=h.length;v>f;f++){var d=h[f],m=r[d];if(zt(m))void 0===m?delete n[d]:n[d]=m;else{var y=n[d],b=m;if(_t(t,d,i)||_t(r,d,i))delete n[d];else{if(Ht(y)&&Ht(b)){var g=i.get(y)||[],p=i.get(b)||[];g.push({obj:t,key:d}),p.push({obj:r,key:d}),i.set(y,g),i.set(b,p)}n[d]=Dt(n[d],m,e,i)}}}}else n=r;return n}}function _t(t,r,e){for(var i=e.get(t[r])||[],n=0,o=i.length;o>n;n++){var s=i[n];if(s.key===r&&s.obj===t)return!0}return!1}function Ft(t){return Array.isArray(t)}function qt(t){return"function"==typeof t}function Ht(t){return!zt(t)&&!Ft(t)&&!qt(t)&&"object"==typeof t}function zt(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||void 0===t||t instanceof Date||t instanceof RegExp||null===t}class Vt extends Error{constructor(t){super(t),Object.setPrototypeOf(this,Vt.prototype)}}function Xt(t,r){var e,i=new Promise((function(t,i){e=setTimeout((function(){i(new Vt("Operation timed out."))}),r)}));return Promise.race([t,i]).then((t=>(clearTimeout(e),t)),(t=>{throw clearTimeout(e),t}))}class Gt{constructor(){this.me=void 0,this.ge=void 0,this.ye=void 0,this.me=new Promise(((t,r)=>{this.ge=t,this.ye=r}))}get promise(){return this.me}resolve(t){this.ge(t)}reject(t){this.ye(t)}}class Jt{constructor(t,r){this.be=void 0,this.we=void 0,this.Ce=!1,this.Ie=new Gt,this.be=t,this.we=r}get isCalled(){return this.Ce}get promise(){return this.Ie.promise}call(){if(!this.Ce){this.Ce=!0;try{for(var t=arguments.length,r=new Array(t),e=0;t>e;e++)r[e]=arguments[e];Promise.resolve(this.be.call(this.we,...r)).then((t=>this.Ie.resolve(t)),(t=>this.Ie.reject(t)))}catch(t){this.Ie.reject(t)}}return this.Ie.promise}}var Wt={Se:(t,r)=>new Promise((e=>{ut.with(function(t){return t.setValue(ht,!0)}(ut.active()),(()=>{t.export(r,(t=>{e(t)}))}))}))};class Kt{constructor(t,r,e,i,n){this.ke=void 0,this.xe=void 0,this.Ae=void 0,this.Te=void 0,this.Ne=void 0,this.Re=void 0,this.ke=t,this.xe=r,this.Ae=e,this.Te=i,this.Ne=n,this.Re=at.createComponentLogger({namespace:"OTLPExportDelegate"})}export(t,r){if(this.Re.debug("items to be sent",t),this.Te.hasReachedLimit())r({code:mt.FAILED,error:new Error("Concurrent export limit reached")});else{var e=this.xe.serializeRequest(t);null!=e?this.Te.pushPromise(this.ke.send(e,this.Ne).then((t=>{if("success"!==t.status)r("failure"===t.status&&t.error?{code:mt.FAILED,error:t.error}:"retryable"===t.status?{code:mt.FAILED,error:new d("Export failed with retryable status")}:{code:mt.FAILED,error:new d("Export failed with unknown error")});else{if(null!=t.data)try{this.Ae.handleResponse(this.xe.deserializeResponse(t.data))}catch(r){this.Re.warn("Export succeeded but could not deserialize response - is the response specification compliant?",r,t.data)}r({code:mt.SUCCESS})}}),(t=>r({code:mt.FAILED,error:t})))):r({code:mt.FAILED,error:new Error("Nothing to send")})}}forceFlush(){return this.Te.awaitAll()}shutdown(){var t=this;return r((function*(){t.Re.debug("shutdown started"),yield t.forceFlush(),t.ke.shutdown()}))()}}function $t(t,r,e){return i={transport:e,serializer:r,promiseHandler:b(t)},new Kt(i.transport,i.serializer,{handleResponse(t){null!=t&&function(t){return{}.hasOwnProperty.call(t,"partialSuccess")}(t)&&null!=t.partialSuccess&&0!==Object.keys(t.partialSuccess).length&&at.warn("Received Partial Success response:",JSON.stringify(t.partialSuccess))}},i.promiseHandler,{timeout:t.timeoutMillis}.timeout);var i}function Qt(t){return 48>t||t>57?97>t||t>102?t-55:t-87:t-48}function Yt(t){for(var r=new Uint8Array(t.length/2),e=0,i=0;t.length>i;i+=2){var n=Qt(t.charCodeAt(i)),o=Qt(t.charCodeAt(i+1));r[e++]=n<<4|o}return r}function Zt(t){var r=BigInt(1e9);return BigInt(Math.trunc(t[0]))*r+BigInt(Math.trunc(t[1]))}function tr(t){var r;return r=Zt(t),{low:Number(BigInt.asUintN(32,r)),high:Number(BigInt.asUintN(32,r>>BigInt(32)))}}var rr="undefined"!=typeof BigInt?function(t){return Zt(t).toString()}:function(t){return t[0]*jt+t[1]};function er(t){return t}function ir(t){if(void 0!==t)return Yt(t)}var nr={encodeHrTime:tr,encodeSpanContext:Yt,encodeOptionalSpanContext:ir};function or(t,r){return{key:t,value:sr(r)}}function sr(t){var 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(sr)}}:"object"===r&&null!=t?{kvlistValue:{values:Object.entries(t).map((t=>{var[r,e]=t;return or(r,e)}))}}:{}}function ur(t,r){var e=function(t){var r=new Map;for(var e of t){var{resource:i,instrumentationScope:{name:n,version:o="",schemaUrl:s=""}}=e,u=r.get(i);u||(u=new Map,r.set(i,u));var a=n+"@"+o+":"+s,c=u.get(a);c||u.set(a,c=[]),c.push(e)}return r}(t);return Array.from(e,(t=>{var[e,i]=t,n=function(t){var r,e={attributes:(r=t.attributes,Object.keys(r).map((t=>or(t,r[t])))),droppedAttributesCount:0},i=t.schemaUrl;return i&&""!==i&&(e.schemaUrl=i),e}(e);return{resource:n,scopeLogs:Array.from(i,(t=>{var e,[,i]=t;return{scope:(e=i[0].instrumentationScope,{name:e.name,version:e.version}),logRecords:i.map((t=>function(t,r){var e,i,n,o;return{timeUnixNano:r.encodeHrTime(t.hrTime),observedTimeUnixNano:r.encodeHrTime(t.hrTimeObserved),severityNumber:t.severityNumber,severityText:t.severityText,body:sr(t.body),eventName:t.eventName,attributes:(o=t.attributes,Object.keys(o).map((t=>or(t,o[t])))),droppedAttributesCount:t.droppedAttributesCount,flags:null==(e=t.spanContext)?void 0:e.traceFlags,traceId:r.encodeOptionalSpanContext(null==(i=t.spanContext)?void 0:i.traceId),spanId:r.encodeOptionalSpanContext(null==(n=t.spanContext)?void 0:n.spanId)}}(t,r))),schemaUrl:i[0].instrumentationScope.schemaUrl}})),schemaUrl:n.schemaUrl}}))}var ar=t=>null!==t&&"object"==typeof t&&"function"==typeof t.then;class cr{static FromAttributeList(t,r){var e=new cr({},r);return e.Me=hr(t),e._e=t.filter((t=>{var[r,e]=t;return ar(e)})).length>0,e}constructor(t,r){var e;this.Me=void 0,this._e=!1,this.Ee=void 0,this.Oe=void 0;var i=null!==(e=t.attributes)&&void 0!==e?e:{};this.Me=Object.entries(i).map((t=>{var[r,e]=t;return ar(e)&&(this._e=!0),[r,e]})),this.Me=hr(this.Me),this.Ee=function(t){if("string"==typeof t||void 0===t)return t;at.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}(null==r?void 0:r.schemaUrl)}get asyncAttributesPending(){return this._e}waitForAsyncAttributes(){var t=this;return r((function*(){if(t.asyncAttributesPending){for(var r=0;t.Me.length>r;r++){var[e,i]=t.Me[r];t.Me[r]=[e,ar(i)?yield i:i]}t._e=!1}}))()}get attributes(){if(this.asyncAttributesPending&&at.error("Accessing resource attributes before async attributes settled"),this.Oe)return this.Oe;var t={};for(var[r,e]of this.Me){var i;ar(e)?at.debug("Unsettled resource attribute "+r+" skipped"):null!=e&&(null!==(i=t[r])&&void 0!==i||(t[r]=e))}return this._e||(this.Oe=t),t}getRawAttributes(){return this.Me}get schemaUrl(){return this.Ee}merge(t){if(null==t)return this;var r,e,i,n,o=(n=null==(e=t)?void 0:e.schemaUrl,void 0===(i=null==(r=this)?void 0:r.schemaUrl)||""===i?n:void 0===n||""===n||i===n?i:void at.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',i,n)),s=o?{schemaUrl:o}:void 0;return cr.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],s)}}function lr(t,r){return cr.FromAttributeList(Object.entries(t),r)}function hr(t){return t.map((t=>{var[r,e]=t;return ar(e)?[r,e.catch((t=>{at.debug("promise rejection for resource attribute: %s - %s",r,t)}))]:[r,e]}))}var fr={serializeRequest(t){var r,e,i=(r=t,e=function(t){var r,e;if(void 0===t)return nr;var i=null===(r=t.useLongBits)||void 0===r||r,n=null!==(e=t.useHex)&&void 0!==e&&e;return{encodeHrTime:i?tr:rr,encodeSpanContext:n?er:Yt,encodeOptionalSpanContext:n?er:ir}}({useHex:!0,useLongBits:!1}),{resourceLogs:ur(r,e)});return(new TextEncoder).encode(JSON.stringify(i))},deserializeResponse(t){if(0===t.length)return{};var r=new TextDecoder;return JSON.parse(r.decode(t))}};class vr{constructor(t){this.ke=void 0,this.ke=t}retry(t,r,e){return new Promise(((i,n)=>{setTimeout((()=>{this.ke.send(t,r).then(i,n)}),e)}))}send(t,e){var i=this;return r((function*(){for(var r=Date.now()+e,n=yield i.ke.send(t,e),o=5,s=1e3;"retryable"===n.status&&o>0;){var u;o--;var a=Math.max(Math.min(s,5e3)+(.4*Math.random()-.2),0);s*=1.5;var c=null!==(u=n.retryInMillis)&&void 0!==u?u:a,l=r-Date.now();if(c>l)return n;n=yield i.retry(t,l,c)}return n}))()}shutdown(){return this.ke.shutdown()}}function dr(t){return new vr(t.transport)}function mr(t){return[429,502,503,504].includes(t)}function yr(t){if(null!=t){var r=Number.parseInt(t,10);if(Number.isInteger(r))return r>0?1e3*r:-1;var e=new Date(t).getTime()-Date.now();return 0>e?0:e}}class br{constructor(t){this.Fe=void 0,this.Fe=t}send(t,e){var i=this;return r((function*(){var r=yield i.Fe.headers();return yield new Promise((n=>{var o=new XMLHttpRequest;o.timeout=e,o.open("POST",i.Fe.url),Object.entries(r).forEach((t=>{var[r,e]=t;o.setRequestHeader(r,e)})),o.ontimeout=t=>{n({status:"failure",error:new Error("XHR request timed out")})},o.onreadystatechange=()=>{200>o.status||o.status>299?o.status&&mr(o.status)?n({status:"retryable",retryInMillis:yr(o.getResponseHeader("Retry-After"))}):0!==o.status&&n({status:"failure",error:new Error("XHR request failed with non-retryable status")}):(at.debug("XHR success"),n({status:"success"}))},o.onabort=()=>{n({status:"failure",error:new Error("XHR request aborted")})},o.onerror=()=>{n({status:"failure",error:new Error("XHR request errored")})},o.send(t)}))}))()}shutdown(){}}class gr{constructor(t){this.Le=void 0,this.Le=t}send(t){var e=this;return r((function*(){var r=(yield e.Le.headers())["Content-Type"];return new Promise((i=>{navigator.sendBeacon(e.Le.url,new Blob([t],{type:r}))?(at.debug("SendBeacon success"),i({status:"success"})):i({status:"failure",error:new Error("SendBeacon failed")})}))}))()}shutdown(){}}class pr{constructor(t){this.Fe=void 0,this.Fe=t}send(t,e){var i=this;return r((function*(){var r=new AbortController,n=setTimeout((()=>r.abort()),e);try{var o,s=!!globalThis.location,u=new URL(i.Fe.url),a=yield fetch(u.href,{method:"POST",headers:yield i.Fe.headers(),body:t,signal:r.signal,keepalive:s,mode:s?(null==(o=globalThis.location)?void 0:o.origin)===u.origin?"same-origin":"cors":"no-cors"});return 200>a.status||a.status>299?mr(a.status)?{status:"retryable",retryInMillis:yr(a.headers.get("Retry-After"))}:{status:"failure",error:new Error("Fetch request failed with non-retryable status")}:(at.debug("response success"),{status:"success"})}catch(t){return"AbortError"===(null==t?void 0:t.name)?{status:"failure",error:new Error("Fetch request timed out",{cause:t})}:{status:"failure",error:new Error("Fetch request errored",{cause:t})}}finally{clearTimeout(n)}}))()}shutdown(){}}function wr(t,r){return $t(t,r,dr({transport:(e=t,new br(e))}));var e}function Sr(t,r){return $t(t,r,dr({transport:(e=t,new pr(e))}));var e}function jr(t,r){return $t(t,r,dr({transport:(e={url:t.url,headers:t.headers},new gr(e))}));var e}function Lr(t){if(null!=t)try{var r,e=null==(r=globalThis.location)?void 0:r.href;return new URL(t,e).href}catch(r){throw new Error("Configuration: Could not parse user-provided export URL: '"+t+"'")}}function Or(t){return"function"==typeof t.headers?t.headers:function(t){if(null!=t)return r((function*(){return t}))}(t.headers)}function Tr(t,i,n){return o={url:t.url,timeoutMillis:t.timeoutMillis,headers:Or(t),concurrencyLimit:t.concurrencyLimit},s={},u=function(t,i){return e({},{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"},{headers:(n=r((function*(){return t})),function(){return n.apply(this,arguments)}),url:"http://localhost:4318/"+i});var n}(n,i),e({},function(t,r,e){var i,n,o,s,u,a;return{timeoutMillis:m(null!==(i=null!==(n=t.timeoutMillis)&&void 0!==n?n:r.timeoutMillis)&&void 0!==i?i:e.timeoutMillis),concurrencyLimit:null!==(o=null!==(s=t.concurrencyLimit)&&void 0!==s?s:r.concurrencyLimit)&&void 0!==o?o:e.concurrencyLimit,compression:null!==(u=null!==(a=t.compression)&&void 0!==a?a:r.compression)&&void 0!==u?u:e.compression}}(o,s,u),{headers:(l=o.headers,h=s.headers,f=u.headers,r((function*(){var t=e({},yield f()),r={};return null!=h&&Object.assign(r,yield h()),null!=l&&Object.assign(r,function(t){var r={};return Object.entries(null!=t?t:{}).forEach((t=>{var[e,i]=t;void 0!==i?r[e]=String(i):at.warn('Header "'+e+'" has invalid value ('+i+") and will be ignored")})),r}(yield l())),Object.assign(r,t)}))),url:null!==(a=null!==(c=Lr(o.url))&&void 0!==c?c:s.url)&&void 0!==a?a:u.url});var o,s,u,a,c,l,h,f}function xr(t,r,e,i){return(t.headers||"function"!=typeof navigator.sendBeacon?void 0!==globalThis.fetch?Sr:wr:jr)(Tr(t,e,i),r)}class Er extends v{constructor(t){void 0===t&&(t={}),super(xr(t,fr,"v1/logs",{"Content-Type":"application/json"}))}}class Ar{set severityText(t){this.Be()||(this.Ze=t)}get severityText(){return this.Ze}set severityNumber(t){this.Be()||(this.De=t)}get severityNumber(){return this.De}set body(t){this.Be()||(this.Pe=t)}get body(){return this.Pe}get eventName(){return this.Ve}set eventName(t){this.Be()||(this.Ve=t)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(t,r,e){this.hrTime=void 0,this.hrTimeObserved=void 0,this.spanContext=void 0,this.resource=void 0,this.instrumentationScope=void 0,this.attributes={},this.Ze=void 0,this.De=void 0,this.Pe=void 0,this.Ve=void 0,this.totalAttributesCount=0,this.qe=!1,this.je=void 0;var{timestamp:i,observedTimestamp:n,eventName:o,severityNumber:s,severityText:u,body:a,attributes:c={},context:l}=e,h=Date.now();if(this.hrTime=Tt(null!=i?i:h),this.hrTimeObserved=Tt(null!=n?n:h),l){var f=lt.getSpanContext(l);f&&Z(f)&&(this.spanContext=f)}this.severityNumber=s,this.severityText=u,this.body=a,this.resource=t.resource,this.instrumentationScope=r,this.je=t.logRecordLimits,this.Ve=o,this.setAttributes(c)}setAttribute(t,r){return this.Be()||null===r?this:0===t.length?(at.warn("Invalid attribute key: "+t),this):ft(r)||"object"==typeof r&&!Array.isArray(r)&&Object.keys(r).length>0?(this.totalAttributesCount+=1,Object.keys(this.attributes).length<this.je.attributeCountLimit||{}.hasOwnProperty.call(this.attributes,t)?(this.attributes[t]=ft(r)?this.He(r):r,this):(1===this.droppedAttributesCount&&at.warn("Dropping extra attributes."),this)):(at.warn("Invalid attribute value set for key: "+t),this)}setAttributes(t){for(var[r,e]of Object.entries(t))this.setAttribute(r,e);return this}setBody(t){return this.body=t,this}setEventName(t){return this.eventName=t,this}setSeverityNumber(t){return this.severityNumber=t,this}setSeverityText(t){return this.severityText=t,this}Ye(){this.qe=!0}He(t){var r=this.je.attributeValueLengthLimit;return r>0?"string"==typeof t?this.Ge(t,r):Array.isArray(t)?t.map((t=>"string"==typeof t?this.Ge(t,r):t)):t:(at.warn("Attribute value limit must be positive, got "+r),t)}Ge(t,r){return t.length>r?t.substring(0,r):t}Be(){return this.qe&&at.warn("Can not execute the operation on emitted log record"),this.qe}}class Rr{constructor(t,r){this.instrumentationScope=void 0,this.We=void 0,this.instrumentationScope=t,this.We=r}emit(t){var r=t.context||ut.active(),i=new Ar(this.We,this.instrumentationScope,e({context:r},t));this.We.activeProcessor.onEmit(i,r),i.Ye()}}class Pr{forceFlush(){return Promise.resolve()}onEmit(t,r){}shutdown(){return Promise.resolve()}}class Nr{constructor(t,r){this.processors=void 0,this.forceFlushTimeoutMillis=void 0,this.processors=t,this.forceFlushTimeoutMillis=r}forceFlush(){var t=this;return r((function*(){var r=t.forceFlushTimeoutMillis;yield Promise.all(t.processors.map((t=>Xt(t.forceFlush(),r))))}))()}onEmit(t,r){this.processors.forEach((e=>e.onEmit(t,r)))}shutdown(){var t=this;return r((function*(){yield Promise.all(t.processors.map((t=>t.shutdown())))}))()}}class Cr{constructor(t,r,e,i){this.resource=void 0,this.forceFlushTimeoutMillis=void 0,this.logRecordLimits=void 0,this.processors=void 0,this.loggers=new Map,this.activeProcessor=void 0,this.registeredLogRecordProcessors=[],this.resource=t,this.forceFlushTimeoutMillis=r,this.logRecordLimits=e,this.processors=i,i.length>0?(this.registeredLogRecordProcessors=i,this.activeProcessor=new Nr(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Pr}}class Ir{constructor(t){var r,e,i;void 0===t&&(t={}),this.Ue=void 0,this.We=void 0;var n,o,s,u,a,c,l,h=function(){for(var t=arguments.length,r=new Array(t),e=0;t>e;e++)r[e]=arguments[e];for(var i=r.shift(),n=new WeakMap;r.length>0;)i=Dt(i,r.shift(),0,n);return i}({},{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},includeTraceContext:!0},t),f=null!==(r=t.resource)&&void 0!==r?r:lr({"service.name":"unknown_service",[bt]:wt[bt],[gt]:wt[gt],[pt]:wt[pt]});this.We=new Cr(f,h.forceFlushTimeoutMillis,{attributeCountLimit:null!==(o=null!==(s=null!==(u=(n=h.logRecordLimits).attributeCountLimit)&&void 0!==u?u:void 0)&&void 0!==s?s:void 0)&&void 0!==o?o:128,attributeValueLengthLimit:null!==(a=null!==(c=null!==(l=n.attributeValueLengthLimit)&&void 0!==l?l:void 0)&&void 0!==c?c:void 0)&&void 0!==a?a:1/0},null!==(e=null==(i=t)?void 0:i.processors)&&void 0!==e?e:[]),this.Ue=new Jt(this.ze,this)}getLogger(t,r,e){if(this.Ue.isCalled)return at.warn("A shutdown LoggerProvider cannot provide a Logger"),n;t||at.warn("Logger requested without instrumentation scope name.");var i=t||"unknown",o=i+"@"+(r||"")+":"+((null==e?void 0:e.schemaUrl)||"");return this.We.loggers.has(o)||this.We.loggers.set(o,new Rr({name:i,version:r,schemaUrl:null==e?void 0:e.schemaUrl},this.We)),this.We.loggers.get(o)}forceFlush(){return this.Ue.isCalled?(at.warn("invalid attempt to force flush after LoggerProvider shutdown"),this.Ue.promise):this.We.activeProcessor.forceFlush()}shutdown(){return this.Ue.isCalled?(at.warn("shutdown may only be called once per LoggerProvider"),this.Ue.promise):this.Ue.call()}ze(){return this.We.activeProcessor.shutdown()}}class Mr{constructor(t,r){var e,i,n,o,s,u,a,c;this.Xe=void 0,this.Ke=void 0,this.Je=void 0,this.Qe=void 0,this.$e=void 0,this.et=!1,this.tt=[],this.rt=void 0,this.Ue=void 0,this.Xe=t,this.Ke=null!==(e=null!==(i=null==r?void 0:r.maxExportBatchSize)&&void 0!==i?i:void 0)&&void 0!==e?e:512,this.Je=null!==(n=null!==(o=null==r?void 0:r.maxQueueSize)&&void 0!==o?o:void 0)&&void 0!==n?n:2048,this.Qe=null!==(s=null!==(u=null==r?void 0:r.scheduledDelayMillis)&&void 0!==u?u:void 0)&&void 0!==s?s:5e3,this.$e=null!==(a=null!==(c=null==r?void 0:r.exportTimeoutMillis)&&void 0!==c?c:void 0)&&void 0!==a?a:3e4,this.Ue=new Jt(this.ze,this),this.Ke>this.Je&&(at.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this.Ke=this.Je)}onEmit(t){this.Ue.isCalled||this.nt(t)}forceFlush(){return this.Ue.isCalled?this.Ue.promise:this.it()}shutdown(){return this.Ue.call()}ze(){var t=this;return r((function*(){t.onShutdown(),yield t.it(),yield t.Xe.shutdown()}))()}nt(t){this.Je>this.tt.length&&(this.tt.push(t),this.ot())}it(){return new Promise(((t,r)=>{for(var e=[],i=Math.ceil(this.tt.length/this.Ke),n=0;i>n;n++)e.push(this.st());Promise.all(e).then((()=>{t()})).catch(r)}))}st(){return this.ut(),0===this.tt.length?Promise.resolve():new Promise(((t,r)=>{Xt(this.Se(this.tt.splice(0,this.Ke)),this.$e).then((()=>t())).catch(r)}))}ot(){if(!this.et){var t=()=>{this.et=!0,this.st().then((()=>{this.et=!1,this.tt.length>0&&(this.ut(),this.ot())})).catch((t=>{this.et=!1,dt(t)}))};if(this.tt.length>=this.Ke)return t();void 0===this.rt&&(this.rt=setTimeout((()=>t()),this.Qe),"number"!=typeof this.rt&&this.rt.unref())}}ut(){void 0!==this.rt&&(clearTimeout(this.rt),this.rt=void 0)}Se(t){var r=()=>Wt.Se(this.Xe,t).then((t=>{var r;t.code!==mt.SUCCESS&&dt(null!==(r=t.error)&&void 0!==r?r:new Error("BatchLogRecordProcessor: log record export failed (status "+t+")"))})).catch(dt),e=t.map((t=>t.resource)).filter((t=>t.asyncAttributesPending));return 0===e.length?r():Promise.all(e.map((t=>null==t.waitForAsyncAttributes?void 0:t.waitForAsyncAttributes()))).then(r,dt)}}class Ur extends Mr{constructor(t,r){super(t,r),this.ct=void 0,this.dt=void 0,this.ht(r)}onShutdown(){"undefined"!=typeof document&&(this.ct&&document.removeEventListener("visibilitychange",this.ct),this.dt&&document.removeEventListener("pagehide",this.dt))}ht(t){!0!==(null==t?void 0:t.disableAutoFlushOnDocumentHide)&&"undefined"!=typeof document&&(this.ct=()=>{"hidden"===document.visibilityState&&this.forceFlush()},this.dt=()=>{this.forceFlush()},document.addEventListener("visibilitychange",this.ct),document.addEventListener("pagehide",this.dt))}}var kr="undefined"!=typeof window?window:void 0,Br="undefined"!=typeof globalThis?globalThis:kr;"undefined"==typeof self&&(Br.self=Br),"undefined"==typeof File&&(Br.File=function(){}),null!=Br&&Br.XMLHttpRequest&&new Br.XMLHttpRequest;var Dr=null!=kr?kr:{},_r={}.toString,Fr=Array.isArray||function(t){return"[object Array]"===_r.call(t)},qr=t=>t===Object(t)&&!Fr(t),Hr=1e4,zr=function(t,r,e,i,n,o){if(void 0===r&&(r=""),void 0===e&&(e={}),void 0===i&&(i=50),void 0===n&&(n=Hr),void 0===o&&(o=new WeakSet),o.has(t))return e[r||"circular"]="[Circular]",e;for(var s in o.add(t),t)if({}.hasOwnProperty.call(t,s)){var u=t[s],a=r?r+"."+s:s;if(qr(u))zr(u,a,e,i,n,o);else{if(i-=1,n-=String(u).length,n-=a.length,0>=i||0>=n)return void(e.attributes_truncated=!0);e[a]=u}}return e},Vr={log:"INFO",warn:"WARNING",error:"ERROR",debug:"DEBUG",info:"INFO"};Dr.__PosthogExtensions__=Dr.__PosthogExtensions__||{},Dr.__PosthogExtensions__.logs={initializeLogs(t){(t=>{var r,i={"service.name":(null==(r=t.config.logs)?void 0:r.serviceName)||"posthog-browser-logs",host:Dr.location.host};if(t.sessionManager){var{sessionId:n,windowId:o}=t.sessionManager.checkAndGetSessionAndWindowId(!0);i=e({},i,{"session.id":n,"window.id":o})}f.setGlobalLoggerProvider(new Ir({resource:lr(i),processors:[new Ur(new Er({url:t.config.api_host+"/i/v1/logs?token="+t.config.token,headers:{"Content-Type":"text/plain"}}))]}))})(t);var r=f.getLogger("console"),i={};if(t.sessionManager){var{sessionStartTimestamp:n,lastActivityTimestamp:o}=t.sessionManager.checkAndGetSessionAndWindowId(!0);i={sessionStartTimestamp:n.toString(),lastActivityTimestamp:o.toString()}}var s=function(n){var o;Dr.console[n]=(o=Dr.console[n],function(){for(var s=arguments.length,u=new Array(s),a=0;s>a;a++)u[a]=arguments[a];if(u.length>0){var c=u.map((t=>{return JSON.stringify(t,(r=new WeakSet,(t,i)=>{if(i instanceof Error)return e({},i,{name:i.name,message:i.message,stack:i.stack});if("object"==typeof i&&null!==i){if(r.has(i))return"[Circular]";r.add(i)}return i}));var r})).join(" ");c.length>Hr&&(c=c.slice(0,Hr)+"...",i.body_truncated="true"),r.emit({severityText:Vr[n],body:c,attributes:e({"log.source":"console."+n,distinct_id:t.get_distinct_id(),"location.href":Dr.location.href},i,qr(u[0])?zr(u[0]):{})}),o.apply(Dr.console,u)}})};for(var u of["debug","log","warn","error","info"])s(u)}}}();
2
2
  //# sourceMappingURL=logs.js.map