@blueking/open-telemetry 0.0.7 → 0.0.8
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/bk-rum.global.js +7 -7
- package/dist/bk-rum.global.js.map +1 -1
- package/dist/index.js +130 -153
- package/dist/index.js.map +1 -1
- package/dist/plugins/csp-violation.d.ts +1 -1
- package/package.json +1 -1
package/dist/bk-rum.global.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var BkOpenTelemetry=(function(){var e=Object.defineProperty,t=(e,t)=>()=>(e&&(t=e(e=0)),t),n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},r,i=t((()=>{r=`1.9.1`}));function a(e){let t=new Set([e]),n=new Set,r=e.match(o);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function s(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(o);if(!r)return a(e);let c={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return c.prerelease!=null||i.major!==c.major?a(e):i.major===0?i.minor===c.minor&&i.patch<=c.patch?s(e):a(e):i.minor<=c.minor?s(e):a(e)}}var o,s,c=t((()=>{i(),o=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,s=a(r)}));function l(e,t,n,i=!1){var a;let o=m[p]=(a=m[p])==null?{version:r}:a;if(!i&&o[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(o.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${o.version} for ${e} does not match previously registered API v${r}`);return n.error(t.stack||t.message),!1}return o[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${r}.`),!0}function u(e){var t,n;let r=(t=m[p])==null?void 0:t.version;if(!(!r||!s(r)))return(n=m[p])==null?void 0:n[e]}function d(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${r}.`);let n=m[p];n&&delete n[e]}var f,p,m,h=t((()=>{i(),c(),f=r.split(`.`)[0],p=Symbol.for(`opentelemetry.js.api.${f}`),m=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function g(e,t,n){let r=u(`diag`);if(r)return r[e](t,...n)}var _,v=t((()=>{h(),_=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return g(`debug`,this._namespace,e)}error(...e){return g(`error`,this._namespace,e)}info(...e){return g(`info`,this._namespace,e)}warn(...e){return g(`warn`,this._namespace,e)}verbose(...e){return g(`verbose`,this._namespace,e)}}})),y,b=t((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(y||(y={}))}));function x(e,t){e<y.NONE?e=y.NONE:e>y.ALL&&(e=y.ALL),t=t||{};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,y.ERROR),warn:n(`warn`,y.WARN),info:n(`info`,y.INFO),debug:n(`debug`,y.DEBUG),verbose:n(`verbose`,y.VERBOSE)}}var ee=t((()=>{b()})),te,S,ne=t((()=>{v(),ee(),b(),h(),te=`diag`,S=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function e(e){return function(...t){let n=u(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:y.INFO})=>{var r,i,a;if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error((r=e.stack)==null?e.message:r),!1}typeof n==`number`&&(n={logLevel:n});let o=u(`diag`),s=x((i=n.logLevel)==null?y.INFO:i,e);if(o&&!n.suppressOverrideMessage){let e=(a=Error().stack)==null?`<failed to generate stacktrace>`:a;o.warn(`Current logger will be overwritten from ${e}`),s.warn(`Current logger will overwrite one already registered from ${e}`)}return l(`diag`,s,t,!0)},t.disable=()=>{d(te,t)},t.createComponentLogger=e=>new _(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}})),C,re=t((()=>{C=class e{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,n){let r=new e(this._entries);return r._entries.set(t,n),r}removeEntry(t){let n=new e(this._entries);return n._entries.delete(t),n}removeEntries(...t){let n=new e(this._entries);for(let e of t)n._entries.delete(e);return n}clear(){return new e}}})),ie,ae=t((()=>{ie=Symbol(`BaggageEntryMetadata`)}));function w(e={}){return new C(new Map(Object.entries(e)))}function T(e){return typeof e!=`string`&&(oe.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=``),{__TYPE__:ie,toString(){return e}}}var oe,E=t((()=>{ne(),re(),ae(),oe=S.instance()}));function se(e){return Symbol.for(e)}var ce,D,le=t((()=>{ce=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},D=new ce}));function ue(){return xe}var de,fe,pe,me,he,ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke=t((()=>{de=class{constructor(){}createGauge(e,t){return Ce}createHistogram(e,t){return we}createCounter(e,t){return Se}createUpDownCounter(e,t){return Te}createObservableGauge(e,t){return De}createObservableCounter(e,t){return Ee}createObservableUpDownCounter(e,t){return Oe}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},fe=class{},pe=class extends fe{add(e,t){}},me=class extends fe{add(e,t){}},he=class extends fe{record(e,t){}},ge=class extends fe{record(e,t){}},_e=class{addCallback(e){}removeCallback(e){}},ve=class extends _e{},ye=class extends _e{},be=class extends _e{},xe=new de,Se=new pe,Ce=new he,we=new ge,Te=new me,Ee=new ve,De=new ye,Oe=new be})),Ae,je=t((()=>{(function(e){e[e.INT=0]=`INT`,e[e.DOUBLE=1]=`DOUBLE`})(Ae||(Ae={}))})),Me,Ne,Pe=t((()=>{Me={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},Ne={set(e,t,n){e!=null&&(e[t]=n)}}})),Fe,Ie=t((()=>{le(),Fe=class{active(){return D}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),Le,Re,ze,Be=t((()=>{Ie(),h(),ne(),Le=`context`,Re=new Fe,ze=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(e){return l(Le,e,S.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return u(Le)||Re}disable(){this._getContextManager().disable(),d(Le,S.instance())}}})),O,Ve=t((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(O||(O={}))})),He,Ue,We,Ge=t((()=>{Ve(),He=`0000000000000000`,Ue=`00000000000000000000000000000000`,We={traceId:Ue,spanId:He,traceFlags:O.NONE}})),Ke,qe=t((()=>{Ge(),Ke=class{constructor(e=We){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function Je(e){return e.getValue(et)||void 0}function Ye(){return Je(ze.getInstance().active())}function Xe(e,t){return e.setValue(et,t)}function Ze(e){return e.deleteValue(et)}function Qe(e,t){return Xe(e,new Ke(t))}function $e(e){var t;return(t=Je(e))==null?void 0:t.spanContext()}var et,tt=t((()=>{le(),qe(),Be(),et=se(`OpenTelemetry Context Key SPAN`)}));function nt(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(st[e.charCodeAt(t)]|0)+(st[e.charCodeAt(t+1)]|0)+(st[e.charCodeAt(t+2)]|0)+(st[e.charCodeAt(t+3)]|0);return n===t}function rt(e){return nt(e,32)&&e!==`00000000000000000000000000000000`}function it(e){return nt(e,16)&&e!==`0000000000000000`}function at(e){return rt(e.traceId)&&it(e.spanId)}function ot(e){return new Ke(e)}var st,ct=t((()=>{Ge(),qe(),st=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}));function lt(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var ut,dt,ft=t((()=>{Be(),tt(),qe(),ct(),ut=ze.getInstance(),dt=class{startSpan(e,t,n=ut.active()){if(t!=null&&t.root)return new Ke;let r=n&&$e(n);return lt(r)&&at(r)?new Ke(r):new Ke}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a==null?ut.active():a,c=this.startSpan(e,i,s),l=Xe(s,c);return ut.with(l,o,void 0,c)}}})),pt,mt,ht=t((()=>{ft(),pt=new dt,mt=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):pt}}})),gt,_t=t((()=>{ft(),gt=class{getTracer(e,t,n){return new dt}}})),vt,yt,bt=t((()=>{ht(),_t(),vt=new gt,yt=class{getTracer(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))==null?new mt(this,e,t,n):r}getDelegate(){var e;return(e=this._delegate)==null?vt:e}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getTracer(e,t,n)}}})),xt,St=t((()=>{(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(xt||(xt={}))})),Ct,wt=t((()=>{(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(Ct||(Ct={}))})),Tt,Et=t((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Tt||(Tt={}))})),k,Dt=t((()=>{Be(),k=ze.getInstance()})),A,Ot=t((()=>{ne(),A=S.instance()})),kt,At,jt=t((()=>{ke(),kt=class{getMeter(e,t,n){return xe}},At=new kt})),Mt,Nt,Pt=t((()=>{jt(),h(),ne(),Mt=`metrics`,Nt=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalMeterProvider(e){return l(Mt,e,S.instance())}getMeterProvider(){return u(Mt)||At}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){d(Mt,S.instance())}}})),Ft,It=t((()=>{Pt(),Ft=Nt.getInstance()})),Lt,Rt=t((()=>{Lt=class{inject(e,t){}extract(e,t){return e}fields(){return[]}}}));function zt(e){return e.getValue(Ut)||void 0}function Bt(){return zt(ze.getInstance().active())}function Vt(e,t){return e.setValue(Ut,t)}function Ht(e){return e.deleteValue(Ut)}var Ut,Wt=t((()=>{Be(),le(),Ut=se(`OpenTelemetry Baggage Key`)})),Gt,Kt,qt,Jt=t((()=>{h(),Rt(),Pe(),Wt(),E(),ne(),Gt=`propagation`,Kt=new Lt,qt=class e{constructor(){this.createBaggage=w,this.getBaggage=zt,this.getActiveBaggage=Bt,this.setBaggage=Vt,this.deleteBaggage=Ht}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(e){return l(Gt,e,S.instance())}inject(e,t,n=Ne){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=Me){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){d(Gt,S.instance())}_getGlobalPropagator(){return u(Gt)||Kt}}})),Yt,Xt=t((()=>{Jt(),Yt=qt.getInstance()})),Zt,Qt,$t=t((()=>{h(),bt(),ct(),tt(),ne(),Zt=`trace`,Qt=class e{constructor(){this._proxyTracerProvider=new yt,this.wrapSpanContext=ot,this.isSpanContextValid=at,this.deleteSpan=Ze,this.getSpan=Je,this.getActiveSpan=Ye,this.getSpanContext=$e,this.setSpan=Xe,this.setSpanContext=Qe}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(e){let t=l(Zt,this._proxyTracerProvider,S.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return u(Zt)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){d(Zt,S.instance()),this._proxyTracerProvider=new yt}}})),j,en=t((()=>{$t(),j=Qt.getInstance()})),M=t((()=>{E(),le(),b(),ke(),je(),Pe(),ht(),bt(),St(),wt(),Et(),Ve(),ct(),Ge(),Dt(),Ot(),It(),Xt(),en()})),N,tn=t((()=>{(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(N||(N={}))})),nn,rn,an=t((()=>{nn=class{emit(e){}enabled(){return!1}},rn=new nn}));function on(e,t,n){return r=>r===e?t:n}var sn,cn,ln=t((()=>{sn=Symbol.for(`io.opentelemetry.js.api.logs`),cn=globalThis})),un,dn,fn=t((()=>{an(),un=class{getLogger(e,t,n){return new nn}},dn=new un})),pn,mn=t((()=>{an(),pn=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):rn}}})),hn,gn=t((()=>{fn(),mn(),hn=class{getLogger(e,t,n){var r;return(r=this._getDelegateLogger(e,t,n))==null?new pn(this,e,t,n):r}_getDelegate(){var e;return(e=this._delegate)==null?dn:e}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getLogger(e,t,n)}}})),_n,vn=t((()=>{ln(),fn(),gn(),_n=class e{constructor(){this._proxyLoggerProvider=new hn}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return cn[sn]?this.getLoggerProvider():(cn[sn]=on(1,e,dn),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,t;return(t=(e=cn[sn])==null?void 0:e.call(cn,1))==null?this._proxyLoggerProvider:t}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete cn[sn],this._proxyLoggerProvider=new hn}}})),yn,bn=t((()=>{tn(),an(),vn(),yn=_n.getInstance()}));function xn(e){return typeof e==`object`&&!!e&&`addEventListener`in e&&typeof e.addEventListener==`function`&&`removeEventListener`in e&&typeof e.removeEventListener==`function`}function Sn(e){"@babel/helpers - typeof";return Sn=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Sn(e)}var Cn=t((()=>{}));function wn(e,t){if(Sn(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Sn(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Tn=t((()=>{Cn()}));function En(e){var t=wn(e,`string`);return Sn(t)==`symbol`?t:t+``}var Dn=t((()=>{Cn(),Tn()}));function P(e,t,n){return(t=En(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var F=t((()=>{Dn()}));M(),F();var On=`OT_ZONE_CONTEXT`,kn=class{constructor(){P(this,`_enabled`,!1)}_bindFunction(e,t){let n=this,r=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(r,`length`,{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}_bindListener(e,t){let n=t;return n.__ot_listeners===void 0?(n.__ot_listeners={},typeof n.addEventListener==`function`&&(n.addEventListener=this._patchAddEventListener(n,n.addEventListener,e)),typeof n.removeEventListener==`function`&&(n.removeEventListener=this._patchRemoveEventListener(n,n.removeEventListener)),t):t}_createZone(e,t){return Zone.current.fork({name:e,properties:{[On]:t},onCancelTask(e,t,n,r){return r.state===`notScheduled`||r.state===`running`?r:e.cancelTask(n,r)}})}_patchAddEventListener(e,t,n){let r=this;return function(i,a,o){e.__ot_listeners===void 0&&(e.__ot_listeners={});let s=e.__ot_listeners[i];s===void 0&&(s=new WeakMap,e.__ot_listeners[i]=s);let c=r.bind(n,a);return s.set(a,c),t.call(this,i,c,o)}}_patchRemoveEventListener(e,t){return function(n,r){if(e.__ot_listeners===void 0||e.__ot_listeners[n]===void 0)return t.call(this,n,r);let i=e.__ot_listeners[n],a=i.get(r);return i.delete(r),t.call(this,n,a||r)}}active(){return!this._enabled||!Zone.current?D:Zone.current.get(On)||D}bind(e,t){return typeof t==`function`?this._bindFunction(e,t):(xn(t)&&this._bindListener(e,t),t)}disable(){return this._enabled=!1,this}enable(){return this._enabled=!0,this}with(e,t,n,...r){let i=`otel:with`;return t.name&&(i+=`:${t.name}`),this._createZone(i,e).run(t,n,r)}};bn();var An=Object.defineProperty,jn=Object.defineProperties,Mn=Object.getOwnPropertyDescriptors,Nn=Object.getOwnPropertySymbols,Pn=Object.prototype.hasOwnProperty,Fn=Object.prototype.propertyIsEnumerable,In=(e,t,n)=>t in e?An(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ln=(e,t)=>{for(var n in t||(t={}))Pn.call(t,n)&&In(e,n,t[n]);if(Nn)for(var n of Nn(t))Fn.call(t,n)&&In(e,n,t[n]);return e},Rn=(e,t)=>jn(e,Mn(t)),I=(e,t,n)=>(In(e,typeof t==`symbol`?t:t+``,n),n),zn=globalThis;function Bn(e){return(zn.__Zone_symbol_prefix||`__zone_symbol__`)+e}function Vn(){let e=zn.performance;function t(t){e&&e.mark&&e.mark(t)}function n(t,n){e&&e.measure&&e.measure(t,n)}t(`Zone`);let r=class e{constructor(e,t){I(this,`_parent`),I(this,`_name`),I(this,`_properties`),I(this,`_zoneDelegate`),this._parent=e,this._name=t?t.name||`unnamed`:`<root>`,this._properties=t&&t.properties||{},this._zoneDelegate=new o(this,this._parent&&this._parent._zoneDelegate,t)}static assertZonePatched(){if(zn.Promise!==ie.ZoneAwarePromise)throw Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")}static get root(){let t=e.current;for(;t.parent;)t=t.parent;return t}static get current(){return w.zone}static get currentTask(){return T}static __load_patch(r,i,a=!1){if(ie.hasOwnProperty(r)){let e=zn[Bn(`forceDuplicateZoneCheck`)]===!0;if(!a&&e)throw Error(`Already loaded patch: `+r)}else if(!zn[`__Zone_disable_`+r]){let a=`Zone:`+r;t(a),ie[r]=i(zn,e,ae),n(a,a)}}get parent(){return this._parent}get name(){return this._name}get(e){let t=this.getZoneWith(e);if(t)return t._properties[e]}getZoneWith(e){let t=this;for(;t;){if(t._properties.hasOwnProperty(e))return t;t=t._parent}return null}fork(e){if(!e)throw Error(`ZoneSpec required!`);return this._zoneDelegate.fork(this,e)}wrap(e,t){if(typeof e!=`function`)throw Error(`Expecting function got: `+e);let n=this._zoneDelegate.intercept(this,e,t),r=this;return function(){return r.runGuarded(n,this,arguments,t)}}run(e,t,n,r){w={parent:w,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{w=w.parent}}runGuarded(e,t=null,n,r){w={parent:w,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{w=w.parent}}runTask(e,t,n){if(e.zone!=this)throw Error(`A task can only be run in the zone of creation! (Creation: `+(e.zone||v).name+`; Execution: `+this.name+`)`);let r=e,{type:i,data:{isPeriodic:a=!1,isRefreshable:o=!1}={}}=e;if(e.state===y&&(i===re||i===C))return;let s=e.state!=ee;s&&r._transitionTo(ee,x);let c=T;T=r,w={parent:w,zone:this};try{i==C&&e.data&&!a&&!o&&(e.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,r,t,n)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{let t=e.state;if(t!==y&&t!==S)if(i==re||a||o&&t===b)s&&r._transitionTo(x,ee,b);else{let e=r._zoneDelegates;this._updateTaskCount(r,-1),s&&r._transitionTo(y,ee,y),o&&(r._zoneDelegates=e)}w=w.parent,T=c}}scheduleTask(e){if(e.zone&&e.zone!==this){let t=this;for(;t;){if(t===e.zone)throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${e.zone.name}`);t=t.parent}}e._transitionTo(b,y);let t=[];e._zoneDelegates=t,e._zone=this;try{e=this._zoneDelegate.scheduleTask(this,e)}catch(t){throw e._transitionTo(S,b,y),this._zoneDelegate.handleError(this,t),t}return e._zoneDelegates===t&&this._updateTaskCount(e,1),e.state==b&&e._transitionTo(x,b),e}scheduleMicroTask(e,t,n,r){return this.scheduleTask(new s(ne,e,t,n,r,void 0))}scheduleMacroTask(e,t,n,r,i){return this.scheduleTask(new s(C,e,t,n,r,i))}scheduleEventTask(e,t,n,r,i){return this.scheduleTask(new s(re,e,t,n,r,i))}cancelTask(e){if(e.zone!=this)throw Error(`A task can only be cancelled in the zone of creation! (Creation: `+(e.zone||v).name+`; Execution: `+this.name+`)`);if(!(e.state!==x&&e.state!==ee)){e._transitionTo(te,x,ee);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(S,te),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(y,te),e.runCount=-1,e}}_updateTaskCount(e,t){let n=e._zoneDelegates;t==-1&&(e._zoneDelegates=null);for(let r=0;r<n.length;r++)n[r]._updateTaskCount(e.type,t)}};I(r,`__symbol__`,Bn);let i=r,a={name:``,onHasTask:(e,t,n,r)=>e.hasTask(n,r),onScheduleTask:(e,t,n,r)=>e.scheduleTask(n,r),onInvokeTask:(e,t,n,r,i,a)=>e.invokeTask(n,r,i,a),onCancelTask:(e,t,n,r)=>e.cancelTask(n,r)};class o{constructor(e,t,n){I(this,`_zone`),I(this,`_taskCounts`,{microTask:0,macroTask:0,eventTask:0}),I(this,`_forkDlgt`),I(this,`_forkZS`),I(this,`_forkCurrZone`),I(this,`_interceptDlgt`),I(this,`_interceptZS`),I(this,`_interceptCurrZone`),I(this,`_invokeDlgt`),I(this,`_invokeZS`),I(this,`_invokeCurrZone`),I(this,`_handleErrorDlgt`),I(this,`_handleErrorZS`),I(this,`_handleErrorCurrZone`),I(this,`_scheduleTaskDlgt`),I(this,`_scheduleTaskZS`),I(this,`_scheduleTaskCurrZone`),I(this,`_invokeTaskDlgt`),I(this,`_invokeTaskZS`),I(this,`_invokeTaskCurrZone`),I(this,`_cancelTaskDlgt`),I(this,`_cancelTaskZS`),I(this,`_cancelTaskCurrZone`),I(this,`_hasTaskDlgt`),I(this,`_hasTaskDlgtOwner`),I(this,`_hasTaskZS`),I(this,`_hasTaskCurrZone`),this._zone=e,this._forkZS=n&&(n&&n.onFork?n:t._forkZS),this._forkDlgt=n&&(n.onFork?t:t._forkDlgt),this._forkCurrZone=n&&(n.onFork?this._zone:t._forkCurrZone),this._interceptZS=n&&(n.onIntercept?n:t._interceptZS),this._interceptDlgt=n&&(n.onIntercept?t:t._interceptDlgt),this._interceptCurrZone=n&&(n.onIntercept?this._zone:t._interceptCurrZone),this._invokeZS=n&&(n.onInvoke?n:t._invokeZS),this._invokeDlgt=n&&(n.onInvoke?t:t._invokeDlgt),this._invokeCurrZone=n&&(n.onInvoke?this._zone:t._invokeCurrZone),this._handleErrorZS=n&&(n.onHandleError?n:t._handleErrorZS),this._handleErrorDlgt=n&&(n.onHandleError?t:t._handleErrorDlgt),this._handleErrorCurrZone=n&&(n.onHandleError?this._zone:t._handleErrorCurrZone),this._scheduleTaskZS=n&&(n.onScheduleTask?n:t._scheduleTaskZS),this._scheduleTaskDlgt=n&&(n.onScheduleTask?t:t._scheduleTaskDlgt),this._scheduleTaskCurrZone=n&&(n.onScheduleTask?this._zone:t._scheduleTaskCurrZone),this._invokeTaskZS=n&&(n.onInvokeTask?n:t._invokeTaskZS),this._invokeTaskDlgt=n&&(n.onInvokeTask?t:t._invokeTaskDlgt),this._invokeTaskCurrZone=n&&(n.onInvokeTask?this._zone:t._invokeTaskCurrZone),this._cancelTaskZS=n&&(n.onCancelTask?n:t._cancelTaskZS),this._cancelTaskDlgt=n&&(n.onCancelTask?t:t._cancelTaskDlgt),this._cancelTaskCurrZone=n&&(n.onCancelTask?this._zone:t._cancelTaskCurrZone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;let r=n&&n.onHasTask,i=t&&t._hasTaskZS;(r||i)&&(this._hasTaskZS=r?n:a,this._hasTaskDlgt=t,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=this._zone,n.onScheduleTask||(this._scheduleTaskZS=a,this._scheduleTaskDlgt=t,this._scheduleTaskCurrZone=this._zone),n.onInvokeTask||(this._invokeTaskZS=a,this._invokeTaskDlgt=t,this._invokeTaskCurrZone=this._zone),n.onCancelTask||(this._cancelTaskZS=a,this._cancelTaskDlgt=t,this._cancelTaskCurrZone=this._zone))}get zone(){return this._zone}fork(e,t){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,e,t):new i(e,t)}intercept(e,t,n){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,e,t,n):t}invoke(e,t,n,r,i){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,e,t,n,r,i):t.apply(n,r)}handleError(e,t){return this._handleErrorZS?this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,e,t):!0}scheduleTask(e,t){let n=t;if(this._scheduleTaskZS)this._hasTaskZS&&n._zoneDelegates.push(this._hasTaskDlgtOwner),n=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,e,t),n||(n=t);else if(t.scheduleFn)t.scheduleFn(t);else if(t.type==ne)g(t);else throw Error(`Task is missing scheduleFn.`);return n}invokeTask(e,t,n,r){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,e,t,n,r):t.callback.apply(n,r)}cancelTask(e,t){let n;if(this._cancelTaskZS)n=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,e,t);else{if(!t.cancelFn)throw Error(`Task is not cancelable`);n=t.cancelFn(t)}return n}hasTask(e,t){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,e,t)}catch(t){this.handleError(e,t)}}_updateTaskCount(e,t){let n=this._taskCounts,r=n[e],i=n[e]=r+t;if(i<0)throw Error(`More tasks executed then were scheduled.`);if(r==0||i==0){let t={microTask:n.microTask>0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:e};this.hasTask(this._zone,t)}}}class s{constructor(e,t,n,r,i,a){if(I(this,`type`),I(this,`source`),I(this,`invoke`),I(this,`callback`),I(this,`data`),I(this,`scheduleFn`),I(this,`cancelFn`),I(this,`_zone`,null),I(this,`runCount`,0),I(this,`_zoneDelegates`,null),I(this,`_state`,`notScheduled`),this.type=e,this.source=t,this.data=r,this.scheduleFn=i,this.cancelFn=a,!n)throw Error(`callback is not defined`);this.callback=n;let o=this;e===re&&r&&r.useG?this.invoke=s.invokeTask:this.invoke=function(){return s.invokeTask.call(zn,o,this,arguments)}}static invokeTask(e,t,n){e||(e=this),oe++;try{return e.runCount++,e.zone.runTask(e,t,n)}finally{oe===1&&!zn[d]&&_(),oe--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(y,b)}_transitionTo(e,t,n){if(this._state===t||this._state===n)this._state=e,e==y&&(this._zoneDelegates=null);else throw Error(`${this.type} '${this.source}': can not transition to '${e}', expecting state '${t}'${n?` or '`+n+`'`:``}, was '${this._state}'.`)}toString(){return this.data&&this.data.handleId!==void 0?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}let c=Bn(`setTimeout`),l=Bn(`Promise`),u=Bn(`then`),d=Bn(`enable_native_microtask_draining`),f=[],p=!1,m;function h(e){var t;!m&&zn[l]&&(m=zn[l].resolve(0)),m?((t=m[u])==null?m.then:t).call(m,e):zn[c](e,0)}function g(e){let t=zn[d],n=t&&f.length===0&&!p,r=!t&&oe===0&&f.length===0;(n||r)&&h(_),e&&f.push(e)}function _(){if(!p){for(p=!0;f.length;){let e=f;f=[];for(let t of e)try{t.zone.runTask(t,null,null)}catch(e){ae.onUnhandledError(e)}}zn[d]?(p=!1,ae.microtaskDrainDone()):(ae.microtaskDrainDone(),p=!1)}}let v={name:`NO ZONE`},y=`notScheduled`,b=`scheduling`,x=`scheduled`,ee=`running`,te=`canceling`,S=`unknown`,ne=`microTask`,C=`macroTask`,re=`eventTask`,ie={},ae={symbol:Bn,currentZoneFrame:()=>w,onUnhandledError:E,microtaskDrainDone:E,scheduleMicroTask:g,showUncaughtError:()=>!i[Bn(`ignoreConsoleErrorUncaughtError`)],patchEventTarget:()=>[],patchOnProperties:E,patchMethod:()=>E,bindArguments:()=>[],patchThen:()=>E,patchMacroTask:()=>E,patchEventPrototype:()=>E,getGlobalObjects:()=>void 0,ObjectDefineProperty:()=>E,ObjectGetOwnPropertyDescriptor:()=>void 0,ObjectCreate:()=>void 0,ArraySlice:()=>[],patchClass:()=>E,wrapWithCurrentZone:()=>E,filterProperties:()=>[],attachOriginToPatched:()=>E,_redefineProperty:()=>E,patchCallbacks:()=>E,nativeScheduleMicroTask:h},w={parent:null,zone:new i(null,null)},T=null,oe=0;function E(){}return n(`Zone`,`Zone`),i}function Hn(){let e=globalThis,t=e[Bn(`forceDuplicateZoneCheck`)]===!0;if(e.Zone&&(t||typeof e.Zone.__symbol__!=`function`))throw Error(`Zone already loaded.`);return e.Zone!=null||(e.Zone=Vn()),e.Zone}var Un=Object.getOwnPropertyDescriptor,Wn=Object.defineProperty,Gn=Object.getPrototypeOf,Kn=Object.create,qn=Array.prototype.slice,Jn=`addEventListener`,Yn=`removeEventListener`,Xn=Bn(Jn),Zn=Bn(Yn),Qn=`true`,$n=`false`,er=Bn(``);function tr(e,t){return Zone.current.wrap(e,t)}function nr(e,t,n,r,i){return Zone.current.scheduleMacroTask(e,t,n,r,i)}var L=Bn,rr=typeof window<`u`,ir=rr?window:void 0,R=rr&&ir||globalThis,ar=`removeAttribute`;function or(e,t){for(let n=e.length-1;n>=0;n--)typeof e[n]==`function`&&(e[n]=tr(e[n],t+`_`+n));return e}function sr(e,t){let n=e.constructor.name;for(let r=0;r<t.length;r++){let i=t[r],a=e[i];if(a){if(!cr(Un(e,i)))continue;e[i]=(e=>{let t=function(){return e.apply(this,or(arguments,n+`.`+i))};return wr(t,e),t})(a)}}}function cr(e){return e?e.writable===!1?!1:!(typeof e.get==`function`&&e.set===void 0):!0}var lr=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope,ur=!(`nw`in R)&&R.process!==void 0&&R.process.toString()===`[object process]`,dr=!ur&&!lr&&!!(rr&&ir.HTMLElement),fr=R.process!==void 0&&R.process.toString()===`[object process]`&&!lr&&!!(rr&&ir.HTMLElement),pr={},mr=L(`enable_beforeunload`),hr=function(e){if(e=e||R.event,!e)return;let t=pr[e.type];t||(t=pr[e.type]=L(`ON_PROPERTY`+e.type));let n=this||e.target||R,r=n[t],i;if(dr&&n===ir&&e.type===`error`){let t=e;i=r&&r.call(this,t.message,t.filename,t.lineno,t.colno,t.error),i===!0&&e.preventDefault()}else i=r&&r.apply(this,arguments),e.type===`beforeunload`&&R[mr]&&typeof i==`string`?e.returnValue=i:i!=null&&!i&&e.preventDefault();return i};function gr(e,t,n){let r=Un(e,t);if(!r&&n&&Un(n,t)&&(r={enumerable:!0,configurable:!0}),!r||!r.configurable)return;let i=L(`on`+t+`patched`);if(e.hasOwnProperty(i)&&e[i])return;delete r.writable,delete r.value;let a=r.get,o=r.set,s=t.slice(2),c=pr[s];c||(c=pr[s]=L(`ON_PROPERTY`+s)),r.set=function(t){let n=this;!n&&e===R&&(n=R),n&&(typeof n[c]==`function`&&n.removeEventListener(s,hr),o==null||o.call(n,null),n[c]=t,typeof t==`function`&&n.addEventListener(s,hr,!1))},r.get=function(){let n=this;if(!n&&e===R&&(n=R),!n)return null;let i=n[c];if(i)return i;if(a){let e=a.call(this);if(e)return r.set.call(this,e),typeof n[ar]==`function`&&n.removeAttribute(t),e}return null},Wn(e,t,r),e[i]=!0}function _r(e,t,n){if(t)for(let r=0;r<t.length;r++)gr(e,`on`+t[r],n);else{let t=[];for(let n in e)n.slice(0,2)==`on`&&t.push(n);for(let r=0;r<t.length;r++)gr(e,t[r],n)}}var vr=L(`originalInstance`);function yr(e){let t=R[e];if(!t)return;R[L(e)]=t,R[e]=function(){let n=or(arguments,e);switch(n.length){case 0:this[vr]=new t;break;case 1:this[vr]=new t(n[0]);break;case 2:this[vr]=new t(n[0],n[1]);break;case 3:this[vr]=new t(n[0],n[1],n[2]);break;case 4:this[vr]=new t(n[0],n[1],n[2],n[3]);break;default:throw Error(`Arg list too long.`)}},wr(R[e],t);let n=new t(function(){}),r;for(r in n)e===`XMLHttpRequest`&&r===`responseBlob`||(function(t){typeof n[t]==`function`?R[e].prototype[t]=function(){return this[vr][t].apply(this[vr],arguments)}:Wn(R[e].prototype,t,{set:function(n){typeof n==`function`?(this[vr][t]=tr(n,e+`.`+t),wr(this[vr][t],n)):this[vr][t]=n},get:function(){return this[vr][t]}})})(r);for(r in t)r!==`prototype`&&t.hasOwnProperty(r)&&(R[e][r]=t[r])}function br(e,t){typeof Object.getOwnPropertySymbols==`function`&&Object.getOwnPropertySymbols(e).forEach(n=>{let r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,{get:function(){return e[n]},set:function(t){r&&(!r.writable||typeof r.set!=`function`)||(e[n]=t)},enumerable:r?r.enumerable:!0,configurable:r?r.configurable:!0})})}var xr=!1;function Sr(e,t,n){let r=e;for(;r&&!r.hasOwnProperty(t);)r=Gn(r);!r&&e[t]&&(r=e);let i=L(t),a=null;if(r&&(!(a=r[i])||!r.hasOwnProperty(i))&&(a=r[i]=r[t],cr(r&&Un(r,t)))){let e=n(a,i,t);r[t]=function(){return e(this,arguments)},wr(r[t],a),xr&&br(a,r[t])}return a}function Cr(e,t,n){let r=null;function i(e){let t=e.data;return t.args[t.cbIdx]=function(){e.invoke.apply(this,arguments)},r.apply(t.target,t.args),e}r=Sr(e,t,e=>function(t,r){let a=n(t,r);return a.cbIdx>=0&&typeof r[a.cbIdx]==`function`?nr(a.name,r[a.cbIdx],a,i):e.apply(t,r)})}function wr(e,t){e[L(`OriginalDelegate`)]=t}function Tr(e){return typeof e==`function`}function Er(e){return typeof e==`number`}var Dr={useG:!0},Or={},kr={},Ar=RegExp(`^`+er+`(\\w+)(true|false)$`),jr=L(`propagationStopped`);function Mr(e,t){let n=(t?t(e):e)+$n,r=(t?t(e):e)+Qn,i=er+n,a=er+r;Or[e]={},Or[e][$n]=i,Or[e][Qn]=a}function Nr(e,t,n,r){let i=r&&r.add||Jn,a=r&&r.rm||Yn,o=r&&r.listeners||`eventListeners`,s=r&&r.rmAll||`removeAllListeners`,c=L(i),l=`.`+i+`:`,u=`prependListener`;``+u;let d=function(e,t,n){if(e.isRemoved)return;let r=e.callback;typeof r==`object`&&r.handleEvent&&(e.callback=e=>r.handleEvent(e),e.originalDelegate=r);let i;try{e.invoke(e,t,[n])}catch(e){i=e}let o=e.options;if(o&&typeof o==`object`&&o.once){let r=e.originalDelegate?e.originalDelegate:e.callback;t[a].call(t,n.type,r,o)}return i};function f(n,r,i){if(r=r||e.event,!r)return;let a=n||r.target||e,o=a[Or[r.type][i?Qn:$n]];if(o){let e=[];if(o.length===1){let t=d(o[0],a,r);t&&e.push(t)}else{let t=o.slice();for(let n=0;n<t.length&&!(r&&r[jr]===!0);n++){let i=d(t[n],a,r);i&&e.push(i)}}if(e.length===1)throw e[0];for(let n=0;n<e.length;n++){let r=e[n];t.nativeScheduleMicroTask(()=>{throw r})}}}let p=function(e){return f(this,e,!1)},m=function(e){return f(this,e,!0)};function h(t,n){if(!t)return!1;let r=!0;n&&n.useG!==void 0&&(r=n.useG);let d=n&&n.vh,f=!0;n&&n.chkDup!==void 0&&(f=n.chkDup);let h=!1;n&&n.rt!==void 0&&(h=n.rt);let g=t;for(;g&&!g.hasOwnProperty(i);)g=Gn(g);if(!g&&t[i]&&(g=t),!g||g[c])return!1;let _=n&&n.eventNameToString,v={},y=g[c]=g[i],b=g[L(a)]=g[a],x=g[L(o)]=g[o],ee=g[L(s)]=g[s],te;n&&n.prepend&&(te=g[L(n.prepend)]=g[n.prepend]);function S(e,t){return t?typeof e==`boolean`?{capture:e,passive:!0}:e?typeof e==`object`&&e.passive!==!1?Rn(Ln({},e),{passive:!0}):e:{passive:!0}:e}let ne=function(e){if(!v.isExisting)return y.call(v.target,v.eventName,v.capture?m:p,v.options)},C=function(e){if(!e.isRemoved){let t=Or[e.eventName],n;t&&(n=t[e.capture?Qn:$n]);let r=n&&e.target[n];if(r){for(let t=0;t<r.length;t++)if(r[t]===e){r.splice(t,1),e.isRemoved=!0,e.removeAbortListener&&(e.removeAbortListener(),e.removeAbortListener=null),r.length===0&&(e.allRemoved=!0,e.target[n]=null);break}}}if(e.allRemoved)return b.call(e.target,e.eventName,e.capture?m:p,e.options)},re=function(e){return y.call(v.target,v.eventName,e.invoke,v.options)},ie=function(e){return te.call(v.target,v.eventName,e.invoke,v.options)},ae=function(e){return b.call(e.target,e.eventName,e.invoke,e.options)},w=r?ne:re,T=r?C:ae,oe=(n==null?void 0:n.diff)||function(e,t){let n=typeof t;return n===`function`&&e.callback===t||n===`object`&&e.originalDelegate===t},E=Zone[L(`UNPATCHED_EVENTS`)],se=e[L(`PASSIVE_EVENTS`)];function ce(e){if(typeof e==`object`&&e){let t=Ln({},e);return e.signal&&(t.signal=e.signal),t}return e}let D=function(t,i,a,o,s=!1,c=!1){return function(){let l=this||e,u=arguments[0];n&&n.transferEventName&&(u=n.transferEventName(u));let p=arguments[1];if(!p||ur&&u===`uncaughtException`)return t.apply(this,arguments);let m=!1;if(typeof p!=`function`){if(!p.handleEvent)return t.apply(this,arguments);m=!0}if(d&&!d(t,p,l,arguments))return;let h=!!se&&se.indexOf(u)!==-1,g=ce(S(arguments[2],h)),y=g==null?void 0:g.signal;if(y!=null&&y.aborted)return;if(E){for(let e=0;e<E.length;e++)if(u===E[e])return h?t.call(l,u,p,g):t.apply(this,arguments)}let b=g?typeof g==`boolean`?!0:g.capture:!1,x=g&&typeof g==`object`?g.once:!1,ee=Zone.current,te=Or[u];te||(Mr(u,_),te=Or[u]);let ne=te[b?Qn:$n],C=l[ne],re=!1;if(C){if(re=!0,f){for(let e=0;e<C.length;e++)if(oe(C[e],p))return}}else C=l[ne]=[];let ie,ae=l.constructor.name,w=kr[ae];w&&(ie=w[u]),ie||(ie=ae+i+(_?_(u):u)),v.options=g,x&&(v.options.once=!1),v.target=l,v.capture=b,v.eventName=u,v.isExisting=re;let T=r?Dr:void 0;T&&(T.taskData=v),y&&(v.options.signal=void 0);let D=ee.scheduleEventTask(ie,p,T,a,o);if(y){v.options.signal=y;let e=()=>D.zone.cancelTask(D);t.call(y,`abort`,e,{once:!0}),D.removeAbortListener=()=>y.removeEventListener(`abort`,e)}if(v.target=null,T&&(T.taskData=null),x&&(v.options.once=!0),typeof D.options!=`boolean`&&(D.options=g),D.target=l,D.capture=b,D.eventName=u,m&&(D.originalDelegate=p),c?C.unshift(D):C.push(D),s)return l}};return g[i]=D(y,l,w,T,h),te&&(g[u]=D(te,`.prependListener:`,ie,T,h,!0)),g[a]=function(){let t=this||e,r=arguments[0];n&&n.transferEventName&&(r=n.transferEventName(r));let i=arguments[2],a=i?typeof i==`boolean`?!0:i.capture:!1,o=arguments[1];if(!o)return b.apply(this,arguments);if(d&&!d(b,o,t,arguments))return;let s=Or[r],c;s&&(c=s[a?Qn:$n]);let l=c&&t[c];if(l)for(let e=0;e<l.length;e++){let n=l[e];if(oe(n,o)){if(l.splice(e,1),n.isRemoved=!0,l.length===0&&(n.allRemoved=!0,t[c]=null,!a&&typeof r==`string`)){let e=er+`ON_PROPERTY`+r;t[e]=null}return n.zone.cancelTask(n),h?t:void 0}}return b.apply(this,arguments)},g[o]=function(){let t=this||e,r=arguments[0];n&&n.transferEventName&&(r=n.transferEventName(r));let i=[],a=Pr(t,_?_(r):r);for(let e=0;e<a.length;e++){let t=a[e],n=t.originalDelegate?t.originalDelegate:t.callback;i.push(n)}return i},g[s]=function(){let t=this||e,r=arguments[0];if(r){n&&n.transferEventName&&(r=n.transferEventName(r));let e=Or[r];if(e){let n=e[$n],i=e[Qn],o=t[n],s=t[i];if(o){let e=o.slice();for(let t=0;t<e.length;t++){let n=e[t],i=n.originalDelegate?n.originalDelegate:n.callback;this[a].call(this,r,i,n.options)}}if(s){let e=s.slice();for(let t=0;t<e.length;t++){let n=e[t],i=n.originalDelegate?n.originalDelegate:n.callback;this[a].call(this,r,i,n.options)}}}}else{let e=Object.keys(t);for(let t=0;t<e.length;t++){let n=e[t],r=Ar.exec(n),i=r&&r[1];i&&i!==`removeListener`&&this[s].call(this,i)}this[s].call(this,`removeListener`)}if(h)return this},wr(g[i],y),wr(g[a],b),ee&&wr(g[s],ee),x&&wr(g[o],x),!0}let g=[];for(let e=0;e<n.length;e++)g[e]=h(n[e],r);return g}function Pr(e,t){if(!t){let n=[];for(let r in e){let i=Ar.exec(r),a=i&&i[1];if(a&&(!t||a===t)){let t=e[r];if(t)for(let e=0;e<t.length;e++)n.push(t[e])}}return n}let n=Or[t];n||(Mr(t),n=Or[t]);let r=e[n[$n]],i=e[n[Qn]];return r?i?r.concat(i):r.slice():i?i.slice():[]}function Fr(e,t){let n=e.Event;n&&n.prototype&&t.patchMethod(n.prototype,`stopImmediatePropagation`,e=>function(t,n){t[jr]=!0,e&&e.apply(t,n)})}function Ir(e,t){t.patchMethod(e,`queueMicrotask`,e=>function(e,t){Zone.current.scheduleMicroTask(`queueMicrotask`,t[0])})}var Lr=L(`zoneTask`);function Rr(e,t,n,r){let i=null,a=null;t+=r,n+=r;let o={};function s(t){let n=t.data;n.args[0]=function(){return t.invoke.apply(this,arguments)};let r=i.apply(e,n.args);return Er(r)?n.handleId=r:(n.handle=r,n.isRefreshable=Tr(r.refresh)),t}function c(t){let{handle:n,handleId:r}=t.data;return a.call(e,n==null?r:n)}i=Sr(e,t,n=>function(i,a){var l;if(Tr(a[0])){let e={isRefreshable:!1,isPeriodic:r===`Interval`,delay:r===`Timeout`||r===`Interval`?a[1]||0:void 0,args:a},n=a[0];a[0]=function(){try{return n.apply(this,arguments)}finally{let{handle:t,handleId:n,isPeriodic:r,isRefreshable:i}=e;!r&&!i&&(n?delete o[n]:t&&(t[Lr]=null))}};let i=nr(t,a[0],e,s,c);if(!i)return i;let{handleId:u,handle:d,isRefreshable:f,isPeriodic:p}=i.data;if(u)o[u]=i;else if(d&&(d[Lr]=i,f&&!p)){let e=d.refresh;d.refresh=function(){let{zone:t,state:n}=i;return n===`notScheduled`?(i._state=`scheduled`,t._updateTaskCount(i,1)):n===`running`&&(i._state=`scheduling`),e.call(this)}}return(l=d==null?u:d)==null?i:l}else return n.apply(e,a)}),a=Sr(e,n,t=>function(n,r){let i=r[0],a;Er(i)?(a=o[i],delete o[i]):(a=i==null?void 0:i[Lr],a?i[Lr]=null:a=i),a!=null&&a.type?a.cancelFn&&a.zone.cancelTask(a):t.apply(e,r)})}function zr(e,t){let{isBrowser:n,isMix:r}=t.getGlobalObjects();!n&&!r||!e.customElements||!(`customElements`in e)||t.patchCallbacks(t,e.customElements,`customElements`,`define`,[`connectedCallback`,`disconnectedCallback`,`adoptedCallback`,`attributeChangedCallback`,`formAssociatedCallback`,`formDisabledCallback`,`formResetCallback`,`formStateRestoreCallback`])}function Br(e,t){if(Zone[t.symbol(`patchEventTarget`)])return;let{eventNames:n,zoneSymbolEventNames:r,TRUE_STR:i,FALSE_STR:a,ZONE_SYMBOL_PREFIX:o}=t.getGlobalObjects();for(let e=0;e<n.length;e++){let t=n[e],s=t+a,c=t+i,l=o+s,u=o+c;r[t]={},r[t][a]=l,r[t][i]=u}let s=e.EventTarget;if(!(!s||!s.prototype))return t.patchEventTarget(e,t,[s&&s.prototype]),!0}function Vr(e,t){t.patchEventPrototype(e,t)}function Hr(e,t,n){if(!n||n.length===0)return t;let r=n.filter(t=>t.target===e);if(r.length===0)return t;let i=r[0].ignoreProperties;return t.filter(e=>i.indexOf(e)===-1)}function Ur(e,t,n,r){e&&_r(e,Hr(e,t,n),r)}function Wr(e){return Object.getOwnPropertyNames(e).filter(e=>e.startsWith(`on`)&&e.length>2).map(e=>e.substring(2))}function Gr(e,t){if(ur&&!fr||Zone[e.symbol(`patchEvents`)])return;let n=t.__Zone_ignore_on_properties,r=[];if(dr){let e=window;r=r.concat([`Document`,`SVGElement`,`Element`,`HTMLElement`,`HTMLBodyElement`,`HTMLMediaElement`,`HTMLFrameSetElement`,`HTMLFrameElement`,`HTMLIFrameElement`,`HTMLMarqueeElement`,`Worker`]),Ur(e,Wr(e),n,Gn(e))}r=r.concat([`XMLHttpRequest`,`XMLHttpRequestEventTarget`,`IDBIndex`,`IDBRequest`,`IDBOpenDBRequest`,`IDBDatabase`,`IDBTransaction`,`IDBCursor`,`WebSocket`]);for(let e=0;e<r.length;e++){let i=t[r[e]];i!=null&&i.prototype&&Ur(i.prototype,Wr(i.prototype),n)}}function Kr(e){e.__load_patch(`timers`,e=>{let t=`clear`;Rr(e,`set`,t,`Timeout`),Rr(e,`set`,t,`Interval`),Rr(e,`set`,t,`Immediate`)}),e.__load_patch(`requestAnimationFrame`,e=>{Rr(e,`request`,`cancel`,`AnimationFrame`),Rr(e,`mozRequest`,`mozCancel`,`AnimationFrame`),Rr(e,`webkitRequest`,`webkitCancel`,`AnimationFrame`)}),e.__load_patch(`blocking`,(e,t)=>{let n=[`alert`,`prompt`,`confirm`];for(let r=0;r<n.length;r++){let i=n[r];Sr(e,i,(n,r,i)=>function(r,a){return t.current.run(n,e,a,i)})}}),e.__load_patch(`EventTarget`,(e,t,n)=>{Vr(e,n),Br(e,n);let r=e.XMLHttpRequestEventTarget;r&&r.prototype&&n.patchEventTarget(e,n,[r.prototype])}),e.__load_patch(`MutationObserver`,(e,t,n)=>{yr(`MutationObserver`),yr(`WebKitMutationObserver`)}),e.__load_patch(`IntersectionObserver`,(e,t,n)=>{yr(`IntersectionObserver`)}),e.__load_patch(`FileReader`,(e,t,n)=>{yr(`FileReader`)}),e.__load_patch(`on_property`,(e,t,n)=>{Gr(n,e)}),e.__load_patch(`customElements`,(e,t,n)=>{zr(e,n)}),e.__load_patch(`XHR`,(e,t)=>{c(e);let n=L(`xhrTask`),r=L(`xhrSync`),i=L(`xhrListener`),a=L(`xhrScheduled`),o=L(`xhrURL`),s=L(`xhrErrorBeforeScheduled`);function c(e){let c=e.XMLHttpRequest;if(!c)return;let l=c.prototype;function u(e){return e[n]}let d=l[Xn],f=l[Zn];if(!d){let t=e.XMLHttpRequestEventTarget;if(t){let e=t.prototype;d=e[Xn],f=e[Zn]}}let p=`readystatechange`,m=`scheduled`;function h(e){let r=e.data,o=r.target;o[a]=!1,o[s]=!1;let c=o[i];d||(d=o[Xn],f=o[Zn]),c&&f.call(o,p,c);let l=o[i]=()=>{if(o.readyState===o.DONE)if(!r.aborted&&o[a]&&e.state===m){let n=o[t.__symbol__(`loadfalse`)];if(o.status!==0&&n&&n.length>0){let i=e.invoke;e.invoke=function(){let n=o[t.__symbol__(`loadfalse`)];for(let t=0;t<n.length;t++)n[t]===e&&n.splice(t,1);!r.aborted&&e.state===m&&i.call(e)},n.push(e)}else e.invoke()}else !r.aborted&&o[a]===!1&&(o[s]=!0)};return d.call(o,p,l),o[n]||(o[n]=e),x.apply(o,r.args),o[a]=!0,e}function g(){}function _(e){let t=e.data;return t.aborted=!0,ee.apply(t.target,t.args)}let v=Sr(l,`open`,()=>function(e,t){return e[r]=t[2]==0,e[o]=t[1],v.apply(e,t)}),y=L(`fetchTaskAborting`),b=L(`fetchTaskScheduling`),x=Sr(l,`send`,()=>function(e,n){if(t.current[b]===!0||e[r])return x.apply(e,n);{let t={target:e,url:e[o],isPeriodic:!1,args:n,aborted:!1},r=nr(`XMLHttpRequest.send`,g,t,h,_);e&&e[s]===!0&&!t.aborted&&r.state===m&&r.invoke()}}),ee=Sr(l,`abort`,()=>function(e,n){let r=u(e);if(r&&typeof r.type==`string`){if(r.cancelFn==null||r.data&&r.data.aborted)return;r.zone.cancelTask(r)}else if(t.current[y]===!0)return ee.apply(e,n)})}}),e.__load_patch(`geolocation`,e=>{e.navigator&&e.navigator.geolocation&&sr(e.navigator.geolocation,[`getCurrentPosition`,`watchPosition`])}),e.__load_patch(`PromiseRejectionEvent`,(e,t)=>{function n(t){return function(n){Pr(e,t).forEach(r=>{let i=e.PromiseRejectionEvent;if(i){let e=new i(t,{promise:n.promise,reason:n.rejection});r.invoke(e)}})}}e.PromiseRejectionEvent&&(t[L(`unhandledPromiseRejectionHandler`)]=n(`unhandledrejection`),t[L(`rejectionHandledHandler`)]=n(`rejectionhandled`))}),e.__load_patch(`queueMicrotask`,(e,t,n)=>{Ir(e,n)})}function qr(e){e.__load_patch(`ZoneAwarePromise`,(e,t,n)=>{let r=Object.getOwnPropertyDescriptor,i=Object.defineProperty;function a(e){return e&&e.toString===Object.prototype.toString?(e.constructor&&e.constructor.name||``)+`: `+JSON.stringify(e):e?e.toString():Object.prototype.toString.call(e)}let o=n.symbol,s=[],c=e[o(`DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION`)]!==!1,l=o(`Promise`),u=o(`then`);n.onUnhandledError=e=>{if(n.showUncaughtError()){let t=e&&e.rejection;t?console.error(`Unhandled Promise rejection:`,t instanceof Error?t.message:t,`; Zone:`,e.zone.name,`; Task:`,e.task&&e.task.source,`; Value:`,t,t instanceof Error?t.stack:void 0):console.error(e)}},n.microtaskDrainDone=()=>{for(;s.length;){let e=s.shift();try{e.zone.runGuarded(()=>{throw e.throwOriginal?e.rejection:e})}catch(e){f(e)}}};let d=o(`unhandledPromiseRejectionHandler`);function f(e){n.onUnhandledError(e);try{let n=t[d];typeof n==`function`&&n.call(this,e)}catch(e){}}function p(e){return e&&typeof e.then==`function`}function m(e){return e}function h(e){return w.reject(e)}let g=o(`state`),_=o(`value`),v=o(`finally`),y=o(`parentPromiseValue`),b=o(`parentPromiseState`);function x(e,t){return n=>{try{S(e,t,n)}catch(t){S(e,!1,t)}}}let ee=function(){let e=!1;return function(t){return function(){e||(e=!0,t.apply(null,arguments))}}},te=o(`currentTaskTrace`);function S(e,r,o){let l=ee();if(e===o)throw TypeError(`Promise resolved with itself`);if(e[g]===null){let u=null;try{(typeof o==`object`||typeof o==`function`)&&(u=o&&o.then)}catch(t){return l(()=>{S(e,!1,t)})(),e}if(r!==!1&&o instanceof w&&o.hasOwnProperty(g)&&o.hasOwnProperty(_)&&o[g]!==null)C(o),S(e,o[g],o[_]);else if(r!==!1&&typeof u==`function`)try{u.call(o,l(x(e,r)),l(x(e,!1)))}catch(t){l(()=>{S(e,!1,t)})()}else{e[g]=r;let l=e[_];if(e[_]=o,e[v]===v&&r===!0&&(e[g]=e[b],e[_]=e[y]),r===!1&&o instanceof Error){let e=t.currentTask&&t.currentTask.data&&t.currentTask.data.__creationTrace__;e&&i(o,te,{configurable:!0,enumerable:!1,writable:!0,value:e})}for(let t=0;t<l.length;)re(e,l[t++],l[t++],l[t++],l[t++]);if(l.length==0&&r==0){e[g]=0;let r=o;try{throw Error(`Uncaught (in promise): `+a(o)+(o&&o.stack?`
|
|
2
|
-
`+o.stack:``))}catch(e){r=e}c&&(r.throwOriginal=!0),r.rejection=o,r.promise=e,r.zone=t.current,r.task=t.currentTask,s.push(r),n.scheduleMicroTask()}}}return e}let ne=o(`rejectionHandledHandler`);function C(e){if(e[g]===0){try{let n=t[ne];n&&typeof n==`function`&&n.call(this,{rejection:e[_],promise:e})}catch(e){}e[g]=!1;for(let t=0;t<s.length;t++)e===s[t].promise&&s.splice(t,1)}}function re(e,t,n,r,i){C(e);let a=e[g],o=a?typeof r==`function`?r:m:typeof i==`function`?i:h;t.scheduleMicroTask(`Promise.then`,()=>{try{let r=e[_],i=!!n&&v===n[v];i&&(n[y]=r,n[b]=a),S(n,!0,t.run(o,void 0,i&&o!==h&&o!==m?[]:[r]))}catch(e){S(n,!1,e)}},n)}let ie=function(){},ae=e.AggregateError;class w{static toString(){return`function ZoneAwarePromise() { [native code] }`}static resolve(e){return e instanceof w?e:S(new this(null),!0,e)}static reject(e){return S(new this(null),!1,e)}static withResolvers(){let e={};return e.promise=new w((t,n)=>{e.resolve=t,e.reject=n}),e}static any(e){if(!e||typeof e[Symbol.iterator]!=`function`)return Promise.reject(new ae([],`All promises were rejected`));let t=[],n=0;try{for(let r of e)n++,t.push(w.resolve(r))}catch(e){return Promise.reject(new ae([],`All promises were rejected`))}if(n===0)return Promise.reject(new ae([],`All promises were rejected`));let r=!1,i=[];return new w((e,a)=>{for(let o=0;o<t.length;o++)t[o].then(t=>{r||(r=!0,e(t))},e=>{i.push(e),n--,n===0&&(r=!0,a(new ae(i,`All promises were rejected`)))})})}static race(e){let t,n,r=new this((e,r)=>{t=e,n=r});function i(e){t(e)}function a(e){n(e)}for(let t of e)p(t)||(t=this.resolve(t)),t.then(i,a);return r}static all(e){return w.allWithCallback(e)}static allSettled(e){return(this&&this.prototype instanceof w?this:w).allWithCallback(e,{thenCallback:e=>({status:`fulfilled`,value:e}),errorCallback:e=>({status:`rejected`,reason:e})})}static allWithCallback(e,t){let n,r,i=new this((e,t)=>{n=e,r=t}),a=2,o=0,s=[];for(let i of e){p(i)||(i=this.resolve(i));let e=o;try{i.then(r=>{s[e]=t?t.thenCallback(r):r,a--,a===0&&n(s)},i=>{t?(s[e]=t.errorCallback(i),a--,a===0&&n(s)):r(i)})}catch(e){r(e)}a++,o++}return a-=2,a===0&&n(s),i}constructor(e){let t=this;if(!(t instanceof w))throw Error(`Must be an instanceof Promise.`);t[g]=null,t[_]=[];try{let n=ee();e&&e(n(x(t,!0)),n(x(t,!1)))}catch(e){S(t,!1,e)}}get[Symbol.toStringTag](){return`Promise`}get[Symbol.species](){return w}then(e,n){var r;let i=(r=this.constructor)==null?void 0:r[Symbol.species];(!i||typeof i!=`function`)&&(i=this.constructor||w);let a=new i(ie),o=t.current;return this[g]==null?this[_].push(o,a,e,n):re(this,o,a,e,n),a}catch(e){return this.then(null,e)}finally(e){var n;let r=(n=this.constructor)==null?void 0:n[Symbol.species];(!r||typeof r!=`function`)&&(r=w);let i=new r(ie);i[v]=v;let a=t.current;return this[g]==null?this[_].push(a,i,e,e):re(this,a,i,e,e),i}}w.resolve=w.resolve,w.reject=w.reject,w.race=w.race,w.all=w.all;let T=e[l]=e.Promise;e.Promise=w;let oe=o(`thenPatched`);function E(e){let t=e.prototype,n=r(t,`then`);if(n&&(n.writable===!1||!n.configurable))return;let i=t.then;t[u]=i,e.prototype.then=function(e,t){return new w((e,t)=>{i.call(this,e,t)}).then(e,t)},e[oe]=!0}n.patchThen=E;function se(e){return function(t,n){let r=e.apply(t,n);if(r instanceof w)return r;let i=r.constructor;return i[oe]||E(i),r}}if(T){E(T);let t=T.try;t&&typeof t==`function`&&(w.try=t),Sr(e,`fetch`,e=>se(e))}return Promise[t.__symbol__(`uncaughtPromiseErrors`)]=s,w})}function Jr(e){e.__load_patch(`toString`,e=>{let t=Function.prototype.toString,n=L(`OriginalDelegate`),r=L(`Promise`),i=L(`Error`),a=function(){if(typeof this==`function`){let a=this[n];if(a)return typeof a==`function`?t.call(a):Object.prototype.toString.call(a);if(this===Promise){let n=e[r];if(n)return t.call(n)}if(this===Error){let n=e[i];if(n)return t.call(n)}}return t.call(this)};a[n]=t,Function.prototype.toString=a;let o=Object.prototype.toString;Object.prototype.toString=function(){return typeof Promise==`function`&&this instanceof Promise?`[object Promise]`:o.call(this)}})}function Yr(e,t,n,r,i){let a=Zone.__symbol__(r);if(t[a])return;let o=t[a]=t[r];t[r]=function(a,s,c){return s&&s.prototype&&i.forEach(function(t){let i=`${n}.${r}::`+t,a=s.prototype;try{if(a.hasOwnProperty(t)){let n=e.ObjectGetOwnPropertyDescriptor(a,t);n&&n.value?(n.value=e.wrapWithCurrentZone(n.value,i),e._redefineProperty(s.prototype,t,n)):a[t]&&(a[t]=e.wrapWithCurrentZone(a[t],i))}else a[t]&&(a[t]=e.wrapWithCurrentZone(a[t],i))}catch(e){}}),o.call(t,a,s,c)},e.attachOriginToPatched(t[r],o)}function Xr(e){e.__load_patch(`util`,(e,t,n)=>{let r=Wr(e);n.patchOnProperties=_r,n.patchMethod=Sr,n.bindArguments=or,n.patchMacroTask=Cr;let i=t.__symbol__(`BLACK_LISTED_EVENTS`),a=t.__symbol__(`UNPATCHED_EVENTS`);e[a]&&(e[i]=e[a]),e[i]&&(t[i]=t[a]=e[i]),n.patchEventPrototype=Fr,n.patchEventTarget=Nr,n.ObjectDefineProperty=Wn,n.ObjectGetOwnPropertyDescriptor=Un,n.ObjectCreate=Kn,n.ArraySlice=qn,n.patchClass=yr,n.wrapWithCurrentZone=tr,n.filterProperties=Hr,n.attachOriginToPatched=wr,n._redefineProperty=Object.defineProperty,n.patchCallbacks=Yr,n.getGlobalObjects=()=>({globalSources:kr,zoneSymbolEventNames:Or,eventNames:r,isBrowser:dr,isMix:fr,isNode:ur,TRUE_STR:Qn,FALSE_STR:$n,ZONE_SYMBOL_PREFIX:er,ADD_EVENT_LISTENER_STR:Jn,REMOVE_EVENT_LISTENER_STR:Yn})})}function Zr(e){qr(e),Jr(e),Xr(e)}var Qr=Hn();Zr(Qr),Kr(Qr);function $r(e){return e.setValue(ti,!0)}function ei(e){return e.getValue(ti)===!0}var ti,ni=t((()=>{M(),ti=se(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)})),ri,ii,ai=t((()=>{ri=`baggage`,ii=4096}));function oi(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function si(e){return e.getAllEntries().map(([e,t])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(n+=`;`+t.metadata.toString()),n})}function ci(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch(e){return}let c;return t!==-1&&t<e.length-1&&(c=T(e.substring(t+1))),{key:o,value:s,metadata:c}}var li=t((()=>{M(),ai()})),ui,di=t((()=>{M(),ni(),ai(),li(),ui=class{inject(e,t,n){let r=Yt.getBaggage(e);if(!r||ei(e))return;let i=oi(si(r).filter(e=>e.length<=ii).slice(0,180));i.length>0&&n.set(t,ri,i)}extract(e,t,n){let r=n.get(t,ri),i=Array.isArray(r)?r.join(`,`):r;if(!i)return e;let a={};return i.length===0||(i.split(`,`).forEach(e=>{let t=ci(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),a[t.key]=e}}),Object.entries(a).length===0)?e:Yt.setBaggage(e,Yt.createBaggage(a))}fields(){return[ri]}}}));function fi(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!pi(n)){A.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!mi(r)){A.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function pi(e){return typeof e==`string`&&e!==``}function mi(e){return e==null?!0:Array.isArray(e)?hi(e):gi(typeof e)}function hi(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(gi(e)){t=e;continue}return!1}return!1}}return!0}function gi(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var _i=t((()=>{M()}));function vi(){return e=>{A.error(yi(e))}}function yi(e){return typeof e==`string`?e:JSON.stringify(bi(e))}function bi(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var xi=t((()=>{M()}));function Si(e){try{Ci(e)}catch(e){}}var Ci,wi=t((()=>{xi(),Ci=vi()})),Ti=t((()=>{})),Ei,Di=t((()=>{Ei=`2.7.1`})),Oi=t((()=>{})),ki=t((()=>{Oi()})),Ai=t((()=>{})),ji=t((()=>{Ai()})),Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji=t((()=>{Mi=`error.type`,Ni=`exception.message`,Pi=`exception.stacktrace`,Fi=`exception.type`,Ii=`http.request.method`,Li=`http.request.method_original`,Ri=`http.response.status_code`,zi=`server.address`,Bi=`server.port`,Vi=`service.name`,Hi=`telemetry.sdk.language`,Ui=`webjs`,Wi=`telemetry.sdk.name`,Gi=`telemetry.sdk.version`,Ki=`url.full`,qi=`user_agent.original`})),Yi=t((()=>{})),Xi=t((()=>{})),Zi=t((()=>{ki(),ji(),Ji(),Yi(),Xi()})),Qi,$i=t((()=>{Qi=`process.runtime.name`})),ea,ta=t((()=>{Di(),Zi(),$i(),ea={[Wi]:`opentelemetry`,[Qi]:`browser`,[Hi]:Ui,[Gi]:Ei}})),z,na=t((()=>{Ti(),ta(),z=performance}));function ra(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*pa)]}function ia(e){return da(ra(z.timeOrigin),ra(typeof e==`number`?e:z.now()))}function aa(e){if(la(e))return e;if(typeof e==`number`)return e<z.timeOrigin?ia(e):ra(e);if(e instanceof Date)return ra(e.getTime());throw TypeError(`Invalid input type`)}function oa(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=ma),[n,r]}function sa(e){return e[0]*ma+e[1]}function ca(e){return e[0]*1e6+e[1]/1e3}function la(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function ua(e){return la(e)||typeof e==`number`||e instanceof Date}function da(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=ma&&(n[1]-=ma,n[0]+=1),n}var fa,pa,ma,ha=t((()=>{na(),fa=9,pa=Math.pow(10,6),ma=Math.pow(10,fa)})),ga,_a=t((()=>{(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(ga||(ga={}))})),va,ya=t((()=>{M(),F(),va=class{constructor(e={}){var t;P(this,`_propagators`,void 0),P(this,`_fields`,void 0),this._propagators=(t=e.propagators)==null?[]:t;let n=new Set;for(let e of this._propagators){let t=typeof e.fields==`function`?e.fields():[];for(let e of t)n.add(e)}this._fields=Array.from(n)}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){A.warn(`Failed to inject with ${r.constructor.name}. Err: ${e.message}`)}}extract(e,t,n){return this._propagators.reduce((e,r)=>{try{return r.extract(e,t,n)}catch(e){A.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}}}));function ba(e){return Ta.test(e)}function xa(e){return Ea.test(e)&&!Da.test(e)}var Sa,Ca,wa,Ta,Ea,Da,Oa=t((()=>{Sa=`[_0-9a-z-*/]`,Ca=`[a-z]${Sa}{0,255}`,wa=`[a-z0-9]${Sa}{0,240}@[a-z]${Sa}{0,13}`,Ta=RegExp(`^(?:${Ca}|${wa})$`),Ea=/^[ -~]{0,255}[!-~]$/,Da=/,|=/})),ka,Aa,ja,Ma,Na,Pa=t((()=>{Oa(),F(),ka=32,Aa=512,ja=`,`,Ma=`=`,Na=class e{constructor(e){P(this,`_length`,void 0),P(this,`_rawTraceState`,void 0),P(this,`_internalState`,void 0),this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!ba(e)||!xa(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(typeof r==`string`?i+=t.length-r.length:i+=e.length+t.length+(n.size>0?2:1),i>Aa)return this;let a=new Map(n);return a.delete(e),a.set(e,t),this._fromState(a,i)}unset(e){let t=this._getState(),n=t.get(e);if(typeof n!=`string`)return this;let r=this._length-(e.length+n.length+1);t.size>1&&--r;let i=new Map(t);return i.delete(e),this._fromState(i,r)}get(e){return this._getState().get(e)}serialize(){let e=``,t=0;for(let n of this._getState())t>0&&(e=ja+e),e=`${n[0]}${Ma}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(ja),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(Ma);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!ba(a)||!xa(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>Aa)&&(t.set(a,o),n=s,t.size>=ka))break}return this._length=n,this._internalState=new Map(Array.from(t.entries()).reverse()),this._internalState}_fromState(t,n){let r=Object.create(e.prototype);return r._internalState=t,r._length=n,r}}}));function Fa(e){let t=za.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Ia,La,Ra,za,Ba,Va=t((()=>{M(),ni(),Pa(),Ia=`traceparent`,La=`tracestate`,Ra=`00`,za=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`),Ba=class{inject(e,t,n){let r=j.getSpanContext(e);if(!r||ei(e)||!at(r))return;let i=`${Ra}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||O.NONE).toString(16)}`;n.set(t,Ia,i),r.traceState&&n.set(t,La,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,Ia);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=Fa(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,La);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Na(typeof e==`string`?e:void 0)}return j.setSpanContext(e,a)}fields(){return[Ia,La]}}}));function Ha(e){if(!Ua(e)||Wa(e)!==qa)return!1;let t=Qa(e);if(t===null)return!0;let n=eo.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Xa.call(n)===Za}function Ua(e){return typeof e==`object`&&!!e}function Wa(e){return e==null?e===void 0?Ya:Ja:to&&to in Object(e)?Ga(e):Ka(e)}function Ga(e){let t=eo.call(e,to),n=e[to],r=!1;try{e[to]=void 0,r=!0}catch(e){}let i=no.call(e);return r&&(t?e[to]=n:delete e[to]),i}function Ka(e){return no.call(e)}var qa,Ja,Ya,Xa,Za,Qa,$a,eo,to,no,ro=t((()=>{qa=`[object Object]`,Ja=`[object Null]`,Ya=`[object Undefined]`,Xa=Function.prototype.toString,Za=Xa.call(Object),Qa=Object.getPrototypeOf,$a=Object.prototype,eo=$a.hasOwnProperty,to=Symbol?Symbol.toStringTag:void 0,no=$a.toString}));function io(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=oo(t,e.shift(),0,n);return t}function ao(e){return co(e)?e.slice():e}function oo(e,t,n=0,r){let i;if(!(n>mo)){if(n++,fo(e)||fo(t)||lo(t))i=ao(t);else if(co(e)){if(i=e.slice(),co(t))for(let e=0,n=t.length;e<n;e++)i.push(ao(t[e]));else if(uo(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=ao(t[r]))}}}else if(uo(e))if(uo(t)){if(!po(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(fo(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(so(e,s,r)||so(t,s,r))delete i[s];else{if(uo(a)&&uo(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=oo(i[s],c,n,r)}}}}else i=t;return i}}function so(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function co(e){return Array.isArray(e)}function lo(e){return typeof e==`function`}function uo(e){return!fo(e)&&!co(e)&&!lo(e)&&typeof e==`object`}function fo(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function po(e,t){return!(!Ha(e)||!Ha(t))}var mo,ho=t((()=>{ro(),mo=20}));function go(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new _o(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var _o,vo=t((()=>{_o=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}}));function yo(e,t){return typeof t==`string`?e===t:!!e.match(t)}function bo(e,t){if(!t)return!1;for(let n of t)if(yo(e,n))return!0;return!1}var xo=t((()=>{})),So,Co=t((()=>{F(),So=class{constructor(){P(this,`_promise`,void 0),P(this,`_resolve`,void 0),P(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}})),wo,To=t((()=>{Co(),F(),wo=class{constructor(e,t){P(this,`_isCalled`,!1),P(this,`_deferred`,new So),P(this,`_callback`,void 0),P(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}}));function Eo(e,t){return new Promise(n=>{k.with($r(k.active()),()=>{e.export(t,n)})})}var Do=t((()=>{M(),ni()})),Oo,B=t((()=>{di(),F(),_i(),wi(),xi(),ha(),_a(),li(),na(),ya(),Va(),M(),ni(),Pa(),ho(),vo(),xo(),To(),Do(),Oo={_export:Eo}}));F();var ko=class{constructor(e){P(this,`_delegate`,void 0),this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}};F();var Ao=class extends Error{constructor(e,t,n){super(e),P(this,`code`,void 0),P(this,`name`,`OTLPExporterError`),P(this,`data`,void 0),this.data=n,this.code=t}};function jo(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function V(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){jo(a,r,i,o,s,`next`,e)}function s(e){jo(a,r,i,o,s,`throw`,e)}o(void 0)})}}var H=t((()=>{}));H();function Mo(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function No(e){if(e!=null)return V(function*(){return e})}function Po(e,t,n){var r,i,a,o,s,c;return{timeoutMillis:Mo((r=(i=e.timeoutMillis)==null?t.timeoutMillis:i)==null?n.timeoutMillis:r),concurrencyLimit:(a=(o=e.concurrencyLimit)==null?t.concurrencyLimit:o)==null?n.concurrencyLimit:a,compression:(s=(c=e.compression)==null?t.compression:c)==null?n.compression:s}}function Fo(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}F(),H();var Io=class{constructor(e){P(this,`_concurrencyLimit`,void 0),P(this,`_sendingPromises`,[]),this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}awaitAll(){var e=this;return V(function*(){yield Promise.all(e._sendingPromises)})()}};function Lo(e){return new Io(e.concurrencyLimit)}M();function Ro(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function zo(){return{handleResponse(e){e==null||!Ro(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||A.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}B(),M(),F(),H();var Bo=class{constructor(e,t,n,r,i){P(this,`_diagLogger`,void 0),P(this,`_transport`,void 0),P(this,`_serializer`,void 0),P(this,`_responseHandler`,void 0),P(this,`_promiseQueue`,void 0),P(this,`_timeout`,void 0),this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=A.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:ga.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:ga.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:ga.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:ga.FAILED,error:e.error});return}else if(e.status===`retryable`){var n;t({code:ga.FAILED,error:(n=e.error)==null?new Ao(`Export failed with retryable status`):n})}else t({code:ga.FAILED,error:new Ao(`Export failed with unknown error`)})},e=>t({code:ga.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}shutdown(){var e=this;return V(function*(){e._diagLogger.debug(`shutdown started`),yield e.forceFlush(),e._transport.shutdown()})()}};function Vo(e,t){return new Bo(e.transport,e.serializer,zo(),e.promiseHandler,t.timeout)}function Ho(e,t,n){return Vo({transport:n,serializer:t,promiseHandler:Lo(e)},{timeout:e.timeoutMillis})}var Uo;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(Uo||(Uo={}));var U;(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(U||(U={}));var Wo;(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(Wo||(Wo={}));function Go(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function Ko(e){var t,n;return`${e.name}:${(t=e.version)==null?``:t}:${(n=e.schemaUrl)==null?``:n}`}var qo=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Jo(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new qo(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function Yo(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Xo(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function Zo(e,t){return e.toLowerCase()===t.toLowerCase()}var Qo;(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(Qo||(Qo={})),F();var $o=class{constructor(){P(this,`kind`,Qo.DROP)}createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}};F();function es(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var ts=class{constructor(e,t,n=!0,r=es(t)){P(this,`startTime`,void 0),P(this,`_boundaries`,void 0),P(this,`_recordMinMax`,void 0),P(this,`_current`,void 0),this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=Xo(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},ns=class{constructor(e,t){P(this,`kind`,Qo.HISTOGRAM),P(this,`_boundaries`,void 0),P(this,`_recordMinMax`,void 0),this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new ts(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new ts(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new ts(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wo.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===U.GAUGE||e.type===U.UP_DOWN_COUNTER||e.type===U.OBSERVABLE_GAUGE||e.type===U.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}};F();var rs=class e{constructor(e=new is,t=0,n=0,r=0){P(this,`backing`,void 0),P(this,`indexBase`,void 0),P(this,`indexStart`,void 0),P(this,`indexEnd`,void 0),this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},is=class e{constructor(e=[0]){P(this,`_counts`,void 0),this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}},as=2146435072,os=1048575,ss=1023,cs=-ss+1,ls=ss,us=Math.pow(2,-1022);function ds(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&as)>>20)-ss}function fs(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let n=t.getUint32(0),r=t.getUint32(4);return(n&os)*Math.pow(2,32)+r}function ps(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*Math.pow(2,t)}function ms(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var hs=class extends Error{};F();var gs=class{constructor(e){P(this,`_shift`,void 0),this._shift=-e}mapToIndex(e){return e<us?this._minNormalLowerBoundaryIndex():ds(e)+this._rightShift(fs(e)-1,52)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new hs(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new hs(`overflow: ${e} is > maximum lower boundary: ${n}`);return ps(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=cs>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return ls>>this._shift}_rightShift(e,t){return Math.floor(e*Math.pow(2,-t))}};F();var _s=class{constructor(e){P(this,`_scale`,void 0),P(this,`_scaleFactor`,void 0),P(this,`_inverseFactor`,void 0),this._scale=e,this._scaleFactor=ps(Math.LOG2E,e),this._inverseFactor=ps(Math.LN2,-e)}mapToIndex(e){if(e<=us)return this._minNormalLowerBoundaryIndex()-1;if(fs(e)===0)return(ds(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new hs(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return us;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new hs(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return cs<<this._scale}_maxNormalLowerBoundaryIndex(){return(ls+1<<this._scale)-1}},vs=-10,ys=20,bs=Array.from({length:31},(e,t)=>t>10?new _s(t-10):new gs(t-10));function xs(e){if(e>ys||e<vs)throw new hs(`expected scale >= ${vs} && <= ${ys}, got: ${e}`);return bs[e+10]}M(),F();var Ss=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}constructor(e,t){P(this,`low`,void 0),P(this,`high`,void 0),this.low=e,this.high=t}},Cs=20,ws=160,Ts=2,Es=class e{constructor(e,t=ws,n=!0,r=0,i=0,a=0,o=1/0,s=-1/0,c=new rs,l=new rs,u=xs(Cs)){P(this,`startTime`,void 0),P(this,`_maxSize`,void 0),P(this,`_recordMinMax`,void 0),P(this,`_sum`,void 0),P(this,`_count`,void 0),P(this,`_zeroCount`,void 0),P(this,`_min`,void 0),P(this,`_max`,void 0),P(this,`_positive`,void 0),P(this,`_negative`,void 0),P(this,`_mapping`,void 0),this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=i,this._zeroCount=a,this._min=o,this._max=s,this._positive=c,this._negative=l,this._mapping=u,this._maxSize<Ts&&(A.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
|
|
3
|
-
changing to the minimum size of: ${Ts}`),this._maxSize=Ts)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){if(!Number.isNaN(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,n){let r=this._mapping.mapToIndex(t),i=!1,a=0,o=0;if(e.length===0?(e.indexStart=r,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):r<e.indexStart&&e.indexEnd-r>=this._maxSize?(i=!0,o=r,a=e.indexEnd):r>e.indexEnd&&r-e.indexStart>=this._maxSize&&(i=!0,o=e.indexStart,a=r),i){let e=this._changeScale(a,o);this._downscale(e),r=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,r,n)}_incrementIndexBy(e,t,n){if(n===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let n=e.indexEnd-t;n>=e.backing.length&&this._grow(e,n+1),e.indexStart=t}else if(t>e.indexEnd){let n=t-e.indexStart;n>=e.backing.length&&this._grow(e,n+1),e.indexEnd=t}let r=t-e.indexBase;r<0&&(r+=e.backing.length),e.incrementBucket(r,n)}_grow(e,t){let n=e.backing.length,r=e.indexBase-e.indexStart,i=n-r,a=ms(t);a>this._maxSize&&(a=this._maxSize);let o=a-r;e.backing.growTo(a,i,o)}_changeScale(e,t){let n=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,n++;return n}_downscale(e){if(e===0)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=xs(t)}_minScale(e){let t=Math.min(this.scale,e.scale),n=Ss.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),r=Ss.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(n.high,n.low),t-this._changeScale(r.high,r.low))}_highLowAtScale(e,t,n){if(e.length===0)return new Ss(0,-1);let r=t-n;return new Ss(e.indexStart>>r,e.indexEnd>>r)}_mergeBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++)this._incrementIndexBy(e,i+t>>a,n.at(t))}_diffBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++){let r=(i+t>>a)-e.indexBase;r<0&&(r+=e.backing.length),e.decrementBucket(r,n.at(t))}e.trim()}},Ds=class{constructor(e,t){P(this,`kind`,Qo.EXPONENTIAL_HISTOGRAM),P(this,`_maxSize`,void 0),P(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new Es(e,this._maxSize,this._recordMinMax)}merge(e,t){let n=t.clone();return n.merge(e),n}diff(e,t){let n=t.clone();return n.diff(e),n}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wo.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===U.GAUGE||e.type===U.UP_DOWN_COUNTER||e.type===U.OBSERVABLE_GAUGE||e.type===U.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,positive:{offset:i.positive.offset,bucketCounts:i.positive.bucketCounts},negative:{offset:i.negative.offset,bucketCounts:i.negative.bucketCounts},count:i.count,scale:i.scale,zeroCount:i.zeroCount}}})}}};B(),F();var Os=class{constructor(e,t=0,n=[0,0]){P(this,`startTime`,void 0),P(this,`_current`,void 0),P(this,`sampleTime`,void 0),this.startTime=e,this._current=t,this.sampleTime=n}record(e){this._current=e,this.sampleTime=ra(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},ks=class{constructor(){P(this,`kind`,Qo.LAST_VALUE)}createAccumulation(e){return new Os(e)}merge(e,t){let n=ca(t.sampleTime)>=ca(e.sampleTime)?t:e;return new Os(e.startTime,n.toPointValue(),n.sampleTime)}diff(e,t){let n=ca(t.sampleTime)>=ca(e.sampleTime)?t:e;return new Os(t.startTime,n.toPointValue(),n.sampleTime)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wo.GAUGE,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()}))}}};F();var As=class{constructor(e,t,n=0,r=!1){P(this,`startTime`,void 0),P(this,`monotonic`,void 0),P(this,`_current`,void 0),P(this,`reset`,void 0),this.startTime=e,this.monotonic=t,this._current=n,this.reset=r}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},js=class{constructor(e){P(this,`kind`,Qo.SUM),P(this,`monotonic`,void 0),this.monotonic=e}createAccumulation(e){return new As(e,this.monotonic)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue();return t.reset?new As(t.startTime,this.monotonic,r,t.reset):new As(e.startTime,this.monotonic,n+r)}diff(e,t){let n=e.toPointValue(),r=t.toPointValue();return this.monotonic&&n>r?new As(t.startTime,this.monotonic,r,!0):new As(t.startTime,this.monotonic,r-n)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wo.SUM,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()})),isMonotonic:this.monotonic}}};M(),F();var Ms=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};P(Ms,`DEFAULT_INSTANCE`,new $o);var Ns=class e{createAggregator(t){switch(t.type){case U.COUNTER:case U.OBSERVABLE_COUNTER:case U.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}};P(Ns,`MONOTONIC_INSTANCE`,new js(!0)),P(Ns,`NON_MONOTONIC_INSTANCE`,new js(!1));var Ps=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};P(Ps,`DEFAULT_INSTANCE`,new ks);var Fs=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};P(Fs,`DEFAULT_INSTANCE`,new ns([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0));var Is=class{constructor(e,t=!0){if(P(this,`_boundaries`,void 0),P(this,`_recordMinMax`,void 0),e==null)throw Error(`ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array`);e=e.concat(),e=e.sort((e,t)=>e-t);let n=e.lastIndexOf(-1/0),r=e.indexOf(1/0);r===-1&&(r=void 0),this._boundaries=e.slice(n+1,r),this._recordMinMax=t}createAggregator(e){return new ns(this._boundaries,this._recordMinMax)}},Ls=class{constructor(e=160,t=!0){P(this,`_maxSize`,void 0),P(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new Ds(this._maxSize,this._recordMinMax)}},Rs=class{_resolve(e){switch(e.type){case U.COUNTER:case U.UP_DOWN_COUNTER:case U.OBSERVABLE_COUNTER:case U.OBSERVABLE_UP_DOWN_COUNTER:return Bs;case U.GAUGE:case U.OBSERVABLE_GAUGE:return Vs;case U.HISTOGRAM:return e.advice.explicitBucketBoundaries?new Is(e.advice.explicitBucketBoundaries):Hs}return A.warn(`Unable to recognize instrument type: ${e.type}`),zs}createAggregator(e){return this._resolve(e).createAggregator(e)}},zs=new Ms,Bs=new Ns,Vs=new Ps,Hs=new Fs;new Ls;var Us=new Rs,Ws;(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`})(Ws||(Ws={}));function Gs(e){switch(e.type){case Ws.DEFAULT:return Us;case Ws.DROP:return zs;case Ws.SUM:return Bs;case Ws.LAST_VALUE:return Vs;case Ws.EXPONENTIAL_HISTOGRAM:{var t,n;let r=e;return new Ls((t=r.options)==null?void 0:t.maxSize,(n=r.options)==null?void 0:n.recordMinMax)}case Ws.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;if(t.options==null)return Hs;var r,i;return new Is((r=t.options)==null?void 0:r.boundaries,(i=t.options)==null?void 0:i.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}var Ks=e=>({type:Ws.DEFAULT}),qs=e=>Uo.CUMULATIVE;M(),F(),H();var Js=class{constructor(e){var t,n,r;P(this,`_shutdown`,!1),P(this,`_metricProducers`,void 0),P(this,`_sdkMetricProducer`,void 0),P(this,`_aggregationTemporalitySelector`,void 0),P(this,`_aggregationSelector`,void 0),P(this,`_cardinalitySelector`,void 0),this._aggregationSelector=(t=e==null?void 0:e.aggregationSelector)==null?Ks:t,this._aggregationTemporalitySelector=(n=e==null?void 0:e.aggregationTemporalitySelector)==null?qs:n,this._metricProducers=(r=e==null?void 0:e.metricProducers)==null?[]:r,this._cardinalitySelector=e==null?void 0:e.cardinalitySelector}setMetricProducer(e){if(this._sdkMetricProducer)throw Error(`MetricReader can not be bound to a MeterProvider again.`);this._sdkMetricProducer=e,this.onInitialized()}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}collect(e){var t=this;return V(function*(){if(t._sdkMetricProducer===void 0)throw Error(`MetricReader is not bound to a MetricProducer`);if(t._shutdown)throw Error(`MetricReader is shutdown`);let[n,...r]=yield Promise.all([t._sdkMetricProducer.collect({timeoutMillis:e==null?void 0:e.timeoutMillis}),...t._metricProducers.map(t=>t.collect({timeoutMillis:e==null?void 0:e.timeoutMillis}))]),i=n.errors.concat(r.flatMap(e=>e.errors));return{resourceMetrics:{resource:n.resourceMetrics.resource,scopeMetrics:n.resourceMetrics.scopeMetrics.concat(r.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:i}})()}shutdown(e){var t=this;return V(function*(){if(t._shutdown){A.error(`Cannot call shutdown twice.`);return}(e==null?void 0:e.timeoutMillis)==null?yield t.onShutdown():yield Jo(t.onShutdown(),e.timeoutMillis),t._shutdown=!0})()}forceFlush(e){var t=this;return V(function*(){if(t._shutdown){A.warn(`Cannot forceFlush on already shutdown MetricReader.`);return}if((e==null?void 0:e.timeoutMillis)==null){yield t.onForceFlush();return}yield Jo(t.onForceFlush(),e.timeoutMillis)})()}};function Ys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ys(Object(n),!0).forEach(function(t){P(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var G=t((()=>{F()}));M(),B(),F(),G(),H();var Xs=class extends Js{constructor(e){var t,n;let{exporter:r,exportIntervalMillis:i=6e4,metricProducers:a,cardinalityLimits:o}=e,{exportTimeoutMillis:s=3e4}=e;if(super({aggregationSelector:(t=r.selectAggregation)==null?void 0:t.bind(r),aggregationTemporalitySelector:(n=r.selectAggregationTemporality)==null?void 0:n.bind(r),metricProducers:a,cardinalitySelector:e=>{let t=W({default:2e3},o);switch(e){case U.COUNTER:var n;return(n=t.counter)==null?t.default:n;case U.GAUGE:var r;return(r=t.gauge)==null?t.default:r;case U.HISTOGRAM:var i;return(i=t.histogram)==null?t.default:i;case U.OBSERVABLE_COUNTER:var a;return(a=t.observableCounter)==null?t.default:a;case U.OBSERVABLE_UP_DOWN_COUNTER:var s;return(s=t.observableUpDownCounter)==null?t.default:s;case U.OBSERVABLE_GAUGE:var c;return(c=t.observableGauge)==null?t.default:c;case U.UP_DOWN_COUNTER:var l;return(l=t.upDownCounter)==null?t.default:l;default:return t.default}}}),P(this,`_interval`,void 0),P(this,`_exporter`,void 0),P(this,`_exportInterval`,void 0),P(this,`_exportTimeout`,void 0),i<=0)throw Error(`exportIntervalMillis must be greater than 0`);if(s<=0)throw Error(`exportTimeoutMillis must be greater than 0`);if(i<s){if(`exportIntervalMillis`in e&&`exportTimeoutMillis`in e)throw Error(`exportIntervalMillis must be greater than or equal to exportTimeoutMillis`);A.info(`Timeout of ${s} exceeds the interval of ${i}. Clamping timeout to interval duration.`),s=i}this._exportInterval=i,this._exportTimeout=s,this._exporter=r}_runOnce(){var e=this;return V(function*(){try{yield Jo(e._doRun(),e._exportTimeout)}catch(t){if(t instanceof qo){A.error(`Export took longer than %s milliseconds and timed out.`,e._exportTimeout);return}Si(t)}})()}_doRun(){var e=this;return V(function*(){let{resourceMetrics:t,errors:n}=yield e.collect({timeoutMillis:e._exportTimeout});if(n.length>0&&A.error(`PeriodicExportingMetricReader: metrics collection errors`,...n),t.resource.asyncAttributesPending)try{var r,i;yield(r=(i=t.resource).waitForAsyncAttributes)==null?void 0:r.call(i)}catch(e){A.debug(`Error while resolving async portion of resource: `,e),Si(e)}if(t.scopeMetrics.length===0)return;let a=yield Oo._export(e._exporter,t);if(a.code!==ga.SUCCESS)throw Error(`PeriodicExportingMetricReader: metrics export failed (error ${a.error})`)})()}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!=`number`&&this._interval.unref()}onForceFlush(){var e=this;return V(function*(){yield e._runOnce(),yield e._exporter.forceFlush()})()}onShutdown(){var e=this;return V(function*(){e._interval&&clearInterval(e._interval),yield e.onForceFlush(),yield e._exporter.shutdown()})()}};function Zs(){if(Qs===void 0)try{let e=globalThis.process.argv0;Qs=e?`unknown_service:${e}`:`unknown_service`}catch(e){Qs=`unknown_service`}return Qs}var Qs,$s=t((()=>{})),ec,tc=t((()=>{ec=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}));function nc(e,t){return sc.FromAttributeList(Object.entries(e),t)}function rc(){return nc({[Vi]:Zs(),[Hi]:ea[Hi],[Wi]:ea[Wi],[Gi]:ea[Gi]})}function ic(e){return e.map(([e,t])=>ec(t)?[e,t.catch(t=>{A.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function ac(e){if(typeof e==`string`||e===void 0)return e;A.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function oc(e,t){let n=e==null?void 0:e.schemaUrl,r=t==null?void 0:t.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;A.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var sc,cc=t((()=>{M(),B(),Zi(),$s(),tc(),F(),H(),sc=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=ic(t),r._asyncAttributesPending=t.filter(([e,t])=>ec(t)).length>0,r}constructor(e,t){var n;P(this,`_rawAttributes`,void 0),P(this,`_asyncAttributesPending`,!1),P(this,`_schemaUrl`,void 0),P(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(ec(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=ic(this._rawAttributes),this._schemaUrl=ac(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return V(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,ec(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&A.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(ec(n)){A.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]!=null||(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=oc(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}})),lc=t((()=>{M(),cc(),Zi(),B(),F(),$s()}));F();var uc=class{constructor(){P(this,`_registeredViews`,[])}addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(n=>this._matchInstrument(n.instrumentSelector,e)&&this._matchMeter(n.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}};M();function dc(e,t,n){var r,i,a,o;return hc(e)||A.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:(r=n==null?void 0:n.description)==null?``:r,unit:(i=n==null?void 0:n.unit)==null?``:i,valueType:(a=n==null?void 0:n.valueType)==null?Ae.DOUBLE:a,advice:(o=n==null?void 0:n.advice)==null?{}:o}}function fc(e,t){var n,r;return{name:(n=e.name)==null?t.name:n,description:(r=e.description)==null?t.description:r,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function pc(e,t){return Zo(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var mc=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function hc(e){return mc.test(e)}M(),B(),F();var gc=class{constructor(e,t){P(this,`_writableMetricStorage`,void 0),P(this,`_descriptor`,void 0),this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},n=k.active()){if(typeof e!=`number`){A.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`);return}this._descriptor.valueType===Ae.INT&&!Number.isInteger(e)&&(A.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,n,ra(Date.now()))}},_c=class extends gc{add(e,t,n){this._record(e,t,n)}},vc=class extends gc{add(e,t,n){if(e<0){A.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},yc=class extends gc{record(e,t,n){this._record(e,t,n)}},bc=class extends gc{record(e,t,n){if(e<0){A.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},xc=class{constructor(e,t,n){P(this,`_metricStorages`,void 0),P(this,`_descriptor`,void 0),P(this,`_observableRegistry`,void 0),this._descriptor=e,this._metricStorages=t,this._observableRegistry=n}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}},Sc=class extends xc{},Cc=class extends xc{},wc=class extends xc{};function Tc(e){return e instanceof xc}F();var Ec=class{constructor(e){P(this,`_meterSharedState`,void 0),this._meterSharedState=e}createGauge(e,t){let n=dc(e,U.GAUGE,t);return new yc(this._meterSharedState.registerMetricStorage(n),n)}createHistogram(e,t){let n=dc(e,U.HISTOGRAM,t);return new bc(this._meterSharedState.registerMetricStorage(n),n)}createCounter(e,t){let n=dc(e,U.COUNTER,t);return new vc(this._meterSharedState.registerMetricStorage(n),n)}createUpDownCounter(e,t){let n=dc(e,U.UP_DOWN_COUNTER,t);return new _c(this._meterSharedState.registerMetricStorage(n),n)}createObservableGauge(e,t){let n=dc(e,U.OBSERVABLE_GAUGE,t);return new Cc(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let n=dc(e,U.OBSERVABLE_COUNTER,t);return new Sc(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let n=dc(e,U.OBSERVABLE_UP_DOWN_COUNTER,t);return new wc(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}};F();var Dc=class{constructor(e){P(this,`_instrumentDescriptor`,void 0),this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=dc(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}};F();var Oc=class{constructor(e){P(this,`_valueMap`,new Map),P(this,`_keyMap`,new Map),P(this,`_hash`,void 0),this._hash=e}get(e,t){return t!=null||(t=this._hash(e)),this._valueMap.get(t)}getOrDefault(e,t){let n=this._hash(e);if(this._valueMap.has(n))return this._valueMap.get(n);let r=t();return this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,r),r}set(e,t,n){n!=null||(n=this._hash(e)),this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,t)}has(e,t){return t!=null||(t=this._hash(e)),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}},kc=class extends Oc{constructor(){super(Go)}};F();var Ac=class{constructor(e,t){P(this,`_activeCollectionStorage`,new kc),P(this,`_cumulativeMemoStorage`,new kc),P(this,`_cardinalityLimit`,void 0),P(this,`_overflowAttributes`,{"otel.metric.overflow":!0}),P(this,`_overflowHashCode`,void 0),P(this,`_aggregator`,void 0),this._aggregator=e,this._cardinalityLimit=(t==null?2e3:t)-1,this._overflowHashCode=Go(this._overflowAttributes)}record(e,t,n,r){let i=this._activeCollectionStorage.get(t);if(!i){if(this._activeCollectionStorage.size>=this._cardinalityLimit){let t=this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(r));t==null||t.record(e);return}i=this._aggregator.createAccumulation(r),this._activeCollectionStorage.set(t,i)}i==null||i.record(e)}batchCumulate(e,t){for(let[n,r,i]of e.entries()){let e=n,a=i,o=this._aggregator.createAccumulation(t);o==null||o.record(r);let s=o;if(this._cumulativeMemoStorage.has(e,a)){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(e,a))){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}if(this._activeCollectionStorage.has(e,a)){let t=this._activeCollectionStorage.get(e,a);s=this._aggregator.merge(t,s)}this._cumulativeMemoStorage.set(e,o,a),this._activeCollectionStorage.set(e,s,a)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new kc,e}};F();var jc=class e{constructor(e,t){P(this,`_aggregator`,void 0),P(this,`_unreportedAccumulations`,new Map),P(this,`_reportHistory`,new Map),this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(t,n,r,i){this._stashAccumulations(r);let a=this._getMergedUnreportedAccumulations(t),o=a,s;if(this._reportHistory.has(t)){let n=this._reportHistory.get(t),r=n.collectionTime;s=n.aggregationTemporality,o=s===Uo.CUMULATIVE?e.merge(n.accumulations,a,this._aggregator):e.calibrateStartTime(n.accumulations,a,r)}else s=t.selectAggregationTemporality(n.type);this._reportHistory.set(t,{accumulations:o,collectionTime:i,aggregationTemporality:s});let c=Mc(o);if(c.length!==0)return this._aggregator.toMetricData(n,s,c,i)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let n of t){let t=this._unreportedAccumulations.get(n);t===void 0&&(t=[],this._unreportedAccumulations.set(n,t)),t.push(e)}}_getMergedUnreportedAccumulations(t){let n=new kc,r=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),r===void 0)return n;for(let t of r)n=e.merge(n,t,this._aggregator);return n}static merge(e,t,n){let r=e,i=t.entries(),a=i.next();for(;a.done!==!0;){let[t,o,s]=a.value;if(e.has(t,s)){let i=e.get(t,s),a=n.merge(i,o);r.set(t,a,s)}else r.set(t,o,s);a=i.next()}return r}static calibrateStartTime(e,t,n){for(let[r,i]of e.keys()){let e=t.get(r,i);e==null||e.setStartTime(n)}return t}};function Mc(e){return Array.from(e.entries())}F();var Nc=class extends Dc{constructor(e,t,n,r,i){super(e),P(this,`_aggregationCardinalityLimit`,void 0),P(this,`_deltaMetricStorage`,void 0),P(this,`_temporalMetricStorage`,void 0),P(this,`_attributesProcessor`,void 0),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Ac(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new jc(t,r),this._attributesProcessor=n}record(e,t){let n=new kc;for(let[t,r]of e.entries())n.set(this._attributesProcessor.process(t),r);this._deltaMetricStorage.batchCumulate(n,t)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};function Pc(e,t){let n=``;return e.unit!==t.unit&&(n+=`\t- Unit '${e.unit}' does not match '${t.unit}'\n`),e.type!==t.type&&(n+=`\t- Type '${e.type}' does not match '${t.type}'\n`),e.valueType!==t.valueType&&(n+=`\t- Value Type '${e.valueType}' does not match '${t.valueType}'\n`),e.description!==t.description&&(n+=`\t- Description '${e.description}' does not match '${t.description}'\n`),n}function Fc(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function Ic(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function Lc(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}function Rc(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
|
|
1
|
+
var BkOpenTelemetry=(function(){var e=Object.defineProperty,t=(e,t)=>()=>(e&&(t=e(e=0)),t),n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},r,i=t((()=>{r=`1.9.1`}));function a(e){let t=new Set([e]),n=new Set,r=e.match(o);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function s(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(o);if(!r)return a(e);let c={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return c.prerelease!=null||i.major!==c.major?a(e):i.major===0?i.minor===c.minor&&i.patch<=c.patch?s(e):a(e):i.minor<=c.minor?s(e):a(e)}}var o,s,c=t((()=>{i(),o=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,s=a(r)}));function l(e,t,n,i=!1){var a;let o=m[p]=(a=m[p])==null?{version:r}:a;if(!i&&o[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(o.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${o.version} for ${e} does not match previously registered API v${r}`);return n.error(t.stack||t.message),!1}return o[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${r}.`),!0}function u(e){var t,n;let r=(t=m[p])==null?void 0:t.version;if(!(!r||!s(r)))return(n=m[p])==null?void 0:n[e]}function d(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${r}.`);let n=m[p];n&&delete n[e]}var f,p,m,h=t((()=>{i(),c(),f=r.split(`.`)[0],p=Symbol.for(`opentelemetry.js.api.${f}`),m=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function g(e,t,n){let r=u(`diag`);if(r)return r[e](t,...n)}var _,v=t((()=>{h(),_=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return g(`debug`,this._namespace,e)}error(...e){return g(`error`,this._namespace,e)}info(...e){return g(`info`,this._namespace,e)}warn(...e){return g(`warn`,this._namespace,e)}verbose(...e){return g(`verbose`,this._namespace,e)}}})),y,b=t((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(y||(y={}))}));function x(e,t){e<y.NONE?e=y.NONE:e>y.ALL&&(e=y.ALL),t=t||{};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,y.ERROR),warn:n(`warn`,y.WARN),info:n(`info`,y.INFO),debug:n(`debug`,y.DEBUG),verbose:n(`verbose`,y.VERBOSE)}}var S=t((()=>{b()})),ee,C,te=t((()=>{v(),S(),b(),h(),ee=`diag`,C=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function e(e){return function(...t){let n=u(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:y.INFO})=>{var r,i,a;if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error((r=e.stack)==null?e.message:r),!1}typeof n==`number`&&(n={logLevel:n});let o=u(`diag`),s=x((i=n.logLevel)==null?y.INFO:i,e);if(o&&!n.suppressOverrideMessage){let e=(a=Error().stack)==null?`<failed to generate stacktrace>`:a;o.warn(`Current logger will be overwritten from ${e}`),s.warn(`Current logger will overwrite one already registered from ${e}`)}return l(`diag`,s,t,!0)},t.disable=()=>{d(ee,t)},t.createComponentLogger=e=>new _(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}})),w,ne=t((()=>{w=class e{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let t=this._entries.get(e);if(t)return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(t,n){let r=new e(this._entries);return r._entries.set(t,n),r}removeEntry(t){let n=new e(this._entries);return n._entries.delete(t),n}removeEntries(...t){let n=new e(this._entries);for(let e of t)n._entries.delete(e);return n}clear(){return new e}}})),re,ie=t((()=>{re=Symbol(`BaggageEntryMetadata`)}));function T(e={}){return new w(new Map(Object.entries(e)))}function E(e){return typeof e!=`string`&&(ae.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=``),{__TYPE__:re,toString(){return e}}}var ae,D=t((()=>{te(),ne(),ie(),ae=C.instance()}));function oe(e){return Symbol.for(e)}var se,O,ce=t((()=>{se=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},O=new se}));function le(){return be}var ue,de,fe,pe,me,he,ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe=t((()=>{ue=class{constructor(){}createGauge(e,t){return Se}createHistogram(e,t){return Ce}createCounter(e,t){return xe}createUpDownCounter(e,t){return we}createObservableGauge(e,t){return Ee}createObservableCounter(e,t){return Te}createObservableUpDownCounter(e,t){return De}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},de=class{},fe=class extends de{add(e,t){}},pe=class extends de{add(e,t){}},me=class extends de{record(e,t){}},he=class extends de{record(e,t){}},ge=class{addCallback(e){}removeCallback(e){}},_e=class extends ge{},ve=class extends ge{},ye=class extends ge{},be=new ue,xe=new fe,Se=new me,Ce=new he,we=new pe,Te=new _e,Ee=new ve,De=new ye})),ke,Ae=t((()=>{(function(e){e[e.INT=0]=`INT`,e[e.DOUBLE=1]=`DOUBLE`})(ke||(ke={}))})),je,Me,Ne=t((()=>{je={get(e,t){if(e!=null)return e[t]},keys(e){return e==null?[]:Object.keys(e)}},Me={set(e,t,n){e!=null&&(e[t]=n)}}})),Pe,Fe=t((()=>{ce(),Pe=class{active(){return O}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),Ie,Le,Re,ze=t((()=>{Fe(),h(),te(),Ie=`context`,Le=new Pe,Re=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(e){return l(Ie,e,C.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return u(Ie)||Le}disable(){this._getContextManager().disable(),d(Ie,C.instance())}}})),k,Be=t((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(k||(k={}))})),Ve,He,Ue,We=t((()=>{Be(),Ve=`0000000000000000`,He=`00000000000000000000000000000000`,Ue={traceId:He,spanId:Ve,traceFlags:k.NONE}})),Ge,Ke=t((()=>{We(),Ge=class{constructor(e=Ue){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function qe(e){return e.getValue($e)||void 0}function Je(){return qe(Re.getInstance().active())}function Ye(e,t){return e.setValue($e,t)}function Xe(e){return e.deleteValue($e)}function Ze(e,t){return Ye(e,new Ge(t))}function Qe(e){var t;return(t=qe(e))==null?void 0:t.spanContext()}var $e,et=t((()=>{ce(),Ke(),ze(),$e=oe(`OpenTelemetry Context Key SPAN`)}));function tt(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(ot[e.charCodeAt(t)]|0)+(ot[e.charCodeAt(t+1)]|0)+(ot[e.charCodeAt(t+2)]|0)+(ot[e.charCodeAt(t+3)]|0);return n===t}function nt(e){return tt(e,32)&&e!==`00000000000000000000000000000000`}function rt(e){return tt(e,16)&&e!==`0000000000000000`}function it(e){return nt(e.traceId)&&rt(e.spanId)}function at(e){return new Ge(e)}var ot,st=t((()=>{We(),Ke(),ot=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}));function ct(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var lt,ut,dt=t((()=>{ze(),et(),Ke(),st(),lt=Re.getInstance(),ut=class{startSpan(e,t,n=lt.active()){if(t!=null&&t.root)return new Ge;let r=n&&Qe(n);return ct(r)&&it(r)?new Ge(r):new Ge}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a==null?lt.active():a,c=this.startSpan(e,i,s),l=Ye(s,c);return lt.with(l,o,void 0,c)}}})),ft,pt,mt=t((()=>{dt(),ft=new ut,pt=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):ft}}})),ht,gt=t((()=>{dt(),ht=class{getTracer(e,t,n){return new ut}}})),_t,vt,yt=t((()=>{mt(),gt(),_t=new ht,vt=class{getTracer(e,t,n){var r;return(r=this.getDelegateTracer(e,t,n))==null?new pt(this,e,t,n):r}getDelegate(){var e;return(e=this._delegate)==null?_t:e}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getTracer(e,t,n)}}})),bt,xt=t((()=>{(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(bt||(bt={}))})),St,Ct=t((()=>{(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(St||(St={}))})),wt,Tt=t((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(wt||(wt={}))})),A,Et=t((()=>{ze(),A=Re.getInstance()})),j,Dt=t((()=>{te(),j=C.instance()})),Ot,kt,At=t((()=>{Oe(),Ot=class{getMeter(e,t,n){return be}},kt=new Ot})),jt,Mt,Nt=t((()=>{At(),h(),te(),jt=`metrics`,Mt=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalMeterProvider(e){return l(jt,e,C.instance())}getMeterProvider(){return u(jt)||kt}getMeter(e,t,n){return this.getMeterProvider().getMeter(e,t,n)}disable(){d(jt,C.instance())}}})),Pt,Ft=t((()=>{Nt(),Pt=Mt.getInstance()})),It,Lt=t((()=>{It=class{inject(e,t){}extract(e,t){return e}fields(){return[]}}}));function Rt(e){return e.getValue(Ht)||void 0}function zt(){return Rt(Re.getInstance().active())}function Bt(e,t){return e.setValue(Ht,t)}function Vt(e){return e.deleteValue(Ht)}var Ht,Ut=t((()=>{ze(),ce(),Ht=oe(`OpenTelemetry Baggage Key`)})),Wt,Gt,Kt,qt=t((()=>{h(),Lt(),Ne(),Ut(),D(),te(),Wt=`propagation`,Gt=new It,Kt=class e{constructor(){this.createBaggage=T,this.getBaggage=Rt,this.getActiveBaggage=zt,this.setBaggage=Bt,this.deleteBaggage=Vt}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalPropagator(e){return l(Wt,e,C.instance())}inject(e,t,n=Me){return this._getGlobalPropagator().inject(e,t,n)}extract(e,t,n=je){return this._getGlobalPropagator().extract(e,t,n)}fields(){return this._getGlobalPropagator().fields()}disable(){d(Wt,C.instance())}_getGlobalPropagator(){return u(Wt)||Gt}}})),Jt,Yt=t((()=>{qt(),Jt=Kt.getInstance()})),Xt,Zt,Qt=t((()=>{h(),yt(),st(),et(),te(),Xt=`trace`,Zt=class e{constructor(){this._proxyTracerProvider=new vt,this.wrapSpanContext=at,this.isSpanContextValid=it,this.deleteSpan=Xe,this.getSpan=qe,this.getActiveSpan=Je,this.getSpanContext=Qe,this.setSpan=Ye,this.setSpanContext=Ze}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(e){let t=l(Xt,this._proxyTracerProvider,C.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return u(Xt)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){d(Xt,C.instance()),this._proxyTracerProvider=new vt}}})),M,$t=t((()=>{Qt(),M=Zt.getInstance()})),N=t((()=>{D(),ce(),b(),Oe(),Ae(),Ne(),mt(),yt(),xt(),Ct(),Tt(),Be(),st(),We(),Et(),Dt(),Ft(),Yt(),$t()})),en,tn=t((()=>{(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(en||(en={}))})),nn,rn,an=t((()=>{nn=class{emit(e){}enabled(){return!1}},rn=new nn}));function on(e,t,n){return r=>r===e?t:n}var sn,cn,ln=t((()=>{sn=Symbol.for(`io.opentelemetry.js.api.logs`),cn=globalThis})),un,dn,fn=t((()=>{an(),un=class{getLogger(e,t,n){return new nn}},dn=new un})),pn,mn=t((()=>{an(),pn=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):rn}}})),hn,gn=t((()=>{fn(),mn(),hn=class{getLogger(e,t,n){var r;return(r=this._getDelegateLogger(e,t,n))==null?new pn(this,e,t,n):r}_getDelegate(){var e;return(e=this._delegate)==null?dn:e}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){var r;return(r=this._delegate)==null?void 0:r.getLogger(e,t,n)}}})),_n,vn=t((()=>{ln(),fn(),gn(),_n=class e{constructor(){this._proxyLoggerProvider=new hn}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return cn[sn]?this.getLoggerProvider():(cn[sn]=on(1,e,dn),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,t;return(t=(e=cn[sn])==null?void 0:e.call(cn,1))==null?this._proxyLoggerProvider:t}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete cn[sn],this._proxyLoggerProvider=new hn}}})),yn,bn=t((()=>{tn(),an(),vn(),yn=_n.getInstance()}));function xn(e){return typeof e==`object`&&!!e&&`addEventListener`in e&&typeof e.addEventListener==`function`&&`removeEventListener`in e&&typeof e.removeEventListener==`function`}function Sn(e){"@babel/helpers - typeof";return Sn=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Sn(e)}var Cn=t((()=>{}));function wn(e,t){if(Sn(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Sn(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Tn=t((()=>{Cn()}));function En(e){var t=wn(e,`string`);return Sn(t)==`symbol`?t:t+``}var Dn=t((()=>{Cn(),Tn()}));function P(e,t,n){return(t=En(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var F=t((()=>{Dn()}));N(),F();var On=`OT_ZONE_CONTEXT`,kn=class{constructor(){P(this,`_enabled`,!1)}_bindFunction(e,t){let n=this,r=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(r,`length`,{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}_bindListener(e,t){let n=t;return n.__ot_listeners===void 0?(n.__ot_listeners={},typeof n.addEventListener==`function`&&(n.addEventListener=this._patchAddEventListener(n,n.addEventListener,e)),typeof n.removeEventListener==`function`&&(n.removeEventListener=this._patchRemoveEventListener(n,n.removeEventListener)),t):t}_createZone(e,t){return Zone.current.fork({name:e,properties:{[On]:t},onCancelTask(e,t,n,r){return r.state===`notScheduled`||r.state===`running`?r:e.cancelTask(n,r)}})}_patchAddEventListener(e,t,n){let r=this;return function(i,a,o){e.__ot_listeners===void 0&&(e.__ot_listeners={});let s=e.__ot_listeners[i];s===void 0&&(s=new WeakMap,e.__ot_listeners[i]=s);let c=r.bind(n,a);return s.set(a,c),t.call(this,i,c,o)}}_patchRemoveEventListener(e,t){return function(n,r){if(e.__ot_listeners===void 0||e.__ot_listeners[n]===void 0)return t.call(this,n,r);let i=e.__ot_listeners[n],a=i.get(r);return i.delete(r),t.call(this,n,a||r)}}active(){return!this._enabled||!Zone.current?O:Zone.current.get(On)||O}bind(e,t){return typeof t==`function`?this._bindFunction(e,t):(xn(t)&&this._bindListener(e,t),t)}disable(){return this._enabled=!1,this}enable(){return this._enabled=!0,this}with(e,t,n,...r){let i=`otel:with`;return t.name&&(i+=`:${t.name}`),this._createZone(i,e).run(t,n,r)}};bn();var An=Object.defineProperty,jn=Object.defineProperties,Mn=Object.getOwnPropertyDescriptors,Nn=Object.getOwnPropertySymbols,Pn=Object.prototype.hasOwnProperty,Fn=Object.prototype.propertyIsEnumerable,In=(e,t,n)=>t in e?An(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ln=(e,t)=>{for(var n in t||(t={}))Pn.call(t,n)&&In(e,n,t[n]);if(Nn)for(var n of Nn(t))Fn.call(t,n)&&In(e,n,t[n]);return e},Rn=(e,t)=>jn(e,Mn(t)),I=(e,t,n)=>(In(e,typeof t==`symbol`?t:t+``,n),n),zn=globalThis;function Bn(e){return(zn.__Zone_symbol_prefix||`__zone_symbol__`)+e}function Vn(){let e=zn.performance;function t(t){e&&e.mark&&e.mark(t)}function n(t,n){e&&e.measure&&e.measure(t,n)}t(`Zone`);let r=class e{constructor(e,t){I(this,`_parent`),I(this,`_name`),I(this,`_properties`),I(this,`_zoneDelegate`),this._parent=e,this._name=t?t.name||`unnamed`:`<root>`,this._properties=t&&t.properties||{},this._zoneDelegate=new o(this,this._parent&&this._parent._zoneDelegate,t)}static assertZonePatched(){if(zn.Promise!==re.ZoneAwarePromise)throw Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")}static get root(){let t=e.current;for(;t.parent;)t=t.parent;return t}static get current(){return T.zone}static get currentTask(){return E}static __load_patch(r,i,a=!1){if(re.hasOwnProperty(r)){let e=zn[Bn(`forceDuplicateZoneCheck`)]===!0;if(!a&&e)throw Error(`Already loaded patch: `+r)}else if(!zn[`__Zone_disable_`+r]){let a=`Zone:`+r;t(a),re[r]=i(zn,e,ie),n(a,a)}}get parent(){return this._parent}get name(){return this._name}get(e){let t=this.getZoneWith(e);if(t)return t._properties[e]}getZoneWith(e){let t=this;for(;t;){if(t._properties.hasOwnProperty(e))return t;t=t._parent}return null}fork(e){if(!e)throw Error(`ZoneSpec required!`);return this._zoneDelegate.fork(this,e)}wrap(e,t){if(typeof e!=`function`)throw Error(`Expecting function got: `+e);let n=this._zoneDelegate.intercept(this,e,t),r=this;return function(){return r.runGuarded(n,this,arguments,t)}}run(e,t,n,r){T={parent:T,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{T=T.parent}}runGuarded(e,t=null,n,r){T={parent:T,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{T=T.parent}}runTask(e,t,n){if(e.zone!=this)throw Error(`A task can only be run in the zone of creation! (Creation: `+(e.zone||v).name+`; Execution: `+this.name+`)`);let r=e,{type:i,data:{isPeriodic:a=!1,isRefreshable:o=!1}={}}=e;if(e.state===y&&(i===ne||i===w))return;let s=e.state!=S;s&&r._transitionTo(S,x);let c=E;E=r,T={parent:T,zone:this};try{i==w&&e.data&&!a&&!o&&(e.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,r,t,n)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{let t=e.state;if(t!==y&&t!==C)if(i==ne||a||o&&t===b)s&&r._transitionTo(x,S,b);else{let e=r._zoneDelegates;this._updateTaskCount(r,-1),s&&r._transitionTo(y,S,y),o&&(r._zoneDelegates=e)}T=T.parent,E=c}}scheduleTask(e){if(e.zone&&e.zone!==this){let t=this;for(;t;){if(t===e.zone)throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${e.zone.name}`);t=t.parent}}e._transitionTo(b,y);let t=[];e._zoneDelegates=t,e._zone=this;try{e=this._zoneDelegate.scheduleTask(this,e)}catch(t){throw e._transitionTo(C,b,y),this._zoneDelegate.handleError(this,t),t}return e._zoneDelegates===t&&this._updateTaskCount(e,1),e.state==b&&e._transitionTo(x,b),e}scheduleMicroTask(e,t,n,r){return this.scheduleTask(new s(te,e,t,n,r,void 0))}scheduleMacroTask(e,t,n,r,i){return this.scheduleTask(new s(w,e,t,n,r,i))}scheduleEventTask(e,t,n,r,i){return this.scheduleTask(new s(ne,e,t,n,r,i))}cancelTask(e){if(e.zone!=this)throw Error(`A task can only be cancelled in the zone of creation! (Creation: `+(e.zone||v).name+`; Execution: `+this.name+`)`);if(!(e.state!==x&&e.state!==S)){e._transitionTo(ee,x,S);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(C,ee),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(y,ee),e.runCount=-1,e}}_updateTaskCount(e,t){let n=e._zoneDelegates;t==-1&&(e._zoneDelegates=null);for(let r=0;r<n.length;r++)n[r]._updateTaskCount(e.type,t)}};I(r,`__symbol__`,Bn);let i=r,a={name:``,onHasTask:(e,t,n,r)=>e.hasTask(n,r),onScheduleTask:(e,t,n,r)=>e.scheduleTask(n,r),onInvokeTask:(e,t,n,r,i,a)=>e.invokeTask(n,r,i,a),onCancelTask:(e,t,n,r)=>e.cancelTask(n,r)};class o{constructor(e,t,n){I(this,`_zone`),I(this,`_taskCounts`,{microTask:0,macroTask:0,eventTask:0}),I(this,`_forkDlgt`),I(this,`_forkZS`),I(this,`_forkCurrZone`),I(this,`_interceptDlgt`),I(this,`_interceptZS`),I(this,`_interceptCurrZone`),I(this,`_invokeDlgt`),I(this,`_invokeZS`),I(this,`_invokeCurrZone`),I(this,`_handleErrorDlgt`),I(this,`_handleErrorZS`),I(this,`_handleErrorCurrZone`),I(this,`_scheduleTaskDlgt`),I(this,`_scheduleTaskZS`),I(this,`_scheduleTaskCurrZone`),I(this,`_invokeTaskDlgt`),I(this,`_invokeTaskZS`),I(this,`_invokeTaskCurrZone`),I(this,`_cancelTaskDlgt`),I(this,`_cancelTaskZS`),I(this,`_cancelTaskCurrZone`),I(this,`_hasTaskDlgt`),I(this,`_hasTaskDlgtOwner`),I(this,`_hasTaskZS`),I(this,`_hasTaskCurrZone`),this._zone=e,this._forkZS=n&&(n&&n.onFork?n:t._forkZS),this._forkDlgt=n&&(n.onFork?t:t._forkDlgt),this._forkCurrZone=n&&(n.onFork?this._zone:t._forkCurrZone),this._interceptZS=n&&(n.onIntercept?n:t._interceptZS),this._interceptDlgt=n&&(n.onIntercept?t:t._interceptDlgt),this._interceptCurrZone=n&&(n.onIntercept?this._zone:t._interceptCurrZone),this._invokeZS=n&&(n.onInvoke?n:t._invokeZS),this._invokeDlgt=n&&(n.onInvoke?t:t._invokeDlgt),this._invokeCurrZone=n&&(n.onInvoke?this._zone:t._invokeCurrZone),this._handleErrorZS=n&&(n.onHandleError?n:t._handleErrorZS),this._handleErrorDlgt=n&&(n.onHandleError?t:t._handleErrorDlgt),this._handleErrorCurrZone=n&&(n.onHandleError?this._zone:t._handleErrorCurrZone),this._scheduleTaskZS=n&&(n.onScheduleTask?n:t._scheduleTaskZS),this._scheduleTaskDlgt=n&&(n.onScheduleTask?t:t._scheduleTaskDlgt),this._scheduleTaskCurrZone=n&&(n.onScheduleTask?this._zone:t._scheduleTaskCurrZone),this._invokeTaskZS=n&&(n.onInvokeTask?n:t._invokeTaskZS),this._invokeTaskDlgt=n&&(n.onInvokeTask?t:t._invokeTaskDlgt),this._invokeTaskCurrZone=n&&(n.onInvokeTask?this._zone:t._invokeTaskCurrZone),this._cancelTaskZS=n&&(n.onCancelTask?n:t._cancelTaskZS),this._cancelTaskDlgt=n&&(n.onCancelTask?t:t._cancelTaskDlgt),this._cancelTaskCurrZone=n&&(n.onCancelTask?this._zone:t._cancelTaskCurrZone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;let r=n&&n.onHasTask,i=t&&t._hasTaskZS;(r||i)&&(this._hasTaskZS=r?n:a,this._hasTaskDlgt=t,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=this._zone,n.onScheduleTask||(this._scheduleTaskZS=a,this._scheduleTaskDlgt=t,this._scheduleTaskCurrZone=this._zone),n.onInvokeTask||(this._invokeTaskZS=a,this._invokeTaskDlgt=t,this._invokeTaskCurrZone=this._zone),n.onCancelTask||(this._cancelTaskZS=a,this._cancelTaskDlgt=t,this._cancelTaskCurrZone=this._zone))}get zone(){return this._zone}fork(e,t){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,e,t):new i(e,t)}intercept(e,t,n){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,e,t,n):t}invoke(e,t,n,r,i){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,e,t,n,r,i):t.apply(n,r)}handleError(e,t){return this._handleErrorZS?this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,e,t):!0}scheduleTask(e,t){let n=t;if(this._scheduleTaskZS)this._hasTaskZS&&n._zoneDelegates.push(this._hasTaskDlgtOwner),n=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,e,t),n||(n=t);else if(t.scheduleFn)t.scheduleFn(t);else if(t.type==te)g(t);else throw Error(`Task is missing scheduleFn.`);return n}invokeTask(e,t,n,r){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,e,t,n,r):t.callback.apply(n,r)}cancelTask(e,t){let n;if(this._cancelTaskZS)n=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,e,t);else{if(!t.cancelFn)throw Error(`Task is not cancelable`);n=t.cancelFn(t)}return n}hasTask(e,t){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,e,t)}catch(t){this.handleError(e,t)}}_updateTaskCount(e,t){let n=this._taskCounts,r=n[e],i=n[e]=r+t;if(i<0)throw Error(`More tasks executed then were scheduled.`);if(r==0||i==0){let t={microTask:n.microTask>0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:e};this.hasTask(this._zone,t)}}}class s{constructor(e,t,n,r,i,a){if(I(this,`type`),I(this,`source`),I(this,`invoke`),I(this,`callback`),I(this,`data`),I(this,`scheduleFn`),I(this,`cancelFn`),I(this,`_zone`,null),I(this,`runCount`,0),I(this,`_zoneDelegates`,null),I(this,`_state`,`notScheduled`),this.type=e,this.source=t,this.data=r,this.scheduleFn=i,this.cancelFn=a,!n)throw Error(`callback is not defined`);this.callback=n;let o=this;e===ne&&r&&r.useG?this.invoke=s.invokeTask:this.invoke=function(){return s.invokeTask.call(zn,o,this,arguments)}}static invokeTask(e,t,n){e||(e=this),ae++;try{return e.runCount++,e.zone.runTask(e,t,n)}finally{ae===1&&!zn[d]&&_(),ae--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(y,b)}_transitionTo(e,t,n){if(this._state===t||this._state===n)this._state=e,e==y&&(this._zoneDelegates=null);else throw Error(`${this.type} '${this.source}': can not transition to '${e}', expecting state '${t}'${n?` or '`+n+`'`:``}, was '${this._state}'.`)}toString(){return this.data&&this.data.handleId!==void 0?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}let c=Bn(`setTimeout`),l=Bn(`Promise`),u=Bn(`then`),d=Bn(`enable_native_microtask_draining`),f=[],p=!1,m;function h(e){var t;!m&&zn[l]&&(m=zn[l].resolve(0)),m?((t=m[u])==null?m.then:t).call(m,e):zn[c](e,0)}function g(e){let t=zn[d],n=t&&f.length===0&&!p,r=!t&&ae===0&&f.length===0;(n||r)&&h(_),e&&f.push(e)}function _(){if(!p){for(p=!0;f.length;){let e=f;f=[];for(let t of e)try{t.zone.runTask(t,null,null)}catch(e){ie.onUnhandledError(e)}}zn[d]?(p=!1,ie.microtaskDrainDone()):(ie.microtaskDrainDone(),p=!1)}}let v={name:`NO ZONE`},y=`notScheduled`,b=`scheduling`,x=`scheduled`,S=`running`,ee=`canceling`,C=`unknown`,te=`microTask`,w=`macroTask`,ne=`eventTask`,re={},ie={symbol:Bn,currentZoneFrame:()=>T,onUnhandledError:D,microtaskDrainDone:D,scheduleMicroTask:g,showUncaughtError:()=>!i[Bn(`ignoreConsoleErrorUncaughtError`)],patchEventTarget:()=>[],patchOnProperties:D,patchMethod:()=>D,bindArguments:()=>[],patchThen:()=>D,patchMacroTask:()=>D,patchEventPrototype:()=>D,getGlobalObjects:()=>void 0,ObjectDefineProperty:()=>D,ObjectGetOwnPropertyDescriptor:()=>void 0,ObjectCreate:()=>void 0,ArraySlice:()=>[],patchClass:()=>D,wrapWithCurrentZone:()=>D,filterProperties:()=>[],attachOriginToPatched:()=>D,_redefineProperty:()=>D,patchCallbacks:()=>D,nativeScheduleMicroTask:h},T={parent:null,zone:new i(null,null)},E=null,ae=0;function D(){}return n(`Zone`,`Zone`),i}function Hn(){let e=globalThis,t=e[Bn(`forceDuplicateZoneCheck`)]===!0;if(e.Zone&&(t||typeof e.Zone.__symbol__!=`function`))throw Error(`Zone already loaded.`);return e.Zone!=null||(e.Zone=Vn()),e.Zone}var Un=Object.getOwnPropertyDescriptor,Wn=Object.defineProperty,Gn=Object.getPrototypeOf,Kn=Object.create,qn=Array.prototype.slice,Jn=`addEventListener`,Yn=`removeEventListener`,Xn=Bn(Jn),Zn=Bn(Yn),Qn=`true`,$n=`false`,er=Bn(``);function tr(e,t){return Zone.current.wrap(e,t)}function nr(e,t,n,r,i){return Zone.current.scheduleMacroTask(e,t,n,r,i)}var L=Bn,rr=typeof window<`u`,ir=rr?window:void 0,R=rr&&ir||globalThis,ar=`removeAttribute`;function or(e,t){for(let n=e.length-1;n>=0;n--)typeof e[n]==`function`&&(e[n]=tr(e[n],t+`_`+n));return e}function sr(e,t){let n=e.constructor.name;for(let r=0;r<t.length;r++){let i=t[r],a=e[i];if(a){if(!cr(Un(e,i)))continue;e[i]=(e=>{let t=function(){return e.apply(this,or(arguments,n+`.`+i))};return wr(t,e),t})(a)}}}function cr(e){return e?e.writable===!1?!1:!(typeof e.get==`function`&&e.set===void 0):!0}var lr=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope,ur=!(`nw`in R)&&R.process!==void 0&&R.process.toString()===`[object process]`,dr=!ur&&!lr&&!!(rr&&ir.HTMLElement),fr=R.process!==void 0&&R.process.toString()===`[object process]`&&!lr&&!!(rr&&ir.HTMLElement),pr={},mr=L(`enable_beforeunload`),hr=function(e){if(e=e||R.event,!e)return;let t=pr[e.type];t||(t=pr[e.type]=L(`ON_PROPERTY`+e.type));let n=this||e.target||R,r=n[t],i;if(dr&&n===ir&&e.type===`error`){let t=e;i=r&&r.call(this,t.message,t.filename,t.lineno,t.colno,t.error),i===!0&&e.preventDefault()}else i=r&&r.apply(this,arguments),e.type===`beforeunload`&&R[mr]&&typeof i==`string`?e.returnValue=i:i!=null&&!i&&e.preventDefault();return i};function gr(e,t,n){let r=Un(e,t);if(!r&&n&&Un(n,t)&&(r={enumerable:!0,configurable:!0}),!r||!r.configurable)return;let i=L(`on`+t+`patched`);if(e.hasOwnProperty(i)&&e[i])return;delete r.writable,delete r.value;let a=r.get,o=r.set,s=t.slice(2),c=pr[s];c||(c=pr[s]=L(`ON_PROPERTY`+s)),r.set=function(t){let n=this;!n&&e===R&&(n=R),n&&(typeof n[c]==`function`&&n.removeEventListener(s,hr),o==null||o.call(n,null),n[c]=t,typeof t==`function`&&n.addEventListener(s,hr,!1))},r.get=function(){let n=this;if(!n&&e===R&&(n=R),!n)return null;let i=n[c];if(i)return i;if(a){let e=a.call(this);if(e)return r.set.call(this,e),typeof n[ar]==`function`&&n.removeAttribute(t),e}return null},Wn(e,t,r),e[i]=!0}function _r(e,t,n){if(t)for(let r=0;r<t.length;r++)gr(e,`on`+t[r],n);else{let t=[];for(let n in e)n.slice(0,2)==`on`&&t.push(n);for(let r=0;r<t.length;r++)gr(e,t[r],n)}}var vr=L(`originalInstance`);function yr(e){let t=R[e];if(!t)return;R[L(e)]=t,R[e]=function(){let n=or(arguments,e);switch(n.length){case 0:this[vr]=new t;break;case 1:this[vr]=new t(n[0]);break;case 2:this[vr]=new t(n[0],n[1]);break;case 3:this[vr]=new t(n[0],n[1],n[2]);break;case 4:this[vr]=new t(n[0],n[1],n[2],n[3]);break;default:throw Error(`Arg list too long.`)}},wr(R[e],t);let n=new t(function(){}),r;for(r in n)e===`XMLHttpRequest`&&r===`responseBlob`||(function(t){typeof n[t]==`function`?R[e].prototype[t]=function(){return this[vr][t].apply(this[vr],arguments)}:Wn(R[e].prototype,t,{set:function(n){typeof n==`function`?(this[vr][t]=tr(n,e+`.`+t),wr(this[vr][t],n)):this[vr][t]=n},get:function(){return this[vr][t]}})})(r);for(r in t)r!==`prototype`&&t.hasOwnProperty(r)&&(R[e][r]=t[r])}function br(e,t){typeof Object.getOwnPropertySymbols==`function`&&Object.getOwnPropertySymbols(e).forEach(n=>{let r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,{get:function(){return e[n]},set:function(t){r&&(!r.writable||typeof r.set!=`function`)||(e[n]=t)},enumerable:r?r.enumerable:!0,configurable:r?r.configurable:!0})})}var xr=!1;function Sr(e,t,n){let r=e;for(;r&&!r.hasOwnProperty(t);)r=Gn(r);!r&&e[t]&&(r=e);let i=L(t),a=null;if(r&&(!(a=r[i])||!r.hasOwnProperty(i))&&(a=r[i]=r[t],cr(r&&Un(r,t)))){let e=n(a,i,t);r[t]=function(){return e(this,arguments)},wr(r[t],a),xr&&br(a,r[t])}return a}function Cr(e,t,n){let r=null;function i(e){let t=e.data;return t.args[t.cbIdx]=function(){e.invoke.apply(this,arguments)},r.apply(t.target,t.args),e}r=Sr(e,t,e=>function(t,r){let a=n(t,r);return a.cbIdx>=0&&typeof r[a.cbIdx]==`function`?nr(a.name,r[a.cbIdx],a,i):e.apply(t,r)})}function wr(e,t){e[L(`OriginalDelegate`)]=t}function Tr(e){return typeof e==`function`}function Er(e){return typeof e==`number`}var Dr={useG:!0},Or={},kr={},Ar=RegExp(`^`+er+`(\\w+)(true|false)$`),jr=L(`propagationStopped`);function Mr(e,t){let n=(t?t(e):e)+$n,r=(t?t(e):e)+Qn,i=er+n,a=er+r;Or[e]={},Or[e][$n]=i,Or[e][Qn]=a}function Nr(e,t,n,r){let i=r&&r.add||Jn,a=r&&r.rm||Yn,o=r&&r.listeners||`eventListeners`,s=r&&r.rmAll||`removeAllListeners`,c=L(i),l=`.`+i+`:`,u=`prependListener`;``+u;let d=function(e,t,n){if(e.isRemoved)return;let r=e.callback;typeof r==`object`&&r.handleEvent&&(e.callback=e=>r.handleEvent(e),e.originalDelegate=r);let i;try{e.invoke(e,t,[n])}catch(e){i=e}let o=e.options;if(o&&typeof o==`object`&&o.once){let r=e.originalDelegate?e.originalDelegate:e.callback;t[a].call(t,n.type,r,o)}return i};function f(n,r,i){if(r=r||e.event,!r)return;let a=n||r.target||e,o=a[Or[r.type][i?Qn:$n]];if(o){let e=[];if(o.length===1){let t=d(o[0],a,r);t&&e.push(t)}else{let t=o.slice();for(let n=0;n<t.length&&!(r&&r[jr]===!0);n++){let i=d(t[n],a,r);i&&e.push(i)}}if(e.length===1)throw e[0];for(let n=0;n<e.length;n++){let r=e[n];t.nativeScheduleMicroTask(()=>{throw r})}}}let p=function(e){return f(this,e,!1)},m=function(e){return f(this,e,!0)};function h(t,n){if(!t)return!1;let r=!0;n&&n.useG!==void 0&&(r=n.useG);let d=n&&n.vh,f=!0;n&&n.chkDup!==void 0&&(f=n.chkDup);let h=!1;n&&n.rt!==void 0&&(h=n.rt);let g=t;for(;g&&!g.hasOwnProperty(i);)g=Gn(g);if(!g&&t[i]&&(g=t),!g||g[c])return!1;let _=n&&n.eventNameToString,v={},y=g[c]=g[i],b=g[L(a)]=g[a],x=g[L(o)]=g[o],S=g[L(s)]=g[s],ee;n&&n.prepend&&(ee=g[L(n.prepend)]=g[n.prepend]);function C(e,t){return t?typeof e==`boolean`?{capture:e,passive:!0}:e?typeof e==`object`&&e.passive!==!1?Rn(Ln({},e),{passive:!0}):e:{passive:!0}:e}let te=function(e){if(!v.isExisting)return y.call(v.target,v.eventName,v.capture?m:p,v.options)},w=function(e){if(!e.isRemoved){let t=Or[e.eventName],n;t&&(n=t[e.capture?Qn:$n]);let r=n&&e.target[n];if(r){for(let t=0;t<r.length;t++)if(r[t]===e){r.splice(t,1),e.isRemoved=!0,e.removeAbortListener&&(e.removeAbortListener(),e.removeAbortListener=null),r.length===0&&(e.allRemoved=!0,e.target[n]=null);break}}}if(e.allRemoved)return b.call(e.target,e.eventName,e.capture?m:p,e.options)},ne=function(e){return y.call(v.target,v.eventName,e.invoke,v.options)},re=function(e){return ee.call(v.target,v.eventName,e.invoke,v.options)},ie=function(e){return b.call(e.target,e.eventName,e.invoke,e.options)},T=r?te:ne,E=r?w:ie,ae=(n==null?void 0:n.diff)||function(e,t){let n=typeof t;return n===`function`&&e.callback===t||n===`object`&&e.originalDelegate===t},D=Zone[L(`UNPATCHED_EVENTS`)],oe=e[L(`PASSIVE_EVENTS`)];function se(e){if(typeof e==`object`&&e){let t=Ln({},e);return e.signal&&(t.signal=e.signal),t}return e}let O=function(t,i,a,o,s=!1,c=!1){return function(){let l=this||e,u=arguments[0];n&&n.transferEventName&&(u=n.transferEventName(u));let p=arguments[1];if(!p||ur&&u===`uncaughtException`)return t.apply(this,arguments);let m=!1;if(typeof p!=`function`){if(!p.handleEvent)return t.apply(this,arguments);m=!0}if(d&&!d(t,p,l,arguments))return;let h=!!oe&&oe.indexOf(u)!==-1,g=se(C(arguments[2],h)),y=g==null?void 0:g.signal;if(y!=null&&y.aborted)return;if(D){for(let e=0;e<D.length;e++)if(u===D[e])return h?t.call(l,u,p,g):t.apply(this,arguments)}let b=g?typeof g==`boolean`?!0:g.capture:!1,x=g&&typeof g==`object`?g.once:!1,S=Zone.current,ee=Or[u];ee||(Mr(u,_),ee=Or[u]);let te=ee[b?Qn:$n],w=l[te],ne=!1;if(w){if(ne=!0,f){for(let e=0;e<w.length;e++)if(ae(w[e],p))return}}else w=l[te]=[];let re,ie=l.constructor.name,T=kr[ie];T&&(re=T[u]),re||(re=ie+i+(_?_(u):u)),v.options=g,x&&(v.options.once=!1),v.target=l,v.capture=b,v.eventName=u,v.isExisting=ne;let E=r?Dr:void 0;E&&(E.taskData=v),y&&(v.options.signal=void 0);let O=S.scheduleEventTask(re,p,E,a,o);if(y){v.options.signal=y;let e=()=>O.zone.cancelTask(O);t.call(y,`abort`,e,{once:!0}),O.removeAbortListener=()=>y.removeEventListener(`abort`,e)}if(v.target=null,E&&(E.taskData=null),x&&(v.options.once=!0),typeof O.options!=`boolean`&&(O.options=g),O.target=l,O.capture=b,O.eventName=u,m&&(O.originalDelegate=p),c?w.unshift(O):w.push(O),s)return l}};return g[i]=O(y,l,T,E,h),ee&&(g[u]=O(ee,`.prependListener:`,re,E,h,!0)),g[a]=function(){let t=this||e,r=arguments[0];n&&n.transferEventName&&(r=n.transferEventName(r));let i=arguments[2],a=i?typeof i==`boolean`?!0:i.capture:!1,o=arguments[1];if(!o)return b.apply(this,arguments);if(d&&!d(b,o,t,arguments))return;let s=Or[r],c;s&&(c=s[a?Qn:$n]);let l=c&&t[c];if(l)for(let e=0;e<l.length;e++){let n=l[e];if(ae(n,o)){if(l.splice(e,1),n.isRemoved=!0,l.length===0&&(n.allRemoved=!0,t[c]=null,!a&&typeof r==`string`)){let e=er+`ON_PROPERTY`+r;t[e]=null}return n.zone.cancelTask(n),h?t:void 0}}return b.apply(this,arguments)},g[o]=function(){let t=this||e,r=arguments[0];n&&n.transferEventName&&(r=n.transferEventName(r));let i=[],a=Pr(t,_?_(r):r);for(let e=0;e<a.length;e++){let t=a[e],n=t.originalDelegate?t.originalDelegate:t.callback;i.push(n)}return i},g[s]=function(){let t=this||e,r=arguments[0];if(r){n&&n.transferEventName&&(r=n.transferEventName(r));let e=Or[r];if(e){let n=e[$n],i=e[Qn],o=t[n],s=t[i];if(o){let e=o.slice();for(let t=0;t<e.length;t++){let n=e[t],i=n.originalDelegate?n.originalDelegate:n.callback;this[a].call(this,r,i,n.options)}}if(s){let e=s.slice();for(let t=0;t<e.length;t++){let n=e[t],i=n.originalDelegate?n.originalDelegate:n.callback;this[a].call(this,r,i,n.options)}}}}else{let e=Object.keys(t);for(let t=0;t<e.length;t++){let n=e[t],r=Ar.exec(n),i=r&&r[1];i&&i!==`removeListener`&&this[s].call(this,i)}this[s].call(this,`removeListener`)}if(h)return this},wr(g[i],y),wr(g[a],b),S&&wr(g[s],S),x&&wr(g[o],x),!0}let g=[];for(let e=0;e<n.length;e++)g[e]=h(n[e],r);return g}function Pr(e,t){if(!t){let n=[];for(let r in e){let i=Ar.exec(r),a=i&&i[1];if(a&&(!t||a===t)){let t=e[r];if(t)for(let e=0;e<t.length;e++)n.push(t[e])}}return n}let n=Or[t];n||(Mr(t),n=Or[t]);let r=e[n[$n]],i=e[n[Qn]];return r?i?r.concat(i):r.slice():i?i.slice():[]}function Fr(e,t){let n=e.Event;n&&n.prototype&&t.patchMethod(n.prototype,`stopImmediatePropagation`,e=>function(t,n){t[jr]=!0,e&&e.apply(t,n)})}function Ir(e,t){t.patchMethod(e,`queueMicrotask`,e=>function(e,t){Zone.current.scheduleMicroTask(`queueMicrotask`,t[0])})}var Lr=L(`zoneTask`);function Rr(e,t,n,r){let i=null,a=null;t+=r,n+=r;let o={};function s(t){let n=t.data;n.args[0]=function(){return t.invoke.apply(this,arguments)};let r=i.apply(e,n.args);return Er(r)?n.handleId=r:(n.handle=r,n.isRefreshable=Tr(r.refresh)),t}function c(t){let{handle:n,handleId:r}=t.data;return a.call(e,n==null?r:n)}i=Sr(e,t,n=>function(i,a){var l;if(Tr(a[0])){let e={isRefreshable:!1,isPeriodic:r===`Interval`,delay:r===`Timeout`||r===`Interval`?a[1]||0:void 0,args:a},n=a[0];a[0]=function(){try{return n.apply(this,arguments)}finally{let{handle:t,handleId:n,isPeriodic:r,isRefreshable:i}=e;!r&&!i&&(n?delete o[n]:t&&(t[Lr]=null))}};let i=nr(t,a[0],e,s,c);if(!i)return i;let{handleId:u,handle:d,isRefreshable:f,isPeriodic:p}=i.data;if(u)o[u]=i;else if(d&&(d[Lr]=i,f&&!p)){let e=d.refresh;d.refresh=function(){let{zone:t,state:n}=i;return n===`notScheduled`?(i._state=`scheduled`,t._updateTaskCount(i,1)):n===`running`&&(i._state=`scheduling`),e.call(this)}}return(l=d==null?u:d)==null?i:l}else return n.apply(e,a)}),a=Sr(e,n,t=>function(n,r){let i=r[0],a;Er(i)?(a=o[i],delete o[i]):(a=i==null?void 0:i[Lr],a?i[Lr]=null:a=i),a!=null&&a.type?a.cancelFn&&a.zone.cancelTask(a):t.apply(e,r)})}function zr(e,t){let{isBrowser:n,isMix:r}=t.getGlobalObjects();!n&&!r||!e.customElements||!(`customElements`in e)||t.patchCallbacks(t,e.customElements,`customElements`,`define`,[`connectedCallback`,`disconnectedCallback`,`adoptedCallback`,`attributeChangedCallback`,`formAssociatedCallback`,`formDisabledCallback`,`formResetCallback`,`formStateRestoreCallback`])}function Br(e,t){if(Zone[t.symbol(`patchEventTarget`)])return;let{eventNames:n,zoneSymbolEventNames:r,TRUE_STR:i,FALSE_STR:a,ZONE_SYMBOL_PREFIX:o}=t.getGlobalObjects();for(let e=0;e<n.length;e++){let t=n[e],s=t+a,c=t+i,l=o+s,u=o+c;r[t]={},r[t][a]=l,r[t][i]=u}let s=e.EventTarget;if(!(!s||!s.prototype))return t.patchEventTarget(e,t,[s&&s.prototype]),!0}function Vr(e,t){t.patchEventPrototype(e,t)}function Hr(e,t,n){if(!n||n.length===0)return t;let r=n.filter(t=>t.target===e);if(r.length===0)return t;let i=r[0].ignoreProperties;return t.filter(e=>i.indexOf(e)===-1)}function Ur(e,t,n,r){e&&_r(e,Hr(e,t,n),r)}function Wr(e){return Object.getOwnPropertyNames(e).filter(e=>e.startsWith(`on`)&&e.length>2).map(e=>e.substring(2))}function Gr(e,t){if(ur&&!fr||Zone[e.symbol(`patchEvents`)])return;let n=t.__Zone_ignore_on_properties,r=[];if(dr){let e=window;r=r.concat([`Document`,`SVGElement`,`Element`,`HTMLElement`,`HTMLBodyElement`,`HTMLMediaElement`,`HTMLFrameSetElement`,`HTMLFrameElement`,`HTMLIFrameElement`,`HTMLMarqueeElement`,`Worker`]),Ur(e,Wr(e),n,Gn(e))}r=r.concat([`XMLHttpRequest`,`XMLHttpRequestEventTarget`,`IDBIndex`,`IDBRequest`,`IDBOpenDBRequest`,`IDBDatabase`,`IDBTransaction`,`IDBCursor`,`WebSocket`]);for(let e=0;e<r.length;e++){let i=t[r[e]];i!=null&&i.prototype&&Ur(i.prototype,Wr(i.prototype),n)}}function Kr(e){e.__load_patch(`timers`,e=>{let t=`clear`;Rr(e,`set`,t,`Timeout`),Rr(e,`set`,t,`Interval`),Rr(e,`set`,t,`Immediate`)}),e.__load_patch(`requestAnimationFrame`,e=>{Rr(e,`request`,`cancel`,`AnimationFrame`),Rr(e,`mozRequest`,`mozCancel`,`AnimationFrame`),Rr(e,`webkitRequest`,`webkitCancel`,`AnimationFrame`)}),e.__load_patch(`blocking`,(e,t)=>{let n=[`alert`,`prompt`,`confirm`];for(let r=0;r<n.length;r++){let i=n[r];Sr(e,i,(n,r,i)=>function(r,a){return t.current.run(n,e,a,i)})}}),e.__load_patch(`EventTarget`,(e,t,n)=>{Vr(e,n),Br(e,n);let r=e.XMLHttpRequestEventTarget;r&&r.prototype&&n.patchEventTarget(e,n,[r.prototype])}),e.__load_patch(`MutationObserver`,(e,t,n)=>{yr(`MutationObserver`),yr(`WebKitMutationObserver`)}),e.__load_patch(`IntersectionObserver`,(e,t,n)=>{yr(`IntersectionObserver`)}),e.__load_patch(`FileReader`,(e,t,n)=>{yr(`FileReader`)}),e.__load_patch(`on_property`,(e,t,n)=>{Gr(n,e)}),e.__load_patch(`customElements`,(e,t,n)=>{zr(e,n)}),e.__load_patch(`XHR`,(e,t)=>{c(e);let n=L(`xhrTask`),r=L(`xhrSync`),i=L(`xhrListener`),a=L(`xhrScheduled`),o=L(`xhrURL`),s=L(`xhrErrorBeforeScheduled`);function c(e){let c=e.XMLHttpRequest;if(!c)return;let l=c.prototype;function u(e){return e[n]}let d=l[Xn],f=l[Zn];if(!d){let t=e.XMLHttpRequestEventTarget;if(t){let e=t.prototype;d=e[Xn],f=e[Zn]}}let p=`readystatechange`,m=`scheduled`;function h(e){let r=e.data,o=r.target;o[a]=!1,o[s]=!1;let c=o[i];d||(d=o[Xn],f=o[Zn]),c&&f.call(o,p,c);let l=o[i]=()=>{if(o.readyState===o.DONE)if(!r.aborted&&o[a]&&e.state===m){let n=o[t.__symbol__(`loadfalse`)];if(o.status!==0&&n&&n.length>0){let i=e.invoke;e.invoke=function(){let n=o[t.__symbol__(`loadfalse`)];for(let t=0;t<n.length;t++)n[t]===e&&n.splice(t,1);!r.aborted&&e.state===m&&i.call(e)},n.push(e)}else e.invoke()}else !r.aborted&&o[a]===!1&&(o[s]=!0)};return d.call(o,p,l),o[n]||(o[n]=e),x.apply(o,r.args),o[a]=!0,e}function g(){}function _(e){let t=e.data;return t.aborted=!0,S.apply(t.target,t.args)}let v=Sr(l,`open`,()=>function(e,t){return e[r]=t[2]==0,e[o]=t[1],v.apply(e,t)}),y=L(`fetchTaskAborting`),b=L(`fetchTaskScheduling`),x=Sr(l,`send`,()=>function(e,n){if(t.current[b]===!0||e[r])return x.apply(e,n);{let t={target:e,url:e[o],isPeriodic:!1,args:n,aborted:!1},r=nr(`XMLHttpRequest.send`,g,t,h,_);e&&e[s]===!0&&!t.aborted&&r.state===m&&r.invoke()}}),S=Sr(l,`abort`,()=>function(e,n){let r=u(e);if(r&&typeof r.type==`string`){if(r.cancelFn==null||r.data&&r.data.aborted)return;r.zone.cancelTask(r)}else if(t.current[y]===!0)return S.apply(e,n)})}}),e.__load_patch(`geolocation`,e=>{e.navigator&&e.navigator.geolocation&&sr(e.navigator.geolocation,[`getCurrentPosition`,`watchPosition`])}),e.__load_patch(`PromiseRejectionEvent`,(e,t)=>{function n(t){return function(n){Pr(e,t).forEach(r=>{let i=e.PromiseRejectionEvent;if(i){let e=new i(t,{promise:n.promise,reason:n.rejection});r.invoke(e)}})}}e.PromiseRejectionEvent&&(t[L(`unhandledPromiseRejectionHandler`)]=n(`unhandledrejection`),t[L(`rejectionHandledHandler`)]=n(`rejectionhandled`))}),e.__load_patch(`queueMicrotask`,(e,t,n)=>{Ir(e,n)})}function qr(e){e.__load_patch(`ZoneAwarePromise`,(e,t,n)=>{let r=Object.getOwnPropertyDescriptor,i=Object.defineProperty;function a(e){return e&&e.toString===Object.prototype.toString?(e.constructor&&e.constructor.name||``)+`: `+JSON.stringify(e):e?e.toString():Object.prototype.toString.call(e)}let o=n.symbol,s=[],c=e[o(`DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION`)]!==!1,l=o(`Promise`),u=o(`then`);n.onUnhandledError=e=>{if(n.showUncaughtError()){let t=e&&e.rejection;t?console.error(`Unhandled Promise rejection:`,t instanceof Error?t.message:t,`; Zone:`,e.zone.name,`; Task:`,e.task&&e.task.source,`; Value:`,t,t instanceof Error?t.stack:void 0):console.error(e)}},n.microtaskDrainDone=()=>{for(;s.length;){let e=s.shift();try{e.zone.runGuarded(()=>{throw e.throwOriginal?e.rejection:e})}catch(e){f(e)}}};let d=o(`unhandledPromiseRejectionHandler`);function f(e){n.onUnhandledError(e);try{let n=t[d];typeof n==`function`&&n.call(this,e)}catch(e){}}function p(e){return e&&typeof e.then==`function`}function m(e){return e}function h(e){return T.reject(e)}let g=o(`state`),_=o(`value`),v=o(`finally`),y=o(`parentPromiseValue`),b=o(`parentPromiseState`);function x(e,t){return n=>{try{C(e,t,n)}catch(t){C(e,!1,t)}}}let S=function(){let e=!1;return function(t){return function(){e||(e=!0,t.apply(null,arguments))}}},ee=o(`currentTaskTrace`);function C(e,r,o){let l=S();if(e===o)throw TypeError(`Promise resolved with itself`);if(e[g]===null){let u=null;try{(typeof o==`object`||typeof o==`function`)&&(u=o&&o.then)}catch(t){return l(()=>{C(e,!1,t)})(),e}if(r!==!1&&o instanceof T&&o.hasOwnProperty(g)&&o.hasOwnProperty(_)&&o[g]!==null)w(o),C(e,o[g],o[_]);else if(r!==!1&&typeof u==`function`)try{u.call(o,l(x(e,r)),l(x(e,!1)))}catch(t){l(()=>{C(e,!1,t)})()}else{e[g]=r;let l=e[_];if(e[_]=o,e[v]===v&&r===!0&&(e[g]=e[b],e[_]=e[y]),r===!1&&o instanceof Error){let e=t.currentTask&&t.currentTask.data&&t.currentTask.data.__creationTrace__;e&&i(o,ee,{configurable:!0,enumerable:!1,writable:!0,value:e})}for(let t=0;t<l.length;)ne(e,l[t++],l[t++],l[t++],l[t++]);if(l.length==0&&r==0){e[g]=0;let r=o;try{throw Error(`Uncaught (in promise): `+a(o)+(o&&o.stack?`
|
|
2
|
+
`+o.stack:``))}catch(e){r=e}c&&(r.throwOriginal=!0),r.rejection=o,r.promise=e,r.zone=t.current,r.task=t.currentTask,s.push(r),n.scheduleMicroTask()}}}return e}let te=o(`rejectionHandledHandler`);function w(e){if(e[g]===0){try{let n=t[te];n&&typeof n==`function`&&n.call(this,{rejection:e[_],promise:e})}catch(e){}e[g]=!1;for(let t=0;t<s.length;t++)e===s[t].promise&&s.splice(t,1)}}function ne(e,t,n,r,i){w(e);let a=e[g],o=a?typeof r==`function`?r:m:typeof i==`function`?i:h;t.scheduleMicroTask(`Promise.then`,()=>{try{let r=e[_],i=!!n&&v===n[v];i&&(n[y]=r,n[b]=a),C(n,!0,t.run(o,void 0,i&&o!==h&&o!==m?[]:[r]))}catch(e){C(n,!1,e)}},n)}let re=function(){},ie=e.AggregateError;class T{static toString(){return`function ZoneAwarePromise() { [native code] }`}static resolve(e){return e instanceof T?e:C(new this(null),!0,e)}static reject(e){return C(new this(null),!1,e)}static withResolvers(){let e={};return e.promise=new T((t,n)=>{e.resolve=t,e.reject=n}),e}static any(e){if(!e||typeof e[Symbol.iterator]!=`function`)return Promise.reject(new ie([],`All promises were rejected`));let t=[],n=0;try{for(let r of e)n++,t.push(T.resolve(r))}catch(e){return Promise.reject(new ie([],`All promises were rejected`))}if(n===0)return Promise.reject(new ie([],`All promises were rejected`));let r=!1,i=[];return new T((e,a)=>{for(let o=0;o<t.length;o++)t[o].then(t=>{r||(r=!0,e(t))},e=>{i.push(e),n--,n===0&&(r=!0,a(new ie(i,`All promises were rejected`)))})})}static race(e){let t,n,r=new this((e,r)=>{t=e,n=r});function i(e){t(e)}function a(e){n(e)}for(let t of e)p(t)||(t=this.resolve(t)),t.then(i,a);return r}static all(e){return T.allWithCallback(e)}static allSettled(e){return(this&&this.prototype instanceof T?this:T).allWithCallback(e,{thenCallback:e=>({status:`fulfilled`,value:e}),errorCallback:e=>({status:`rejected`,reason:e})})}static allWithCallback(e,t){let n,r,i=new this((e,t)=>{n=e,r=t}),a=2,o=0,s=[];for(let i of e){p(i)||(i=this.resolve(i));let e=o;try{i.then(r=>{s[e]=t?t.thenCallback(r):r,a--,a===0&&n(s)},i=>{t?(s[e]=t.errorCallback(i),a--,a===0&&n(s)):r(i)})}catch(e){r(e)}a++,o++}return a-=2,a===0&&n(s),i}constructor(e){let t=this;if(!(t instanceof T))throw Error(`Must be an instanceof Promise.`);t[g]=null,t[_]=[];try{let n=S();e&&e(n(x(t,!0)),n(x(t,!1)))}catch(e){C(t,!1,e)}}get[Symbol.toStringTag](){return`Promise`}get[Symbol.species](){return T}then(e,n){var r;let i=(r=this.constructor)==null?void 0:r[Symbol.species];(!i||typeof i!=`function`)&&(i=this.constructor||T);let a=new i(re),o=t.current;return this[g]==null?this[_].push(o,a,e,n):ne(this,o,a,e,n),a}catch(e){return this.then(null,e)}finally(e){var n;let r=(n=this.constructor)==null?void 0:n[Symbol.species];(!r||typeof r!=`function`)&&(r=T);let i=new r(re);i[v]=v;let a=t.current;return this[g]==null?this[_].push(a,i,e,e):ne(this,a,i,e,e),i}}T.resolve=T.resolve,T.reject=T.reject,T.race=T.race,T.all=T.all;let E=e[l]=e.Promise;e.Promise=T;let ae=o(`thenPatched`);function D(e){let t=e.prototype,n=r(t,`then`);if(n&&(n.writable===!1||!n.configurable))return;let i=t.then;t[u]=i,e.prototype.then=function(e,t){return new T((e,t)=>{i.call(this,e,t)}).then(e,t)},e[ae]=!0}n.patchThen=D;function oe(e){return function(t,n){let r=e.apply(t,n);if(r instanceof T)return r;let i=r.constructor;return i[ae]||D(i),r}}if(E){D(E);let t=E.try;t&&typeof t==`function`&&(T.try=t),Sr(e,`fetch`,e=>oe(e))}return Promise[t.__symbol__(`uncaughtPromiseErrors`)]=s,T})}function Jr(e){e.__load_patch(`toString`,e=>{let t=Function.prototype.toString,n=L(`OriginalDelegate`),r=L(`Promise`),i=L(`Error`),a=function(){if(typeof this==`function`){let a=this[n];if(a)return typeof a==`function`?t.call(a):Object.prototype.toString.call(a);if(this===Promise){let n=e[r];if(n)return t.call(n)}if(this===Error){let n=e[i];if(n)return t.call(n)}}return t.call(this)};a[n]=t,Function.prototype.toString=a;let o=Object.prototype.toString;Object.prototype.toString=function(){return typeof Promise==`function`&&this instanceof Promise?`[object Promise]`:o.call(this)}})}function Yr(e,t,n,r,i){let a=Zone.__symbol__(r);if(t[a])return;let o=t[a]=t[r];t[r]=function(a,s,c){return s&&s.prototype&&i.forEach(function(t){let i=`${n}.${r}::`+t,a=s.prototype;try{if(a.hasOwnProperty(t)){let n=e.ObjectGetOwnPropertyDescriptor(a,t);n&&n.value?(n.value=e.wrapWithCurrentZone(n.value,i),e._redefineProperty(s.prototype,t,n)):a[t]&&(a[t]=e.wrapWithCurrentZone(a[t],i))}else a[t]&&(a[t]=e.wrapWithCurrentZone(a[t],i))}catch(e){}}),o.call(t,a,s,c)},e.attachOriginToPatched(t[r],o)}function Xr(e){e.__load_patch(`util`,(e,t,n)=>{let r=Wr(e);n.patchOnProperties=_r,n.patchMethod=Sr,n.bindArguments=or,n.patchMacroTask=Cr;let i=t.__symbol__(`BLACK_LISTED_EVENTS`),a=t.__symbol__(`UNPATCHED_EVENTS`);e[a]&&(e[i]=e[a]),e[i]&&(t[i]=t[a]=e[i]),n.patchEventPrototype=Fr,n.patchEventTarget=Nr,n.ObjectDefineProperty=Wn,n.ObjectGetOwnPropertyDescriptor=Un,n.ObjectCreate=Kn,n.ArraySlice=qn,n.patchClass=yr,n.wrapWithCurrentZone=tr,n.filterProperties=Hr,n.attachOriginToPatched=wr,n._redefineProperty=Object.defineProperty,n.patchCallbacks=Yr,n.getGlobalObjects=()=>({globalSources:kr,zoneSymbolEventNames:Or,eventNames:r,isBrowser:dr,isMix:fr,isNode:ur,TRUE_STR:Qn,FALSE_STR:$n,ZONE_SYMBOL_PREFIX:er,ADD_EVENT_LISTENER_STR:Jn,REMOVE_EVENT_LISTENER_STR:Yn})})}function Zr(e){qr(e),Jr(e),Xr(e)}var Qr=Hn();Zr(Qr),Kr(Qr);function $r(e){return e.setValue(ti,!0)}function ei(e){return e.getValue(ti)===!0}var ti,ni=t((()=>{N(),ti=oe(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)})),ri,ii,ai=t((()=>{ri=`baggage`,ii=4096}));function oi(e){return e.reduce((e,t)=>{let n=`${e}${e===``?``:`,`}${t}`;return n.length>8192?e:n},``)}function si(e){return e.getAllEntries().map(([e,t])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(t.value)}`;return t.metadata!==void 0&&(n+=`;`+t.metadata.toString()),n})}function ci(e){if(!e)return;let t=e.indexOf(`;`),n=t===-1?e:e.substring(0,t),r=n.indexOf(`=`);if(r<=0)return;let i=n.substring(0,r).trim(),a=n.substring(r+1).trim();if(!i||!a)return;let o,s;try{o=decodeURIComponent(i),s=decodeURIComponent(a)}catch(e){return}let c;return t!==-1&&t<e.length-1&&(c=E(e.substring(t+1))),{key:o,value:s,metadata:c}}var li=t((()=>{N(),ai()})),ui,di=t((()=>{N(),ni(),ai(),li(),ui=class{inject(e,t,n){let r=Jt.getBaggage(e);if(!r||ei(e))return;let i=oi(si(r).filter(e=>e.length<=ii).slice(0,180));i.length>0&&n.set(t,ri,i)}extract(e,t,n){let r=n.get(t,ri),i=Array.isArray(r)?r.join(`,`):r;if(!i)return e;let a={};return i.length===0||(i.split(`,`).forEach(e=>{let t=ci(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),a[t.key]=e}}),Object.entries(a).length===0)?e:Jt.setBaggage(e,Jt.createBaggage(a))}fields(){return[ri]}}}));function fi(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!pi(n)){j.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!mi(r)){j.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function pi(e){return typeof e==`string`&&e!==``}function mi(e){return e==null?!0:Array.isArray(e)?hi(e):gi(typeof e)}function hi(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(gi(e)){t=e;continue}return!1}return!1}}return!0}function gi(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var _i=t((()=>{N()}));function vi(){return e=>{j.error(yi(e))}}function yi(e){return typeof e==`string`?e:JSON.stringify(bi(e))}function bi(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var xi=t((()=>{N()}));function Si(e){try{Ci(e)}catch(e){}}var Ci,wi=t((()=>{xi(),Ci=vi()})),Ti=t((()=>{})),Ei,Di=t((()=>{Ei=`2.7.1`})),Oi=t((()=>{})),ki=t((()=>{Oi()})),Ai=t((()=>{})),ji=t((()=>{Ai()})),Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji=t((()=>{Mi=`error.type`,Ni=`exception.message`,Pi=`exception.stacktrace`,Fi=`exception.type`,Ii=`http.request.method`,Li=`http.request.method_original`,Ri=`http.response.status_code`,zi=`server.address`,Bi=`server.port`,Vi=`service.name`,Hi=`telemetry.sdk.language`,Ui=`webjs`,Wi=`telemetry.sdk.name`,Gi=`telemetry.sdk.version`,Ki=`url.full`,qi=`user_agent.original`})),Yi=t((()=>{})),Xi=t((()=>{})),Zi=t((()=>{ki(),ji(),Ji(),Yi(),Xi()})),Qi,$i=t((()=>{Qi=`process.runtime.name`})),ea,ta=t((()=>{Di(),Zi(),$i(),ea={[Wi]:`opentelemetry`,[Qi]:`browser`,[Hi]:Ui,[Gi]:Ei}})),z,na=t((()=>{Ti(),ta(),z=performance}));function ra(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*pa)]}function ia(e){return da(ra(z.timeOrigin),ra(typeof e==`number`?e:z.now()))}function aa(e){if(la(e))return e;if(typeof e==`number`)return e<z.timeOrigin?ia(e):ra(e);if(e instanceof Date)return ra(e.getTime());throw TypeError(`Invalid input type`)}function oa(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=ma),[n,r]}function sa(e){return e[0]*ma+e[1]}function ca(e){return e[0]*1e6+e[1]/1e3}function la(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function ua(e){return la(e)||typeof e==`number`||e instanceof Date}function da(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=ma&&(n[1]-=ma,n[0]+=1),n}var fa,pa,ma,ha=t((()=>{na(),fa=9,pa=Math.pow(10,6),ma=Math.pow(10,fa)})),ga,_a=t((()=>{(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(ga||(ga={}))})),va,ya=t((()=>{N(),F(),va=class{constructor(e={}){var t;P(this,`_propagators`,void 0),P(this,`_fields`,void 0),this._propagators=(t=e.propagators)==null?[]:t;let n=new Set;for(let e of this._propagators){let t=typeof e.fields==`function`?e.fields():[];for(let e of t)n.add(e)}this._fields=Array.from(n)}inject(e,t,n){for(let r of this._propagators)try{r.inject(e,t,n)}catch(e){j.warn(`Failed to inject with ${r.constructor.name}. Err: ${e.message}`)}}extract(e,t,n){return this._propagators.reduce((e,r)=>{try{return r.extract(e,t,n)}catch(e){j.warn(`Failed to extract with ${r.constructor.name}. Err: ${e.message}`)}return e},e)}fields(){return this._fields.slice()}}}));function ba(e){return Ta.test(e)}function xa(e){return Ea.test(e)&&!Da.test(e)}var Sa,Ca,wa,Ta,Ea,Da,Oa=t((()=>{Sa=`[_0-9a-z-*/]`,Ca=`[a-z]${Sa}{0,255}`,wa=`[a-z0-9]${Sa}{0,240}@[a-z]${Sa}{0,13}`,Ta=RegExp(`^(?:${Ca}|${wa})$`),Ea=/^[ -~]{0,255}[!-~]$/,Da=/,|=/})),ka,Aa,ja,Ma,Na,Pa=t((()=>{Oa(),F(),ka=32,Aa=512,ja=`,`,Ma=`=`,Na=class e{constructor(e){P(this,`_length`,void 0),P(this,`_rawTraceState`,void 0),P(this,`_internalState`,void 0),this._rawTraceState=typeof e==`string`?e:``,this._length=this._rawTraceState.length}set(e,t){if(!ba(e)||!xa(t))return this;let n=this._getState(),r=n.get(e),i=this._length;if(typeof r==`string`?i+=t.length-r.length:i+=e.length+t.length+(n.size>0?2:1),i>Aa)return this;let a=new Map(n);return a.delete(e),a.set(e,t),this._fromState(a,i)}unset(e){let t=this._getState(),n=t.get(e);if(typeof n!=`string`)return this;let r=this._length-(e.length+n.length+1);t.size>1&&--r;let i=new Map(t);return i.delete(e),this._fromState(i,r)}get(e){return this._getState().get(e)}serialize(){let e=``,t=0;for(let n of this._getState())t>0&&(e=ja+e),e=`${n[0]}${Ma}${n[1]}`+e,t++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(ja),t=new Map,n=0;for(let r of e){let e=r.trim(),i=e.indexOf(Ma);if(i===-1)continue;let a=e.slice(0,i),o=e.slice(i+1);if(!ba(a)||!xa(o))continue;let s=n+e.length+ +(t.size>0);if(!(s>Aa)&&(t.set(a,o),n=s,t.size>=ka))break}return this._length=n,this._internalState=new Map(Array.from(t.entries()).reverse()),this._internalState}_fromState(t,n){let r=Object.create(e.prototype);return r._internalState=t,r._length=n,r}}}));function Fa(e){let t=za.exec(e);return!t||t[1]===`00`&&t[5]?null:{traceId:t[2],spanId:t[3],traceFlags:parseInt(t[4],16)}}var Ia,La,Ra,za,Ba,Va=t((()=>{N(),ni(),Pa(),Ia=`traceparent`,La=`tracestate`,Ra=`00`,za=RegExp(`^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$`),Ba=class{inject(e,t,n){let r=M.getSpanContext(e);if(!r||ei(e)||!it(r))return;let i=`${Ra}-${r.traceId}-${r.spanId}-0${Number(r.traceFlags||k.NONE).toString(16)}`;n.set(t,Ia,i),r.traceState&&n.set(t,La,r.traceState.serialize())}extract(e,t,n){let r=n.get(t,Ia);if(!r)return e;let i=Array.isArray(r)?r[0]:r;if(typeof i!=`string`)return e;let a=Fa(i);if(!a)return e;a.isRemote=!0;let o=n.get(t,La);if(o){let e=Array.isArray(o)?o.join(`,`):o;a.traceState=new Na(typeof e==`string`?e:void 0)}return M.setSpanContext(e,a)}fields(){return[Ia,La]}}}));function Ha(e){if(!Ua(e)||Wa(e)!==qa)return!1;let t=Qa(e);if(t===null)return!0;let n=eo.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Xa.call(n)===Za}function Ua(e){return typeof e==`object`&&!!e}function Wa(e){return e==null?e===void 0?Ya:Ja:to&&to in Object(e)?Ga(e):Ka(e)}function Ga(e){let t=eo.call(e,to),n=e[to],r=!1;try{e[to]=void 0,r=!0}catch(e){}let i=no.call(e);return r&&(t?e[to]=n:delete e[to]),i}function Ka(e){return no.call(e)}var qa,Ja,Ya,Xa,Za,Qa,$a,eo,to,no,ro=t((()=>{qa=`[object Object]`,Ja=`[object Null]`,Ya=`[object Undefined]`,Xa=Function.prototype.toString,Za=Xa.call(Object),Qa=Object.getPrototypeOf,$a=Object.prototype,eo=$a.hasOwnProperty,to=Symbol?Symbol.toStringTag:void 0,no=$a.toString}));function io(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=oo(t,e.shift(),0,n);return t}function ao(e){return co(e)?e.slice():e}function oo(e,t,n=0,r){let i;if(!(n>mo)){if(n++,fo(e)||fo(t)||lo(t))i=ao(t);else if(co(e)){if(i=e.slice(),co(t))for(let e=0,n=t.length;e<n;e++)i.push(ao(t[e]));else if(uo(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=ao(t[r]))}}}else if(uo(e))if(uo(t)){if(!po(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(fo(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(so(e,s,r)||so(t,s,r))delete i[s];else{if(uo(a)&&uo(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=oo(i[s],c,n,r)}}}}else i=t;return i}}function so(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function co(e){return Array.isArray(e)}function lo(e){return typeof e==`function`}function uo(e){return!fo(e)&&!co(e)&&!lo(e)&&typeof e==`object`}function fo(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function po(e,t){return!(!Ha(e)||!Ha(t))}var mo,ho=t((()=>{ro(),mo=20}));function go(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new _o(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var _o,vo=t((()=>{_o=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}}));function yo(e,t){return typeof t==`string`?e===t:!!e.match(t)}function bo(e,t){if(!t)return!1;for(let n of t)if(yo(e,n))return!0;return!1}var xo=t((()=>{})),So,Co=t((()=>{F(),So=class{constructor(){P(this,`_promise`,void 0),P(this,`_resolve`,void 0),P(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}})),wo,To=t((()=>{Co(),F(),wo=class{constructor(e,t){P(this,`_isCalled`,!1),P(this,`_deferred`,new So),P(this,`_callback`,void 0),P(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}}));function Eo(e,t){return new Promise(n=>{A.with($r(A.active()),()=>{e.export(t,n)})})}var Do=t((()=>{N(),ni()})),Oo,B=t((()=>{di(),F(),_i(),wi(),xi(),ha(),_a(),li(),na(),ya(),Va(),N(),ni(),Pa(),ho(),vo(),xo(),To(),Do(),Oo={_export:Eo}}));F();var ko=class{constructor(e){P(this,`_delegate`,void 0),this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}};F();var Ao=class extends Error{constructor(e,t,n){super(e),P(this,`code`,void 0),P(this,`name`,`OTLPExporterError`),P(this,`data`,void 0),this.data=n,this.code=t}};function jo(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function V(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){jo(a,r,i,o,s,`next`,e)}function s(e){jo(a,r,i,o,s,`throw`,e)}o(void 0)})}}var H=t((()=>{}));H();function Mo(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function No(e){if(e!=null)return V(function*(){return e})}function Po(e,t,n){var r,i,a,o,s,c;return{timeoutMillis:Mo((r=(i=e.timeoutMillis)==null?t.timeoutMillis:i)==null?n.timeoutMillis:r),concurrencyLimit:(a=(o=e.concurrencyLimit)==null?t.concurrencyLimit:o)==null?n.concurrencyLimit:a,compression:(s=(c=e.compression)==null?t.compression:c)==null?n.compression:s}}function Fo(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}F(),H();var Io=class{constructor(e){P(this,`_concurrencyLimit`,void 0),P(this,`_sendingPromises`,[]),this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}awaitAll(){var e=this;return V(function*(){yield Promise.all(e._sendingPromises)})()}};function Lo(e){return new Io(e.concurrencyLimit)}N();function Ro(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function zo(){return{handleResponse(e){e==null||!Ro(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||j.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}B(),N(),F(),H();var Bo=class{constructor(e,t,n,r,i){P(this,`_diagLogger`,void 0),P(this,`_transport`,void 0),P(this,`_serializer`,void 0),P(this,`_responseHandler`,void 0),P(this,`_promiseQueue`,void 0),P(this,`_timeout`,void 0),this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=j.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:ga.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:ga.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:ga.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:ga.FAILED,error:e.error});return}else if(e.status===`retryable`){var n;t({code:ga.FAILED,error:(n=e.error)==null?new Ao(`Export failed with retryable status`):n})}else t({code:ga.FAILED,error:new Ao(`Export failed with unknown error`)})},e=>t({code:ga.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}shutdown(){var e=this;return V(function*(){e._diagLogger.debug(`shutdown started`),yield e.forceFlush(),e._transport.shutdown()})()}};function Vo(e,t){return new Bo(e.transport,e.serializer,zo(),e.promiseHandler,t.timeout)}function Ho(e,t,n){return Vo({transport:n,serializer:t,promiseHandler:Lo(e)},{timeout:e.timeoutMillis})}var Uo;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(Uo||(Uo={}));var U;(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(U||(U={}));var Wo;(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(Wo||(Wo={}));function Go(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function Ko(e){var t,n;return`${e.name}:${(t=e.version)==null?``:t}:${(n=e.schemaUrl)==null?``:n}`}var qo=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function Jo(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new qo(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function Yo(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Xo(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function Zo(e,t){return e.toLowerCase()===t.toLowerCase()}var Qo;(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(Qo||(Qo={})),F();var $o=class{constructor(){P(this,`kind`,Qo.DROP)}createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}};F();function es(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var ts=class{constructor(e,t,n=!0,r=es(t)){P(this,`startTime`,void 0),P(this,`_boundaries`,void 0),P(this,`_recordMinMax`,void 0),P(this,`_current`,void 0),this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=Xo(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},ns=class{constructor(e,t){P(this,`kind`,Qo.HISTOGRAM),P(this,`_boundaries`,void 0),P(this,`_recordMinMax`,void 0),this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new ts(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new ts(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new ts(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wo.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===U.GAUGE||e.type===U.UP_DOWN_COUNTER||e.type===U.OBSERVABLE_GAUGE||e.type===U.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}};F();var rs=class e{constructor(e=new is,t=0,n=0,r=0){P(this,`backing`,void 0),P(this,`indexBase`,void 0),P(this,`indexStart`,void 0),P(this,`indexEnd`,void 0),this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},is=class e{constructor(e=[0]){P(this,`_counts`,void 0),this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}},as=2146435072,os=1048575,ss=1023,cs=-ss+1,ls=ss,us=Math.pow(2,-1022);function ds(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&as)>>20)-ss}function fs(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let n=t.getUint32(0),r=t.getUint32(4);return(n&os)*Math.pow(2,32)+r}function ps(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*Math.pow(2,t)}function ms(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var hs=class extends Error{};F();var gs=class{constructor(e){P(this,`_shift`,void 0),this._shift=-e}mapToIndex(e){return e<us?this._minNormalLowerBoundaryIndex():ds(e)+this._rightShift(fs(e)-1,52)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new hs(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new hs(`overflow: ${e} is > maximum lower boundary: ${n}`);return ps(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=cs>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return ls>>this._shift}_rightShift(e,t){return Math.floor(e*Math.pow(2,-t))}};F();var _s=class{constructor(e){P(this,`_scale`,void 0),P(this,`_scaleFactor`,void 0),P(this,`_inverseFactor`,void 0),this._scale=e,this._scaleFactor=ps(Math.LOG2E,e),this._inverseFactor=ps(Math.LN2,-e)}mapToIndex(e){if(e<=us)return this._minNormalLowerBoundaryIndex()-1;if(fs(e)===0)return(ds(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new hs(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return us;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new hs(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return cs<<this._scale}_maxNormalLowerBoundaryIndex(){return(ls+1<<this._scale)-1}},vs=-10,ys=20,bs=Array.from({length:31},(e,t)=>t>10?new _s(t-10):new gs(t-10));function xs(e){if(e>ys||e<vs)throw new hs(`expected scale >= ${vs} && <= ${ys}, got: ${e}`);return bs[e+10]}N(),F();var Ss=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}constructor(e,t){P(this,`low`,void 0),P(this,`high`,void 0),this.low=e,this.high=t}},Cs=20,ws=160,Ts=2,Es=class e{constructor(e,t=ws,n=!0,r=0,i=0,a=0,o=1/0,s=-1/0,c=new rs,l=new rs,u=xs(Cs)){P(this,`startTime`,void 0),P(this,`_maxSize`,void 0),P(this,`_recordMinMax`,void 0),P(this,`_sum`,void 0),P(this,`_count`,void 0),P(this,`_zeroCount`,void 0),P(this,`_min`,void 0),P(this,`_max`,void 0),P(this,`_positive`,void 0),P(this,`_negative`,void 0),P(this,`_mapping`,void 0),this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=i,this._zeroCount=a,this._min=o,this._max=s,this._positive=c,this._negative=l,this._mapping=u,this._maxSize<Ts&&(j.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
|
|
3
|
+
changing to the minimum size of: ${Ts}`),this._maxSize=Ts)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){if(!Number.isNaN(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,n){let r=this._mapping.mapToIndex(t),i=!1,a=0,o=0;if(e.length===0?(e.indexStart=r,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):r<e.indexStart&&e.indexEnd-r>=this._maxSize?(i=!0,o=r,a=e.indexEnd):r>e.indexEnd&&r-e.indexStart>=this._maxSize&&(i=!0,o=e.indexStart,a=r),i){let e=this._changeScale(a,o);this._downscale(e),r=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,r,n)}_incrementIndexBy(e,t,n){if(n===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let n=e.indexEnd-t;n>=e.backing.length&&this._grow(e,n+1),e.indexStart=t}else if(t>e.indexEnd){let n=t-e.indexStart;n>=e.backing.length&&this._grow(e,n+1),e.indexEnd=t}let r=t-e.indexBase;r<0&&(r+=e.backing.length),e.incrementBucket(r,n)}_grow(e,t){let n=e.backing.length,r=e.indexBase-e.indexStart,i=n-r,a=ms(t);a>this._maxSize&&(a=this._maxSize);let o=a-r;e.backing.growTo(a,i,o)}_changeScale(e,t){let n=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,n++;return n}_downscale(e){if(e===0)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=xs(t)}_minScale(e){let t=Math.min(this.scale,e.scale),n=Ss.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),r=Ss.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(n.high,n.low),t-this._changeScale(r.high,r.low))}_highLowAtScale(e,t,n){if(e.length===0)return new Ss(0,-1);let r=t-n;return new Ss(e.indexStart>>r,e.indexEnd>>r)}_mergeBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++)this._incrementIndexBy(e,i+t>>a,n.at(t))}_diffBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++){let r=(i+t>>a)-e.indexBase;r<0&&(r+=e.backing.length),e.decrementBucket(r,n.at(t))}e.trim()}},Ds=class{constructor(e,t){P(this,`kind`,Qo.EXPONENTIAL_HISTOGRAM),P(this,`_maxSize`,void 0),P(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new Es(e,this._maxSize,this._recordMinMax)}merge(e,t){let n=t.clone();return n.merge(e),n}diff(e,t){let n=t.clone();return n.diff(e),n}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wo.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===U.GAUGE||e.type===U.UP_DOWN_COUNTER||e.type===U.OBSERVABLE_GAUGE||e.type===U.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,positive:{offset:i.positive.offset,bucketCounts:i.positive.bucketCounts},negative:{offset:i.negative.offset,bucketCounts:i.negative.bucketCounts},count:i.count,scale:i.scale,zeroCount:i.zeroCount}}})}}};B(),F();var Os=class{constructor(e,t=0,n=[0,0]){P(this,`startTime`,void 0),P(this,`_current`,void 0),P(this,`sampleTime`,void 0),this.startTime=e,this._current=t,this.sampleTime=n}record(e){this._current=e,this.sampleTime=ra(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},ks=class{constructor(){P(this,`kind`,Qo.LAST_VALUE)}createAccumulation(e){return new Os(e)}merge(e,t){let n=ca(t.sampleTime)>=ca(e.sampleTime)?t:e;return new Os(e.startTime,n.toPointValue(),n.sampleTime)}diff(e,t){let n=ca(t.sampleTime)>=ca(e.sampleTime)?t:e;return new Os(t.startTime,n.toPointValue(),n.sampleTime)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wo.GAUGE,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()}))}}};F();var As=class{constructor(e,t,n=0,r=!1){P(this,`startTime`,void 0),P(this,`monotonic`,void 0),P(this,`_current`,void 0),P(this,`reset`,void 0),this.startTime=e,this.monotonic=t,this._current=n,this.reset=r}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},js=class{constructor(e){P(this,`kind`,Qo.SUM),P(this,`monotonic`,void 0),this.monotonic=e}createAccumulation(e){return new As(e,this.monotonic)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue();return t.reset?new As(t.startTime,this.monotonic,r,t.reset):new As(e.startTime,this.monotonic,n+r)}diff(e,t){let n=e.toPointValue(),r=t.toPointValue();return this.monotonic&&n>r?new As(t.startTime,this.monotonic,r,!0):new As(t.startTime,this.monotonic,r-n)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:Wo.SUM,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()})),isMonotonic:this.monotonic}}};N(),F();var Ms=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};P(Ms,`DEFAULT_INSTANCE`,new $o);var Ns=class e{createAggregator(t){switch(t.type){case U.COUNTER:case U.OBSERVABLE_COUNTER:case U.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}};P(Ns,`MONOTONIC_INSTANCE`,new js(!0)),P(Ns,`NON_MONOTONIC_INSTANCE`,new js(!1));var Ps=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};P(Ps,`DEFAULT_INSTANCE`,new ks);var Fs=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};P(Fs,`DEFAULT_INSTANCE`,new ns([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0));var Is=class{constructor(e,t=!0){if(P(this,`_boundaries`,void 0),P(this,`_recordMinMax`,void 0),e==null)throw Error(`ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array`);e=e.concat(),e=e.sort((e,t)=>e-t);let n=e.lastIndexOf(-1/0),r=e.indexOf(1/0);r===-1&&(r=void 0),this._boundaries=e.slice(n+1,r),this._recordMinMax=t}createAggregator(e){return new ns(this._boundaries,this._recordMinMax)}},Ls=class{constructor(e=160,t=!0){P(this,`_maxSize`,void 0),P(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new Ds(this._maxSize,this._recordMinMax)}},Rs=class{_resolve(e){switch(e.type){case U.COUNTER:case U.UP_DOWN_COUNTER:case U.OBSERVABLE_COUNTER:case U.OBSERVABLE_UP_DOWN_COUNTER:return Bs;case U.GAUGE:case U.OBSERVABLE_GAUGE:return Vs;case U.HISTOGRAM:return e.advice.explicitBucketBoundaries?new Is(e.advice.explicitBucketBoundaries):Hs}return j.warn(`Unable to recognize instrument type: ${e.type}`),zs}createAggregator(e){return this._resolve(e).createAggregator(e)}},zs=new Ms,Bs=new Ns,Vs=new Ps,Hs=new Fs;new Ls;var Us=new Rs,Ws;(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`})(Ws||(Ws={}));function Gs(e){switch(e.type){case Ws.DEFAULT:return Us;case Ws.DROP:return zs;case Ws.SUM:return Bs;case Ws.LAST_VALUE:return Vs;case Ws.EXPONENTIAL_HISTOGRAM:{var t,n;let r=e;return new Ls((t=r.options)==null?void 0:t.maxSize,(n=r.options)==null?void 0:n.recordMinMax)}case Ws.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;if(t.options==null)return Hs;var r,i;return new Is((r=t.options)==null?void 0:r.boundaries,(i=t.options)==null?void 0:i.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}var Ks=e=>({type:Ws.DEFAULT}),qs=e=>Uo.CUMULATIVE;N(),F(),H();var Js=class{constructor(e){var t,n,r;P(this,`_shutdown`,!1),P(this,`_metricProducers`,void 0),P(this,`_sdkMetricProducer`,void 0),P(this,`_aggregationTemporalitySelector`,void 0),P(this,`_aggregationSelector`,void 0),P(this,`_cardinalitySelector`,void 0),this._aggregationSelector=(t=e==null?void 0:e.aggregationSelector)==null?Ks:t,this._aggregationTemporalitySelector=(n=e==null?void 0:e.aggregationTemporalitySelector)==null?qs:n,this._metricProducers=(r=e==null?void 0:e.metricProducers)==null?[]:r,this._cardinalitySelector=e==null?void 0:e.cardinalitySelector}setMetricProducer(e){if(this._sdkMetricProducer)throw Error(`MetricReader can not be bound to a MeterProvider again.`);this._sdkMetricProducer=e,this.onInitialized()}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}collect(e){var t=this;return V(function*(){if(t._sdkMetricProducer===void 0)throw Error(`MetricReader is not bound to a MetricProducer`);if(t._shutdown)throw Error(`MetricReader is shutdown`);let[n,...r]=yield Promise.all([t._sdkMetricProducer.collect({timeoutMillis:e==null?void 0:e.timeoutMillis}),...t._metricProducers.map(t=>t.collect({timeoutMillis:e==null?void 0:e.timeoutMillis}))]),i=n.errors.concat(r.flatMap(e=>e.errors));return{resourceMetrics:{resource:n.resourceMetrics.resource,scopeMetrics:n.resourceMetrics.scopeMetrics.concat(r.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:i}})()}shutdown(e){var t=this;return V(function*(){if(t._shutdown){j.error(`Cannot call shutdown twice.`);return}(e==null?void 0:e.timeoutMillis)==null?yield t.onShutdown():yield Jo(t.onShutdown(),e.timeoutMillis),t._shutdown=!0})()}forceFlush(e){var t=this;return V(function*(){if(t._shutdown){j.warn(`Cannot forceFlush on already shutdown MetricReader.`);return}if((e==null?void 0:e.timeoutMillis)==null){yield t.onForceFlush();return}yield Jo(t.onForceFlush(),e.timeoutMillis)})()}};function Ys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ys(Object(n),!0).forEach(function(t){P(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var G=t((()=>{F()}));N(),B(),F(),G(),H();var Xs=class extends Js{constructor(e){var t,n;let{exporter:r,exportIntervalMillis:i=6e4,metricProducers:a,cardinalityLimits:o}=e,{exportTimeoutMillis:s=3e4}=e;if(super({aggregationSelector:(t=r.selectAggregation)==null?void 0:t.bind(r),aggregationTemporalitySelector:(n=r.selectAggregationTemporality)==null?void 0:n.bind(r),metricProducers:a,cardinalitySelector:e=>{let t=W({default:2e3},o);switch(e){case U.COUNTER:var n;return(n=t.counter)==null?t.default:n;case U.GAUGE:var r;return(r=t.gauge)==null?t.default:r;case U.HISTOGRAM:var i;return(i=t.histogram)==null?t.default:i;case U.OBSERVABLE_COUNTER:var a;return(a=t.observableCounter)==null?t.default:a;case U.OBSERVABLE_UP_DOWN_COUNTER:var s;return(s=t.observableUpDownCounter)==null?t.default:s;case U.OBSERVABLE_GAUGE:var c;return(c=t.observableGauge)==null?t.default:c;case U.UP_DOWN_COUNTER:var l;return(l=t.upDownCounter)==null?t.default:l;default:return t.default}}}),P(this,`_interval`,void 0),P(this,`_exporter`,void 0),P(this,`_exportInterval`,void 0),P(this,`_exportTimeout`,void 0),i<=0)throw Error(`exportIntervalMillis must be greater than 0`);if(s<=0)throw Error(`exportTimeoutMillis must be greater than 0`);if(i<s){if(`exportIntervalMillis`in e&&`exportTimeoutMillis`in e)throw Error(`exportIntervalMillis must be greater than or equal to exportTimeoutMillis`);j.info(`Timeout of ${s} exceeds the interval of ${i}. Clamping timeout to interval duration.`),s=i}this._exportInterval=i,this._exportTimeout=s,this._exporter=r}_runOnce(){var e=this;return V(function*(){try{yield Jo(e._doRun(),e._exportTimeout)}catch(t){if(t instanceof qo){j.error(`Export took longer than %s milliseconds and timed out.`,e._exportTimeout);return}Si(t)}})()}_doRun(){var e=this;return V(function*(){let{resourceMetrics:t,errors:n}=yield e.collect({timeoutMillis:e._exportTimeout});if(n.length>0&&j.error(`PeriodicExportingMetricReader: metrics collection errors`,...n),t.resource.asyncAttributesPending)try{var r,i;yield(r=(i=t.resource).waitForAsyncAttributes)==null?void 0:r.call(i)}catch(e){j.debug(`Error while resolving async portion of resource: `,e),Si(e)}if(t.scopeMetrics.length===0)return;let a=yield Oo._export(e._exporter,t);if(a.code!==ga.SUCCESS)throw Error(`PeriodicExportingMetricReader: metrics export failed (error ${a.error})`)})()}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!=`number`&&this._interval.unref()}onForceFlush(){var e=this;return V(function*(){yield e._runOnce(),yield e._exporter.forceFlush()})()}onShutdown(){var e=this;return V(function*(){e._interval&&clearInterval(e._interval),yield e.onForceFlush(),yield e._exporter.shutdown()})()}};function Zs(){if(Qs===void 0)try{let e=globalThis.process.argv0;Qs=e?`unknown_service:${e}`:`unknown_service`}catch(e){Qs=`unknown_service`}return Qs}var Qs,$s=t((()=>{})),ec,tc=t((()=>{ec=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}));function nc(e,t){return sc.FromAttributeList(Object.entries(e),t)}function rc(){return nc({[Vi]:Zs(),[Hi]:ea[Hi],[Wi]:ea[Wi],[Gi]:ea[Gi]})}function ic(e){return e.map(([e,t])=>ec(t)?[e,t.catch(t=>{j.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function ac(e){if(typeof e==`string`||e===void 0)return e;j.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function oc(e,t){let n=e==null?void 0:e.schemaUrl,r=t==null?void 0:t.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;j.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var sc,cc=t((()=>{N(),B(),Zi(),$s(),tc(),F(),H(),sc=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=ic(t),r._asyncAttributesPending=t.filter(([e,t])=>ec(t)).length>0,r}constructor(e,t){var n;P(this,`_rawAttributes`,void 0),P(this,`_asyncAttributesPending`,!1),P(this,`_schemaUrl`,void 0),P(this,`_memoizedAttributes`,void 0);let r=(n=e.attributes)==null?{}:n;this._rawAttributes=Object.entries(r).map(([e,t])=>(ec(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=ic(this._rawAttributes),this._schemaUrl=ac(t==null?void 0:t.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}waitForAsyncAttributes(){var e=this;return V(function*(){if(e.asyncAttributesPending){for(let t=0;t<e._rawAttributes.length;t++){let[n,r]=e._rawAttributes[t];e._rawAttributes[t]=[n,ec(r)?yield r:r]}e._asyncAttributesPending=!1}})()}get attributes(){if(this.asyncAttributesPending&&j.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(ec(n)){j.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]!=null||(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=oc(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}})),lc=t((()=>{N(),cc(),Zi(),B(),F(),$s()}));F();var uc=class{constructor(){P(this,`_registeredViews`,[])}addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(n=>this._matchInstrument(n.instrumentSelector,e)&&this._matchMeter(n.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}};N();function dc(e,t,n){var r,i,a,o;return hc(e)||j.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:(r=n==null?void 0:n.description)==null?``:r,unit:(i=n==null?void 0:n.unit)==null?``:i,valueType:(a=n==null?void 0:n.valueType)==null?ke.DOUBLE:a,advice:(o=n==null?void 0:n.advice)==null?{}:o}}function fc(e,t){var n,r;return{name:(n=e.name)==null?t.name:n,description:(r=e.description)==null?t.description:r,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function pc(e,t){return Zo(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var mc=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function hc(e){return mc.test(e)}N(),B(),F();var gc=class{constructor(e,t){P(this,`_writableMetricStorage`,void 0),P(this,`_descriptor`,void 0),this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},n=A.active()){if(typeof e!=`number`){j.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`);return}this._descriptor.valueType===ke.INT&&!Number.isInteger(e)&&(j.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,n,ra(Date.now()))}},_c=class extends gc{add(e,t,n){this._record(e,t,n)}},vc=class extends gc{add(e,t,n){if(e<0){j.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},yc=class extends gc{record(e,t,n){this._record(e,t,n)}},bc=class extends gc{record(e,t,n){if(e<0){j.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},xc=class{constructor(e,t,n){P(this,`_metricStorages`,void 0),P(this,`_descriptor`,void 0),P(this,`_observableRegistry`,void 0),this._descriptor=e,this._metricStorages=t,this._observableRegistry=n}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}},Sc=class extends xc{},Cc=class extends xc{},wc=class extends xc{};function Tc(e){return e instanceof xc}F();var Ec=class{constructor(e){P(this,`_meterSharedState`,void 0),this._meterSharedState=e}createGauge(e,t){let n=dc(e,U.GAUGE,t);return new yc(this._meterSharedState.registerMetricStorage(n),n)}createHistogram(e,t){let n=dc(e,U.HISTOGRAM,t);return new bc(this._meterSharedState.registerMetricStorage(n),n)}createCounter(e,t){let n=dc(e,U.COUNTER,t);return new vc(this._meterSharedState.registerMetricStorage(n),n)}createUpDownCounter(e,t){let n=dc(e,U.UP_DOWN_COUNTER,t);return new _c(this._meterSharedState.registerMetricStorage(n),n)}createObservableGauge(e,t){let n=dc(e,U.OBSERVABLE_GAUGE,t);return new Cc(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let n=dc(e,U.OBSERVABLE_COUNTER,t);return new Sc(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let n=dc(e,U.OBSERVABLE_UP_DOWN_COUNTER,t);return new wc(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}};F();var Dc=class{constructor(e){P(this,`_instrumentDescriptor`,void 0),this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=dc(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}};F();var Oc=class{constructor(e){P(this,`_valueMap`,new Map),P(this,`_keyMap`,new Map),P(this,`_hash`,void 0),this._hash=e}get(e,t){return t!=null||(t=this._hash(e)),this._valueMap.get(t)}getOrDefault(e,t){let n=this._hash(e);if(this._valueMap.has(n))return this._valueMap.get(n);let r=t();return this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,r),r}set(e,t,n){n!=null||(n=this._hash(e)),this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,t)}has(e,t){return t!=null||(t=this._hash(e)),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}},kc=class extends Oc{constructor(){super(Go)}};F();var Ac=class{constructor(e,t){P(this,`_activeCollectionStorage`,new kc),P(this,`_cumulativeMemoStorage`,new kc),P(this,`_cardinalityLimit`,void 0),P(this,`_overflowAttributes`,{"otel.metric.overflow":!0}),P(this,`_overflowHashCode`,void 0),P(this,`_aggregator`,void 0),this._aggregator=e,this._cardinalityLimit=(t==null?2e3:t)-1,this._overflowHashCode=Go(this._overflowAttributes)}record(e,t,n,r){let i=this._activeCollectionStorage.get(t);if(!i){if(this._activeCollectionStorage.size>=this._cardinalityLimit){let t=this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(r));t==null||t.record(e);return}i=this._aggregator.createAccumulation(r),this._activeCollectionStorage.set(t,i)}i==null||i.record(e)}batchCumulate(e,t){for(let[n,r,i]of e.entries()){let e=n,a=i,o=this._aggregator.createAccumulation(t);o==null||o.record(r);let s=o;if(this._cumulativeMemoStorage.has(e,a)){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(e,a))){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}if(this._activeCollectionStorage.has(e,a)){let t=this._activeCollectionStorage.get(e,a);s=this._aggregator.merge(t,s)}this._cumulativeMemoStorage.set(e,o,a),this._activeCollectionStorage.set(e,s,a)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new kc,e}};F();var jc=class e{constructor(e,t){P(this,`_aggregator`,void 0),P(this,`_unreportedAccumulations`,new Map),P(this,`_reportHistory`,new Map),this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(t,n,r,i){this._stashAccumulations(r);let a=this._getMergedUnreportedAccumulations(t),o=a,s;if(this._reportHistory.has(t)){let n=this._reportHistory.get(t),r=n.collectionTime;s=n.aggregationTemporality,o=s===Uo.CUMULATIVE?e.merge(n.accumulations,a,this._aggregator):e.calibrateStartTime(n.accumulations,a,r)}else s=t.selectAggregationTemporality(n.type);this._reportHistory.set(t,{accumulations:o,collectionTime:i,aggregationTemporality:s});let c=Mc(o);if(c.length!==0)return this._aggregator.toMetricData(n,s,c,i)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let n of t){let t=this._unreportedAccumulations.get(n);t===void 0&&(t=[],this._unreportedAccumulations.set(n,t)),t.push(e)}}_getMergedUnreportedAccumulations(t){let n=new kc,r=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),r===void 0)return n;for(let t of r)n=e.merge(n,t,this._aggregator);return n}static merge(e,t,n){let r=e,i=t.entries(),a=i.next();for(;a.done!==!0;){let[t,o,s]=a.value;if(e.has(t,s)){let i=e.get(t,s),a=n.merge(i,o);r.set(t,a,s)}else r.set(t,o,s);a=i.next()}return r}static calibrateStartTime(e,t,n){for(let[r,i]of e.keys()){let e=t.get(r,i);e==null||e.setStartTime(n)}return t}};function Mc(e){return Array.from(e.entries())}F();var Nc=class extends Dc{constructor(e,t,n,r,i){super(e),P(this,`_aggregationCardinalityLimit`,void 0),P(this,`_deltaMetricStorage`,void 0),P(this,`_temporalMetricStorage`,void 0),P(this,`_attributesProcessor`,void 0),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Ac(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new jc(t,r),this._attributesProcessor=n}record(e,t){let n=new kc;for(let[t,r]of e.entries())n.set(this._attributesProcessor.process(t),r);this._deltaMetricStorage.batchCumulate(n,t)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};function Pc(e,t){let n=``;return e.unit!==t.unit&&(n+=`\t- Unit '${e.unit}' does not match '${t.unit}'\n`),e.type!==t.type&&(n+=`\t- Type '${e.type}' does not match '${t.type}'\n`),e.valueType!==t.valueType&&(n+=`\t- Value Type '${e.valueType}' does not match '${t.valueType}'\n`),e.description!==t.description&&(n+=`\t- Description '${e.description}' does not match '${t.description}'\n`),n}function Fc(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function Ic(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function Lc(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}function Rc(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
|
|
4
4
|
\t- OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${r}
|
|
5
|
-
\t- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${r}`}function zc(e,t){return e.valueType===t.valueType?e.unit===t.unit?e.type===t.type?e.description===t.description?``:Rc(e,t):Lc(e,t):Ic(e,t):Fc(e,t)}
|
|
5
|
+
\t- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${r}`}function zc(e,t){return e.valueType===t.valueType?e.unit===t.unit?e.type===t.type?e.description===t.description?``:Rc(e,t):Lc(e,t):Ic(e,t):Fc(e,t)}N(),F();var Bc=class e{constructor(){P(this,`_sharedRegistry`,new Map),P(this,`_perCollectorRegistry`,new Map)}static create(){return new e}getStorages(e){let t=[];for(let e of this._sharedRegistry.values())t=t.concat(e);let n=this._perCollectorRegistry.get(e);if(n!=null)for(let e of n.values())t=t.concat(e);return t}register(e){this._registerStorage(e,this._sharedRegistry)}registerForCollector(e,t){let n=this._perCollectorRegistry.get(e);n==null&&(n=new Map,this._perCollectorRegistry.set(e,n)),this._registerStorage(t,n)}findOrUpdateCompatibleStorage(e){let t=this._sharedRegistry.get(e.name);return t===void 0?null:this._findOrUpdateCompatibleStorage(e,t)}findOrUpdateCompatibleCollectorStorage(e,t){let n=this._perCollectorRegistry.get(e);if(n===void 0)return null;let r=n.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)}_registerStorage(e,t){let n=e.getInstrumentDescriptor(),r=t.get(n.name);if(r===void 0){t.set(n.name,[e]);return}r.push(e)}_findOrUpdateCompatibleStorage(e,t){let n=null;for(let r of t){let t=r.getInstrumentDescriptor();pc(t,e)?(t.description!==e.description&&(e.description.length>t.description.length&&r.updateDescription(e.description),j.warn(`A view or instrument with the name `,e.name,` has already been registered, but has a different description and is incompatible with another registered view.
|
|
6
6
|
`,`Details:
|
|
7
7
|
`,Pc(t,e),`The longer description will be used.
|
|
8
|
-
To resolve the conflict:`,zc(t,e))),n=r):
|
|
8
|
+
To resolve the conflict:`,zc(t,e))),n=r):j.warn(`A view or instrument with the name `,e.name,` has already been registered and is incompatible with another registered view.
|
|
9
9
|
`,`Details:
|
|
10
10
|
`,Pc(t,e),`To resolve the conflict:
|
|
11
|
-
`,zc(t,e))}return n}};F();var Vc=class{constructor(e){P(this,`_backingStorages`,void 0),this._backingStorages=e}record(e,t,n,r){let i=this._backingStorages;for(let a=0;a<i.length;a++)i[a].record(e,t,n,r)}};M(),F();var Hc=class{constructor(e,t){P(this,`_buffer`,new kc),P(this,`_instrumentName`,void 0),P(this,`_valueType`,void 0),this._instrumentName=e,this._valueType=t}observe(e,t={}){if(typeof e!=`number`){A.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===Ae.INT&&!Number.isInteger(e)&&(A.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(t,e)}},Uc=class{constructor(){P(this,`_buffer`,new Map)}observe(e,t,n={}){if(!Tc(e))return;let r=this._buffer.get(e);if(r==null&&(r=new kc,this._buffer.set(e,r)),typeof t!=`number`){A.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===Ae.INT&&!Number.isInteger(t)&&(A.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||r.set(n,t)}};M(),F(),H();var Wc=class{constructor(){P(this,`_callbacks`,[]),P(this,`_batchCallbacks`,[])}addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,t){let n=new Set(t.filter(Tc));if(n.size===0){A.error(`BatchObservableCallback is not associated with valid instruments`,t);return}this._findBatchCallback(e,n)>=0||this._batchCallbacks.push({callback:e,instruments:n})}removeBatchCallback(e,t){let n=new Set(t.filter(Tc)),r=this._findBatchCallback(e,n);r<0||this._batchCallbacks.splice(r,1)}observe(e,t){var n=this;return V(function*(){let r=n._observeCallbacks(e,t),i=n._observeBatchCallbacks(e,t);return(yield Promise.allSettled([...r,...i])).filter(e=>e.status===`rejected`).map(e=>e.reason)})()}_observeCallbacks(e,t){return this._callbacks.map(function(){var n=V(function*({callback:n,instrument:r}){let i=new Hc(r._descriptor.name,r._descriptor.valueType),a=Promise.resolve(n(i));t!=null&&(a=Jo(a,t)),yield a,r._metricStorages.forEach(t=>{t.record(i._buffer,e)})});return function(e){return n.apply(this,arguments)}}())}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(function(){var n=V(function*({callback:n,instruments:r}){let i=new Uc,a=Promise.resolve(n(i));t!=null&&(a=Jo(a,t)),yield a,r.forEach(t=>{let n=i._buffer.get(t);n!=null&&t._metricStorages.forEach(t=>{t.record(n,e)})})});return function(e){return n.apply(this,arguments)}}())}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&Yo(n.instruments,t))}};F();var Gc=class extends Dc{constructor(e,t,n,r,i){super(e),P(this,`_aggregationCardinalityLimit`,void 0),P(this,`_deltaMetricStorage`,void 0),P(this,`_temporalMetricStorage`,void 0),P(this,`_attributesProcessor`,void 0),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Ac(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new jc(t,r),this._attributesProcessor=n}record(e,t,n,r){t=this._attributesProcessor.process(t,n),this._deltaMetricStorage.record(e,t,n,r)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};F();var Kc=class{process(e,t){return e}},qc=class{constructor(e){P(this,`_processors`,void 0),this._processors=e}process(e,t){let n=e;for(let e of this._processors)n=e.process(n,t);return n}};function Jc(){return Xc}function Yc(e){return new qc(e)}var Xc=new Kc;F(),H();var Zc=class{constructor(e,t){P(this,`metricStorageRegistry`,new Bc),P(this,`observableRegistry`,new Wc),P(this,`meter`,void 0),P(this,`_meterProviderSharedState`,void 0),P(this,`_instrumentationScope`,void 0),this.meter=new Ec(this),this._meterProviderSharedState=e,this._instrumentationScope=t}registerMetricStorage(e){let t=this._registerMetricStorage(e,Gc);return t.length===1?t[0]:new Vc(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,Nc)}collect(e,t,n){var r=this;return V(function*(){let i=yield r.observableRegistry.observe(t,n==null?void 0:n.timeoutMillis),a=r.metricStorageRegistry.getStorages(e);if(a.length===0)return null;let o=[];return a.forEach(n=>{let r=n.collect(e,t);r!=null&&o.push(r)}),o.length===0?{errors:i}:{scopeMetrics:{scope:r._instrumentationScope,metrics:o},errors:i}})()}_registerMetricStorage(e,t){let n=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(n=>{let r=fc(n,e),i=this.metricStorageRegistry.findOrUpdateCompatibleStorage(r);if(i!=null)return i;let a=new t(r,n.aggregation.createAggregator(r),n.attributesProcessor,this._meterProviderSharedState.metricCollectors,n.aggregationCardinalityLimit);return this.metricStorageRegistry.register(a),a});if(n.length===0){let r=this._meterProviderSharedState.selectAggregations(e.type).map(([n,r])=>{let i=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(n,e);if(i!=null)return i;let a=r.createAggregator(e),o=n.selectCardinalityLimit(e.type),s=new t(e,a,Jc(),[n],o);return this.metricStorageRegistry.registerForCollector(n,s),s});n=n.concat(r)}return n}};F();var Qc=class{constructor(e){P(this,`viewRegistry`,new uc),P(this,`metricCollectors`,[]),P(this,`meterSharedStates`,new Map),P(this,`resource`,void 0),this.resource=e}getMeterSharedState(e){let t=Ko(e),n=this.meterSharedStates.get(t);return n==null&&(n=new Zc(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,Gs(n.selectAggregation(e))]);return t}};B(),F(),H();var $c=class{constructor(e,t){P(this,`_sharedState`,void 0),P(this,`_metricReader`,void 0),this._sharedState=e,this._metricReader=t}collect(e){var t=this;return V(function*(){let n=ra(Date.now()),r=[],i=[],a=Array.from(t._sharedState.meterSharedStates.values()).map(function(){var a=V(function*(a){let o=yield a.collect(t,n,e);(o==null?void 0:o.scopeMetrics)!=null&&r.push(o.scopeMetrics),(o==null?void 0:o.errors)!=null&&i.push(...o.errors)});return function(e){return a.apply(this,arguments)}}());return yield Promise.all(a),{resourceMetrics:{resource:t._sharedState.resource,scopeMetrics:r},errors:i}})()}forceFlush(e){var t=this;return V(function*(){yield t._metricReader.forceFlush(e)})()}shutdown(e){var t=this;return V(function*(){yield t._metricReader.shutdown(e)})()}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){var t,n,r;return(t=(n=(r=this._metricReader).selectCardinalityLimit)==null?void 0:n.call(r,e))==null?2e3:t}};F();var el=/[\^$\\.+?()[\]{}|]/g,tl=class e{constructor(t){P(this,`_matchAll`,void 0),P(this,`_regexp`,void 0),t===`*`?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(el,`\\$&`).replace(`*`,`.*`)}$`}static hasWildcard(e){return e.includes(`*`)}},nl=class{constructor(e){P(this,`_matchAll`,void 0),P(this,`_pattern`,void 0),this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};F();var rl=class{constructor(e){var t;P(this,`_nameFilter`,void 0),P(this,`_type`,void 0),P(this,`_unitFilter`,void 0),this._nameFilter=new tl((t=e==null?void 0:e.name)==null?`*`:t),this._type=e==null?void 0:e.type,this._unitFilter=new nl(e==null?void 0:e.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};F();var il=class{constructor(e){P(this,`_nameFilter`,void 0),P(this,`_versionFilter`,void 0),P(this,`_schemaUrlFilter`,void 0),this._nameFilter=new nl(e==null?void 0:e.name),this._versionFilter=new nl(e==null?void 0:e.version),this._schemaUrlFilter=new nl(e==null?void 0:e.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};F();function al(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function ol(e){if(al(e))throw Error(`Cannot create view with no selector arguments supplied`);if(e.name!=null&&((e==null?void 0:e.instrumentName)==null||tl.hasWildcard(e.instrumentName)))throw Error(`Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.`)}var sl=class{constructor(e){var t;P(this,`name`,void 0),P(this,`description`,void 0),P(this,`aggregation`,void 0),P(this,`attributesProcessor`,void 0),P(this,`instrumentSelector`,void 0),P(this,`meterSelector`,void 0),P(this,`aggregationCardinalityLimit`,void 0),ol(e),e.attributesProcessors==null?this.attributesProcessor=Jc():this.attributesProcessor=Yc(e.attributesProcessors),this.name=e.name,this.description=e.description,this.aggregation=Gs((t=e.aggregation)==null?{type:Ws.DEFAULT}:t),this.instrumentSelector=new rl({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new il({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}};M(),lc(),F(),H();var cl=class{constructor(e){var t;if(P(this,`_sharedState`,void 0),P(this,`_shutdown`,!1),this._sharedState=new Qc((t=e==null?void 0:e.resource)==null?rc():t),(e==null?void 0:e.views)!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new sl(t));if((e==null?void 0:e.readers)!=null&&e.readers.length>0)for(let t of e.readers){let e=new $c(this._sharedState,t);t.setMetricProducer(e),this._sharedState.metricCollectors.push(e)}}getMeter(e,t=``,n={}){return this._shutdown?(A.warn(`A shutdown MeterProvider cannot provide a Meter`),ue()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}shutdown(e){var t=this;return V(function*(){if(t._shutdown){A.warn(`shutdown may only be called once per MeterProvider`);return}t._shutdown=!0,yield Promise.all(t._sharedState.metricCollectors.map(t=>t.shutdown(e)))})()}forceFlush(e){var t=this;return V(function*(){if(t._shutdown){A.warn(`invalid attempt to force flush after MeterProvider shutdown`);return}yield Promise.all(t._sharedState.metricCollectors.map(t=>t.forceFlush(e)))})()}},ll;(function(e){e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]=`AGGREGATION_TEMPORALITY_UNSPECIFIED`,e[e.AGGREGATION_TEMPORALITY_DELTA=1]=`AGGREGATION_TEMPORALITY_DELTA`,e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]=`AGGREGATION_TEMPORALITY_CUMULATIVE`})(ll||(ll={}));function ul(e,t){let n={attributes:fl(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function dl(e){return{name:e.name,version:e.version}}function fl(e,t){return Object.keys(e).map(n=>pl(n,e[n],t))}function pl(e,t,n){return{key:e,value:ml(t,n)}}function ml(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=ml(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:ml(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}M();function hl(e,t){let n=ul(e.resource,t);return{resource:n,schemaUrl:n.schemaUrl,scopeMetrics:gl(e.scopeMetrics,t)}}function gl(e,t){return Array.from(e.map(e=>({scope:dl(e.scope),metrics:e.metrics.map(e=>_l(e,t)),schemaUrl:e.scope.schemaUrl})))}function _l(e,t){let n={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},r=Sl(e.aggregationTemporality);switch(e.dataPointType){case Wo.SUM:n.sum={aggregationTemporality:r,isMonotonic:e.isMonotonic,dataPoints:yl(e,t)};break;case Wo.GAUGE:n.gauge={dataPoints:yl(e,t)};break;case Wo.HISTOGRAM:n.histogram={aggregationTemporality:r,dataPoints:bl(e,t)};break;case Wo.EXPONENTIAL_HISTOGRAM:n.exponentialHistogram={aggregationTemporality:r,dataPoints:xl(e,t)};break}return n}function vl(e,t,n){let r={attributes:fl(e.attributes,n),startTimeUnixNano:n.encodeHrTime(e.startTime),timeUnixNano:n.encodeHrTime(e.endTime)};switch(t){case Ae.INT:r.asInt=e.value;break;case Ae.DOUBLE:r.asDouble=e.value;break}return r}function yl(e,t){return e.dataPoints.map(n=>vl(n,e.descriptor.valueType,t))}function bl(e,t){return e.dataPoints.map(e=>{let n=e.value;return{attributes:fl(e.attributes,t),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(e.startTime),timeUnixNano:t.encodeHrTime(e.endTime)}})}function xl(e,t){return e.dataPoints.map(e=>{let n=e.value;return{attributes:fl(e.attributes,t),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(e.startTime),timeUnixNano:t.encodeHrTime(e.endTime)}})}function Sl(e){switch(e){case Uo.DELTA:return ll.AGGREGATION_TEMPORALITY_DELTA;case Uo.CUMULATIVE:return ll.AGGREGATION_TEMPORALITY_CUMULATIVE}}function Cl(e,t){return{resourceMetrics:e.map(e=>hl(e,t))}}B();function wl(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Tl(e){return wl(e).toString()}var El=typeof BigInt<`u`?Tl:sa;function Dl(e){return e}var Ol={encodeHrTime:El,encodeSpanContext:Dl,encodeOptionalSpanContext:Dl,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}};function kl(e,t){return{resourceLogs:jl(e,t)}}function Al(e){let t=new Map;for(let n of e){let{resource:e,instrumentationScope:{name:r,version:i=``,schemaUrl:a=``}}=n,o=t.get(e);o||(o=new Map,t.set(e,o));let s=`${r}@${i}:${a}`,c=o.get(s);c||(c=[],o.set(s,c)),c.push(n)}return t}function jl(e,t){let n=Al(e);return Array.from(n,([e,n])=>{let r=ul(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:dl(e[0].instrumentationScope),logRecords:e.map(e=>Ml(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function Ml(e,t){var n,r,i;return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:Nl(e.severityNumber),severityText:e.severityText,body:ml(e.body,t),eventName:e.eventName,attributes:Pl(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:(n=e.spanContext)==null?void 0:n.traceFlags,traceId:t.encodeOptionalSpanContext((r=e.spanContext)==null?void 0:r.traceId),spanId:t.encodeOptionalSpanContext((i=e.spanContext)==null?void 0:i.spanId)}}function Nl(e){return e}function Pl(e,t){return Object.keys(e).map(n=>pl(n,e[n],t))}M();var Fl={serializeRequest:e=>{let t=kl(e,Ol);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return A.warn(`Failed to parse logs export response: ${e.message}. Returning empty response`),{}}}};M();var Il={serializeRequest:e=>{let t=Cl([e],Ol);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return A.warn(`Failed to parse metrics export response: ${e.message}. Returning empty response`),{}}}},Ll=256,Rl=512;function zl(e,t){let n=e&255|Ll;return t&&(n|=Rl),n}function Bl(e,t){var n,r,i,a;let o=e.spanContext(),s=e.status,c=(n=e.parentSpanContext)!=null&&n.spanId?t.encodeSpanContext((r=e.parentSpanContext)==null?void 0:r.spanId):void 0;return{traceId:t.encodeSpanContext(o.traceId),spanId:t.encodeSpanContext(o.spanId),parentSpanId:c,traceState:(i=o.traceState)==null?void 0:i.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:fl(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Hl(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map(e=>Vl(e,t)),droppedLinksCount:e.droppedLinksCount,flags:zl(o.traceFlags,(a=e.parentSpanContext)==null?void 0:a.isRemote)}}function Vl(e,t){var n;return{attributes:e.attributes?fl(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:(n=e.context.traceState)==null?void 0:n.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:zl(e.context.traceFlags,e.context.isRemote)}}function Hl(e,t){return{attributes:e.attributes?fl(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Ul(e,t){return{resourceSpans:Gl(e,t)}}function Wl(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function Gl(e,t){let n=Wl(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>Bl(e,t));o.push({scope:dl(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=ul(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}M();var Kl={serializeRequest:e=>{let t=Ul(e,Ol);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return A.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}};M(),F(),H();var ql=5,Jl=1e3,Yl=5e3,Xl=1.5,Zl=.2;function Ql(){return 2*Zl*Math.random()-Zl}var $l=class{constructor(e){P(this,`_transport`,void 0),this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}send(e,t){var n=this;return V(function*(){let r=ql,i=Jl,a=Date.now()+t,o=yield n._transport.send(e,t);for(;o.status===`retryable`&&r>0;){var s;r--;let t=Math.max(Math.min(i*(1+Ql()),Yl),0);i*=Xl;let c=(s=o.retryInMillis)==null?t:s,l=a-Date.now();if(c>l)return A.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(l)}ms, not retrying further.`),o;A.verbose(`Scheduling export retry in ${Math.round(c)}ms`),o=yield n.retry(e,l,c)}return o.status===`success`?A.verbose(`Export succeeded after ${ql-r} retry attempts.`):o.status===`retryable`?A.info(`Export failed after maximum retry attempts (${ql}).`):A.info(`Export failed with non-retryable error: ${o.error}`),o})()}shutdown(){return this._transport.shutdown()}};function eu(e){return new $l(e.transport)}function tu(e){return e===429||e===502||e===503||e===504}function nu(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}M(),F(),H();var ru=60*1024,iu=9,au=0,ou=0,su=class{constructor(e){P(this,`_parameters`,void 0),this._parameters=e}send(e,t){var n=this;return V(function*(){let r=new AbortController,i=setTimeout(()=>r.abort(),t),a=globalThis.fetch;typeof a.__original==`function`&&(a=a.__original);let o=e.byteLength,s=au+o>ru,c=!s&&!(ou>=iu);if(c)au+=o,ou++;else{let e=s?`size limit`:`count limit`;A.debug(`keepalive disabled: ${(o/1024).toFixed(1)}KB payload, ${ou} pending (${e})`)}try{let t=new URL(n._parameters.url),i=yield a(t.href,{method:`POST`,headers:yield n._parameters.headers(),body:e,signal:r.signal,keepalive:c,mode:globalThis.location?globalThis.location.origin===t.origin?`same-origin`:`cors`:`no-cors`});return i.status>=200&&i.status<=299?(A.debug(`export response success (status: ${i.status})`),{status:`success`}):tu(i.status)?(A.warn(`export response retryable (status: ${i.status})`),{status:`retryable`,retryInMillis:nu(i.headers.get(`Retry-After`))}):(A.error(`export response failure (status: ${i.status})`),{status:`failure`,error:Error(`Fetch request failed with non-retryable status ${i.status}`)})}catch(e){return lu(e)?(A.warn(`export request retryable (network error: ${e})`),{status:`retryable`,error:Error(`Fetch request encountered a network error`,{cause:e})}):(A.error(`export request failure (error: ${e})`),{status:`failure`,error:Error(`Fetch request errored`,{cause:e})})}finally{clearTimeout(i),c&&(au-=o,ou--)}})()}shutdown(){}};function cu(e){return new su(e)}function lu(e){return e instanceof TypeError&&!e.cause}function uu(e,t){return Ho(e,t,eu({transport:cu(e)}))}M();function du(e){let t={};return Object.entries(e==null?{}:e).forEach(([e,n])=>{n===void 0?A.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}G(),H();function fu(e,t,n){return V(function*(){let r=W({},yield n()),i={};return t!=null&&Object.assign(i,yield t()),e!=null&&Object.assign(i,du(yield e())),Object.assign(i,r)})}function pu(e){if(e!=null)try{var t;let n=(t=globalThis.location)==null?void 0:t.href;return new URL(e,n).href}catch(t){throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function mu(e,t,n){var r,i;return W(W({},Po(e,t,n)),{},{headers:fu(e.headers,t.headers,n.headers),url:(r=(i=pu(e.url))==null?t.url:i)==null?n.url:r})}function hu(e,t){return W(W({},Fo()),{},{headers:function(){var t=V(function*(){return e});return function(){return t.apply(this,arguments)}}(),url:`http://localhost:4318/`+t})}function gu(e){return typeof e.headers==`function`?e.headers:No(e.headers)}function _u(e,t,n){return mu({url:e.url,timeoutMillis:e.timeoutMillis,headers:gu(e),concurrencyLimit:e.concurrencyLimit},{},hu(n,t))}function vu(e,t,n,r){return uu(_u(e,n,r),t)}var yu=class extends ko{constructor(e={}){super(vu(e,Fl,`v1/logs`,{"Content-Type":`application/json`}))}},bu;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`,e[e.LOWMEMORY=2]=`LOWMEMORY`})(bu||(bu={})),B(),M(),F();var xu=()=>Uo.CUMULATIVE,Su=e=>{switch(e){case U.COUNTER:case U.OBSERVABLE_COUNTER:case U.GAUGE:case U.HISTOGRAM:case U.OBSERVABLE_GAUGE:return Uo.DELTA;case U.UP_DOWN_COUNTER:case U.OBSERVABLE_UP_DOWN_COUNTER:return Uo.CUMULATIVE}},Cu=e=>{switch(e){case U.COUNTER:case U.HISTOGRAM:return Uo.DELTA;case U.GAUGE:case U.UP_DOWN_COUNTER:case U.OBSERVABLE_UP_DOWN_COUNTER:case U.OBSERVABLE_COUNTER:case U.OBSERVABLE_GAUGE:return Uo.CUMULATIVE}};function wu(){var e;let t=((e=void 0)==null?`cumulative`:e).toLowerCase();return t===`cumulative`?xu:t===`delta`?Su:t===`lowmemory`?Cu:(A.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${t}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),xu)}function Tu(e){return e==null?wu():e===bu.DELTA?Su:e===bu.LOWMEMORY?Cu:xu}var Eu=Object.freeze({type:Ws.DEFAULT});function Du(e){var t;return(t=e==null?void 0:e.aggregationPreference)==null?(()=>Eu):t}var Ou=class extends ko{constructor(e,t){super(e),P(this,`_aggregationTemporalitySelector`,void 0),P(this,`_aggregationSelector`,void 0),this._aggregationSelector=Du(t),this._aggregationTemporalitySelector=Tu(t==null?void 0:t.temporalityPreference)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}},ku=class extends Ou{constructor(e){super(vu(e==null?{}:e,Il,`v1/metrics`,{"Content-Type":`application/json`}),e)}},Au=class extends ko{constructor(e={}){super(vu(e,Kl,`v1/traces`,{"Content-Type":`application/json`}))}};function ju(e,t,n,r){for(let i=0,a=e.length;i<a;i++){let a=e[i];t&&a.setTracerProvider(t),n&&a.setMeterProvider(n),r&&a.setLoggerProvider&&a.setLoggerProvider(r),a.getConfig().enabled||a.enable()}}function Mu(e){e.forEach(e=>e.disable())}var Nu=t((()=>{}));function Pu(e){var t,n;let r=e.tracerProvider||j.getTracerProvider(),i=e.meterProvider||Ft.getMeterProvider(),a=e.loggerProvider||yn.getLoggerProvider(),o=(t=(n=e.instrumentations)==null?void 0:n.flat())==null?[]:t;return ju(o,r,i,a),()=>{Mu(o)}}var Fu=t((()=>{M(),Nu()}));function Iu(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}function Lu(e){e&&e.logger&&(typeof e.logger==`function`?K=e.logger:K(`new logger isn't a function, not replacing`))}var K,Ru,zu,Bu,Vu,Hu=t((()=>{K=console.error.bind(console),Ru=(e,t,n)=>{if(!e||!e[t]){K(`no original function `+String(t)+` to wrap`);return}if(!n){K(`no wrapper function`),K(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){K(`original object and wrapper must be functions`);return}let i=n(r,t);return Iu(i,`__original`,r),Iu(i,`__unwrap`,()=>{e[t]===i&&Iu(e,t,r)}),Iu(i,`__wrapped`,!0),Iu(e,t,i),i},zu=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{K(`must provide one or more modules to patch`),K(Error().stack);return}if(!(t&&Array.isArray(t))){K(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{Ru(e,t,n)})})},Bu=(e,t)=>{if(!e||!e[t]){K(`no function to unwrap.`),K(Error().stack);return}let n=e[t];if(!n.__unwrap)K(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},Vu=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{K(`must provide one or more modules to patch`),K(Error().stack);return}if(!(t&&Array.isArray(t))){K(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{Bu(e,t)})})},Lu.wrap=Ru,Lu.massWrap=zu,Lu.unwrap=Bu,Lu.massUnwrap=Vu})),Uu,Wu=t((()=>{M(),bn(),Hu(),F(),G(),Uu=class{constructor(e,t,n){P(this,`_config`,{}),P(this,`_tracer`,void 0),P(this,`_meter`,void 0),P(this,`_logger`,void 0),P(this,`_diag`,void 0),P(this,`instrumentationName`,void 0),P(this,`instrumentationVersion`,void 0),P(this,`_wrap`,Ru),P(this,`_unwrap`,Bu),P(this,`_massWrap`,zu),P(this,`_massUnwrap`,Vu),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=A.createComponentLogger({namespace:e}),this._tracer=j.getTracer(e,t),this._meter=Ft.getMeter(e,t),this._logger=yn.getLogger(e,t),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){var e;let t=(e=this.init())==null?[]:e;return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config=W({enabled:!0},e)}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}}})),Gu,Ku=t((()=>{Wu(),Gu=class extends Uu{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}}})),qu=t((()=>{Ku(),M()}));function Ju(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}var Yu=t((()=>{}));function Xu(e,t){let n=q.OLD,r=t==null?void 0:t.split(`,`).map(e=>e.trim()).filter(e=>e!==``);for(let t of r==null?[]:r)if(t.toLowerCase()===e+`/dup`){n=q.DUPLICATE;break}else t.toLowerCase()===e&&(n=q.STABLE);return n}var q,Zu=t((()=>{(function(e){e[e.STABLE=1]=`STABLE`,e[e.OLD=2]=`OLD`,e[e.DUPLICATE=3]=`DUPLICATE`})(q||(q={}))})),Qu=t((()=>{Fu(),qu(),F(),Yu(),Zu()}));function $u(e){return ed(e,new WeakSet)}function ed(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>ed(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>ed(e,t))}return!1}M(),B(),Zi(),F();var td=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){P(this,`hrTime`,void 0),P(this,`hrTimeObserved`,void 0),P(this,`spanContext`,void 0),P(this,`resource`,void 0),P(this,`instrumentationScope`,void 0),P(this,`attributes`,{}),P(this,`_severityText`,void 0),P(this,`_severityNumber`,void 0),P(this,`_body`,void 0),P(this,`_eventName`,void 0),P(this,`_attributesCount`,0),P(this,`_droppedAttributesCount`,0),P(this,`_isReadonly`,!1),P(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=aa(r==null?f:r),this.hrTimeObserved=aa(i==null?f:i),d){let e=j.getSpanContext(d);e&&at(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return A.warn(`Invalid attribute key: ${e}`),this;if(!$u(t))return A.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&A.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return A.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Ni,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(Fi,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(Fi,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Ni,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(Pi,n.stack),t=!0)}t||A.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&A.warn(`Can not execute the operation on emitted log record`),this._isReadonly}};bn(),M(),F(),G();var nd=class{constructor(e,t){P(this,`instrumentationScope`,void 0),P(this,`_sharedState`,void 0),P(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){var t;let n=this._loggerConfig,r=e.context||k.active(),i=(t=e.severityNumber)==null?N.UNSPECIFIED:t;if(i!==N.UNSPECIFIED&&i<n.minimumSeverity)return;if(n.traceBased){let e=j.getSpanContext(r);if(e&&at(e)&&(e.traceFlags&O.SAMPLED)!==O.SAMPLED)return}let a=new td(this._sharedState,this.instrumentationScope,W({context:r},e));this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(a,r),a._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e==null?void 0:e.severityNumber;if(typeof n==`number`&&n!==N.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=(e==null?void 0:e.context)||k.active();if(t.traceBased){let e=j.getSpanContext(r);if(e&&at(e)&&(e.traceFlags&O.SAMPLED)!==O.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e==null?void 0:e.severityNumber,eventName:e==null?void 0:e.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}},rd=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}};B(),F(),H();var id=class{constructor(e,t){P(this,`processors`,void 0),P(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}forceFlush(){var e=this;return V(function*(){let t=e.forceFlushTimeoutMillis;yield Promise.all(e.processors.map(e=>go(e.forceFlush(),t)))})()}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}shutdown(){var e=this;return V(function*(){yield Promise.all(e.processors.map(e=>e.shutdown()))})()}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}};function ad(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var od=`otel.sdk.log.created`;F();var sd=class{constructor(e){P(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(od,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}},cd=`0.217.0`;M(),bn(),G(),F();var ld={disabled:!1,minimumSeverity:N.UNSPECIFIED,traceBased:!1},ud=()=>W({},ld),dd=class{constructor(e,t,n,r,i,a){P(this,`loggers`,new Map),P(this,`activeProcessor`,void 0),P(this,`registeredLogRecordProcessors`,[]),P(this,`resource`,void 0),P(this,`forceFlushTimeoutMillis`,void 0),P(this,`logRecordLimits`,void 0),P(this,`processors`,void 0),P(this,`loggerMetrics`,void 0),P(this,`_loggerConfigurator`,void 0),P(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new id(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new rd,this._loggerConfigurator=i==null?ud:i;let o=a?a.getMeter(`@opentelemetry/sdk-logs`,cd):ue();this.loggerMetrics=new sd(o)}getLoggerConfig(e){let t=ad(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}};M(),bn(),lc(),B(),F();var fd=class{constructor(e={}){var t,n,r,i,a,o,s,c;P(this,`_shutdownOnce`,void 0),P(this,`_sharedState`,void 0);let l={resource:(t=e.resource)==null?rc():t,forceFlushTimeoutMillis:(n=e.forceFlushTimeoutMillis)==null?3e4:n,logRecordLimits:{attributeCountLimit:(r=(i=e.logRecordLimits)==null?void 0:i.attributeCountLimit)==null?128:r,attributeValueLengthLimit:(a=(o=e.logRecordLimits)==null?void 0:o.attributeValueLengthLimit)==null?1/0:a},loggerConfigurator:(s=e.loggerConfigurator)==null?ud:s,processors:(c=e.processors)==null?[]:c,meterProvider:e.meterProvider};this._sharedState=new dd(l.resource,l.forceFlushTimeoutMillis,l.logRecordLimits,l.processors,l.loggerConfigurator,l.meterProvider),this._shutdownOnce=new wo(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return A.warn(`A shutdown LoggerProvider cannot provide a Logger`),rn;e||A.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new nd({name:r,version:t,schemaUrl:n==null?void 0:n.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(A.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(A.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};M(),B(),H(),F();function pd(e){return md.apply(this,arguments)}function md(){return md=V(function*(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&(yield Promise.all(t))}),md.apply(this,arguments)}var hd=class{constructor(e,t,n){P(this,`_exportCompleted`,void 0),P(this,`_exportScheduledPromise`,void 0),P(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}_executeExport(e,t,n){var r=this;return V(function*(){try{yield pd(t),yield k.with($r(k.active()),V(function*(){return r._exportWithTimeout(e,t,n)}))}catch(e){Si(e),r._exportScheduledResolve()}})()}_exportWithTimeout(e,t,n){var r=this;return V(function*(){return new Promise((i,a)=>{let o=setTimeout(()=>{a(Error(`Timeout`))},n);e.export(t,e=>{if(clearTimeout(o),e.code===ga.SUCCESS)i();else{var t;a((t=e.error)==null?Error(`BatchLogRecordProcessor: log record export failed`):t)}}),r._exportScheduledResolve()})})()}},gd=class{constructor(e,t){var n,r,i,a;P(this,`_maxExportBatchSize`,void 0),P(this,`_maxQueueSize`,void 0),P(this,`_scheduledDelayMillis`,void 0),P(this,`_exportTimeoutMillis`,void 0),P(this,`_exporter`,void 0),P(this,`_currentExport`,null),P(this,`_finishedLogRecords`,[]),P(this,`_timer`,void 0),P(this,`_shutdownOnce`,void 0),P(this,`_flushing`,!1),this._exporter=e,this._maxExportBatchSize=(n=t==null?void 0:t.maxExportBatchSize)==null?512:n,this._maxQueueSize=(r=t==null?void 0:t.maxQueueSize)==null?2048:r,this._scheduledDelayMillis=(i=t==null?void 0:t.scheduledDelayMillis)==null?5e3:i,this._exportTimeoutMillis=(a=t==null?void 0:t.exportTimeoutMillis)==null?3e4:a,this._shutdownOnce=new wo(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(A.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}_shutdown(){var e=this;return V(function*(){e.onShutdown(),yield e._flushAll(),yield e._exporter.shutdown()})()}_flushAll(){var e=this;return V(function*(){if(e._flushing)return;e._flushing=!0;let t=e._finishedLogRecords;for(e._finishedLogRecords=[],e._clearTimer(),e._currentExport!==null&&(yield e._exporter.forceFlush(),yield e._currentExport.exportCompleted,e._currentExport=null);t.length>0;){let n;t.length<=e._maxExportBatchSize?(n=t,t=[]):n=t.splice(0,e._maxExportBatchSize);let r=new hd(e._exporter,n,e._exportTimeoutMillis);e._currentExport=r;try{yield r.exportScheduled,yield e._exporter.forceFlush(),yield r.exportCompleted}catch(e){Si(e)}finally{e._currentExport=null}}e._flushing=!1,e._maybeStartTimer()})()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new hd(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,Si(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};F();var _d=class extends gd{constructor(e,t){super(e,t),P(this,`_visibilityChangeListener`,void 0),P(this,`_pageHideListener`,void 0),this._onInit(t)}onShutdown(){typeof document>`u`||(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}_onInit(e){(e==null?void 0:e.disableAutoFlushOnDocumentHide)===!0||typeof document>`u`||(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}},vd,yd=t((()=>{vd=`exception`})),bd,xd=t((()=>{M(),B(),Zi(),yd(),F(),bd=class{constructor(e){var t,n;P(this,`_spanContext`,void 0),P(this,`kind`,void 0),P(this,`parentSpanContext`,void 0),P(this,`attributes`,{}),P(this,`links`,[]),P(this,`events`,[]),P(this,`startTime`,void 0),P(this,`resource`,void 0),P(this,`instrumentationScope`,void 0),P(this,`_droppedAttributesCount`,0),P(this,`_droppedEventsCount`,0),P(this,`_droppedLinksCount`,0),P(this,`_attributesCount`,0),P(this,`name`,void 0),P(this,`status`,{code:Tt.UNSET}),P(this,`endTime`,[0,0]),P(this,`_ended`,!1),P(this,`_duration`,[-1,-1]),P(this,`_spanProcessor`,void 0),P(this,`_spanLimits`,void 0),P(this,`_attributeValueLengthLimit`,void 0),P(this,`_recordEndMetrics`,void 0),P(this,`_performanceStartTime`,void 0),P(this,`_performanceOffset`,void 0),P(this,`_startTimeProvided`,void 0);let r=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=z.now(),this._performanceOffset=r-(this._performanceStartTime+z.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=(t=this._spanLimits.attributeValueLengthLimit)==null?0:t,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime((n=e.startTime)==null?r:n),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return A.warn(`Invalid attribute key: ${e}`),this;if(!mi(t))return A.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return A.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&A.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),ua(t)&&(ua(n)||(n=t),t=void 0);let i=fi(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&A.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=fi(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===Tt.UNSET||this.status.code===Tt.OK)return this;let t={code:e.code};return e.code===Tt.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&A.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){var t;if(this._isSpanEnded()){A.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=oa(this.startTime,this.endTime),this._duration[0]<0&&(A.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&A.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&A.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),(t=this._recordEndMetrics)==null||t.call(this),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=z.now())return ia(e+this._performanceOffset);if(typeof e==`number`)return ra(e);if(e instanceof Date)return ra(e.getTime());if(la(e))return e;if(this._startTimeProvided)return ra(Date.now());let t=z.now()-this._performanceStartTime;return da(this.startTime,ra(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[Ni]=e:e&&(e.code?n[Fi]=e.code.toString():e.name&&(n[Fi]=e.name),e.message&&(n[Ni]=e.message),e.stack&&(n[Pi]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(vd,n,t):A.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);A.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(A.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}}})),Sd,Cd=t((()=>{(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Sd||(Sd={}))})),wd,Td=t((()=>{Cd(),wd=class{shouldSample(){return{decision:Sd.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}})),Ed,Dd=t((()=>{Cd(),Ed=class{shouldSample(){return{decision:Sd.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}})),Od,kd=t((()=>{M(),B(),Td(),Dd(),F(),Od=class{constructor(e){var t,n,r,i;P(this,`_root`,void 0),P(this,`_remoteParentSampled`,void 0),P(this,`_remoteParentNotSampled`,void 0),P(this,`_localParentSampled`,void 0),P(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(Si(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new Ed),this._remoteParentSampled=(t=e.remoteParentSampled)==null?new Ed:t,this._remoteParentNotSampled=(n=e.remoteParentNotSampled)==null?new wd:n,this._localParentSampled=(r=e.localParentSampled)==null?new Ed:r,this._localParentNotSampled=(i=e.localParentNotSampled)==null?new wd:i}shouldSample(e,t,n,r,i,a){let o=j.getSpanContext(e);return!o||!at(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&O.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&O.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}})),Ad,jd=t((()=>{M(),Cd(),F(),Ad=class{constructor(e=0){P(this,`_ratio`,void 0),P(this,`_upperBound`,void 0),this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:rt(t)&&this._accumulate(t)<this._upperBound?Sd.RECORD_AND_SAMPLED:Sd.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}}}));function Md(){var e,t,n,r,i,a,o,s;return{sampler:Nd(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(e=void 0)==null?1/0:e,attributeCountLimit:(t=void 0)==null?128:t},spanLimits:{attributeValueLengthLimit:(n=void 0)==null?1/0:n,attributeCountLimit:(r=void 0)==null?128:r,linkCountLimit:(i=void 0)==null?128:i,eventCountLimit:(a=void 0)==null?128:a,attributePerEventCountLimit:(o=void 0)==null?128:o,attributePerLinkCountLimit:(s=void 0)==null?128:s}}}function Nd(){var e;let t=(e=void 0)==null?Fd.ParentBasedAlwaysOn:e;switch(t){case Fd.AlwaysOn:return new Ed;case Fd.AlwaysOff:return new wd;case Fd.ParentBasedAlwaysOn:return new Od({root:new Ed});case Fd.ParentBasedAlwaysOff:return new Od({root:new wd});case Fd.TraceIdRatio:return new Ad(Pd());case Fd.ParentBasedTraceIdRatio:return new Od({root:new Ad(Pd())});default:return A.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${Fd.ParentBasedAlwaysOn}".`),new Od({root:new Ed})}}function Pd(){return A.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Id}.`),Id}var Fd,Id,Ld=t((()=>{M(),B(),Td(),Dd(),kd(),jd(),(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(Fd||(Fd={})),Id=1}));function Rd(e){let t={sampler:Nd()},n=Md(),r=Object.assign({},n,t,e);return r.generalLimits=Object.assign({},n.generalLimits,e.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,e.spanLimits||{}),r}function zd(e){var t,n,r,i,a,o,s,c,l,u,d,f;let p=Object.assign({},e.spanLimits);return p.attributeCountLimit=(t=(n=(r=(i=(a=e.spanLimits)==null?void 0:a.attributeCountLimit)==null?(o=e.generalLimits)==null?void 0:o.attributeCountLimit:i)==null?void 0:r)==null?void 0:n)==null?128:t,p.attributeValueLengthLimit=(s=(c=(l=(u=(d=e.spanLimits)==null?void 0:d.attributeValueLengthLimit)==null?(f=e.generalLimits)==null?void 0:f.attributeValueLengthLimit:u)==null?void 0:l)==null?void 0:c)==null?Bd:s,Object.assign({},e,{spanLimits:p})}var Bd,Vd=t((()=>{Ld(),B(),Bd=1/0})),Hd,Ud=t((()=>{M(),B(),F(),Hd=class{constructor(e,t){var n,r,i,a;P(this,`_maxExportBatchSize`,void 0),P(this,`_maxQueueSize`,void 0),P(this,`_scheduledDelayMillis`,void 0),P(this,`_exportTimeoutMillis`,void 0),P(this,`_exporter`,void 0),P(this,`_isExporting`,!1),P(this,`_finishedSpans`,[]),P(this,`_timer`,void 0),P(this,`_shutdownOnce`,void 0),P(this,`_droppedSpansCount`,0),this._exporter=e,this._maxExportBatchSize=typeof(t==null?void 0:t.maxExportBatchSize)==`number`?t.maxExportBatchSize:(n=void 0)==null?512:n,this._maxQueueSize=typeof(t==null?void 0:t.maxQueueSize)==`number`?t.maxQueueSize:(r=void 0)==null?2048:r,this._scheduledDelayMillis=typeof(t==null?void 0:t.scheduledDelayMillis)==`number`?t.scheduledDelayMillis:(i=void 0)==null?5e3:i,this._exportTimeoutMillis=typeof(t==null?void 0:t.exportTimeoutMillis)==`number`?t.exportTimeoutMillis:(a=void 0)==null?3e4:a,this._shutdownOnce=new wo(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(A.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&O.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&A.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(A.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);k.with($r(k.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,r=>{if(clearTimeout(n),r.code===ga.SUCCESS)e();else{var i;t((i=r.error)==null?Error(`BatchSpanProcessor: span export failed`):i)}}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a!=null||(a=[]),a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{Si(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,Si(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),Wd,Gd=t((()=>{Ud(),B(),F(),Wd=class extends Hd{constructor(e,t){super(e,t),P(this,`_visibilityChangeListener`,void 0),P(this,`_pageHideListener`,void 0),this.onInit(t)}onInit(e){(e==null?void 0:e.disableAutoFlushOnDocumentHide)!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{Si(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{Si(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}onShutdown(){typeof document<`u`&&(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}}}));function Kd(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function qd(e){let t=``;for(let n=0;n<e.length;n++)t+=Qd[e[n]];return t}var Jd,Yd,Xd,Zd,Qd,$d,ef=t((()=>{Jd=16,Yd=8,Xd=new Uint8Array(Jd),Zd=new Uint8Array(Yd),Qd=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)),$d=class{generateTraceId(){return Kd(Xd),qd(Xd)}generateSpanId(){return Kd(Zd),qd(Zd)}}})),tf=t((()=>{Gd(),ef()})),nf,rf,af,of,sf=t((()=>{nf=`otel.span.parent.origin`,rf=`otel.span.sampling_result`,af=`otel.sdk.span.live`,of=`otel.sdk.span.started`}));function cf(e){return e?e.isRemote?`remote`:`local`:`none`}function lf(e){switch(e){case Sd.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case Sd.RECORD:return`RECORD_ONLY`;case Sd.NOT_RECORD:return`DROP`}}var uf,df=t((()=>{Cd(),sf(),F(),uf=class{constructor(e){P(this,`startedSpans`,void 0),P(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(of,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(af,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=lf(t);if(this.startedSpans.add(1,{[nf]:cf(e),[rf]:n}),t===Sd.NOT_RECORD)return()=>{};let r={[rf]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}}})),ff,pf=t((()=>{ff=`2.7.1`})),mf,hf=t((()=>{M(),B(),xd(),Vd(),tf(),df(),pf(),F(),mf=class{constructor(e,t,n,r){P(this,`_sampler`,void 0),P(this,`_generalLimits`,void 0),P(this,`_spanLimits`,void 0),P(this,`_idGenerator`,void 0),P(this,`instrumentationScope`,void 0),P(this,`_resource`,void 0),P(this,`_spanProcessor`,void 0),P(this,`_tracerMetrics`,void 0);let i=Rd(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new $d,this._resource=n,this._spanProcessor=r,this.instrumentationScope=e;let a=i.meterProvider?i.meterProvider.getMeter(`@opentelemetry/sdk-trace`,ff):ue();this._tracerMetrics=new uf(a)}startSpan(e,t={},n=k.active()){var r,i,a;t.root&&(n=j.deleteSpan(n));let o=j.getSpan(n);if(ei(n))return A.debug(`Instrumentation suppressed, returning Noop Span`),j.wrapSpanContext(We);let s=o==null?void 0:o.spanContext(),c=this._idGenerator.generateSpanId(),l,u,d;!s||!j.isSpanContextValid(s)?u=this._idGenerator.generateTraceId():(u=s.traceId,d=s.traceState,l=s);let f=(r=t.kind)==null?Ct.INTERNAL:r,p=((i=t.links)==null?[]:i).map(e=>({context:e.context,attributes:fi(e.attributes)})),m=fi(t.attributes),h=this._sampler.shouldSample(n,u,e,f,m,p),g=this._tracerMetrics.startSpan(s,h.decision);d=(a=h.traceState)==null?d:a;let _=h.decision===xt.RECORD_AND_SAMPLED?O.SAMPLED:O.NONE,v={traceId:u,spanId:c,traceFlags:_,traceState:d};if(h.decision===xt.NOT_RECORD)return A.debug(`Recording is off, propagating context in a non-recording span`),j.wrapSpanContext(v);let y=fi(Object.assign(m,h.attributes));return new bd({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:v,name:e,kind:f,links:p,parentSpanContext:l,attributes:y,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:g})}startActiveSpan(e,t,n,r){var i;let a,o,s;if(arguments.length<2)return;arguments.length===2?s=t:arguments.length===3?(a=t,s=n):(a=t,o=n,s=r);let c=(i=o)==null?k.active():i,l=this.startSpan(e,a,c),u=j.setSpan(c,l);return k.with(u,s,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}})),gf,_f=t((()=>{B(),F(),gf=class{constructor(e){P(this,`_spanProcessors`,void 0),this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{Si(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}}})),vf,yf,bf=t((()=>{B(),lc(),hf(),Ld(),_f(),Vd(),F(),(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(vf||(vf={})),yf=class{constructor(e={}){var t,n;P(this,`_config`,void 0),P(this,`_tracers`,new Map),P(this,`_resource`,void 0),P(this,`_activeSpanProcessor`,void 0);let r=io({},Md(),zd(e));this._resource=(t=r.resource)==null?rc():t,this._config=Object.assign({},r,{resource:this._resource});let i=[];(n=e.spanProcessors)!=null&&n.length&&i.push(...e.spanProcessors),this._activeSpanProcessor=new gf(i)}getTracer(e,t,n){let r=`${e}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._tracers.has(r)||this._tracers.set(r,new mf({name:e,version:t,schemaUrl:n==null?void 0:n.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=vf.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==vf.timeout&&(r=vf.resolved,n(r))}).catch(e=>{clearTimeout(i),r=vf.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==vf.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}})),xf,Sf=t((()=>{M(),B(),F(),H(),xf=class{constructor(e){P(this,`_exporter`,void 0),P(this,`_shutdownOnce`,void 0),P(this,`_pendingExports`,void 0),this._exporter=e,this._shutdownOnce=new wo(this._shutdown,this),this._pendingExports=new Set}forceFlush(){var e=this;return V(function*(){yield Promise.all(Array.from(e._pendingExports)),e._exporter.forceFlush&&(yield e._exporter.forceFlush())})()}onStart(e,t){}onEnd(e){if(this._shutdownOnce.isCalled||(e.spanContext().traceFlags&O.SAMPLED)===0)return;let t=this._doExport(e).catch(e=>Si(e));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}_doExport(e){var t=this;return V(function*(){if(e.resource.asyncAttributesPending){var n,r;yield(n=(r=e.resource).waitForAsyncAttributes)==null?void 0:n.call(r)}let i=yield Oo._export(t._exporter,[e]);if(i.code!==ga.SUCCESS){var a;throw(a=i.error)==null?Error(`SimpleSpanProcessor: span export failed (status ${i})`):a}})()}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}})),Cf=t((()=>{bf(),tf(),B(),F(),Sf(),Td(),Dd(),kd(),jd(),Cd()})),wf,Tf=t((()=>{M(),F(),wf=class{constructor(){P(this,`_enabled`,!1),P(this,`_currentContext`,D)}_bindFunction(e=D,t){let n=this,r=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(r,`length`,{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}active(){return this._currentContext}bind(e,t){return e===void 0&&(e=this.active()),typeof t==`function`?this._bindFunction(e,t):t}disable(){return this._currentContext=D,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=D,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||D;try{return t.call(n,...r)}finally{this._currentContext=i}}}}));function Ef(e){if(e!==null){if(e===void 0){let e=new wf;e.enable(),k.setGlobalContextManager(e);return}e.enable(),k.setGlobalContextManager(e)}}function Df(e){if(e!==null){if(e===void 0){Yt.setGlobalPropagator(new va({propagators:[new Ba,new ui]}));return}Yt.setGlobalPropagator(e)}}var Of,kf=t((()=>{Cf(),Tf(),M(),B(),Of=class extends yf{constructor(e={}){super(e)}register(e={}){j.setGlobalTracerProvider(this),Df(e.propagator),Ef(e.contextManager)}}})),J,Af=t((()=>{(function(e){e.CONNECT_END=`connectEnd`,e.CONNECT_START=`connectStart`,e.DECODED_BODY_SIZE=`decodedBodySize`,e.DOM_COMPLETE=`domComplete`,e.DOM_CONTENT_LOADED_EVENT_END=`domContentLoadedEventEnd`,e.DOM_CONTENT_LOADED_EVENT_START=`domContentLoadedEventStart`,e.DOM_INTERACTIVE=`domInteractive`,e.DOMAIN_LOOKUP_END=`domainLookupEnd`,e.DOMAIN_LOOKUP_START=`domainLookupStart`,e.ENCODED_BODY_SIZE=`encodedBodySize`,e.FETCH_START=`fetchStart`,e.LOAD_EVENT_END=`loadEventEnd`,e.LOAD_EVENT_START=`loadEventStart`,e.NAVIGATION_START=`navigationStart`,e.REDIRECT_END=`redirectEnd`,e.REDIRECT_START=`redirectStart`,e.REQUEST_START=`requestStart`,e.RESPONSE_END=`responseEnd`,e.RESPONSE_START=`responseStart`,e.SECURE_CONNECTION_START=`secureConnectionStart`,e.START_TIME=`startTime`,e.UNLOAD_EVENT_END=`unloadEventEnd`,e.UNLOAD_EVENT_START=`unloadEventStart`})(J||(J={}))})),jf,Mf,Nf=t((()=>{jf=`http.response_content_length`,Mf=`http.response_content_length_uncompressed`}));function Pf(){return qf||(qf=document.createElement(`a`)),qf}function Ff(e,t){return t in e}function Y(e,t,n,r=!0){if(Ff(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function If(e,t,n=!1,r,i){if(r===void 0&&(r=t[J.START_TIME]!==0),n||(Y(e,J.FETCH_START,t,r),Y(e,J.DOMAIN_LOOKUP_START,t,r),Y(e,J.DOMAIN_LOOKUP_END,t,r),Y(e,J.CONNECT_START,t,r),Y(e,J.SECURE_CONNECTION_START,t,r),Y(e,J.CONNECT_END,t,r),Y(e,J.REQUEST_START,t,r),Y(e,J.RESPONSE_START,t,r),Y(e,J.RESPONSE_END,t,r)),!i){let n=t[J.ENCODED_BODY_SIZE];n!==void 0&&e.setAttribute(jf,n);let r=t[J.DECODED_BODY_SIZE];r!==void 0&&n!==r&&e.setAttribute(Mf,r)}}function Lf(e){return e.slice().sort((e,t)=>{let n=e[J.FETCH_START],r=t[J.FETCH_START];return n>r?1:n<r?-1:0})}function Rf(){return typeof location<`u`?location.origin:void 0}function zf(e,t,n,r,i=new WeakSet,a){let o=Hf(e);e=o.toString();let s=Vf(e,t,n,r,i,a);if(s.length===0)return{mainRequest:void 0};if(s.length===1)return{mainRequest:s[0]};let c=Lf(s);if(o.origin!==Rf()&&c.length>1){let e=c[0],t=Bf(c,e[J.RESPONSE_END],n),r=e[J.RESPONSE_END];return t[J.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}else return{mainRequest:s[0]}}function Bf(e,t,n){let r=sa(n),i=sa(aa(t)),a=e[1],o,s=e.length;for(let t=1;t<s;t++){let n=e[t],s=sa(aa(n[J.FETCH_START])),c=r-sa(aa(n[J.RESPONSE_END]));s>=i&&(!o||c<o)&&(o=c,a=n)}return a}function Vf(e,t,n,r,i,a){let o=sa(t),s=sa(n),c=r.filter(t=>{let n=sa(aa(t[J.FETCH_START])),r=sa(aa(t[J.RESPONSE_END]));return t.initiatorType.toLowerCase()===(a||`xmlhttprequest`)&&t.name===e&&n>=o&&r<=s});return c.length>0&&(c=c.filter(e=>!i.has(e))),c}function Hf(e){if(typeof URL==`function`)return new URL(e,typeof document<`u`?document.baseURI:typeof location<`u`?location.href:void 0);let t=Pf();return t.href=e,t}function Uf(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return`/`;let n=Gf(e,t);if(t&&n.indexOf(`@id`)>0)return n;let r=``;return e.parentNode&&(r+=Uf(e.parentNode,t)),r+=n,r}function Wf(e){if(!e.parentNode)return 0;let t=[e.nodeType];e.nodeType===Node.CDATA_SECTION_NODE&&t.push(Node.TEXT_NODE);let n=Array.from(e.parentNode.childNodes);return n=n.filter(n=>{let r=n.localName;return t.indexOf(n.nodeType)>=0&&r===e.localName}),n.length>=1?n.indexOf(e)+1:0}function Gf(e,t){let n=e.nodeType,r=Wf(e),i=``;if(n===Node.ELEMENT_NODE){let n=e.getAttribute(`id`);if(t&&n)return`//*[@id="${n}"]`;i=e.localName}else if(n===Node.TEXT_NODE||n===Node.CDATA_SECTION_NODE)i=`text()`;else if(n===Node.COMMENT_NODE)i=`comment()`;else return``;return i&&r>1?`/${i}[${r}]`:`/${i}`}function Kf(e,t){let n=t||[];return(typeof n==`string`||n instanceof RegExp)&&(n=[n]),Hf(e).origin===Rf()?!0:n.some(t=>yo(e,t))}var qf,Jf=t((()=>{Af(),B(),Nf()})),Yf=t((()=>{kf(),Tf(),Af(),Jf(),Cf()}));Qu(),Yf();var X={actionType:`action.type`,deploymentEnvironmentName:`deployment.environment.name`,browserName:`browser_name`,browserVersion:`browser_version`,cacheHit:`cache_hit`,deviceType:`device_type`,durationBucket:`duration_bucket`,errorType:`error_type`,eventLabel:`event_label`,exceptionFingerprint:`exception.fingerprint`,exceptionMessageShort:`exception.message_short`,exceptionStackTopFrame:`exception.stack_top_frame`,longtaskAttributionScript:`longtask.attribution_script`,longtaskBlockingDuration:`longtask.blocking_duration`,networkEffectiveType:`network.effective_type`,nextHopProtocol:`next_hop_protocol`,result:`result`,serviceName:`service.name`,serviceVersion:`service.version`,osName:`os_name`,sessionHasReplay:`session.has_replay`,sessionId:`session.id`,sessionStartTime:`session.start_time`,spanSubtype:`span_subtype`,spanType:`span_type`,statusClass:`status_class`,targetDomain:`target_domain`,targetLabel:`target_label`,targetPathTemplate:`target_path_template`,targetTag:`target.tag`,targetTextShort:`target.text_short`,targetValue:`target_value`,traceScene:`trace_scene`,transferSize:`transfer_size`,userId:`user.id`,vitalMetric:`vital.metric`,vitalRating:`vital.rating`,vitalValue:`vital.value`,viewId:`view.id`,viewLoadingType:`view.loading_type`,viewUrl:`view.url`,viewUrlPathGroup:`view.url_path_group`};G();var Z={abort:`abort`,error:`error`,success:`success`,timeout:`timeout`,warning:`warning`},Q={action:`action`,custom:`custom`,document:`document`,error:`error`,http:`http`,longtask:`longtask`,resource:`resource`,route:`route`,vital:`vital`},Xf=e=>e<100?`<100ms`:e<500?`100~500ms`:e<2e3?`500ms~2s`:`>2s`,Zf=e=>`${Math.trunc(e/100)}xx`,Qf=e=>e===408||e===504?Z.timeout:typeof e==`number`&&e>=400?Z.error:Z.success,$f=e=>e===408||e===504?`network_timeout`:typeof e!=`number`||e<400?`none`:e>=500?`http_5xx`:`http_4xx`,ep=e=>e===`good`?Z.success:Z.warning,tp=(e,t)=>{if(!e)return{};try{let n=new URL(e,typeof location>`u`?`http://localhost`:location.href),r=t==null?n.pathname:t;return{domain:n.host,label:`${n.host}${r}`,pathTemplate:r}}catch(n){return{label:e,pathTemplate:t==null?e:t}}},$=({duration:e,errorType:t=`none`,eventLabel:n,result:r=Z.success,spanSubtype:i,spanType:a,targetLabel:o,targetValue:s,traceScene:c})=>W(W(W(W(W({[X.spanType]:a,[X.spanSubtype]:i,[X.result]:r,[X.errorType]:t},e===void 0?{}:{[X.durationBucket]:Xf(e)}),n===void 0?{}:{[X.eventLabel]:n}),o===void 0?{}:{[X.targetLabel]:o}),s===void 0?{}:{[X.targetValue]:s}),c===void 0?{}:{[X.traceScene]:c}),np=({duration:e,method:t,statusCode:n,subtype:r,url:i,urlPathTemplate:a})=>{let o=tp(i,a);return W(W(W(W(W({},$({duration:e,errorType:$f(n),eventLabel:`API 调用`,result:Qf(n),spanSubtype:r,spanType:Q.http,targetLabel:o.label,targetValue:n})),t?{"http.request.method":t.toUpperCase()}:{}),o.domain?{[X.targetDomain]:o.domain}:{}),o.pathTemplate?{[X.targetPathTemplate]:o.pathTemplate}:{}),typeof n==`number`?{"http.response.status_code":n,[X.statusClass]:Zf(n)}:{})},rp=({duration:e,initiatorType:t=`other`,responseStatus:n,transferSize:r,url:i,urlPathTemplate:a})=>{var o;let s=tp(i,a),c=typeof n==`number`?Qf(n):Z.success;return W(W(W(W({},$({duration:e,errorType:typeof n==`number`?$f(n):`none`,eventLabel:`静态资源`,result:c,spanSubtype:t,spanType:Q.resource,targetLabel:(o=s.label)==null?i:o,targetValue:r})),s.domain?{[X.targetDomain]:s.domain}:{}),s.pathTemplate?{[X.targetPathTemplate]:s.pathTemplate}:{}),typeof n==`number`?{"http.response.status_code":n,[X.statusClass]:Zf(n)}:{})};G();var ip=e=>e instanceof Element?e:void 0,ap=e=>{var t;if(!e)return;let n=((t=e.textContent)==null?void 0:t.trim())||e.getAttribute(`aria-label`)||e.getAttribute(`title`)||``;return n?n.slice(0,32):void 0},op=e=>{let t=[];return{name:`action`,enabled:e.enabled,init(n){if(typeof window>`u`)return;let r={capture:!0,passive:!0},i=e=>{var t;let r=ip(e.target),i=ap(r),a=r==null?void 0:r.tagName.toLowerCase();n.startSpan(`action.${e.type}`,W(W(W(W({},n.config.hooks.getPageAttributes()),$({errorType:`none`,eventLabel:`用户操作`,spanSubtype:e.type,spanType:Q.action,targetLabel:(t=i==null?a:i)==null?e.type:t})),{},{[X.actionType]:e.type},i?{[X.targetTextShort]:i}:{}),a?{[X.targetTag]:a}:{})).end()};for(let n of e.enabled?e.eventNames:[])window.addEventListener(n,i,r),t.push(()=>window.removeEventListener(n,i,r))},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}};bn(),G();var sp=`body`,cp=3e3,lp=.8,up=[`[data-loading="true"]`,`[aria-busy="true"]`,`.loading`,`.is-loading`,`.spinner`,`.skeleton`,`.bk-loading`],dp=[[.5,.5],[.25,.25],[.75,.25],[.25,.75],[.75,.75]],fp=e=>{if(!e)return``;let t=e.tagName.toLowerCase();return e.id?`${t}#${e.id}`:t},pp=(e,t)=>e?t.some(t=>{try{return e.matches(t)||!!e.closest(t)}catch(e){return!1}}):!1,mp=e=>{if(typeof document>`u`)return()=>{};if(document.readyState===`complete`||document.readyState===`interactive`)return e(),()=>{};let t=()=>{document.removeEventListener(`DOMContentLoaded`,t),e()};return document.addEventListener(`DOMContentLoaded`,t),()=>document.removeEventListener(`DOMContentLoaded`,t)},hp=e=>{let t,n,r=!1;return{name:`blank-screen`,enabled:e.enabled,init(i){var a,o;if(typeof window>`u`||typeof document>`u`)return;let s=e.enabled?(a=e.rootSelector)==null?sp:a:sp,c=e.enabled?e.checkDelay:cp,l=e.enabled?e.threshold:lp,u=[...up,...e.enabled?(o=e.ignoreSelectors)==null?[]:o:[]],d=i.meter.createCounter(`browser.blank_screen.count`,{description:`Number of suspected blank screen detections`}),f=()=>{try{var e,t;let n=document.querySelector(s),r=0,a=0;for(let[e,t]of dp){let i=document.elementFromPoint(window.innerWidth*e,window.innerHeight*t);if(pp(i,u)){a+=1;continue}(i===n||i===document.body||i===document.documentElement)&&(r+=1)}let o=dp.length-a;if(o===0)return;let c=r/o,f=c>=l,p=fp(document.elementFromPoint(window.innerWidth/2,window.innerHeight/2)),m=W(W({},$({errorType:f?`blank_screen`:`none`,eventLabel:`白屏`,result:f?Z.error:Z.success,spanSubtype:`blank_screen`,spanType:Q.error,targetLabel:s,targetValue:c})),{},{"blank_screen.score":c,"blank_screen.threshold":l,"blank_screen.root":s,"blank_screen.detected":f,"blank_screen.sample_total":dp.length,"blank_screen.sample_valid":o,"blank_screen.sample_loading":a,"blank_screen.center_element":p,"blank_screen.dom_node_count":(e=(t=document.body)==null?void 0:t.getElementsByTagName(`*`).length)==null?0:e});f&&(d.add(1,i.applyRedact({"blank_screen.root":s})),i.emitLog({severityNumber:N.ERROR,severityText:`ERROR`,body:`browser.blank_screen`,attributes:m}))}catch(e){if(i.config.debug){var n;(n=globalThis.console)==null||n.warn(`[bk-ot][blank-screen] detection failed:`,e)}}};n=mp(()=>{r||(t=window.setTimeout(f,c))})},shutdown(){r=!0,n==null||n(),n=void 0,t!==void 0&&typeof window<`u`&&(window.clearTimeout(t),t=void 0)}}},gp=()=>typeof window>`u`?`http://localhost`:window.location.origin,_p=e=>{try{return new URL(e,gp()).href}catch(t){return e}},vp=e=>e.length>1?e.replace(/\/+$/,``):e,yp=(e,t)=>{let n=e=>vp(e.replace(/[?#].*$/,``));return n(e)===n(t)},bp=e=>{try{return new URL(e,gp()).origin===gp()}catch(e){return!1}},xp=(e,t)=>{let n=_p(t);return[e.transport.traces.endpoint,e.transport.metrics.endpoint,e.transport.logs.endpoint].some(e=>yp(n,_p(e)))},Sp=(e,t)=>xp(e,t),Cp=(e,t)=>bp(t),wp,Tp=t((()=>{(function(e){e.DOCUMENT_LOAD=`documentLoad`,e.DOCUMENT_FETCH=`documentFetch`,e.RESOURCE_FETCH=`resourceFetch`})(wp||(wp={}))})),Ep,Dp,Op=t((()=>{Ep=`0.62.0`,Dp=`@opentelemetry/instrumentation-document-load`})),kp,Ap,jp=t((()=>{kp=`http.url`,Ap=`http.user_agent`})),Mp,Np=t((()=>{(function(e){e.FIRST_PAINT=`firstPaint`,e.FIRST_CONTENTFUL_PAINT=`firstContentfulPaint`})(Mp||(Mp={}))})),Pp,Fp,Ip,Lp=t((()=>{B(),Np(),Pp=()=>{var e;let t={},n=(e=z.getEntriesByType)==null?void 0:e.call(z,`navigation`)[0];if(n)Object.values(J).forEach(e=>{if(Ff(n,e)){let r=n[e];typeof r==`number`&&(t[e]=r)}});else{let e=z.timing;e&&Object.values(J).forEach(n=>{if(Ff(e,n)){let r=e[n];typeof r==`number`&&(t[n]=r)}})}return t},Fp={"first-paint":Mp.FIRST_PAINT,"first-contentful-paint":Mp.FIRST_CONTENTFUL_PAINT},Ip=e=>{var t;let n=(t=z.getEntriesByType)==null?void 0:t.call(z,`paint`);n&&n.forEach(({name:t,startTime:n})=>{Ff(Fp,t)&&e.addEvent(Fp[t],n)})}})),Rp,zp=t((()=>{M(),B(),Yf(),Zi(),Tp(),Op(),jp(),Lp(),F(),Rp=class extends Gu{constructor(e={}){super(Dp,Ep,e),P(this,`component`,`document-load`),P(this,`version`,`1`),P(this,`moduleName`,this.component),P(this,`_semconvStability`,void 0),this._semconvStability=Xu(`http`,e==null?void 0:e.semconvStabilityOptIn)}init(){}_onDocumentLoaded(){window.setTimeout(()=>{this._collectPerformance()})}_addResourcesSpans(e){var t;let n=(t=z.getEntriesByType)==null?void 0:t.call(z,`resource`);n&&n.forEach(t=>{this._initResourceSpan(t,e)})}_collectPerformance(){let e=Array.from(document.getElementsByTagName(`meta`)).find(e=>e.getAttribute(`name`)===Ia),t=Pp(),n=e&&e.content||``;k.with(Yt.extract(D,{traceparent:n}),()=>{var e;let n=this._startSpan(wp.DOCUMENT_LOAD,J.FETCH_START,t);n&&(k.with(j.setSpan(k.active(),n),()=>{let e=this._startSpan(wp.DOCUMENT_FETCH,J.FETCH_START,t);e&&(this._semconvStability&q.OLD&&e.setAttribute(kp,location.href),this._semconvStability&q.STABLE&&e.setAttribute(Ki,location.href),k.with(j.setSpan(k.active(),e),()=>{var n;let r=!(this._semconvStability&q.OLD);If(e,t,this.getConfig().ignoreNetworkEvents,void 0,r),this._addCustomAttributesOnSpan(e,(n=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:n.documentFetch),this._endSpan(e,J.RESPONSE_END,t)}))}),this._semconvStability&q.OLD&&(n.setAttribute(kp,location.href),n.setAttribute(Ap,navigator.userAgent)),this._semconvStability&q.STABLE&&(n.setAttribute(Ki,location.href),n.setAttribute(qi,navigator.userAgent)),this._addResourcesSpans(n),this.getConfig().ignoreNetworkEvents||(Y(n,J.FETCH_START,t),Y(n,J.UNLOAD_EVENT_START,t),Y(n,J.UNLOAD_EVENT_END,t),Y(n,J.DOM_INTERACTIVE,t),Y(n,J.DOM_CONTENT_LOADED_EVENT_START,t),Y(n,J.DOM_CONTENT_LOADED_EVENT_END,t),Y(n,J.DOM_COMPLETE,t),Y(n,J.LOAD_EVENT_START,t),Y(n,J.LOAD_EVENT_END,t)),this.getConfig().ignorePerformancePaintEvents||Ip(n),this._addCustomAttributesOnSpan(n,(e=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:e.documentLoad),this._endSpan(n,J.LOAD_EVENT_END,t))})}_endSpan(e,t,n){e&&(Ff(n,t)?e.end(n[t]):e.end())}_initResourceSpan(e,t){let n=this._startSpan(wp.RESOURCE_FETCH,J.FETCH_START,e,t);if(n){var r;this._semconvStability&q.OLD&&n.setAttribute(kp,e.name),this._semconvStability&q.STABLE&&n.setAttribute(Ki,e.name);let t=!(this._semconvStability&q.OLD);If(n,e,this.getConfig().ignoreNetworkEvents,void 0,t),this._addCustomAttributesOnResourceSpan(n,e,(r=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:r.resourceFetch),this._endSpan(n,J.RESPONSE_END,e)}}_startSpan(e,t,n,r){if(Ff(n,t)&&typeof n[t]==`number`)return this.tracer.startSpan(e,{startTime:n[t]},r?j.setSpan(k.active(),r):void 0)}_waitForPageLoad(){window.document.readyState===`complete`?this._onDocumentLoaded():(this._onDocumentLoaded=this._onDocumentLoaded.bind(this),window.addEventListener(`load`,this._onDocumentLoaded))}_addCustomAttributesOnSpan(e,t){t&&Ju(()=>t(e),e=>{e&&this._diag.error(`addCustomAttributesOnSpan`,e)},!0)}_addCustomAttributesOnResourceSpan(e,t,n){n&&Ju(()=>n(e,t),e=>{e&&this._diag.error(`addCustomAttributesOnResourceSpan`,e)},!0)}enable(){window.removeEventListener(`load`,this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener(`load`,this._onDocumentLoaded)}}})),Bp=n({AttributeNames:()=>wp,DocumentLoadInstrumentation:()=>Rp}),Vp=t((()=>{zp(),Tp()})),Hp,Up=t((()=>{(function(e){e.COMPONENT=`component`,e.HTTP_STATUS_TEXT=`http.status_text`})(Hp||(Hp={}))})),Wp,Gp,Kp,qp,Jp,Yp,Xp,Zp,Qp=t((()=>{Wp=`http.host`,Gp=`http.method`,Kp=`http.request.body.size`,qp=`http.request_content_length_uncompressed`,Jp=`http.scheme`,Yp=`http.status_code`,Xp=`http.url`,Zp=`http.user_agent`}));function $p(...e){if(e[0]instanceof URL||typeof e[0]==`string`){let t=e[1];if(!(t!=null&&t.body))return Promise.resolve();if(t.body instanceof ReadableStream){let{body:e,length:n}=em(t.body);return t.body=e,n}else return Promise.resolve(nm(t.body))}else{let t=e[0];return t!=null&&t.body?t.clone().text().then(e=>rm(e)):Promise.resolve()}}function em(e){if(!e.pipeThrough)return cm.warn(`Platform has ReadableStream but not pipeThrough!`),{body:e,length:Promise.resolve(void 0)};let t=0,n,r=new Promise(e=>{n=e}),i=new TransformStream({start(){},transform(e,n){return V(function*(){let r=yield e;t+=r.byteLength,n.enqueue(e)})()},flush(){n(t)}});return{body:e.pipeThrough(i),length:r}}function tm(e){return typeof Document<`u`&&e instanceof Document}function nm(e){if(tm(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return rm(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return im(e);if(e instanceof URLSearchParams)return rm(e.toString());if(e.byteLength!==void 0)return e.byteLength;cm.warn(`unknown body type`)}function rm(e){return lm.encode(e).byteLength}function im(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function am(e){let t=om(),n=e.toUpperCase();return n in t?n:`_OTHER`}function om(){return dm===void 0&&(dm=um),dm}function sm(e){let t=Number(e.port||fm[e.protocol]);if(t&&!isNaN(t))return t}var cm,lm,um,dm,fm,pm=t((()=>{M(),B(),H(),cm=A.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-fetch/utils`}),lm=new TextEncoder,um={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},fm={"https:":`443`,"http:":`80`}})),mm,hm=t((()=>{mm=`0.217.0`})),gm,_m,vm,ym=t((()=>{M(),Qu(),B(),Yf(),Up(),Qp(),Zi(),pm(),hm(),F(),gm=300,_m=typeof PerformanceObserver<`u`,vm=class extends Gu{constructor(e={}){super(`@opentelemetry/instrumentation-fetch`,mm,e),P(this,`component`,`fetch`),P(this,`version`,mm),P(this,`moduleName`,this.component),P(this,`_usedResources`,new WeakSet),P(this,`_tasksCount`,0),P(this,`_semconvStability`,void 0),this._semconvStability=Xu(`http`,e==null?void 0:e.semconvStabilityOptIn)}init(){}_addChildSpan(e,t){let n=this.tracer.startSpan(`CORS Preflight`,{startTime:t[J.FETCH_START]},j.setSpan(k.active(),e)),r=!(this._semconvStability&q.OLD);If(n,t,this.getConfig().ignoreNetworkEvents,void 0,r),n.end(t[J.RESPONSE_END])}_addFinalSpanAttributes(e,t){let n=Hf(t.url);if(this._semconvStability&q.OLD&&(e.setAttribute(Yp,t.status),t.statusText!=null&&e.setAttribute(Hp.HTTP_STATUS_TEXT,t.statusText),e.setAttribute(Wp,n.host),e.setAttribute(Jp,n.protocol.replace(`:`,``)),typeof navigator<`u`&&e.setAttribute(Zp,navigator.userAgent)),this._semconvStability&q.STABLE){e.setAttribute(Ri,t.status),e.setAttribute(zi,n.hostname);let r=sm(n);r&&e.setAttribute(Bi,r)}}_addHeaders(e,t){if(!Kf(t,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};Yt.inject(k.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}if(e instanceof Request)Yt.inject(k.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else{let t=new Headers(e.headers);Yt.inject(k.active(),t,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))}),e.headers=t}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(e,t={}){if(bo(e,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let n=``,r={};if(this._semconvStability&q.OLD){let i=(t.method||`GET`).toUpperCase();n=`HTTP ${i}`,r[Hp.COMPONENT]=this.moduleName,r[Gp]=i,r[Xp]=e}if(this._semconvStability&q.STABLE){let i=t.method,a=am(t.method||`GET`);n||(n=a),r[Ii]=a,a!==i&&(r[Li]=i),r[Ki]=e}return this.tracer.startSpan(n,{kind:Ct.CLIENT,attributes:r})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType(`resource`)}let i=zf(t.spanUrl,t.startTime,n,r,this._usedResources,`fetch`);if(i.mainRequest){let t=i.mainRequest;this._markResourceAsUsed(t);let n=i.corsPreFlightRequest;n&&(this._addChildSpan(e,n),this._markResourceAsUsed(n));let r=!(this._semconvStability&q.OLD);If(e,t,this.getConfig().ignoreNetworkEvents,void 0,r)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){let r=ra(Date.now()),i=ia();this._addFinalSpanAttributes(e,n),this._semconvStability&q.STABLE&&n.status>=400&&(e.setStatus({code:Tt.ERROR}),e.setAttribute(Mi,String(n.status))),setTimeout(()=>{var n;(n=t.observer)==null||n.disconnect(),this._findResourceAndAddNetworkEvents(e,t,i),this._tasksCount--,this._clearResources(),e.end(r)},gm)}_patchConstructor(){return e=>{let t=this;return function(...n){if(!t._isEnabled)return e.apply(this,n);let r=this,i=Hf(n[0]instanceof Request?n[0].url:String(n[0])).href,a;a=n[0]instanceof Request?n[1]==null?n[0]:new Request(n[0],n[1]):n[1]||{};let o=t._createSpan(i,a);if(!o)return e.apply(this,n);let s=t._prepareSpanData(i);t.getConfig().measureRequestSize&&$p(...n).then(e=>{e&&(t._semconvStability&q.OLD&&o.setAttribute(qp,e),t._semconvStability&q.STABLE&&o.setAttribute(Kp,e))}).catch(e=>{t._diag.warn(`getFetchBodyLength`,e)});function c(e,n){t._applyAttributesAfterFetch(e,a,n),t._endSpan(e,s,{status:n.status||0,statusText:n.message,url:i})}function l(e,n){t._applyAttributesAfterFetch(e,a,n),n.status>=200&&n.status<400?t._endSpan(e,s,n):t._endSpan(e,s,{status:n.status,statusText:n.statusText,url:i})}function u(e,n){try{let t=n.clone().body;if(t){let r=t.getReader(),i=()=>{r.read().then(({done:t})=>{t?l(e,n):i()},t=>{c(e,t)})};i()}else l(e,n)}catch(n){t._diag.error(`Failed to read fetch response body`,n),t._endSpan(e,s,{status:0,url:i})}return n}function d(e,n){try{c(e,n)}catch(r){t._diag.error(`Failed to end span on fetch error`,r),t._endSpan(e,s,{status:n.status||0,url:i})}throw n}return k.with(j.setSpan(k.active(),o),()=>(t._callRequestHook(o,a),t._addHeaders(a,i),t._tasksCount++,e.apply(r,a instanceof Request?[a]:[i,a]).then(u.bind(r,o),d.bind(r,o))))}}}_applyAttributesAfterFetch(e,t,n){let r=this.getConfig().applyCustomAttributesOnSpan;r&&Ju(()=>r(e,t,n),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_callRequestHook(e,t){let n=this.getConfig().requestHook;n&&Ju(()=>n(e,t),e=>{e&&this._diag.error(`requestHook`,e)},!0)}_prepareSpanData(e){let t=ia(),n=[];if(typeof PerformanceObserver!=`function`)return{entries:n,startTime:t,spanUrl:e};let r=new PerformanceObserver(t=>{t.getEntries().forEach(t=>{t.initiatorType===`fetch`&&t.name===e&&n.push(t)})});return r.observe({entryTypes:[`resource`]}),{entries:n,observer:r,startTime:t,spanUrl:e}}enable(){if(!_m){this._diag.warn(`this instrumentation is intended for web usage only, it does not instrument server-side fetch()`);return}if(!this._isEnabled){if(this._isFetchPatched){this._diag.debug(`fetch constructor already patched`),this._isEnabled=!0;return}try{this._wrap(globalThis,`fetch`,this._patchConstructor()),this._isFetchPatched=!0,this._isEnabled=!0}catch(e){this._diag.warn(`Failed to patch globalThis.fetch; instrumentation will not be enabled. Another script may have locked globalThis.fetch via Object.defineProperty.`,e)}}}disable(){_m&&this._isEnabled&&(this._isEnabled=!1,this._usedResources=new WeakSet)}}})),bm=n({FetchInstrumentation:()=>vm}),xm=t((()=>{ym()})),Sm,Cm,wm,Tm,Em,Dm,Om,km,Am=t((()=>{Sm=`http.host`,Cm=`http.method`,wm=`http.request.body.size`,Tm=`http.request_content_length_uncompressed`,Em=`http.scheme`,Dm=`http.status_code`,Om=`http.url`,km=`http.user_agent`})),jm,Mm=t((()=>{(function(e){e.METHOD_OPEN=`open`,e.METHOD_SEND=`send`,e.EVENT_ABORT=`abort`,e.EVENT_ERROR=`error`,e.EVENT_LOAD=`loaded`,e.EVENT_TIMEOUT=`timeout`})(jm||(jm={}))}));function Nm(e){return typeof Document<`u`&&e instanceof Document}function Pm(e){if(Nm(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return Fm(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Im(e);if(e instanceof URLSearchParams)return Fm(e.toString());if(e.byteLength!==void 0)return e.byteLength;Bm.warn(`unknown body type`)}function Fm(e){return Vm.encode(e).byteLength}function Im(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function Lm(e){let t=Rm(),n=e.toUpperCase();return n in t?n:`_OTHER`}function Rm(){return Um===void 0&&(Um=Hm),Um}function zm(e){let t=Number(e.port||Wm[e.protocol]);if(t&&!isNaN(t))return t}var Bm,Vm,Hm,Um,Wm,Gm=t((()=>{M(),B(),Bm=A.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils`}),Vm=new TextEncoder,Hm={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Wm={"https:":`443`,"http:":`80`}})),Km,qm=t((()=>{Km=`0.217.0`})),Jm,Ym=t((()=>{(function(e){e.HTTP_STATUS_TEXT=`http.status_text`})(Jm||(Jm={}))})),Xm,Zm,Qm=t((()=>{M(),Qu(),B(),Yf(),Zi(),Am(),Mm(),Gm(),qm(),Ym(),F(),Xm=300,Zm=class extends Gu{constructor(e={}){super(`@opentelemetry/instrumentation-xml-http-request`,Km,e),P(this,`component`,`xml-http-request`),P(this,`version`,Km),P(this,`moduleName`,this.component),P(this,`_tasksCount`,0),P(this,`_xhrMem`,new WeakMap),P(this,`_usedResources`,new WeakSet),P(this,`_semconvStability`,void 0),this._semconvStability=Xu(`http`,e==null?void 0:e.semconvStabilityOptIn)}init(){}_addHeaders(e,t){let n=Hf(t).href;if(!Kf(n,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};Yt.inject(k.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}let r={};Yt.inject(k.active(),r),Object.keys(r).forEach(t=>{e.setRequestHeader(t,String(r[t]))})}_addChildSpan(e,t){k.with(j.setSpan(k.active(),e),()=>{let e=this.tracer.startSpan(`CORS Preflight`,{startTime:t[J.FETCH_START]}),n=!(this._semconvStability&q.OLD);If(e,t,this.getConfig().ignoreNetworkEvents,void 0,n),e.end(t[J.RESPONSE_END])})}_addFinalSpanAttributes(e,t,n){if(this._semconvStability&q.OLD){if(t.status!==void 0&&e.setAttribute(Dm,t.status),t.statusText!==void 0&&e.setAttribute(Jm.HTTP_STATUS_TEXT,t.statusText),typeof n==`string`){let t=Hf(n);e.setAttribute(Sm,t.host),e.setAttribute(Em,t.protocol.replace(`:`,``))}e.setAttribute(km,navigator.userAgent)}this._semconvStability&q.STABLE&&t.status&&e.setAttribute(Ri,t.status)}_applyAttributesAfterXHR(e,t){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n==`function`&&Ju(()=>n(e,t),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_addResourceObserver(e,t){let n=this._xhrMem.get(e);!n||typeof PerformanceObserver!=`function`||typeof PerformanceResourceTiming!=`function`||(n.createdResources={observer:new PerformanceObserver(e=>{let r=e.getEntries(),i=Hf(t);r.forEach(e=>{e.initiatorType===`xmlhttprequest`&&e.name===i.href&&n.createdResources&&n.createdResources.entries.push(e)})}),entries:[]},n.createdResources.observer.observe({entryTypes:[`resource`]}))}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(z.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(e,t,n,r,i){if(!n||!r||!i||!e.createdResources)return;let a=e.createdResources.entries;(!a||!a.length)&&(a=z.getEntriesByType(`resource`));let o=zf(Hf(n).href,r,i,a,this._usedResources);if(o.mainRequest){let e=o.mainRequest;this._markResourceAsUsed(e);let n=o.corsPreFlightRequest;n&&(this._addChildSpan(t,n),this._markResourceAsUsed(n));let r=!(this._semconvStability&q.OLD);If(t,e,this.getConfig().ignoreNetworkEvents,void 0,r)}}_cleanPreviousSpanInformation(e){let t=this._xhrMem.get(e);if(t){let n=t.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(e)}}_createSpan(e,t,n){let r=Hf(t);if(bo(r.href,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let i=``,a={};if(this._semconvStability&q.OLD&&(i=n.toUpperCase(),a[Cm]=n,a[Om]=r.toString()),this._semconvStability&q.STABLE){let e=n,t=Lm(n);i||(i=t),a[Ii]=t,t!==e&&(a[Li]=e),a[Ki]=r.toString(),a[zi]=r.hostname;let o=zm(r);o&&(a[Bi]=o)}let o=this.tracer.startSpan(i,{kind:Ct.CLIENT,attributes:a});return o.addEvent(jm.METHOD_OPEN),this._cleanPreviousSpanInformation(e),this._xhrMem.set(e,{span:o,spanUrl:t}),o}_markResourceAsUsed(e){this._usedResources.add(e)}_patchOpen(){return e=>{let t=this;return function(...n){if(!t._isEnabled)return e.apply(this,n);let r=n[0],i=n[1];return t._createSpan(this,i,r),e.apply(this,n)}}}_patchSend(){let e=this;function t(t,n,r,i){let a=n.callbackToRemoveEvents;typeof a==`function`&&a();let{span:o,spanUrl:s,sendStartTime:c}=n;o&&(e._findResourceAndAddNetworkEvents(n,o,s,c,r),o.addEvent(t,i),e._addFinalSpanAttributes(o,n,s),o.end(i),e._tasksCount--),e._clearResources()}function n(n,r,i,a){let o=e._xhrMem.get(r);if(!o)return;if(o.status=r.status,o.statusText=r.statusText,e._xhrMem.delete(r),o.span){let t=o.span;e._applyAttributesAfterXHR(t,r),e._semconvStability&q.STABLE&&(i?a&&(t.setStatus({code:Tt.ERROR,message:a}),t.setAttribute(Mi,a)):o.status&&o.status>=400&&(t.setStatus({code:Tt.ERROR}),t.setAttribute(Mi,String(o.status))))}let s=ia(),c=Date.now();setTimeout(()=>{t(n,o,s,c)},Xm)}function r(){n(jm.EVENT_ERROR,this,!0,`error`)}function i(){n(jm.EVENT_ABORT,this,!1)}function a(){n(jm.EVENT_TIMEOUT,this,!0,`timeout`)}function o(){this.status<299?n(jm.EVENT_LOAD,this,!1):n(jm.EVENT_ERROR,this,!1)}function s(t){t.removeEventListener(`abort`,i),t.removeEventListener(`error`,r),t.removeEventListener(`load`,o),t.removeEventListener(`timeout`,a);let n=e._xhrMem.get(t);n&&(n.callbackToRemoveEvents=void 0)}return t=>function(...n){if(!e._isEnabled)return t.apply(this,n);let c=e._xhrMem.get(this);if(!c)return t.apply(this,n);let l=c.span,u=c.spanUrl;if(l&&u){if(e.getConfig().measureRequestSize&&n!=null&&n[0]){let t=n[0],r=Pm(t);r!==void 0&&(e._semconvStability&q.OLD&&l.setAttribute(Tm,r),e._semconvStability&q.STABLE&&l.setAttribute(wm,r))}k.with(j.setSpan(k.active(),l),()=>{e._tasksCount++,c.sendStartTime=ia(),l.addEvent(jm.METHOD_SEND),this.addEventListener(`abort`,i),this.addEventListener(`error`,r),this.addEventListener(`load`,o),this.addEventListener(`timeout`,a),c.callbackToRemoveEvents=()=>{s(this),c.createdResources&&c.createdResources.observer.disconnect()},e._addHeaders(this,u),e._addResourceObserver(this,u)})}return t.apply(this,n)}}enable(){if(!this._isEnabled){if(this._isXhrPatched){this._diag.debug(`reactivating existing patch on`,this.moduleName,this.version),this._isEnabled=!0;return}try{this._diag.debug(`applying patch to`,this.moduleName,this.version),this._wrap(XMLHttpRequest.prototype,`open`,this._patchOpen()),this._wrap(XMLHttpRequest.prototype,`send`,this._patchSend()),this._isXhrPatched=!0,this._isEnabled=!0}catch(e){this._unwrap(XMLHttpRequest.prototype,`open`),this._unwrap(XMLHttpRequest.prototype,`send`),this._diag.warn(`Failed to patch globalThis.XMLHttpRequest; instrumentation will not be enabled. Another script may have locked globalThis.XMLHttpRequest via Object.defineProperty.`,e)}}}disable(){this._isEnabled&&(this._isEnabled=!1,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}}})),$m=n({XMLHttpRequestInstrumentation:()=>Zm}),eh=t((()=>{Qm()})),th,nh=t((()=>{(function(e){e.EVENT_TYPE=`event_type`,e.TARGET_ELEMENT=`target_element`,e.TARGET_XPATH=`target_xpath`,e.HTTP_URL=`http.url`})(th||(th={}))})),rh,ih,ah=t((()=>{rh=`0.61.0`,ih=`@opentelemetry/instrumentation-user-interaction`}));function oh(){return!1}var sh,ch,lh,uh,dh=t((()=>{Qu(),M(),B(),Yf(),nh(),ah(),F(),sh=`OT_ZONE_CONTEXT`,ch=`Navigation:`,lh=[`click`],uh=class extends Gu{constructor(e={}){var t;super(ih,rh,e),P(this,`version`,rh),P(this,`moduleName`,`user-interaction`),P(this,`_spansData`,new WeakMap),P(this,`_wrappedListeners`,new WeakMap),P(this,`_eventsSpanMap`,new WeakMap),P(this,`_eventNames`,void 0),P(this,`_shouldPreventSpanCreation`,void 0),this._eventNames=new Set((t=e==null?void 0:e.eventNames)==null?lh:t),this._shouldPreventSpanCreation=typeof(e==null?void 0:e.shouldPreventSpanCreation)==`function`?e.shouldPreventSpanCreation:oh}init(){}_checkForTimeout(e,t){let n=this._spansData.get(t);n&&(e.source===`setTimeout`?n.hrTimeLastTimeout=ia():e.source!==`Promise.then`&&e.source!==`setTimeout`&&(n.hrTimeLastTimeout=void 0))}_allowEventName(e){return this._eventNames.has(e)}_createSpan(e,t,n){if(!this._isEnabled||!(e instanceof HTMLElement)||!e.getAttribute||e.hasAttribute(`disabled`)||!this._allowEventName(t))return;let r=Uf(e,!0);try{let i=this.tracer.startSpan(t,{attributes:{[th.EVENT_TYPE]:t,[th.TARGET_ELEMENT]:e.tagName,[th.TARGET_XPATH]:r,[th.HTTP_URL]:window.location.href}},n?j.setSpan(k.active(),n):void 0);return this._shouldPreventSpanCreation(t,e,i)===!0?void 0:(this._spansData.set(i,{taskCount:0}),i)}catch(e){this._diag.error(`failed to start create new user interaction span`,e)}}_decrementTask(e){let t=this._spansData.get(e);t&&(t.taskCount--,t.taskCount===0&&this._tryToEndSpan(e,t.hrTimeLastTimeout))}_getCurrentSpan(e){let t=e.get(sh);return t&&j.getSpan(t)}_incrementTask(e){let t=this._spansData.get(e);t&&t.taskCount++}addPatchedListener(e,t,n,r){let i=this._wrappedListeners.get(n);i||(i=new Map,this._wrappedListeners.set(n,i));let a=i.get(t);return a||(a=new Map,i.set(t,a)),a.has(e)?!1:(a.set(e,r),!0)}removePatchedListener(e,t,n){let r=this._wrappedListeners.get(n);if(!r)return;let i=r.get(t);if(!i)return;let a=i.get(e);return a&&(i.delete(e),i.size===0&&(r.delete(t),r.size===0&&this._wrappedListeners.delete(n))),a}_invokeListener(e,t,n){return typeof e==`function`?e.apply(t,n):e.handleEvent(n[0])}_patchAddEventListener(){let e=this;return t=>function(n,r,i){if(!r)return t.call(this,n,r,i);let a=i&&typeof i==`object`&&i.once,o=function(...t){let i,o=t[0],s=o==null?void 0:o.target;o&&(i=e._eventsSpanMap.get(o)),a&&e.removePatchedListener(this,n,r);let c=e._createSpan(s,n,i);return c?(o&&e._eventsSpanMap.set(o,c),k.with(j.setSpan(k.active(),c),()=>{let n=e._invokeListener(r,this,t);return c.end(),n})):e._invokeListener(r,this,t)};if(e.addPatchedListener(this,n,r,o))return t.call(this,n,o,i)}}_patchRemoveEventListener(){let e=this;return t=>function(n,r,i){let a=e.removePatchedListener(this,n,r);return a?t.call(this,n,a,i):t.call(this,n,r,i)}}_getPatchableEventTargets(){return window.EventTarget?[EventTarget.prototype]:[Node.prototype,Window.prototype]}_patchHistoryApi(){this._isEnabled&&(this._wrap(history,`replaceState`,this._patchHistoryMethod()),this._wrap(history,`pushState`,this._patchHistoryMethod()),this._wrap(history,`back`,this._patchHistoryMethod()),this._wrap(history,`forward`,this._patchHistoryMethod()),this._wrap(history,`go`,this._patchHistoryMethod()))}_patchHistoryMethod(){let e=this;return t=>function(...n){if(!e._isEnabled)return t.apply(this,n);let r=`${location.pathname}${location.hash}${location.search}`,i=t.apply(this,n),a=`${location.pathname}${location.hash}${location.search}`;return r!==a&&e._updateInteractionName(a),i}}_updateInteractionName(e){let t=j.getSpan(k.active());t&&typeof t.updateName==`function`&&t.updateName(`${ch} ${e}`)}_patchZoneCancelTask(){let e=this;return t=>function(n){let r=Zone.current,i=e._getCurrentSpan(r);return i&&e._shouldCountTask(n,r)&&e._decrementTask(i),t.call(this,n)}}_patchZoneScheduleTask(){let e=this;return t=>function(n){let r=Zone.current,i=e._getCurrentSpan(r);return i&&e._shouldCountTask(n,r)&&(e._incrementTask(i),e._checkForTimeout(n,i)),t.call(this,n)}}_patchZoneRunTask(){let e=this;return t=>function(n,r,i){let a=Array.isArray(i)&&i[0]instanceof Event?i[0]:void 0,o=a==null?void 0:a.target,s,c=this;if(o){if(s=e._createSpan(o,n.eventName),s)return e._incrementTask(s),c.run(()=>{try{return k.with(j.setSpan(k.active(),s),()=>{let e=Zone.current;return n._zone=e,t.call(e,n,r,i)})}finally{e._decrementTask(s)}})}else s=e._getCurrentSpan(c);try{return t.call(c,n,r,i)}finally{s&&e._shouldCountTask(n,c)&&e._decrementTask(s)}}}_shouldCountTask(e,t){if(e._zone&&(t=e._zone),!t||!e.data||e.data.isPeriodic)return!1;let n=this._getCurrentSpan(t);return!n||!this._spansData.get(n)?!1:e.type===`macroTask`||e.type===`microTask`}_tryToEndSpan(e,t){e&&this._spansData.get(e)&&(e.end(t),this._spansData.delete(e))}enable(){if(this._isEnabled||(this._isEnabled=!0,typeof this._zonePatched==`boolean`))return;let e=this._getZoneWithPrototype();this._diag.debug(`applying patch to`,this.moduleName,this.version,`zone:`,!!e),e?(this._zonePatched=!0,this._wrap(e.prototype,`runTask`,this._patchZoneRunTask()),this._wrap(e.prototype,`scheduleTask`,this._patchZoneScheduleTask()),this._wrap(e.prototype,`cancelTask`,this._patchZoneCancelTask())):(this._zonePatched=!1,this._getPatchableEventTargets().forEach(e=>{this._wrap(e,`addEventListener`,this._patchAddEventListener()),this._wrap(e,`removeEventListener`,this._patchRemoveEventListener())})),this._patchHistoryApi()}disable(){this._isEnabled&&(this._isEnabled=!1)}_getZoneWithPrototype(){return window.Zone}}})),fh=n({AttributeNames:()=>th,UserInteractionInstrumentation:()=>uh}),ph=t((()=>{dh(),nh()}));Qu(),G(),H();var mh=[`http.url`,`url.full`],hh=[`http.status_code`,`http.response.status_code`],gh=[`http.method`,`http.request.method`],_h=e=>({test:e}),vh=(e,t,n)=>{var r;t.setAttributes(e.applyRedact(e.config.hooks.getPageAttributes()));let i;for(let n of mh){var a;let r=(a=t.attributes)==null?void 0:a[n];if(typeof r==`string`){let a=e.applyRedact({[n]:e.config.hooks.redactUrl(r)})[n];typeof a==`string`&&(i=a,t.setAttribute(n,a))}}let o=hh.map(e=>{var n;return(n=t.attributes)==null?void 0:n[e]}).find(e=>typeof e==`number`),s=gh.map(e=>{var n;return(n=t.attributes)==null?void 0:n[e]}).find(e=>typeof e==`string`),c=(r=i)==null?mh.map(e=>{var n;return(n=t.attributes)==null?void 0:n[e]}).find(e=>typeof e==`string`):r;t.setAttributes(e.applyRedact(np({method:s,statusCode:o,subtype:n,url:c,urlPathTemplate:c?e.config.hooks.getViewPathGroup(c):void 0})))},yh=(e,t,n)=>{t.setAttributes(e.applyRedact(W(W({},e.config.hooks.getPageAttributes()),$({errorType:`none`,eventLabel:`文档加载`,spanSubtype:n,spanType:Q.document,targetLabel:e.config.hooks.getViewPathGroup(typeof location>`u`?``:location.href),traceScene:`page_load`}))))},bh=(e,t,n)=>{let r=e.config.hooks.redactUrl(n.name);t.setAttributes(e.applyRedact(W(W(W({},e.config.hooks.getPageAttributes()),rp({duration:n.duration,initiatorType:n.initiatorType||`other`,responseStatus:n.responseStatus,transferSize:n.transferSize,url:r,urlPathTemplate:e.config.hooks.getViewPathGroup(n.name)})),{},{"url.full":r})))},xh=e=>{let t=[];return{name:`official-instrumentations`,enabled:!!(e.documentLoad||e.fetch||e.xhr||e.userInteraction),init(n){return V(function*(){let r=[_h(e=>Sp(n.config,e))],i=[_h(e=>Cp(n.config,e))],[a,o,s,c]=yield Promise.all([e.documentLoad?Promise.resolve().then(()=>(Vp(),Bp)):Promise.resolve(null),e.fetch?Promise.resolve().then(()=>(xm(),bm)):Promise.resolve(null),e.xhr?Promise.resolve().then(()=>(eh(),$m)):Promise.resolve(null),e.userInteraction?Promise.resolve().then(()=>(ph(),fh)):Promise.resolve(null)]);if(a&&t.push(new a.DocumentLoadInstrumentation({semconvStabilityOptIn:`http`,applyCustomAttributesOnSpan:{documentLoad:e=>yh(n,e,`navigate`),documentFetch:e=>yh(n,e,`document_fetch`),resourceFetch:(e,t)=>bh(n,e,t)}})),o&&t.push(new o.FetchInstrumentation({applyCustomAttributesOnSpan:e=>vh(n,e,`fetch`),ignoreUrls:r,propagateTraceHeaderCorsUrls:i,semconvStabilityOptIn:`http`,ignoreNetworkEvents:!1})),s&&t.push(new s.XMLHttpRequestInstrumentation({applyCustomAttributesOnSpan:e=>vh(n,e,`xhr`),ignoreUrls:r,propagateTraceHeaderCorsUrls:i,semconvStabilityOptIn:`http`,ignoreNetworkEvents:!1})),c){let n=e.userInteraction!==null&&typeof e.userInteraction==`object`?{eventNames:e.userInteraction.eventNames}:void 0;t.push(new c.UserInteractionInstrumentation(n))}Pu({instrumentations:t})})()},shutdown(){for(;t.length;){var e,n;(e=t.pop())==null||(n=e.disable)==null||n.call(e)}}}},Sh=e=>{let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(36)},Ch=(e,t)=>{let n=new Map,r=0,i=t=>{if(!(t-r<e)){r=t;for(let[r,i]of n)t-i.windowStart>e&&n.delete(r)}};return{allow(r){let a=Date.now();i(a);let o=n.get(r);return!o||a-o.windowStart>e?(n.set(r,{count:1,windowStart:a}),{allowed:!0,count:1}):(o.count+=1,{allowed:o.count<=t,count:o.count})}}};bn(),G();var wh=6e4,Th=5,Eh=/^https?:|^\/\//i,Dh=(e,t)=>{if(t)return Eh.test(t)?e(t):t},Oh=e=>{let t;return{name:`csp-violation`,enabled:e.enabled,init(e){if(typeof window>`u`||typeof document>`u`)return;let n=Ch(wh,Th),r=t=>{let r=Sh(`${t.violatedDirective}|${t.blockedURI}|${t.sourceFile}|${t.lineNumber}`),i=n.allow(r);if(!i.allowed)return;let a=Dh(e.config.hooks.redactUrl,t.blockedURI),o=t.sourceFile?e.config.hooks.redactUrl(t.sourceFile):void 0,s=i.count===1;e.emitLog({severityNumber:N.WARN,severityText:`WARN`,body:`csp.violation`,attributes:W(W(W({},e.config.hooks.getPageAttributes()),$({errorType:`csp`,eventLabel:`CSP 错误`,result:Z.error,spanSubtype:`csp`,spanType:Q.error,targetLabel:a==null?t.effectiveDirective:a,targetValue:t.statusCode})),{},{"csp.blocked_uri":a,"csp.violated_directive":t.violatedDirective,"csp.effective_directive":t.effectiveDirective,"csp.disposition":t.disposition,"csp.source_file":o,"csp.line_number":t.lineNumber,"csp.column_number":t.columnNumber,"csp.status_code":t.statusCode,"csp.fingerprint":r,"csp.window_count":i.count,[X.exceptionFingerprint]:r,"error.source":`csp`},s?{"csp.original_policy":t.originalPolicy}:{})})};document.addEventListener(`securitypolicyviolation`,r),t=()=>document.removeEventListener(`securitypolicyviolation`,r)},shutdown(){t==null||t(),t=void 0}}},kh=e=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${e}-${Date.now()}-${Math.random().toString(16).slice(2)}`;G();var Ah=`BK_RUM_DEVICE_ID`,jh=250,Mh=()=>navigator.connection,Nh=()=>navigator.userAgentData,Ph=e=>{for(let[t,n]of[[`Edge`,/Edg\/([\d.]+)/],[`Chrome`,/Chrome\/([\d.]+)/],[`Firefox`,/Firefox\/([\d.]+)/],[`Safari`,/Version\/([\d.]+).*Safari/]]){let r=e.match(n);if(r!=null&&r[1])return{name:t,version:r[1].split(`.`)[0]}}return{name:`Other`,version:void 0}},Fh=(e,t)=>{let n=`${t==null?``:t} ${e}`;return/iphone|ipad|ipod/i.test(n)?`iOS`:/android/i.test(n)?`Android`:/mac/i.test(n)?`macOS`:/win/i.test(n)?`Windows`:/linux/i.test(n)?`Linux`:`Other`},Ih=e=>{let t=null;try{t=window.localStorage.getItem(e)}catch(e){}if(t)return t;let n=kh(`device`);try{window.localStorage.setItem(e,n)}catch(e){}return n},Lh=()=>{var e,t;return typeof window>`u`?{}:{"browser.viewport.width":window.innerWidth,"browser.viewport.height":window.innerHeight,"browser.screen.width":(e=window.screen)==null?void 0:e.width,"browser.screen.height":(t=window.screen)==null?void 0:t.height}},Rh=()=>{let e=Mh();return e?{"network.effective_type":e.effectiveType,"network.connection_type":e.type,"network.downlink":e.downlink,"network.rtt":e.rtt,"network.save_data":e.saveData}:{}},zh=()=>{if(typeof navigator>`u`)return{};let e=Nh(),t=navigator.userAgent,n=Ph(t),r=Fh(t,e==null?void 0:e.platform),i=e!=null&&e.mobile||/mobi|android|iphone|ipad|ipod/i.test(t)?`mobile`:`desktop`;return{"device.memory":navigator.deviceMemory,"device.cpu_cores":navigator.hardwareConcurrency,"device.platform":e==null?void 0:e.platform,"device.mobile":e==null?void 0:e.mobile,[X.browserName]:n.name,[X.browserVersion]:n.version,[X.deviceType]:i,[X.osName]:r,"user_agent.name":n.name,"user_agent.version":n.version,"user_agent.os.name":r}},Bh=(e,t)=>{let n;return()=>{n!==void 0&&window.clearTimeout(n),n=window.setTimeout(()=>{n=void 0,e()},t)}},Vh=e=>{let t=[];return{name:`device`,enabled:e.enabled,init(n){var r;let i=e.enabled?(r=e.storageKey)==null?Ah:r:Ah,a=typeof window>`u`?kh(`device`):Ih(i);if(n.setRuntimeAttributes(W(W(W({"device.id":a},zh()),Lh()),Rh())),typeof window>`u`)return;let o=Bh(()=>{n.setRuntimeAttributes(Lh())},jh);window.addEventListener(`resize`,o),window.addEventListener(`orientationchange`,o),t.push(()=>window.removeEventListener(`resize`,o),()=>window.removeEventListener(`orientationchange`,o));let s=Mh();if(s&&typeof s.addEventListener==`function`){let e=()=>{n.setRuntimeAttributes(Rh())};s.addEventListener(`change`,e),t.push(()=>{var t;(t=s.removeEventListener)==null||t.call(s,`change`,e)})}},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}};M(),bn(),G();var Hh=6e4,Uh=5,Wh=e=>{if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch(t){return String(e)}},Gh=e=>{var t;return e instanceof Error?(t=e.stack)==null?``:t:``},Kh=e=>e.slice(0,80),qh=e=>{var t,n;return(t=(n=e.split(`
|
|
12
|
-
`).find(e=>e.trim().startsWith(`at `)))==null?void 0:n.trim())==null?``:t},Jh=e=>e===`unhandledrejection`?`promise`:e===`resource`?`resource_load`:`js`,Yh=({context:e,error:t,exceptionType:n,extra:r={},source:i,spanName:a,throttle:o})=>{let s=Wh(t),c=Gh(t),l=Sh(`${i}|${s}|${c.slice(0,256)}`),u=o.allow(l);if(!u.allowed)return;let d=j.getActiveSpan(),f=t instanceof Error?t:{message:s,name:n==null?i:n},p=W(W(W(W({},e.config.hooks.getPageAttributes()),e.config.hooks.getErrorAttributes()),$({errorType:Jh(i),eventLabel:`错误`,result:Z.error,spanSubtype:Jh(i),spanType:Q.error,targetLabel:t instanceof Error?t.name:n==null?i:n})),{},{"exception.message":s,[X.exceptionMessageShort]:Kh(s),"exception.stacktrace":c,[X.exceptionStackTopFrame]:qh(c),"exception.type":t instanceof Error?t.name:n==null?i:n,[X.exceptionFingerprint]:l,"error.handled":!1,"error.source":i,"error.window_count":u.count},r),m=()=>e.emitLog({severityNumber:N.ERROR,severityText:`ERROR`,body:s,attributes:p});if(d){d.setAttributes(e.applyRedact(p)),d.recordException(f),d.setStatus({code:Tt.ERROR,message:s}),m();return}let h=e.startSpan(a,p);h.recordException(f),h.setStatus({code:Tt.ERROR,message:s}),k.with(j.setSpan(k.active(),h),m),h.end()},Xh=e=>{let t=[];return{name:`error`,enabled:e.enabled,init(n){if(typeof window>`u`)return;let r=Ch(e.enabled?e.windowMs:Hh,e.enabled?e.maxPerWindow:Uh),i=e=>{var t;let i=!e.error&&!e.filename&&e.message===`Script error.`;Yh({context:n,throttle:r,spanName:`browser.error`,source:`window.error`,error:(t=e.error)==null?e.message:t,extra:W({"code.filepath":e.filename,"code.lineno":e.lineno,"code.column":e.colno},i?{"error.cross_origin":!0}:{})})},a=e=>{Yh({context:n,throttle:r,spanName:`browser.unhandledrejection`,source:`unhandledrejection`,error:e.reason,exceptionType:e.reason instanceof Error?e.reason.name:`UnhandledRejection`})},o=e=>{if(e instanceof ErrorEvent)return;let t=e.target;if(!(t instanceof Element))return;let i=t,a=i.src||i.href||t.currentSrc||``;Yh({context:n,throttle:r,spanName:`browser.resource_error`,source:`resource`,error:Error(`Resource load failed: ${t.tagName.toLowerCase()} ${a}`),exceptionType:`ResourceError`,extra:{"url.full":n.config.hooks.redactUrl(a),"html.tag":t.tagName}})};window.addEventListener(`error`,i),window.addEventListener(`unhandledrejection`,a),window.addEventListener(`error`,o,!0),t.push(()=>window.removeEventListener(`error`,i),()=>window.removeEventListener(`unhandledrejection`,a),()=>window.removeEventListener(`error`,o,!0))},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}};bn(),H(),G();var Zh=10*1024,Qh=10,$h=new WeakMap,eg=(e,t)=>e.length<=t?{body:e,truncated:!1}:{body:e.slice(0,t),truncated:!0},tg=(e,t)=>{if(!e)return;if(e instanceof Headers)return e.get(t)||void 0;let n=t.toLowerCase();if(Array.isArray(e)){var r;return(r=e.find(([e])=>e.toLowerCase()===n))==null?void 0:r[1]}let i=Object.keys(e).find(e=>e.toLowerCase()===n);return i?e[i]:void 0},ng=e=>{let t={};return e.forEach((e,n)=>{t[n]=e instanceof File?`[File name=${e.name} type=${e.type||`unknown`} size=${e.size}]`:e}),JSON.stringify(t)},rg=function(){var e=V(function*(e){return e==null?``:typeof e==`string`?e:e instanceof URLSearchParams?e.toString():e instanceof FormData?ng(e):e instanceof Blob?e.text():e instanceof ArrayBuffer||ArrayBuffer.isView(e)?new TextDecoder().decode(e):e instanceof Document?new XMLSerializer().serializeToString(e):String(e)});return function(t){return e.apply(this,arguments)}}(),ig=function(){var e=V(function*(e,t,n){let r=yield rg(e);if(r)return W(W({},eg(r,t)),{},{contentType:n})});return function(t,n,r){return e.apply(this,arguments)}}(),ag=function(){var e=V(function*(e,t,n){try{return yield ig(e,t,n)}catch(e){return}});return function(t,n,r){return e.apply(this,arguments)}}(),og=e=>e instanceof Request?e.url:String(e),sg=(e,t)=>t!=null&&t.method?t.method:e instanceof Request?e.method:`GET`,cg=(e,t,n)=>t!=null&&t.body?()=>ag(t.body,n,tg(t.headers,`content-type`)):(e instanceof Request,()=>Promise.resolve(void 0)),lg=function(){var e=V(function*(e,t){try{let n=e.headers.get(`content-type`)||void 0,r=e.headers.get(`content-length`);if(r){let e=Number(r);if(Number.isFinite(e)&&e>t*Qh)return{body:``,contentType:n,truncated:!0}}let i=e.clone();return ag(i.body?yield i.text():``,t,n)}catch(e){return}});return function(t,n){return e.apply(this,arguments)}}(),ug=(e,t)=>{if(e.responseType===``||e.responseType===`text`)return W(W({},eg(e.responseText||``,t)),{},{contentType:e.getResponseHeader(`content-type`)||void 0});if(e.responseType===`json`)return W(W({},eg(JSON.stringify(e.response),t)),{},{contentType:e.getResponseHeader(`content-type`)||void 0})},dg=(e,t,n)=>{if(n)return e.redact(W(W({},t),{},{body:n.body,truncated:n.truncated}))},fg=({context:e,duration:t,error:n,method:r,request:i,response:a,status:o,subtype:s,url:c})=>{let l=e.config.rum.plugins.httpBody;if(!l.enabled)return;let u=!!n||typeof o==`number`&&o>=400,d=r.toUpperCase(),f=u?dg(l,{contentType:i==null?void 0:i.contentType,method:d,status:o,type:`request`,url:c},i):void 0,p=u?dg(l,{contentType:a==null?void 0:a.contentType,method:d,status:o,type:`response`,url:c},a):void 0,m=W(W(W({},e.config.hooks.getPageAttributes()),np({duration:t,method:d,statusCode:o,subtype:s,url:e.config.hooks.redactUrl(c),urlPathTemplate:e.config.hooks.getViewPathGroup(c)})),{},{"http.duration":t,"http.request.method":d,"url.full":e.config.hooks.redactUrl(c)});if(typeof o==`number`&&(m[`http.response.status_code`]=o),f!=null&&(m[`http.request.body`]=f),p!=null&&(m[`http.response.body`]=p),u){var h,g;m[`http_body.request.truncated`]=(h=i==null?void 0:i.truncated)==null?!1:h,m[`http_body.response.truncated`]=(g=a==null?void 0:a.truncated)==null?!1:g}if(n instanceof Error){var _;m[`exception.message`]=n.message,m[`exception.type`]=n.name,m[`exception.stacktrace`]=(_=n.stack)==null?``:_}e.emitLog({severityNumber:u?N.ERROR:N.INFO,severityText:u?`ERROR`:`INFO`,body:u?`HTTP request completed with error`:`HTTP request completed`,attributes:m})},pg=e=>{let t=[];return{name:`http-body`,enabled:e.enabled,init(n){if(!e||typeof window>`u`)return;let r=e.enabled?e.maxBodySize:Zh,i=window.fetch;if(typeof i==`function`){let e=function(){var e=V(function*(e,t){let a=og(e);if(Sp(n.config,a))return i(e,t);let o=sg(e,t),s=cg(e,t,r),c=performance.now();try{let l=yield i(e,t),u=performance.now()-c,d=l.status>=400;return fg({context:n,duration:u,method:o,request:d?yield s():void 0,response:d?yield lg(l,r):void 0,status:l.status,subtype:`fetch`,url:a}),l}catch(e){let t=yield s();throw fg({context:n,duration:performance.now()-c,error:e,method:o,request:t,subtype:`fetch`,url:a}),e}});return function(t,n){return e.apply(this,arguments)}}();window.fetch=e,t.push(()=>{window.fetch===e&&(window.fetch=i)})}let a=XMLHttpRequest.prototype.open,o=XMLHttpRequest.prototype.send,s=XMLHttpRequest.prototype.setRequestHeader,c=function(e,t,...n){var r;return $h.set(this,{method:e,startTime:performance.now(),url:String(t)}),a.call(this,e,t,(r=n[0])==null?!0:r,n[1],n[2])},l=function(e,t){let n=$h.get(this);if(n){var r;let i=e.toLowerCase(),a=(r=n.requestHeaders)==null?{}:r,o=a[i];a[i]=o?`${o}, ${t}`:t,n.requestHeaders=a}return s.call(this,e,t)},u=function(e){var t=this;let i=$h.get(this);if(i){var a;i.requestBody=e,i.requestContentType=(a=i.requestHeaders)==null?void 0:a[`content-type`]}return this.addEventListener(`abort`,()=>{let e=$h.get(this);e&&(e.aborted=!0)},{once:!0}),this.addEventListener(`error`,()=>{let e=$h.get(this);e&&(e.networkError=!0)},{once:!0}),this.addEventListener(`loadend`,()=>{V(function*(){let e=$h.get(t);if(!e||Sp(n.config,e.url)||e.aborted)return;let i=e.networkError||t.status>=400,a=i?ug(t,r):void 0,o=i?yield ag(e.requestBody,r,e.requestContentType):void 0;fg({context:n,duration:performance.now()-e.startTime,error:e.networkError?Error(`XHR network error`):void 0,method:e.method,request:o,response:a,status:t.status,subtype:`xhr`,url:e.url})})()},{once:!0}),o.call(this,e)};XMLHttpRequest.prototype.open=c,XMLHttpRequest.prototype.setRequestHeader=l,XMLHttpRequest.prototype.send=u,t.push(()=>{XMLHttpRequest.prototype.open===c&&(XMLHttpRequest.prototype.open=a),XMLHttpRequest.prototype.setRequestHeader===l&&(XMLHttpRequest.prototype.setRequestHeader=s),XMLHttpRequest.prototype.send===u&&(XMLHttpRequest.prototype.send=o)})},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}};G();var mg=50,hg=e=>{let t;return{name:`long-task`,enabled:e.enabled,init(n){var r;if(typeof PerformanceObserver>`u`||!((r=PerformanceObserver.supportedEntryTypes)!=null&&r.includes(`longtask`)))return;let i=e.enabled?e.threshold:mg,a=n.meter.createCounter(`browser.long_task.count`,{description:`Number of long tasks observed (duration >= threshold)`}),o=n.meter.createHistogram(`browser.long_task.duration`,{unit:`ms`,description:`Duration of long tasks`});try{t=new PerformanceObserver(e=>{let t=n.applyRedact(W(W({},n.config.hooks.getPageAttributes()),n.config.hooks.getMetricAttributes()));for(let h of e.getEntries()){var r,s,c,l,u,d,f,p,m;if(h.duration<i)continue;let e=(r=h.attribution)==null?void 0:r[0],g=W(W({},t),{},{[X.longtaskAttributionScript]:(s=(c=e==null?void 0:e.containerSrc)==null?e==null?void 0:e.name:c)==null?`unknown`:s}),_=h.duration>100?Z.warning:Z.success;n.startSpan(`browser.long_task`,W(W(W({},t),$({duration:h.duration,errorType:_===Z.warning?`longtask_blocking`:`none`,eventLabel:`长任务`,result:_,spanSubtype:(l=e==null?void 0:e.name)==null?`unknown`:l,spanType:Q.longtask,targetLabel:(u=(d=(f=e==null?void 0:e.containerSrc)==null?e==null?void 0:e.containerName:f)==null?e==null?void 0:e.name:d)==null?`unknown`:u,targetValue:h.duration})),{},{[X.longtaskBlockingDuration]:h.duration,[X.longtaskAttributionScript]:(p=(m=e==null?void 0:e.containerSrc)==null?e==null?void 0:e.name:m)==null?`unknown`:p}),{startTime:performance.timeOrigin+h.startTime}).end(performance.timeOrigin+h.startTime+h.duration),a.add(1,g),o.record(h.duration,g)}}),t.observe({type:`longtask`,buffered:!0})}catch(e){t=void 0}},shutdown(){t==null||t.disconnect(),t=void 0}}},gg=new Set,_g=``,vg,yg,bg=!1,xg=()=>typeof location>`u`?``:location.href,Sg=(e,t)=>{let n=xg();_g=n;let r={fromUrl:t,source:e,toUrl:n};for(let e of Array.from(gg))e(r)},Cg=()=>{Sg(`popstate`,_g||xg())},wg=()=>{Sg(`hashchange`,_g||xg())},Tg=()=>{bg||typeof window>`u`||typeof history>`u`||(bg=!0,_g=xg(),vg=history.pushState,yg=history.replaceState,history.pushState=function(e,t,n){let r=_g||xg(),i=vg==null?void 0:vg.apply(this,[e,t,n]);return Sg(`pushState`,r),i},history.replaceState=function(e,t,n){let r=_g||xg(),i=yg==null?void 0:yg.apply(this,[e,t,n]);return Sg(`replaceState`,r),i},window.addEventListener(`popstate`,Cg),window.addEventListener(`hashchange`,wg))},Eg=()=>{!bg||typeof window>`u`||typeof history>`u`||(vg&&(history.pushState=vg),yg&&(history.replaceState=yg),window.removeEventListener(`popstate`,Cg),window.removeEventListener(`hashchange`,wg),vg=void 0,yg=void 0,bg=!1,_g=``)},Dg=e=>typeof window>`u`||typeof history>`u`?()=>{}:(Tg(),gg.add(e),()=>{gg.delete(e),gg.size===0&&Eg()});G();var Og=()=>typeof location>`u`?``:location.href,kg=e=>{let t=[];return{name:`page-view`,enabled:e.enabled,init(e){if(typeof window>`u`)return;let n=``,r,i=(t,i=n)=>{let a=Og();if(a===n)return;r==null||r.setAttribute(`view.end_reason`,t),r==null||r.end(),n=a;let o=kh(`view`),s=e.config.hooks.getViewPathGroup(a),c=t===`load`?`initial_load`:`route_change`,l=e.config.hooks.redactUrl(a),u=e.config.hooks.redactUrl(i);e.setView({id:o,loadingType:c,url:l,urlPathGroup:s});let d=t===`load`,f=W(W(W({},e.config.hooks.getPageAttributes()),$({errorType:`none`,eventLabel:d?`文档加载`:`路由切换`,spanSubtype:d?`navigate`:t,spanType:d?Q.document:Q.route,targetLabel:s,traceScene:d?`page_load`:`route_change`})),{},{[X.viewId]:o,[X.viewUrl]:l,[X.viewUrlPathGroup]:s,[X.viewLoadingType]:c,"url.previous":u,"event.source":t},d?{"document.referrer":e.config.hooks.redactUrl(document.referrer||``)}:{});r=e.startSpan(`browser.view`,f),e.startSpan(`browser.page_view`,W({},f)).end()},a=Dg(e=>{i(e.source,e.fromUrl)});i(`load`);let o=()=>{r==null||r.setAttribute(`view.end_reason`,`shutdown`),r==null||r.end(),r=void 0};window.addEventListener(`pagehide`,o),t.push(a,()=>window.removeEventListener(`pagehide`,o),o)},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}};G();var Ag=e=>e.transferSize===0&&e.decodedBodySize>0?!0:void 0,jg=e=>{let t,n=new Set;return{name:`resource`,enabled:e.enabled,init(e){var r;if(typeof PerformanceObserver>`u`||!((r=PerformanceObserver.supportedEntryTypes)!=null&&r.includes(`resource`)))return;let i=t=>{if(!t.name||Sp(e.config,t.name))return;let r=`${t.name}|${t.startTime}`;if(n.has(r))return;n.add(r);let i=e.config.hooks.redactUrl(t.name),a=t.duration;e.startSpan(`browser.resource`,W(W(W({},e.config.hooks.getPageAttributes()),rp({duration:a,initiatorType:t.initiatorType||`other`,responseStatus:t.responseStatus,transferSize:t.transferSize,url:i,urlPathTemplate:e.config.hooks.getViewPathGroup(t.name)})),{},{"url.full":i,[X.transferSize]:t.transferSize,[X.cacheHit]:Ag(t),[X.nextHopProtocol]:t.nextHopProtocol,initiator_type:t.initiatorType||`other`,"resource.encoded_body_size":t.encodedBodySize,"resource.decoded_body_size":t.decodedBodySize}),{startTime:performance.timeOrigin+t.startTime}).end(performance.timeOrigin+t.startTime+a)};try{t=new PerformanceObserver(e=>{for(let t of e.getEntries())i(t)}),t.observe({type:`resource`,buffered:!0})}catch(e){t=void 0}},shutdown(){t==null||t.disconnect(),t=void 0,n.clear()}}};G();var Mg=e=>{let t=[],n=!1;return{name:`route-timing`,enabled:e.enabled,init(e){if(typeof window>`u`||typeof history>`u`)return;let r=e.meter.createHistogram(`browser.route_change.duration`,{unit:`ms`,description:`Estimated SPA route change duration (route start to next idle)`}),i=(t,i,a)=>{if(n)return;let o=performance.now(),s=performance.timeOrigin+o,c=()=>{if(n||typeof document<`u`&&document.visibilityState===`hidden`)return;let c=performance.now()-o,l=c>500?Z.warning:Z.success,u=e.applyRedact(W(W(W({},e.config.hooks.getPageAttributes()),e.config.hooks.getMetricAttributes()),{},{"route.change.source":t}));r.record(c,u),e.startSpan(`browser.route_change`,W(W(W({},u),$({duration:c,errorType:l===Z.warning?`slow`:`none`,eventLabel:`路由切换`,result:l,spanSubtype:t,spanType:Q.route,targetLabel:e.config.hooks.getViewPathGroup(a),targetValue:c,traceScene:`route_change`})),{},{"url.full":e.config.hooks.redactUrl(a),"url.previous":e.config.hooks.redactUrl(i)}),{startTime:s}).end()};requestAnimationFrame(()=>requestAnimationFrame(()=>setTimeout(c,0)))},a=Dg(e=>{e.fromUrl!==e.toUrl&&i(e.source,e.fromUrl,e.toUrl)});t.push(a)},shutdown(){for(n=!0;t.length;){var e;(e=t.pop())==null||e()}}}};bn(),G();var Ng=1800*1e3,Pg=1440*60*1e3,Fg=6e4,Ig=5e3,Lg=[`click`,`keydown`,`scroll`,`mousemove`,`touchstart`],Rg=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>0&&e<=t+Ig,zg=(e,t)=>{if(!e)return null;try{let n=JSON.parse(e);if(typeof(n==null?void 0:n.id)==`string`&&Rg(n.ts,t)&&Rg(n.startedAt,t))return n}catch(e){}return null},Bg=(e,t)=>{if(typeof window>`u`)return null;let n=null;try{n=window.localStorage.getItem(e)}catch(e){}let r=zg(n,t);if(r)return r;try{n=window.sessionStorage.getItem(e)}catch(e){}return r=zg(n,t),r},Vg=(e,t)=>{if(typeof window>`u`)return;let n=JSON.stringify(t);try{window.sessionStorage.setItem(e,n)}catch(e){}try{window.localStorage.setItem(e,n)}catch(e){}},Hg=(e,t,n)=>{let r=Date.now(),i=Bg(e,r);if(i){let a=r-i.ts>=t,o=r-i.startedAt>=n;if(!a&&!o){let t=W(W({},i),{},{ts:r});return Vg(e,t),{id:t.id,rotated:!1}}let s=a?`inactivity`:`maxLifetime`,c={id:kh(`session`),startedAt:r,ts:r};return Vg(e,c),{id:c.id,prevId:i.id,reason:s,rotated:!0}}let a={id:kh(`session`),startedAt:r,ts:r};return Vg(e,a),{id:a.id,reason:`init`,rotated:!0}},Ug=e=>{let t=``;try{t=new URL(e).host}catch(n){t=e}return`bk_ot_session__${Sh(t||`default`)}`},Wg=(e,t)=>{if(!t.rotated||!t.reason)return;let n=Date.now();e.emitLog({severityNumber:N.INFO,severityText:`INFO`,body:t.reason===`init`?`session.start`:`session.rotate`,attributes:W(W({},e.config.hooks.getPageAttributes()),{},{[X.sessionHasReplay]:!1,[X.sessionId]:t.id,[X.sessionStartTime]:n,"session.rotate.reason":t.reason},t.prevId?{"session.previous_id":t.prevId}:{})})},Gg=e=>{let t=[];return{name:`session`,enabled:e.enabled,init(n){var r;let i=e.enabled?(r=e.storageKey)==null?Ug(n.config.transport.endpoint):r:Ug(n.config.transport.endpoint),a=e.enabled?e.inactivityMs:Ng,o=e.enabled?e.maxLifetimeMs:Pg,s=``,c=()=>{if(typeof window>`u`){s||(s=kh(`session`),n.setRuntimeAttributes({[X.sessionHasReplay]:!1,[X.sessionId]:s}));return}let e=Hg(i,a,o);n.setRuntimeAttributes({[X.sessionHasReplay]:!1,[X.sessionId]:e.id}),e.id!==s&&(s=e.id,Wg(n,e))};if(c(),typeof window>`u`||typeof document>`u`)return;let l=Date.now(),u=()=>{let e=Date.now();e-l<Fg||(l=e,c())},d={capture:!0,passive:!0};Lg.forEach(e=>{window.addEventListener(e,u,d)}),t.push(()=>{Lg.forEach(e=>{window.removeEventListener(e,u,d)})});let f=()=>{document.visibilityState===`visible`&&c()};document.addEventListener(`visibilitychange`,f),t.push(()=>document.removeEventListener(`visibilitychange`,f));let p=e=>{if(e.storageArea!==window.localStorage||e.key!==i||!e.newValue)return;let t=Date.now(),r=zg(e.newValue,t);if(!(!r||r.id===s)){s=r.id;try{window.sessionStorage.setItem(i,e.newValue)}catch(e){}n.setRuntimeAttributes({[X.sessionId]:r.id})}};window.addEventListener(`storage`,p),t.push(()=>window.removeEventListener(`storage`,p))},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}},Kg=n({CLSThresholds:()=>__,FCPThresholds:()=>h_,INPThresholds:()=>j_,LCPThresholds:()=>P_,TTFBThresholds:()=>I_,onCLS:()=>y_,onFCP:()=>b_,onINP:()=>M_,onLCP:()=>F_,onTTFB:()=>R_});function qg(e,t){return $g.get(e)||$g.set(e,new t),$g.get(e)}var Jg,Yg,Xg,Zg,Qg,$g,e_,t_,n_,r_,i_,a_,o_,s_,c_,l_,u_,d_,f_,p_,m_,h_,g_,__,v_,y_,b_,x_,S_,C_,w_,T_,E_,D_,O_,k_,A_,j_,M_,N_,P_,F_,I_,L_,R_,z_=t((()=>{F(),G(),Jg=class{constructor(){P(this,`t`,void 0),P(this,`o`,0),P(this,`i`,[])}u(e){var t;if(e.hadRecentInput)return;let n=this.i[0],r=this.i.at(-1);this.o&&n&&r&&e.startTime-r.startTime<1e3&&e.startTime-n.startTime<5e3?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),(t=this.t)==null||t.call(this,e)}},Yg=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Xg=e=>{if(document.readyState===`loading`)return`loading`;let t=Yg();if(t){if(e<t.domInteractive)return`loading`;if(t.domContentLoadedEventStart===0||e<t.domContentLoadedEventStart)return`dom-interactive`;if(t.domComplete===0||e<t.domComplete)return`dom-content-loaded`}return`complete`},Zg=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},Qg=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){let n=e,r=n.id?`#`+n.id:[Zg(n),...Array.from(n.classList).sort()].join(`.`);if(t.length+r.length>99)return t||r;if(t=t?r+`>`+t:r,n.id)break;e=n.parentNode}}catch(e){}return t},$g=new WeakMap,e_=-1,t_=()=>e_,n_=e=>{addEventListener(`pageshow`,t=>{t.persisted&&(e_=t.timeStamp,e(t))},!0)},r_=(e,t,n,r)=>{let i,a;return o=>{var s;t.value>=0&&(o||r)&&(a=t.value-((s=i)==null?0:s),(a||i===void 0)&&(i=t.value,t.delta=a,t.rating=((e,t)=>e>t[1]?`poor`:e>t[0]?`needs-improvement`:`good`)(t.value,n),e(t)))}},i_=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},a_=()=>{var e,t;return(e=(t=Yg())==null?void 0:t.activationStart)==null?0:e},o_=(e,t=-1)=>{let n=Yg(),r=`navigate`;return t_()>=0?r=`back-forward-cache`:n&&(document.prerendering||a_()>0?r=`prerender`:document.wasDiscarded?r=`restore`:n.type&&(r=n.type.replace(/_/g,`-`))),{name:e,value:t,rating:`good`,delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+0xe8d4a51000}`,navigationType:r}},s_=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let r=new PerformanceObserver(e=>{queueMicrotask(()=>{t(e.getEntries())})});return r.observe(W({type:e,buffered:!0},n)),r}}catch(e){}},c_=e=>{let t=!1;return()=>{t||(e(),t=!0)}},l_=-1,u_=new Set,d_=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,f_=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of u_)e();isFinite(l_)||(l_=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,f_,!0))}},p_=()=>{if(l_<0){var e;let t=a_(),n=document.prerendering||(e=globalThis.performance.getEntriesByType(`visibility-state`).find(e=>e.name===`hidden`&&e.startTime>=t))==null?void 0:e.startTime;l_=n==null?d_():n,addEventListener(`visibilitychange`,f_,!0),addEventListener(`prerenderingchange`,f_,!0),n_(()=>{setTimeout(()=>{l_=d_()})})}return{get firstHiddenTime(){return l_},onHidden(e){u_.add(e)}}},m_=e=>{document.prerendering?addEventListener(`prerenderingchange`,e,!0):e()},h_=[1800,3e3],g_=(e,t={})=>{m_(()=>{let n=p_(),r,i=o_(`FCP`),a=s_(`paint`,e=>{for(let t of e)t.name===`first-contentful-paint`&&(a.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-a_(),0),i.entries.push(t),r(!0)))});a&&(r=r_(e,i,h_,t.reportAllChanges),n_(n=>{i=o_(`FCP`),r=r_(e,i,h_,t.reportAllChanges),i_(()=>{i.value=performance.now()-n.timeStamp,r(!0)})}))})},__=[.1,.25],v_=e=>e.find(e=>{var t;return((t=e.node)==null?void 0:t.nodeType)===1})||e[0],y_=(e,t={})=>{let n=qg(t=Object.assign({},t),Jg),r=new WeakMap;n.t=e=>{var n;if(!(e==null||(n=e.sources)==null)&&n.length){let n=v_(e.sources),o=n==null?void 0:n.node;if(o){var i,a;let e=(i=(a=t.generateTarget)==null?void 0:a.call(t,o))==null?Qg(o):i;r.set(n,e)}}},((e,t={})=>{let n=p_();g_(c_(()=>{let r,i=o_(`CLS`,0),a=qg(t,Jg),o=e=>{for(let t of e)a.u(t);a.o>i.value&&(i.value=a.o,i.entries=a.i,r())},s=s_(`layout-shift`,o);s&&(r=r_(e,i,__,t.reportAllChanges),n.onHidden(()=>{o(s.takeRecords()),r(!0)}),n_(()=>{a.o=0,i=o_(`CLS`,0),r=r_(e,i,__,t.reportAllChanges),i_(r)}),setTimeout(r))}))})(t=>{e((e=>{let t={};if(e.entries.length){var n;let i=e.entries.reduce((e,t)=>e.value>t.value?e:t);if(!(i==null||(n=i.sources)==null)&&n.length){let e=v_(i.sources);e&&(t={largestShiftTarget:r.get(e),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:e,largestShiftEntry:i,loadState:Xg(i.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},b_=(e,t={})=>{g_(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:Xg(t_())};if(e.entries.length){let n=Yg(),r=e.entries.at(-1);if(n){let i=n.activationStart||0,a=Math.max(0,n.responseStart-i);t={timeToFirstByte:a,firstByteToFCP:e.value-a,loadState:Xg(e.entries[0].startTime),navigationEntry:n,fcpEntry:r}}}return Object.assign(e,{attribution:t})})(t))},t)},x_=0,S_=1/0,C_=0,w_=e=>{for(let t of e)t.interactionId&&(S_=Math.min(S_,t.interactionId),C_=Math.max(C_,t.interactionId),x_=C_?(C_-S_)/7+1:0)},E_=()=>{var e;return T_?x_:(e=performance.interactionCount)==null?0:e},D_=()=>{`interactionCount`in performance||T_||(T_=s_(`event`,w_,{durationThreshold:0}))},O_=0,k_=class{constructor(){P(this,`l`,[]),P(this,`h`,new Map),P(this,`m`,void 0),P(this,`p`,void 0)}v(){O_=E_(),this.l.length=0,this.h.clear()}M(){let e=Math.min(this.l.length-1,Math.floor((E_()-O_)/50));return this.l[e]}u(e){var t;if((t=this.m)==null||t.call(this,e),!e.interactionId&&e.entryType!==`first-input`)return;let n=this.l.at(-1),r=this.h.get(e.interactionId);if(r||this.l.length<10||e.duration>n.T){var i;if(r?e.duration>r.T?(r.entries=[e],r.T=e.duration):e.duration===r.T&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],T:e.duration},this.h.set(r.id,r),this.l.push(r)),this.l.sort((e,t)=>t.T-e.T),this.l.length>10){let e=this.l.splice(10);for(let t of e)this.h.delete(t.id)}(i=this.p)==null||i.call(this,r)}}},A_=e=>{let t=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState===`hidden`)e();else{let r=c_(e),i=-1,a=()=>{n(i),r()};addEventListener(`visibilitychange`,a,{once:!0,capture:!0}),i=t(()=>{removeEventListener(`visibilitychange`,a,{capture:!0}),r()})}},j_=[200,500],M_=(e,t={})=>{let n=qg(t=Object.assign({},t),k_),r=[],i=[],a=0,o=new WeakMap,s=new WeakMap,c=!1,l=()=>{c||(A_(u),c=!0)},u=()=>{let e=new Set(n.l.map(e=>o.get(e.entries[0]))),t=i.length-10;i=i.filter((n,r)=>r>=t||e.has(n));let s=new Set;for(let e of i){let t=d(e.startTime,e.processingEnd);for(let e of t)s.add(e)}r=r.filter(e=>e.startTime>a||s.has(e)),c=!1};n.m=e=>{let n=e.startTime+e.duration,r;a=Math.max(a,e.processingEnd);for(let a=i.length-1;a>=0;a--){let o=i[a];if(Math.abs(n-o.renderTime)<=8){r=o,r.startTime=Math.min(e.startTime,r.startTime),r.processingStart=Math.min(e.processingStart,r.processingStart),r.processingEnd=Math.max(e.processingEnd,r.processingEnd),!1!==t.includeProcessedEventEntries&&r.entries.push(e);break}}r||(r={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:n,entries:!1===t.includeProcessedEventEntries?[]:[e]},i.push(r)),(e.interactionId||e.entryType===`first-input`)&&o.set(e,r),l()},n.p=e=>{if(!s.get(e)){let i=e.entries[0].target;if(i){var n,r;let a=(n=(r=t.generateTarget)==null?void 0:r.call(t,i))==null?Qg(i):n;s.set(e,a)}}};let d=(e,t)=>{let n=[];for(let i of r)if(!(i.startTime+i.duration<e)){if(i.startTime>t)break;n.push(i)}return n},f=e=>{let t=e.entries[0],r=o.get(t),i=t.processingStart,a=Math.max(t.startTime+t.duration,i),c=Math.min(r.processingEnd,a),l=r.entries.sort((e,t)=>e.processingStart-t.processingStart),u=d(t.startTime,c),f=n.h.get(t.interactionId),p={interactionTarget:s.get(f),interactionType:t.name.startsWith(`key`)?`keyboard`:`pointer`,interactionTime:t.startTime,nextPaintTime:a,processedEventEntries:l,longAnimationFrameEntries:u,inputDelay:i-t.startTime,processingDuration:c-i,presentationDelay:a-c,loadState:Xg(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(e=>{var t;if(!((t=e.longAnimationFrameEntries)!=null&&t.length))return;let n=e.interactionTime,r=e.inputDelay,i=e.processingDuration,a,o,s=0,c=0,l=0,u=0;for(let t of e.longAnimationFrameEntries){c=c+t.startTime+t.duration-t.styleAndLayoutStart;for(let e of t.scripts){let t=e.startTime+e.duration;if(t<n)continue;let l=t-Math.max(n,e.startTime),d=e.duration?l/e.duration*e.forcedStyleAndLayoutDuration:0;s+=l-d,c+=d,l>u&&(o=e.startTime<n+r?`input-delay`:e.startTime>=n+r+i?`presentation-delay`:`processing-duration`,a=e,u=l)}}let d=e.longAnimationFrameEntries.at(-1),f=d?d.startTime+d.duration:0;f>=n+r+i&&(l=e.nextPaintTime-f),a&&o&&(e.longestScript={entry:a,subpart:o,intersectingDuration:u}),e.totalScriptDuration=s,e.totalStyleAndLayoutDuration=c,e.totalPaintDuration=l,e.totalUnattributedDuration=e.nextPaintTime-n-s-c-l})(p),Object.assign(e,{attribution:p})};s_(`long-animation-frame`,e=>{r=r.concat(e),l()}),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=p_();m_(()=>{var r;D_();let i,a=o_(`INP`),o=qg(t,k_),s=e=>{A_(()=>{for(let t of e)o.u(t);let t=o.M();t&&t.T!==a.value&&(a.value=t.T,a.entries=t.entries,i())})},c=s_(`event`,s,{durationThreshold:(r=t.durationThreshold)==null?40:r});i=r_(e,a,j_,t.reportAllChanges),c&&(c.observe({type:`first-input`,buffered:!0}),n.onHidden(()=>{s(c.takeRecords()),i(!0)}),n_(()=>{o.v(),a=o_(`INP`),i=r_(e,a,j_,t.reportAllChanges)}))})})(t=>{e(f(t))},t)},N_=class{constructor(){P(this,`m`,void 0)}u(e){var t;(t=this.m)==null||t.call(this,e)}},P_=[2500,4e3],F_=(e,t={})=>{let n=qg(t=Object.assign({},t),N_),r=new WeakMap;n.m=e=>{let n=e.element;if(n){var i,a;let o=(i=(a=t.generateTarget)==null?void 0:a.call(t,n))==null?Qg(n):i;r.set(e,o)}else e.id&&r.set(e,`#${e.id}`)},((e,t={})=>{m_(()=>{let n=p_(),r,i=o_(`LCP`),a=qg(t,N_),o=e=>{t.reportAllChanges||(e=e.slice(-1));for(let t of e)a.u(t),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-a_(),0),i.entries=[t],r())},s=s_(`largest-contentful-paint`,o);if(s){r=r_(e,i,P_,t.reportAllChanges);let n=c_(()=>{o(s.takeRecords()),s.disconnect(),r(!0)}),a=e=>{e.isTrusted&&(A_(n),removeEventListener(e.type,a,{capture:!0}))};for(let e of[`keydown`,`click`,`visibilitychange`])addEventListener(e,a,{capture:!0});n_(n=>{i=o_(`LCP`),r=r_(e,i,P_,t.reportAllChanges),i_(()=>{i.value=performance.now()-n.timeStamp,r(!0)})})}})})(t=>{e((e=>{let t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){let n=e.entries.at(-1),i=n.url&&performance.getEntriesByType(`resource`).find(e=>e.name===n.url);t.target=r.get(n),t.lcpEntry=n,n.url&&(t.url=n.url),i&&(t.lcpResourceEntry=i);let a=Yg();if(a){let n=a.activationStart||0,r=Math.max(0,a.responseStart-n),o=Math.max(r,i?(i.requestStart||i.startTime)-n:0),s=Math.min(e.value,Math.max(o,i?i.responseEnd-n:0));t=W(W({},t),{},{timeToFirstByte:r,resourceLoadDelay:o-r,resourceLoadDuration:s-o,elementRenderDelay:e.value-s,navigationEntry:a})}}return Object.assign(e,{attribution:t})})(t))},t)},I_=[800,1800],L_=e=>{document.prerendering?m_(()=>L_(e)):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,()=>L_(e),!0)},R_=(e,t={})=>{((e,t={})=>{let n=o_(`TTFB`),r=r_(e,n,I_,t.reportAllChanges);L_(()=>{let i=Yg();i&&(n.value=Math.max(i.responseStart-a_(),0),n.entries=[i],r(!0),n_(()=>{n=o_(`TTFB`,0),r=r_(e,n,I_,t.reportAllChanges),r(!0)}))})})(t=>{e((e=>{let t={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(e.entries.length){let n=e.entries[0],r=n.activationStart||0,i=Math.max((n.workerStart||n.fetchStart)-r,0),a=Math.max(n.domainLookupStart-r,0),o=Math.max(n.connectStart-r,0),s=Math.max(n.connectEnd-r,0);t={waitingDuration:i,cacheDuration:a-i,dnsDuration:o-a,connectionDuration:s-o,requestDuration:e.value-s,navigationEntry:n}}return Object.assign(e,{attribution:t})})(t))},t)}}));G(),H();var B_=`unknown`,V_=e=>e?e.replace(/_/g,`-`):B_,H_=()=>{if(typeof performance>`u`)return B_;let e=performance.getEntriesByType(`navigation`)[0];return V_(e==null?void 0:e.type)},U_=(e,t)=>{var n;return{"rum.navigation.type":(n=e.navigationType)==null?t:n,[X.vitalMetric]:e.name.toLowerCase(),[X.vitalRating]:e.rating}},W_=(e,t)=>{var n;let r=(n=e.attribution)==null?{}:n,i={},a=e=>r[e],o=(e,t,n)=>{t!=null&&(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)&&(i[e]=typeof t==`string`&&n?n(t):t)};switch(e.name){case`LCP`:o(`vital.lcp.url`,a(`url`),t),o(`vital.lcp.target`,a(`target`)),o(`vital.lcp.element_render_delay`,a(`elementRenderDelay`)),o(`vital.lcp.resource_load_duration`,a(`resourceLoadDuration`)),o(`vital.lcp.time_to_first_byte`,a(`timeToFirstByte`));break;case`CLS`:o(`vital.cls.largest_shift_target`,a(`largestShiftTarget`)),o(`vital.cls.largest_shift_value`,a(`largestShiftValue`)),o(`vital.cls.load_state`,a(`loadState`));break;case`INP`:o(`vital.inp.interaction_target`,a(`interactionTarget`)),o(`vital.inp.interaction_type`,a(`interactionType`)),o(`vital.inp.input_delay`,a(`inputDelay`)),o(`vital.inp.processing_duration`,a(`processingDuration`)),o(`vital.inp.presentation_delay`,a(`presentationDelay`));break;case`FCP`:o(`vital.fcp.time_to_first_byte`,a(`timeToFirstByte`)),o(`vital.fcp.load_state`,a(`loadState`));break;case`TTFB`:o(`vital.ttfb.waiting_duration`,a(`waitingDuration`)),o(`vital.ttfb.dns_duration`,a(`dnsDuration`)),o(`vital.ttfb.connection_duration`,a(`connectionDuration`)),o(`vital.ttfb.request_duration`,a(`requestDuration`));break;default:break}return i},G_=e=>{let t=!1;return{name:`web-vitals`,enabled:e.enabled,init(e){return V(function*(){if(typeof window>`u`)return;let n;try{n=yield Promise.resolve().then(()=>(z_(),Kg))}catch(t){if(e.config.debug){var r;(r=globalThis.console)==null||r.warn(`[bk-ot] web-vitals load failed:`,t)}return}if(t)return;let{onCLS:i,onFCP:a,onINP:o,onLCP:s,onTTFB:c}=n,l=H_(),u=e.meter.createHistogram(`browser.web_vital.cls`,{unit:`1`,description:`Cumulative Layout Shift`}),d=e.meter.createHistogram(`browser.web_vital.duration`,{unit:`ms`,description:`Web Vitals duration metrics, including FCP, INP, LCP and TTFB`}),f=t=>{let n=t.name.toLowerCase();e.startSpan(`browser.web_vital`,W(W(W(W(W({},e.config.hooks.getPageAttributes()),e.config.hooks.getMetricAttributes()),U_(t,l)),$({duration:t.name===`CLS`?void 0:t.value,errorType:t.rating===`good`?`none`:`slow`,eventLabel:`Web 指标`,result:ep(t.rating),spanSubtype:n,spanType:Q.vital,targetLabel:n,targetValue:t.value})),{},{[X.vitalMetric]:n,[X.vitalValue]:t.value,[X.vitalRating]:t.rating,"vital.id":t.id},W_(t,e.config.hooks.redactUrl))).end()},p=n=>{t||!Number.isFinite(n.value)||(d.record(n.value,e.applyRedact(W(W(W({},e.config.hooks.getPageAttributes()),e.config.hooks.getMetricAttributes()),U_(n,l)))),f(n))};i(n=>{t||!Number.isFinite(n.value)||(u.record(n.value,e.applyRedact(W(W(W({},e.config.hooks.getPageAttributes()),e.config.hooks.getMetricAttributes()),U_(n,l)))),f(n))}),a(p),o(p),s(p),c(p)})()},shutdown(){t=!0}}};M(),bn(),G();var K_=64*1024,q_=6e4,J_=5,Y_=e=>e==null?0:typeof e==`string`?e.length>K_||typeof TextEncoder>`u`?e.length:new TextEncoder().encode(e).byteLength:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:typeof Blob<`u`&&e instanceof Blob?e.size:0,X_=(e,t)=>{let n={"network.protocol.name":`websocket`,"url.full":t(e)},r={"network.protocol.name":`websocket`};try{let t=new URL(e,typeof location>`u`?`http://localhost`:location.href);n[`server.address`]=t.host,n[`url.scheme`]=t.protocol.replace(`:`,``),r[`server.address`]=t.host,r[`url.scheme`]=n[`url.scheme`]}catch(e){}return{metricAttributes:r,spanAttributes:n}},Z_=(e,t)=>{var n;let{bytesCounter:r,connectDurationHistogram:i,context:a,errorCounter:o,errorThrottle:s,isDisposed:c,messageCounter:l,url:u}=t,{metricAttributes:d,spanAttributes:f}=X_(u,a.config.hooks.redactUrl),p=(n=f[`server.address`])==null?f[`url.full`]:n,m=a.startSpan(`websocket.connect`,W(W(W({},f),$({errorType:`none`,eventLabel:`WebSocket`,spanSubtype:`websocket`,spanType:Q.custom,targetLabel:p})),f[`server.address`]?{[X.targetDomain]:f[`server.address`]}:{})),h=performance.now(),g=!1,_=e=>{if(g)return;g=!0;let t=performance.now()-h;e===`error`&&m.setStatus({code:Tt.ERROR,message:`websocket connect failed`}),m.setAttributes($({duration:t,errorType:e===`error`?`network`:`none`,eventLabel:`WebSocket`,result:e===`error`?Z.error:Z.success,spanSubtype:`websocket`,spanType:Q.custom,targetLabel:p,targetValue:t})),m.end(),e===`opened`&&!c()&&i.record(t,d)};e.addEventListener(`open`,()=>{c()||_(`opened`)}),e.addEventListener(`message`,e=>{if(c())return;let t=W(W({},d),{},{"websocket.direction":`in`});l.add(1,t),r.add(Y_(e.data),t)}),e.addEventListener(`error`,()=>{if(c())return;let e=g?`runtime`:`connect`;o.add(1,W(W({},d),{},{"websocket.error.phase":e})),_(`error`);let t=s.allow(`ws:error:${u}`);t.allowed&&a.emitLog({severityNumber:N.ERROR,severityText:`ERROR`,body:`websocket.error`,attributes:W(W(W({},f),$({errorType:`network`,eventLabel:`WebSocket 错误`,result:Z.error,spanSubtype:`websocket`,spanType:Q.custom,targetLabel:p})),{},{"websocket.error.phase":e,"websocket.error.window_count":t.count})})}),e.addEventListener(`close`,e=>{c()||(g||_(`error`),a.emitLog({severityNumber:N.INFO,severityText:`INFO`,body:`websocket.close`,attributes:W(W(W({},f),$({errorType:e.wasClean?`none`:`network`,eventLabel:`WebSocket 关闭`,result:e.wasClean?Z.success:Z.warning,spanSubtype:`websocket`,spanType:Q.custom,targetLabel:p,targetValue:e.code})),{},{"websocket.close.code":e.code,"websocket.close.reason":e.reason,"websocket.close.was_clean":e.wasClean})}))});let v=e.send.bind(e);e.send=e=>{if(!c()){let t=W(W({},d),{},{"websocket.direction":`out`});l.add(1,t),r.add(Y_(e),t)}return v(e)}},Q_=e=>{let t,n,r=!1;return{name:`websocket`,enabled:e.enabled,init(e){if(typeof window>`u`||window.WebSocket===void 0)return;let i=window.WebSocket;t=i;let a=e.meter.createCounter(`browser.websocket.message.count`,{description:`Total number of WebSocket messages observed`}),o=e.meter.createCounter(`browser.websocket.message.bytes`,{unit:`By`,description:`Total bytes transferred over WebSocket (best-effort)`}),s=e.meter.createCounter(`browser.websocket.error.count`,{description:`Total number of WebSocket error events`}),c=e.meter.createHistogram(`browser.websocket.connect.duration`,{unit:`ms`,description:`WebSocket connection establishment duration (only successful connects)`}),l=Ch(q_,J_),u=()=>r;n=new Proxy(i,{construct(t,n,i){let d=Reflect.construct(t,n,i);if(r)return d;let f=n[0]==null?``:String(n[0]);return!f||Sp(e.config,f)||Z_(d,{bytesCounter:o,connectDurationHistogram:c,context:e,errorCounter:s,errorThrottle:l,isDisposed:u,messageCounter:a,url:f}),d}}),window.WebSocket=n},shutdown(){r=!0,typeof window<`u`&&t&&window.WebSocket===n&&(window.WebSocket=t),n=void 0,t=void 0}}};G();var $_=`http://localhost:4318`,ev=60*1e3,tv=`unknown_service`,nv=e=>e.replace(/\/+$/,``),rv=(e,t)=>{let n=nv(e||$_);return n.endsWith(`/v1/${t}`)?n:n.endsWith(`/v1`)?`${n}/${t}`:`${n}/v1/${t}`},iv=(e,t)=>{var n,r,i,a,o;let s=e==null||(n=e.signals)==null?void 0:n[t],c=e==null||(r=e.signals)==null||(r=r.endpoints)==null?void 0:r[t],l=e!=null&&e.token||e!=null&&e.headers||s!=null&&s.headers?W(W(W({},e!=null&&e.token?{Authorization:`Bearer ${e.token}`}:{}),(i=e==null?void 0:e.headers)==null?{}:i),(a=s==null?void 0:s.headers)==null?{}:a):void 0;return{concurrencyLimit:s==null?void 0:s.concurrencyLimit,endpoint:c?nv(c):rv((o=s==null?void 0:s.endpoint)==null?e==null?void 0:e.endpoint:o,t),headers:l,timeoutMillis:s==null?void 0:s.timeoutMillis}},av=e=>typeof e!=`number`||!Number.isFinite(e)?1:Math.max(0,Math.min(1,e)),ov=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:t,sv=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:t,cv=(e,t)=>typeof e!=`number`||!Number.isFinite(e)?t:Math.max(0,Math.min(1,e)),lv=e=>e.body,uv=()=>({enabled:!1}),dv=e=>W({enabled:!0},e),fv=e=>e?{enabled:!0}:uv(),pv=e=>e===!1?uv():{enabled:!0},mv=e=>{var t;return e?dv(typeof e==`boolean`?{maxBodySize:10*1024,redact:lv}:{maxBodySize:ov(e.maxBodySize,10*1024),redact:(t=e.redact)==null?lv:t}):uv()},hv=e=>{var t;return{action:typeof(e==null?void 0:e.action)==`object`?dv({eventNames:(t=e.action.eventNames)==null?[`click`,`submit`,`keydown`]:t}):e!=null&&e.action?dv({eventNames:[`click`,`submit`,`keydown`]}):uv(),device:typeof(e==null?void 0:e.device)==`object`?dv({storageKey:e.device.storageKey}):(e==null?void 0:e.device)===!1?uv():dv({}),httpBody:mv(e==null?void 0:e.httpBody),session:typeof(e==null?void 0:e.session)==`object`?dv({inactivityMs:ov(e.session.inactivityMs,1800*1e3),maxLifetimeMs:ov(e.session.maxLifetimeMs,1440*60*1e3),storageKey:e.session.storageKey}):(e==null?void 0:e.session)===!1?uv():dv({inactivityMs:1800*1e3,maxLifetimeMs:1440*60*1e3}),pageView:pv(e==null?void 0:e.pageView),resource:pv(e==null?void 0:e.resource),error:typeof(e==null?void 0:e.error)==`object`?dv({maxPerWindow:ov(e.error.maxPerWindow,5),windowMs:ov(e.error.windowMs,6e4)}):(e==null?void 0:e.error)===!1?uv():dv({maxPerWindow:5,windowMs:6e4}),webVitals:pv(e==null?void 0:e.webVitals),blankScreen:typeof(e==null?void 0:e.blankScreen)==`object`?dv({checkDelay:sv(e.blankScreen.checkDelay,3e3),ignoreSelectors:e.blankScreen.ignoreSelectors,rootSelector:e.blankScreen.rootSelector,threshold:cv(e.blankScreen.threshold,.8)}):(e==null?void 0:e.blankScreen)===!1?uv():dv({checkDelay:3e3,threshold:.8}),websocket:fv(e==null?void 0:e.websocket),longTask:typeof(e==null?void 0:e.longTask)==`object`?dv({threshold:sv(e.longTask.threshold,50)}):e!=null&&e.longTask?dv({threshold:50}):uv(),cspViolation:fv(e==null?void 0:e.cspViolation),routeTiming:fv(e==null?void 0:e.routeTiming)}},gv=e=>{var t,n,r,i,a,o,s,c;return{instrumentations:{documentLoad:(t=e==null||(n=e.instrumentations)==null?void 0:n.documentLoad)==null?!0:t,fetch:(r=e==null||(i=e.instrumentations)==null?void 0:i.fetch)==null?!0:r,xhr:(a=e==null||(o=e.instrumentations)==null?void 0:o.xhr)==null?!0:a,userInteraction:(s=e==null||(c=e.instrumentations)==null?void 0:c.userInteraction)==null?!0:s},plugins:hv(e==null?void 0:e.plugins)}},_v=e=>e,vv=e=>e,yv=e=>{try{return new URL(e,typeof location>`u`?`http://localhost`:location.href).pathname||`/`}catch(t){return e||`/`}},bv=e=>{var t,n;return{environment:(t=e==null?void 0:e.environment)==null?`production`:t,name:(n=e==null?void 0:e.name)==null?tv:n,version:e==null?void 0:e.version}},xv=e=>W(W({[X.deploymentEnvironmentName]:e.environment,"rum.provider":`blueking`,[X.serviceName]:e.name},e.version?{[X.serviceVersion]:e.version}:{}),{},{"telemetry.sdk.language":`webjs`}),Sv=e=>({endpoint:nv((e==null?void 0:e.endpoint)||$_),traces:iv(e,`traces`),metrics:iv(e,`metrics`),logs:iv(e,`logs`)}),Cv=e=>({rate:av(e==null?void 0:e.rate)}),wv=e=>{var t,n,r,i,a,o,s,c,l,u,d,f;return{getPageAttributes:(t=(n=e.attributes)==null?void 0:n.page)==null?(()=>({"rum.page.host":typeof window>`u`?``:window.location.host,"rum.page.path":typeof window>`u`?``:window.location.pathname})):t,getMetricAttributes:(r=(i=e.attributes)==null?void 0:i.metric)==null?(()=>({})):r,getErrorAttributes:(a=(o=e.attributes)==null?void 0:o.error)==null?(()=>({})):a,getCustomAttributes:(s=(c=e.attributes)==null?void 0:c.custom)==null?(()=>({})):s,getViewPathGroup:t=>{var n,r,i;return(n=(r=e.route)==null||(i=r.getPathGroup)==null?void 0:i.call(r,t))==null?yv(t):n},redactAttributes:(l=(u=e.privacy)==null?void 0:u.redactAttributes)==null?_v:l,redactUrl:(d=(f=e.privacy)==null?void 0:f.redactUrl)==null?vv:d}},Tv=e=>{var t,n,r,i,a,o;let s=bv(e.app);return{app:s,autoStart:(t=e.autoStart)==null?!0:t,debug:(n=e.debug)==null?!1:n,enabled:(r=e.enabled)==null?!0:r,hooks:wv(e),instrumentations:(i=e.instrumentations)==null?[]:i,metricIntervalMillis:ev,plugins:(a=e.plugins)==null?[]:a,resourceAttributes:xv(s),rum:gv(e.rum),sampling:Cv(e.sampling),spanBatch:e.spanBatch,spanProcessor:(o=e.spanProcessor)==null?`batch`:o,transport:Sv(e.transport),user:e.user}};F(),H();var Ev=(e,t)=>typeof e.enabled==`function`?e.enabled(t):e.enabled!==!1,Dv=class{constructor(e){P(this,`plugins`,void 0),P(this,`startedPlugins`,[]),this.plugins=e}flush(){var e=this;return V(function*(){yield Promise.all(e.startedPlugins.map(e=>Promise.resolve().then(()=>{var t;return(t=e.flush)==null?void 0:t.call(e)})))})()}shutdown(){var e=this;return V(function*(){let t=[...e.startedPlugins].reverse();for(let e of t){var n;yield(n=e.shutdown)==null?void 0:n.call(e)}e.startedPlugins=[]})()}start(e){var t=this;return V(function*(){for(let r of t.plugins)if(Ev(r,e.config))try{yield r.init(e),t.startedPlugins.push(r)}catch(t){if(e.config.debug){var n;(n=globalThis.console)==null||n.warn(`[bk-ot] plugin "${r.name}" init failed:`,t)}}})()}},Ov=[`http.url`,`url.full`],kv=e=>{for(let n of Ov){var t;let r=(t=e.attributes)==null?void 0:t[n];if(typeof r==`string`)return r}},Av=class{constructor(e,t){this.inner=e,this.config=t}forceFlush(){return this.inner.forceFlush()}onEnd(e){let t=kv(e);t&&xp(this.config,t)||this.inner.onEnd(e)}onStart(e,t){this.inner.onStart(e,t)}shutdown(){return this.inner.shutdown()}};F(),G();var jv=class{constructor(e={},t){P(this,`attributes`,{}),P(this,`setOptionalAttribute`,(e,t)=>{if(t===void 0){delete this.attributes[e];return}this.attributes[e]=t}),P(this,`user`,{}),P(this,`view`,{}),P(this,`getAttributes`,()=>W({},this.attributes)),P(this,`getUser`,()=>W({},this.user)),P(this,`getView`,()=>W({},this.view)),P(this,`setAttributes`,e=>{for(let[t,n]of Object.entries(e)){if(n===void 0){delete this.attributes[t];continue}this.attributes[t]=n}}),P(this,`setUser`,e=>{if(this.user=W(W({},this.user),e),`id`in e){if(e.id===void 0){delete this.attributes[X.userId];return}this.attributes[X.userId]=e.id}}),P(this,`setView`,e=>{this.view=W(W({},this.view),e),this.setOptionalAttribute(X.viewId,e.id),this.setOptionalAttribute(X.viewUrl,e.url),this.setOptionalAttribute(X.viewUrlPathGroup,e.urlPathGroup),this.setOptionalAttribute(X.viewLoadingType,e.loadingType)}),this.setAttributes(e),t&&this.setUser(t)}},Mv=`BK_RUM_SAMPLING`,Nv=new Map,Pv=e=>Nv.get(e),Fv=(e,t)=>(Nv.set(e,t),t),Iv=({sampling:e})=>{if(e.rate<=0)return!1;if(e.rate>=1)return!0;try{let t=sessionStorage.getItem(Mv);if(t)return t===`1`;let n=Math.random()<e.rate;return sessionStorage.setItem(Mv,n?`1`:`0`),Fv(Mv,n),n}catch(t){let n=Pv(Mv);return typeof n==`boolean`?n:Fv(Mv,Math.random()<e.rate)}};M(),bn(),B(),Qu(),lc(),Cf(),Yf(),F(),G(),H();var Lv=e=>({url:e.endpoint,headers:e.headers,concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis}),Rv=`bk-rum`,zv=(e,t,n)=>n?new Proxy(e,{get(e,n,r){if(n===`export`)return(n,r)=>{var i;return(i=globalThis.console)==null||i.log(`[bk-ot][${t}]`,n),e.export(n,r)};let i=Reflect.get(e,n,r);return typeof i==`function`?i.bind(e):i}}):e,Bv=e=>[xh(e.rum.instrumentations)],Vv=e=>[op(e.rum.plugins.action),Vh(e.rum.plugins.device),pg(e.rum.plugins.httpBody),Gg(e.rum.plugins.session),kg(e.rum.plugins.pageView),Xh(e.rum.plugins.error),G_(e.rum.plugins.webVitals),jg(e.rum.plugins.resource),hp(e.rum.plugins.blankScreen),Q_(e.rum.plugins.websocket),hg(e.rum.plugins.longTask),Oh(e.rum.plugins.cspViolation),Mg(e.rum.plugins.routeTiming)],Hv=class{assertBeforeStart(e){if(this.phase!==`idle`)throw Error(`[bk-ot] ${e}() must be called before start(); set autoStart: false before registration.`)}constructor(e){var t=this;P(this,`loggerProvider`,void 0),P(this,`meterProvider`,void 0),P(this,`phase`,`idle`),P(this,`pluginManager`,void 0),P(this,`plugins`,void 0),P(this,`registeredInstrumentations`,void 0),P(this,`runtimeContext`,void 0),P(this,`sampled`,void 0),P(this,`teardownCallbacks`,[]),P(this,`tracerProvider`,void 0),P(this,`applyRedact`,e=>this.config.hooks.redactAttributes(e)),P(this,`config`,void 0),P(this,`emitLog`,e=>{var t;let n=W(W({},e),{},{attributes:this.applyRedact(W(W({},this.getRuntimeAttributes()),(t=e.attributes)==null?{}:t))});this.logger.emit(n)}),P(this,`flush`,V(function*(){yield t.pluginManager.flush(),yield t.tracerProvider.forceFlush(),yield t.meterProvider.forceFlush(),yield t.loggerProvider.forceFlush()})),P(this,`getRuntimeAttributes`,()=>this.runtimeContext.getAttributes()),P(this,`logger`,void 0),P(this,`meter`,void 0),P(this,`reportAction`,({attributes:e={},targetTag:t,targetText:n,type:r})=>{var i;if(!this.sampled)return;let a=n==null?void 0:n.slice(0,32);this.startSpan(`action.${r}`,W(W(W(W(W({},this.config.hooks.getPageAttributes()),$({errorType:`none`,eventLabel:`用户操作`,spanSubtype:r,spanType:Q.action,targetLabel:(i=a==null?t:a)==null?r:i})),{},{[X.actionType]:r},a?{[X.targetTextShort]:a}:{}),t?{[X.targetTag]:t}:{}),e)).end()}),P(this,`reportCustomEvent`,({attributes:e={},error:t,name:n})=>{if(!this.sampled){if(this.config.debug){var r;(r=globalThis.console)==null||r.warn(`[bk-ot] custom event dropped (not sampled):`,n)}return}let i=this.startSpan(`custom.${n}`,W(W(W(W(W({},this.config.hooks.getPageAttributes()),this.config.hooks.getCustomAttributes()),$({errorType:t?`custom`:`none`,eventLabel:`自定义事件`,result:t?Z.error:Z.success,spanSubtype:n,spanType:Q.custom,targetLabel:n})),e),{},{"rum.custom.name":n}));t&&(i.recordException(t),i.setStatus({code:Tt.ERROR,message:t.message})),i.end()}),P(this,`setRuntimeAttributes`,e=>{this.runtimeContext.setAttributes(e)}),P(this,`setUser`,e=>{this.runtimeContext.setUser(e)}),P(this,`setView`,e=>{this.runtimeContext.setView(e)}),P(this,`shutdown`,V(function*(){if(t.phase!==`stopped`){for(yield t.flush();t.teardownCallbacks.length;){var e;(e=t.teardownCallbacks.pop())==null||e()}for(yield t.pluginManager.shutdown();t.registeredInstrumentations.length;){var n,r;(n=t.registeredInstrumentations.pop())==null||(r=n.disable)==null||r.call(n)}yield t.tracerProvider.shutdown(),yield t.meterProvider.shutdown(),yield t.loggerProvider.shutdown(),j.disable(),Ft.disable(),k.disable(),t.phase=`stopped`}})),P(this,`start`,V(function*(){if(!(t.phase===`started`||t.phase===`starting`)){if(t.phase===`stopped`)throw Error(`[bk-ot] instance has been shut down and cannot be restarted; create a new instance instead.`);if(!t.config.enabled){t.phase=`started`;return}t.phase=`starting`,Yt.setGlobalPropagator(new Ba),t.tracerProvider.register({contextManager:new kn}),Ft.setGlobalMeterProvider(t.meterProvider),yn.setGlobalLoggerProvider(t.loggerProvider);try{if(t.registeredInstrumentations.length&&Pu({instrumentations:t.registeredInstrumentations,meterProvider:t.meterProvider,tracerProvider:t.tracerProvider}),yield t.pluginManager.start(t),typeof window<`u`&&typeof document<`u`){let e=()=>{t.flush()},n=()=>{document.visibilityState===`hidden`&&t.flush()};window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,n),t.teardownCallbacks.push(()=>window.removeEventListener(`pagehide`,e),()=>document.removeEventListener(`visibilitychange`,n))}}catch(r){for(;t.teardownCallbacks.length;){var e;(e=t.teardownCallbacks.pop())==null||e()}yield t.pluginManager.shutdown();for(let e of t.registeredInstrumentations){var n;(n=e.disable)==null||n.call(e)}throw j.disable(),Ft.disable(),k.disable(),t.phase=`idle`,r}t.phase=`started`}})),P(this,`startSpan`,(e,t={},n)=>this.tracer.startSpan(e,{kind:Ct.INTERNAL,startTime:n==null?void 0:n.startTime,attributes:this.applyRedact(W(W({},this.getRuntimeAttributes()),t))})),P(this,`tracer`,void 0),P(this,`use`,e=>(this.assertBeforeStart(`use`),this.sampled&&this.plugins.push(e),this)),P(this,`useInstrumentation`,e=>(this.assertBeforeStart(`useInstrumentation`),this.config.enabled&&this.registeredInstrumentations.push(e),this)),this.config=Tv(e),this.sampled=this.config.enabled&&Iv(this.config);let n=nc(this.config.resourceAttributes),r=zv(new Au(Lv(this.config.transport.traces)),`traces`,this.config.debug),i=zv(new ku(Lv(this.config.transport.metrics)),`metrics`,this.config.debug),a=zv(new yu(Lv(this.config.transport.logs)),`logs`,this.config.debug),o=new Av(this.config.spanProcessor===`simple`?new xf(r):new Wd(r,this.config.spanBatch),this.config),s=new Xs({exporter:i,exportIntervalMillis:this.config.metricIntervalMillis}),c=new _d(a);this.tracerProvider=new Of({resource:n,sampler:new Od({root:new Ad(+!!this.sampled)}),spanProcessors:[o]}),this.meterProvider=new cl({resource:n,readers:[s]}),this.loggerProvider=new fd({resource:n,processors:[c]}),this.tracer=this.tracerProvider.getTracer(Rv),this.meter=this.meterProvider.getMeter(Rv),this.logger=this.loggerProvider.getLogger(Rv),this.runtimeContext=new jv({"rum.sampled":this.sampled},this.config.user),this.registeredInstrumentations=this.config.enabled?[...this.config.instrumentations]:[],this.plugins=[...this.config.enabled?Bv(this.config):[],...this.sampled?[...Vv(this.config),...this.config.plugins]:[]],this.pluginManager=new Dv(this.plugins),this.config.autoStart&&this.start().catch(e=>{var t;(t=globalThis.console)==null||t.warn(`[bk-ot] auto start failed:`,e)})}};return typeof window<`u`&&Object.assign(window,{BkOpenTelemetry:Hv}),Hv})();
|
|
11
|
+
`,zc(t,e))}return n}};F();var Vc=class{constructor(e){P(this,`_backingStorages`,void 0),this._backingStorages=e}record(e,t,n,r){let i=this._backingStorages;for(let a=0;a<i.length;a++)i[a].record(e,t,n,r)}};N(),F();var Hc=class{constructor(e,t){P(this,`_buffer`,new kc),P(this,`_instrumentName`,void 0),P(this,`_valueType`,void 0),this._instrumentName=e,this._valueType=t}observe(e,t={}){if(typeof e!=`number`){j.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===ke.INT&&!Number.isInteger(e)&&(j.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(t,e)}},Uc=class{constructor(){P(this,`_buffer`,new Map)}observe(e,t,n={}){if(!Tc(e))return;let r=this._buffer.get(e);if(r==null&&(r=new kc,this._buffer.set(e,r)),typeof t!=`number`){j.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===ke.INT&&!Number.isInteger(t)&&(j.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||r.set(n,t)}};N(),F(),H();var Wc=class{constructor(){P(this,`_callbacks`,[]),P(this,`_batchCallbacks`,[])}addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,t){let n=new Set(t.filter(Tc));if(n.size===0){j.error(`BatchObservableCallback is not associated with valid instruments`,t);return}this._findBatchCallback(e,n)>=0||this._batchCallbacks.push({callback:e,instruments:n})}removeBatchCallback(e,t){let n=new Set(t.filter(Tc)),r=this._findBatchCallback(e,n);r<0||this._batchCallbacks.splice(r,1)}observe(e,t){var n=this;return V(function*(){let r=n._observeCallbacks(e,t),i=n._observeBatchCallbacks(e,t);return(yield Promise.allSettled([...r,...i])).filter(e=>e.status===`rejected`).map(e=>e.reason)})()}_observeCallbacks(e,t){return this._callbacks.map(function(){var n=V(function*({callback:n,instrument:r}){let i=new Hc(r._descriptor.name,r._descriptor.valueType),a=Promise.resolve(n(i));t!=null&&(a=Jo(a,t)),yield a,r._metricStorages.forEach(t=>{t.record(i._buffer,e)})});return function(e){return n.apply(this,arguments)}}())}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(function(){var n=V(function*({callback:n,instruments:r}){let i=new Uc,a=Promise.resolve(n(i));t!=null&&(a=Jo(a,t)),yield a,r.forEach(t=>{let n=i._buffer.get(t);n!=null&&t._metricStorages.forEach(t=>{t.record(n,e)})})});return function(e){return n.apply(this,arguments)}}())}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&Yo(n.instruments,t))}};F();var Gc=class extends Dc{constructor(e,t,n,r,i){super(e),P(this,`_aggregationCardinalityLimit`,void 0),P(this,`_deltaMetricStorage`,void 0),P(this,`_temporalMetricStorage`,void 0),P(this,`_attributesProcessor`,void 0),this._aggregationCardinalityLimit=i,this._deltaMetricStorage=new Ac(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new jc(t,r),this._attributesProcessor=n}record(e,t,n,r){t=this._attributesProcessor.process(t,n),this._deltaMetricStorage.record(e,t,n,r)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};F();var Kc=class{process(e,t){return e}},qc=class{constructor(e){P(this,`_processors`,void 0),this._processors=e}process(e,t){let n=e;for(let e of this._processors)n=e.process(n,t);return n}};function Jc(){return Xc}function Yc(e){return new qc(e)}var Xc=new Kc;F(),H();var Zc=class{constructor(e,t){P(this,`metricStorageRegistry`,new Bc),P(this,`observableRegistry`,new Wc),P(this,`meter`,void 0),P(this,`_meterProviderSharedState`,void 0),P(this,`_instrumentationScope`,void 0),this.meter=new Ec(this),this._meterProviderSharedState=e,this._instrumentationScope=t}registerMetricStorage(e){let t=this._registerMetricStorage(e,Gc);return t.length===1?t[0]:new Vc(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,Nc)}collect(e,t,n){var r=this;return V(function*(){let i=yield r.observableRegistry.observe(t,n==null?void 0:n.timeoutMillis),a=r.metricStorageRegistry.getStorages(e);if(a.length===0)return null;let o=[];return a.forEach(n=>{let r=n.collect(e,t);r!=null&&o.push(r)}),o.length===0?{errors:i}:{scopeMetrics:{scope:r._instrumentationScope,metrics:o},errors:i}})()}_registerMetricStorage(e,t){let n=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(n=>{let r=fc(n,e),i=this.metricStorageRegistry.findOrUpdateCompatibleStorage(r);if(i!=null)return i;let a=new t(r,n.aggregation.createAggregator(r),n.attributesProcessor,this._meterProviderSharedState.metricCollectors,n.aggregationCardinalityLimit);return this.metricStorageRegistry.register(a),a});if(n.length===0){let r=this._meterProviderSharedState.selectAggregations(e.type).map(([n,r])=>{let i=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(n,e);if(i!=null)return i;let a=r.createAggregator(e),o=n.selectCardinalityLimit(e.type),s=new t(e,a,Jc(),[n],o);return this.metricStorageRegistry.registerForCollector(n,s),s});n=n.concat(r)}return n}};F();var Qc=class{constructor(e){P(this,`viewRegistry`,new uc),P(this,`metricCollectors`,[]),P(this,`meterSharedStates`,new Map),P(this,`resource`,void 0),this.resource=e}getMeterSharedState(e){let t=Ko(e),n=this.meterSharedStates.get(t);return n==null&&(n=new Zc(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,Gs(n.selectAggregation(e))]);return t}};B(),F(),H();var $c=class{constructor(e,t){P(this,`_sharedState`,void 0),P(this,`_metricReader`,void 0),this._sharedState=e,this._metricReader=t}collect(e){var t=this;return V(function*(){let n=ra(Date.now()),r=[],i=[],a=Array.from(t._sharedState.meterSharedStates.values()).map(function(){var a=V(function*(a){let o=yield a.collect(t,n,e);(o==null?void 0:o.scopeMetrics)!=null&&r.push(o.scopeMetrics),(o==null?void 0:o.errors)!=null&&i.push(...o.errors)});return function(e){return a.apply(this,arguments)}}());return yield Promise.all(a),{resourceMetrics:{resource:t._sharedState.resource,scopeMetrics:r},errors:i}})()}forceFlush(e){var t=this;return V(function*(){yield t._metricReader.forceFlush(e)})()}shutdown(e){var t=this;return V(function*(){yield t._metricReader.shutdown(e)})()}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){var t,n,r;return(t=(n=(r=this._metricReader).selectCardinalityLimit)==null?void 0:n.call(r,e))==null?2e3:t}};F();var el=/[\^$\\.+?()[\]{}|]/g,tl=class e{constructor(t){P(this,`_matchAll`,void 0),P(this,`_regexp`,void 0),t===`*`?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(el,`\\$&`).replace(`*`,`.*`)}$`}static hasWildcard(e){return e.includes(`*`)}},nl=class{constructor(e){P(this,`_matchAll`,void 0),P(this,`_pattern`,void 0),this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};F();var rl=class{constructor(e){var t;P(this,`_nameFilter`,void 0),P(this,`_type`,void 0),P(this,`_unitFilter`,void 0),this._nameFilter=new tl((t=e==null?void 0:e.name)==null?`*`:t),this._type=e==null?void 0:e.type,this._unitFilter=new nl(e==null?void 0:e.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};F();var il=class{constructor(e){P(this,`_nameFilter`,void 0),P(this,`_versionFilter`,void 0),P(this,`_schemaUrlFilter`,void 0),this._nameFilter=new nl(e==null?void 0:e.name),this._versionFilter=new nl(e==null?void 0:e.version),this._schemaUrlFilter=new nl(e==null?void 0:e.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};F();function al(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function ol(e){if(al(e))throw Error(`Cannot create view with no selector arguments supplied`);if(e.name!=null&&((e==null?void 0:e.instrumentName)==null||tl.hasWildcard(e.instrumentName)))throw Error(`Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.`)}var sl=class{constructor(e){var t;P(this,`name`,void 0),P(this,`description`,void 0),P(this,`aggregation`,void 0),P(this,`attributesProcessor`,void 0),P(this,`instrumentSelector`,void 0),P(this,`meterSelector`,void 0),P(this,`aggregationCardinalityLimit`,void 0),ol(e),e.attributesProcessors==null?this.attributesProcessor=Jc():this.attributesProcessor=Yc(e.attributesProcessors),this.name=e.name,this.description=e.description,this.aggregation=Gs((t=e.aggregation)==null?{type:Ws.DEFAULT}:t),this.instrumentSelector=new rl({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new il({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}};N(),lc(),F(),H();var cl=class{constructor(e){var t;if(P(this,`_sharedState`,void 0),P(this,`_shutdown`,!1),this._sharedState=new Qc((t=e==null?void 0:e.resource)==null?rc():t),(e==null?void 0:e.views)!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new sl(t));if((e==null?void 0:e.readers)!=null&&e.readers.length>0)for(let t of e.readers){let e=new $c(this._sharedState,t);t.setMetricProducer(e),this._sharedState.metricCollectors.push(e)}}getMeter(e,t=``,n={}){return this._shutdown?(j.warn(`A shutdown MeterProvider cannot provide a Meter`),le()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}shutdown(e){var t=this;return V(function*(){if(t._shutdown){j.warn(`shutdown may only be called once per MeterProvider`);return}t._shutdown=!0,yield Promise.all(t._sharedState.metricCollectors.map(t=>t.shutdown(e)))})()}forceFlush(e){var t=this;return V(function*(){if(t._shutdown){j.warn(`invalid attempt to force flush after MeterProvider shutdown`);return}yield Promise.all(t._sharedState.metricCollectors.map(t=>t.forceFlush(e)))})()}},ll;(function(e){e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]=`AGGREGATION_TEMPORALITY_UNSPECIFIED`,e[e.AGGREGATION_TEMPORALITY_DELTA=1]=`AGGREGATION_TEMPORALITY_DELTA`,e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]=`AGGREGATION_TEMPORALITY_CUMULATIVE`})(ll||(ll={}));function ul(e,t){let n={attributes:fl(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function dl(e){return{name:e.name,version:e.version}}function fl(e,t){return Object.keys(e).map(n=>pl(n,e[n],t))}function pl(e,t,n){return{key:e,value:ml(t,n)}}function ml(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=ml(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:ml(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}N();function hl(e,t){let n=ul(e.resource,t);return{resource:n,schemaUrl:n.schemaUrl,scopeMetrics:gl(e.scopeMetrics,t)}}function gl(e,t){return Array.from(e.map(e=>({scope:dl(e.scope),metrics:e.metrics.map(e=>_l(e,t)),schemaUrl:e.scope.schemaUrl})))}function _l(e,t){let n={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},r=Sl(e.aggregationTemporality);switch(e.dataPointType){case Wo.SUM:n.sum={aggregationTemporality:r,isMonotonic:e.isMonotonic,dataPoints:yl(e,t)};break;case Wo.GAUGE:n.gauge={dataPoints:yl(e,t)};break;case Wo.HISTOGRAM:n.histogram={aggregationTemporality:r,dataPoints:bl(e,t)};break;case Wo.EXPONENTIAL_HISTOGRAM:n.exponentialHistogram={aggregationTemporality:r,dataPoints:xl(e,t)};break}return n}function vl(e,t,n){let r={attributes:fl(e.attributes,n),startTimeUnixNano:n.encodeHrTime(e.startTime),timeUnixNano:n.encodeHrTime(e.endTime)};switch(t){case ke.INT:r.asInt=e.value;break;case ke.DOUBLE:r.asDouble=e.value;break}return r}function yl(e,t){return e.dataPoints.map(n=>vl(n,e.descriptor.valueType,t))}function bl(e,t){return e.dataPoints.map(e=>{let n=e.value;return{attributes:fl(e.attributes,t),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(e.startTime),timeUnixNano:t.encodeHrTime(e.endTime)}})}function xl(e,t){return e.dataPoints.map(e=>{let n=e.value;return{attributes:fl(e.attributes,t),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(e.startTime),timeUnixNano:t.encodeHrTime(e.endTime)}})}function Sl(e){switch(e){case Uo.DELTA:return ll.AGGREGATION_TEMPORALITY_DELTA;case Uo.CUMULATIVE:return ll.AGGREGATION_TEMPORALITY_CUMULATIVE}}function Cl(e,t){return{resourceMetrics:e.map(e=>hl(e,t))}}B();function wl(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Tl(e){return wl(e).toString()}var El=typeof BigInt<`u`?Tl:sa;function Dl(e){return e}var Ol={encodeHrTime:El,encodeSpanContext:Dl,encodeOptionalSpanContext:Dl,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}};function kl(e,t){return{resourceLogs:jl(e,t)}}function Al(e){let t=new Map;for(let n of e){let{resource:e,instrumentationScope:{name:r,version:i=``,schemaUrl:a=``}}=n,o=t.get(e);o||(o=new Map,t.set(e,o));let s=`${r}@${i}:${a}`,c=o.get(s);c||(c=[],o.set(s,c)),c.push(n)}return t}function jl(e,t){let n=Al(e);return Array.from(n,([e,n])=>{let r=ul(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:dl(e[0].instrumentationScope),logRecords:e.map(e=>Ml(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function Ml(e,t){var n,r,i;return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:Nl(e.severityNumber),severityText:e.severityText,body:ml(e.body,t),eventName:e.eventName,attributes:Pl(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:(n=e.spanContext)==null?void 0:n.traceFlags,traceId:t.encodeOptionalSpanContext((r=e.spanContext)==null?void 0:r.traceId),spanId:t.encodeOptionalSpanContext((i=e.spanContext)==null?void 0:i.spanId)}}function Nl(e){return e}function Pl(e,t){return Object.keys(e).map(n=>pl(n,e[n],t))}N();var Fl={serializeRequest:e=>{let t=kl(e,Ol);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return j.warn(`Failed to parse logs export response: ${e.message}. Returning empty response`),{}}}};N();var Il={serializeRequest:e=>{let t=Cl([e],Ol);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return j.warn(`Failed to parse metrics export response: ${e.message}. Returning empty response`),{}}}},Ll=256,Rl=512;function zl(e,t){let n=e&255|Ll;return t&&(n|=Rl),n}function Bl(e,t){var n,r,i,a;let o=e.spanContext(),s=e.status,c=(n=e.parentSpanContext)!=null&&n.spanId?t.encodeSpanContext((r=e.parentSpanContext)==null?void 0:r.spanId):void 0;return{traceId:t.encodeSpanContext(o.traceId),spanId:t.encodeSpanContext(o.spanId),parentSpanId:c,traceState:(i=o.traceState)==null?void 0:i.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:fl(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>Hl(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:s.code,message:s.message},links:e.links.map(e=>Vl(e,t)),droppedLinksCount:e.droppedLinksCount,flags:zl(o.traceFlags,(a=e.parentSpanContext)==null?void 0:a.isRemote)}}function Vl(e,t){var n;return{attributes:e.attributes?fl(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:(n=e.context.traceState)==null?void 0:n.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:zl(e.context.traceFlags,e.context.isRemote)}}function Hl(e,t){return{attributes:e.attributes?fl(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function Ul(e,t){return{resourceSpans:Gl(e,t)}}function Wl(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function Gl(e,t){let n=Wl(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>Bl(e,t));o.push({scope:dl(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=ul(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}N();var Kl={serializeRequest:e=>{let t=Ul(e,Ol);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return j.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}};N(),F(),H();var ql=5,Jl=1e3,Yl=5e3,Xl=1.5,Zl=.2;function Ql(){return 2*Zl*Math.random()-Zl}var $l=class{constructor(e){P(this,`_transport`,void 0),this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}send(e,t){var n=this;return V(function*(){let r=ql,i=Jl,a=Date.now()+t,o=yield n._transport.send(e,t);for(;o.status===`retryable`&&r>0;){var s;r--;let t=Math.max(Math.min(i*(1+Ql()),Yl),0);i*=Xl;let c=(s=o.retryInMillis)==null?t:s,l=a-Date.now();if(c>l)return j.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(l)}ms, not retrying further.`),o;j.verbose(`Scheduling export retry in ${Math.round(c)}ms`),o=yield n.retry(e,l,c)}return o.status===`success`?j.verbose(`Export succeeded after ${ql-r} retry attempts.`):o.status===`retryable`?j.info(`Export failed after maximum retry attempts (${ql}).`):j.info(`Export failed with non-retryable error: ${o.error}`),o})()}shutdown(){return this._transport.shutdown()}};function eu(e){return new $l(e.transport)}function tu(e){return e===429||e===502||e===503||e===504}function nu(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}N(),F(),H();var ru=60*1024,iu=9,au=0,ou=0,su=class{constructor(e){P(this,`_parameters`,void 0),this._parameters=e}send(e,t){var n=this;return V(function*(){let r=new AbortController,i=setTimeout(()=>r.abort(),t),a=globalThis.fetch;typeof a.__original==`function`&&(a=a.__original);let o=e.byteLength,s=au+o>ru,c=!s&&!(ou>=iu);if(c)au+=o,ou++;else{let e=s?`size limit`:`count limit`;j.debug(`keepalive disabled: ${(o/1024).toFixed(1)}KB payload, ${ou} pending (${e})`)}try{let t=new URL(n._parameters.url),i=yield a(t.href,{method:`POST`,headers:yield n._parameters.headers(),body:e,signal:r.signal,keepalive:c,mode:globalThis.location?globalThis.location.origin===t.origin?`same-origin`:`cors`:`no-cors`});return i.status>=200&&i.status<=299?(j.debug(`export response success (status: ${i.status})`),{status:`success`}):tu(i.status)?(j.warn(`export response retryable (status: ${i.status})`),{status:`retryable`,retryInMillis:nu(i.headers.get(`Retry-After`))}):(j.error(`export response failure (status: ${i.status})`),{status:`failure`,error:Error(`Fetch request failed with non-retryable status ${i.status}`)})}catch(e){return lu(e)?(j.warn(`export request retryable (network error: ${e})`),{status:`retryable`,error:Error(`Fetch request encountered a network error`,{cause:e})}):(j.error(`export request failure (error: ${e})`),{status:`failure`,error:Error(`Fetch request errored`,{cause:e})})}finally{clearTimeout(i),c&&(au-=o,ou--)}})()}shutdown(){}};function cu(e){return new su(e)}function lu(e){return e instanceof TypeError&&!e.cause}function uu(e,t){return Ho(e,t,eu({transport:cu(e)}))}N();function du(e){let t={};return Object.entries(e==null?{}:e).forEach(([e,n])=>{n===void 0?j.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}G(),H();function fu(e,t,n){return V(function*(){let r=W({},yield n()),i={};return t!=null&&Object.assign(i,yield t()),e!=null&&Object.assign(i,du(yield e())),Object.assign(i,r)})}function pu(e){if(e!=null)try{var t;let n=(t=globalThis.location)==null?void 0:t.href;return new URL(e,n).href}catch(t){throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function mu(e,t,n){var r,i;return W(W({},Po(e,t,n)),{},{headers:fu(e.headers,t.headers,n.headers),url:(r=(i=pu(e.url))==null?t.url:i)==null?n.url:r})}function hu(e,t){return W(W({},Fo()),{},{headers:function(){var t=V(function*(){return e});return function(){return t.apply(this,arguments)}}(),url:`http://localhost:4318/`+t})}function gu(e){return typeof e.headers==`function`?e.headers:No(e.headers)}function _u(e,t,n){return mu({url:e.url,timeoutMillis:e.timeoutMillis,headers:gu(e),concurrencyLimit:e.concurrencyLimit},{},hu(n,t))}function vu(e,t,n,r){return uu(_u(e,n,r),t)}var yu=class extends ko{constructor(e={}){super(vu(e,Fl,`v1/logs`,{"Content-Type":`application/json`}))}},bu;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`,e[e.LOWMEMORY=2]=`LOWMEMORY`})(bu||(bu={})),B(),N(),F();var xu=()=>Uo.CUMULATIVE,Su=e=>{switch(e){case U.COUNTER:case U.OBSERVABLE_COUNTER:case U.GAUGE:case U.HISTOGRAM:case U.OBSERVABLE_GAUGE:return Uo.DELTA;case U.UP_DOWN_COUNTER:case U.OBSERVABLE_UP_DOWN_COUNTER:return Uo.CUMULATIVE}},Cu=e=>{switch(e){case U.COUNTER:case U.HISTOGRAM:return Uo.DELTA;case U.GAUGE:case U.UP_DOWN_COUNTER:case U.OBSERVABLE_UP_DOWN_COUNTER:case U.OBSERVABLE_COUNTER:case U.OBSERVABLE_GAUGE:return Uo.CUMULATIVE}};function wu(){var e;let t=((e=void 0)==null?`cumulative`:e).toLowerCase();return t===`cumulative`?xu:t===`delta`?Su:t===`lowmemory`?Cu:(j.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${t}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`),xu)}function Tu(e){return e==null?wu():e===bu.DELTA?Su:e===bu.LOWMEMORY?Cu:xu}var Eu=Object.freeze({type:Ws.DEFAULT});function Du(e){var t;return(t=e==null?void 0:e.aggregationPreference)==null?(()=>Eu):t}var Ou=class extends ko{constructor(e,t){super(e),P(this,`_aggregationTemporalitySelector`,void 0),P(this,`_aggregationSelector`,void 0),this._aggregationSelector=Du(t),this._aggregationTemporalitySelector=Tu(t==null?void 0:t.temporalityPreference)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}},ku=class extends Ou{constructor(e){super(vu(e==null?{}:e,Il,`v1/metrics`,{"Content-Type":`application/json`}),e)}},Au=class extends ko{constructor(e={}){super(vu(e,Kl,`v1/traces`,{"Content-Type":`application/json`}))}};function ju(e,t,n,r){for(let i=0,a=e.length;i<a;i++){let a=e[i];t&&a.setTracerProvider(t),n&&a.setMeterProvider(n),r&&a.setLoggerProvider&&a.setLoggerProvider(r),a.getConfig().enabled||a.enable()}}function Mu(e){e.forEach(e=>e.disable())}var Nu=t((()=>{}));function Pu(e){var t,n;let r=e.tracerProvider||M.getTracerProvider(),i=e.meterProvider||Pt.getMeterProvider(),a=e.loggerProvider||yn.getLoggerProvider(),o=(t=(n=e.instrumentations)==null?void 0:n.flat())==null?[]:t;return ju(o,r,i,a),()=>{Mu(o)}}var Fu=t((()=>{N(),Nu()}));function Iu(e,t,n){let r=!!e[t]&&Object.prototype.propertyIsEnumerable.call(e,t);Object.defineProperty(e,t,{configurable:!0,enumerable:r,writable:!0,value:n})}function Lu(e){e&&e.logger&&(typeof e.logger==`function`?K=e.logger:K(`new logger isn't a function, not replacing`))}var K,Ru,zu,Bu,Vu,Hu=t((()=>{K=console.error.bind(console),Ru=(e,t,n)=>{if(!e||!e[t]){K(`no original function `+String(t)+` to wrap`);return}if(!n){K(`no wrapper function`),K(Error().stack);return}let r=e[t];if(typeof r!=`function`||typeof n!=`function`){K(`original object and wrapper must be functions`);return}let i=n(r,t);return Iu(i,`__original`,r),Iu(i,`__unwrap`,()=>{e[t]===i&&Iu(e,t,r)}),Iu(i,`__wrapped`,!0),Iu(e,t,i),i},zu=(e,t,n)=>{if(e)Array.isArray(e)||(e=[e]);else{K(`must provide one or more modules to patch`),K(Error().stack);return}if(!(t&&Array.isArray(t))){K(`must provide one or more functions to wrap on modules`);return}e.forEach(e=>{t.forEach(t=>{Ru(e,t,n)})})},Bu=(e,t)=>{if(!e||!e[t]){K(`no function to unwrap.`),K(Error().stack);return}let n=e[t];if(!n.__unwrap)K(`no original to unwrap to -- has `+String(t)+` already been unwrapped?`);else{n.__unwrap();return}},Vu=(e,t)=>{if(e)Array.isArray(e)||(e=[e]);else{K(`must provide one or more modules to patch`),K(Error().stack);return}if(!(t&&Array.isArray(t))){K(`must provide one or more functions to unwrap on modules`);return}e.forEach(e=>{t.forEach(t=>{Bu(e,t)})})},Lu.wrap=Ru,Lu.massWrap=zu,Lu.unwrap=Bu,Lu.massUnwrap=Vu})),Uu,Wu=t((()=>{N(),bn(),Hu(),F(),G(),Uu=class{constructor(e,t,n){P(this,`_config`,{}),P(this,`_tracer`,void 0),P(this,`_meter`,void 0),P(this,`_logger`,void 0),P(this,`_diag`,void 0),P(this,`instrumentationName`,void 0),P(this,`instrumentationVersion`,void 0),P(this,`_wrap`,Ru),P(this,`_unwrap`,Bu),P(this,`_massWrap`,zu),P(this,`_massUnwrap`,Vu),this.instrumentationName=e,this.instrumentationVersion=t,this.setConfig(n),this._diag=j.createComponentLogger({namespace:e}),this._tracer=M.getTracer(e,t),this._meter=Pt.getMeter(e,t),this._logger=yn.getLogger(e,t),this._updateMetricInstruments()}get meter(){return this._meter}setMeterProvider(e){this._meter=e.getMeter(this.instrumentationName,this.instrumentationVersion),this._updateMetricInstruments()}get logger(){return this._logger}setLoggerProvider(e){this._logger=e.getLogger(this.instrumentationName,this.instrumentationVersion)}getModuleDefinitions(){var e;let t=(e=this.init())==null?[]:e;return Array.isArray(t)?t:[t]}_updateMetricInstruments(){}getConfig(){return this._config}setConfig(e){this._config=W({enabled:!0},e)}setTracerProvider(e){this._tracer=e.getTracer(this.instrumentationName,this.instrumentationVersion)}get tracer(){return this._tracer}_runSpanCustomizationHook(e,t,n,r){if(e)try{e(n,r)}catch(e){this._diag.error(`Error running span customization hook due to exception in handler`,{triggerName:t},e)}}}})),Gu,Ku=t((()=>{Wu(),Gu=class extends Uu{constructor(e,t,n){super(e,t,n),this._config.enabled&&this.enable()}}})),qu=t((()=>{Ku(),N()}));function Ju(e,t,n){let r,i;try{i=e()}catch(e){r=e}finally{if(t(r,i),r&&!n)throw r;return i}}var Yu=t((()=>{}));function Xu(e,t){let n=q.OLD,r=t==null?void 0:t.split(`,`).map(e=>e.trim()).filter(e=>e!==``);for(let t of r==null?[]:r)if(t.toLowerCase()===e+`/dup`){n=q.DUPLICATE;break}else t.toLowerCase()===e&&(n=q.STABLE);return n}var q,Zu=t((()=>{(function(e){e[e.STABLE=1]=`STABLE`,e[e.OLD=2]=`OLD`,e[e.DUPLICATE=3]=`DUPLICATE`})(q||(q={}))})),Qu=t((()=>{Fu(),qu(),F(),Yu(),Zu()}));function $u(e){return ed(e,new WeakSet)}function ed(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>ed(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>ed(e,t))}return!1}N(),B(),Zi(),F();var td=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){P(this,`hrTime`,void 0),P(this,`hrTimeObserved`,void 0),P(this,`spanContext`,void 0),P(this,`resource`,void 0),P(this,`instrumentationScope`,void 0),P(this,`attributes`,{}),P(this,`_severityText`,void 0),P(this,`_severityNumber`,void 0),P(this,`_body`,void 0),P(this,`_eventName`,void 0),P(this,`_attributesCount`,0),P(this,`_droppedAttributesCount`,0),P(this,`_isReadonly`,!1),P(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=aa(r==null?f:r),this.hrTimeObserved=aa(i==null?f:i),d){let e=M.getSpanContext(d);e&&it(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return j.warn(`Invalid attribute key: ${e}`),this;if(!$u(t))return j.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&j.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return j.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Ni,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(Fi,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(Fi,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Ni,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(Pi,n.stack),t=!0)}t||j.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&j.warn(`Can not execute the operation on emitted log record`),this._isReadonly}};bn(),N(),F(),G();var nd=class{constructor(e,t){P(this,`instrumentationScope`,void 0),P(this,`_sharedState`,void 0),P(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){var t;let n=this._loggerConfig,r=e.context||A.active(),i=(t=e.severityNumber)==null?en.UNSPECIFIED:t;if(i!==en.UNSPECIFIED&&i<n.minimumSeverity)return;if(n.traceBased){let e=M.getSpanContext(r);if(e&&it(e)&&(e.traceFlags&k.SAMPLED)!==k.SAMPLED)return}let a=new td(this._sharedState,this.instrumentationScope,W({context:r},e));this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(a,r),a._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e==null?void 0:e.severityNumber;if(typeof n==`number`&&n!==en.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=(e==null?void 0:e.context)||A.active();if(t.traceBased){let e=M.getSpanContext(r);if(e&&it(e)&&(e.traceFlags&k.SAMPLED)!==k.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e==null?void 0:e.severityNumber,eventName:e==null?void 0:e.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}},rd=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}};B(),F(),H();var id=class{constructor(e,t){P(this,`processors`,void 0),P(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}forceFlush(){var e=this;return V(function*(){let t=e.forceFlushTimeoutMillis;yield Promise.all(e.processors.map(e=>go(e.forceFlush(),t)))})()}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}shutdown(){var e=this;return V(function*(){yield Promise.all(e.processors.map(e=>e.shutdown()))})()}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}};function ad(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var od=`otel.sdk.log.created`;F();var sd=class{constructor(e){P(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(od,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}},cd=`0.217.0`;N(),bn(),G(),F();var ld={disabled:!1,minimumSeverity:en.UNSPECIFIED,traceBased:!1},ud=()=>W({},ld),dd=class{constructor(e,t,n,r,i,a){P(this,`loggers`,new Map),P(this,`activeProcessor`,void 0),P(this,`registeredLogRecordProcessors`,[]),P(this,`resource`,void 0),P(this,`forceFlushTimeoutMillis`,void 0),P(this,`logRecordLimits`,void 0),P(this,`processors`,void 0),P(this,`loggerMetrics`,void 0),P(this,`_loggerConfigurator`,void 0),P(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new id(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new rd,this._loggerConfigurator=i==null?ud:i;let o=a?a.getMeter(`@opentelemetry/sdk-logs`,cd):le();this.loggerMetrics=new sd(o)}getLoggerConfig(e){let t=ad(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}};N(),bn(),lc(),B(),F();var fd=class{constructor(e={}){var t,n,r,i,a,o,s,c;P(this,`_shutdownOnce`,void 0),P(this,`_sharedState`,void 0);let l={resource:(t=e.resource)==null?rc():t,forceFlushTimeoutMillis:(n=e.forceFlushTimeoutMillis)==null?3e4:n,logRecordLimits:{attributeCountLimit:(r=(i=e.logRecordLimits)==null?void 0:i.attributeCountLimit)==null?128:r,attributeValueLengthLimit:(a=(o=e.logRecordLimits)==null?void 0:o.attributeValueLengthLimit)==null?1/0:a},loggerConfigurator:(s=e.loggerConfigurator)==null?ud:s,processors:(c=e.processors)==null?[]:c,meterProvider:e.meterProvider};this._sharedState=new dd(l.resource,l.forceFlushTimeoutMillis,l.logRecordLimits,l.processors,l.loggerConfigurator,l.meterProvider),this._shutdownOnce=new wo(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return j.warn(`A shutdown LoggerProvider cannot provide a Logger`),rn;e||j.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new nd({name:r,version:t,schemaUrl:n==null?void 0:n.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(j.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(j.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};N(),B(),H(),F();function pd(e){return md.apply(this,arguments)}function md(){return md=V(function*(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&(yield Promise.all(t))}),md.apply(this,arguments)}var hd=class{constructor(e,t,n){P(this,`_exportCompleted`,void 0),P(this,`_exportScheduledPromise`,void 0),P(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}_executeExport(e,t,n){var r=this;return V(function*(){try{yield pd(t),yield A.with($r(A.active()),V(function*(){return r._exportWithTimeout(e,t,n)}))}catch(e){Si(e),r._exportScheduledResolve()}})()}_exportWithTimeout(e,t,n){var r=this;return V(function*(){return new Promise((i,a)=>{let o=setTimeout(()=>{a(Error(`Timeout`))},n);e.export(t,e=>{if(clearTimeout(o),e.code===ga.SUCCESS)i();else{var t;a((t=e.error)==null?Error(`BatchLogRecordProcessor: log record export failed`):t)}}),r._exportScheduledResolve()})})()}},gd=class{constructor(e,t){var n,r,i,a;P(this,`_maxExportBatchSize`,void 0),P(this,`_maxQueueSize`,void 0),P(this,`_scheduledDelayMillis`,void 0),P(this,`_exportTimeoutMillis`,void 0),P(this,`_exporter`,void 0),P(this,`_currentExport`,null),P(this,`_finishedLogRecords`,[]),P(this,`_timer`,void 0),P(this,`_shutdownOnce`,void 0),P(this,`_flushing`,!1),this._exporter=e,this._maxExportBatchSize=(n=t==null?void 0:t.maxExportBatchSize)==null?512:n,this._maxQueueSize=(r=t==null?void 0:t.maxQueueSize)==null?2048:r,this._scheduledDelayMillis=(i=t==null?void 0:t.scheduledDelayMillis)==null?5e3:i,this._exportTimeoutMillis=(a=t==null?void 0:t.exportTimeoutMillis)==null?3e4:a,this._shutdownOnce=new wo(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(j.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}_shutdown(){var e=this;return V(function*(){e.onShutdown(),yield e._flushAll(),yield e._exporter.shutdown()})()}_flushAll(){var e=this;return V(function*(){if(e._flushing)return;e._flushing=!0;let t=e._finishedLogRecords;for(e._finishedLogRecords=[],e._clearTimer(),e._currentExport!==null&&(yield e._exporter.forceFlush(),yield e._currentExport.exportCompleted,e._currentExport=null);t.length>0;){let n;t.length<=e._maxExportBatchSize?(n=t,t=[]):n=t.splice(0,e._maxExportBatchSize);let r=new hd(e._exporter,n,e._exportTimeoutMillis);e._currentExport=r;try{yield r.exportScheduled,yield e._exporter.forceFlush(),yield r.exportCompleted}catch(e){Si(e)}finally{e._currentExport=null}}e._flushing=!1,e._maybeStartTimer()})()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new hd(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,Si(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}};F();var _d=class extends gd{constructor(e,t){super(e,t),P(this,`_visibilityChangeListener`,void 0),P(this,`_pageHideListener`,void 0),this._onInit(t)}onShutdown(){typeof document>`u`||(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}_onInit(e){(e==null?void 0:e.disableAutoFlushOnDocumentHide)===!0||typeof document>`u`||(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}},vd,yd=t((()=>{vd=`exception`})),bd,xd=t((()=>{N(),B(),Zi(),yd(),F(),bd=class{constructor(e){var t,n;P(this,`_spanContext`,void 0),P(this,`kind`,void 0),P(this,`parentSpanContext`,void 0),P(this,`attributes`,{}),P(this,`links`,[]),P(this,`events`,[]),P(this,`startTime`,void 0),P(this,`resource`,void 0),P(this,`instrumentationScope`,void 0),P(this,`_droppedAttributesCount`,0),P(this,`_droppedEventsCount`,0),P(this,`_droppedLinksCount`,0),P(this,`_attributesCount`,0),P(this,`name`,void 0),P(this,`status`,{code:wt.UNSET}),P(this,`endTime`,[0,0]),P(this,`_ended`,!1),P(this,`_duration`,[-1,-1]),P(this,`_spanProcessor`,void 0),P(this,`_spanLimits`,void 0),P(this,`_attributeValueLengthLimit`,void 0),P(this,`_recordEndMetrics`,void 0),P(this,`_performanceStartTime`,void 0),P(this,`_performanceOffset`,void 0),P(this,`_startTimeProvided`,void 0);let r=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=z.now(),this._performanceOffset=r-(this._performanceStartTime+z.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=(t=this._spanLimits.attributeValueLengthLimit)==null?0:t,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime((n=e.startTime)==null?r:n),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return j.warn(`Invalid attribute key: ${e}`),this;if(!mi(t))return j.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return j.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&j.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),ua(t)&&(ua(n)||(n=t),t=void 0);let i=fi(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&j.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=fi(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===wt.UNSET||this.status.code===wt.OK)return this;let t={code:e.code};return e.code===wt.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&j.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){var t;if(this._isSpanEnded()){j.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=oa(this.startTime,this.endTime),this._duration[0]<0&&(j.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&j.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&j.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),(t=this._recordEndMetrics)==null||t.call(this),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=z.now())return ia(e+this._performanceOffset);if(typeof e==`number`)return ra(e);if(e instanceof Date)return ra(e.getTime());if(la(e))return e;if(this._startTimeProvided)return ra(Date.now());let t=z.now()-this._performanceStartTime;return da(this.startTime,ra(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[Ni]=e:e&&(e.code?n[Fi]=e.code.toString():e.name&&(n[Fi]=e.name),e.message&&(n[Ni]=e.message),e.stack&&(n[Pi]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(vd,n,t):j.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);j.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(j.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}}})),Sd,Cd=t((()=>{(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Sd||(Sd={}))})),wd,Td=t((()=>{Cd(),wd=class{shouldSample(){return{decision:Sd.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}})),Ed,Dd=t((()=>{Cd(),Ed=class{shouldSample(){return{decision:Sd.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}})),Od,kd=t((()=>{N(),B(),Td(),Dd(),F(),Od=class{constructor(e){var t,n,r,i;P(this,`_root`,void 0),P(this,`_remoteParentSampled`,void 0),P(this,`_remoteParentNotSampled`,void 0),P(this,`_localParentSampled`,void 0),P(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(Si(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new Ed),this._remoteParentSampled=(t=e.remoteParentSampled)==null?new Ed:t,this._remoteParentNotSampled=(n=e.remoteParentNotSampled)==null?new wd:n,this._localParentSampled=(r=e.localParentSampled)==null?new Ed:r,this._localParentNotSampled=(i=e.localParentNotSampled)==null?new wd:i}shouldSample(e,t,n,r,i,a){let o=M.getSpanContext(e);return!o||!it(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&k.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&k.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}})),Ad,jd=t((()=>{N(),Cd(),F(),Ad=class{constructor(e=0){P(this,`_ratio`,void 0),P(this,`_upperBound`,void 0),this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:nt(t)&&this._accumulate(t)<this._upperBound?Sd.RECORD_AND_SAMPLED:Sd.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}}}));function Md(){var e,t,n,r,i,a,o,s;return{sampler:Nd(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:(e=void 0)==null?1/0:e,attributeCountLimit:(t=void 0)==null?128:t},spanLimits:{attributeValueLengthLimit:(n=void 0)==null?1/0:n,attributeCountLimit:(r=void 0)==null?128:r,linkCountLimit:(i=void 0)==null?128:i,eventCountLimit:(a=void 0)==null?128:a,attributePerEventCountLimit:(o=void 0)==null?128:o,attributePerLinkCountLimit:(s=void 0)==null?128:s}}}function Nd(){var e;let t=(e=void 0)==null?Fd.ParentBasedAlwaysOn:e;switch(t){case Fd.AlwaysOn:return new Ed;case Fd.AlwaysOff:return new wd;case Fd.ParentBasedAlwaysOn:return new Od({root:new Ed});case Fd.ParentBasedAlwaysOff:return new Od({root:new wd});case Fd.TraceIdRatio:return new Ad(Pd());case Fd.ParentBasedTraceIdRatio:return new Od({root:new Ad(Pd())});default:return j.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${Fd.ParentBasedAlwaysOn}".`),new Od({root:new Ed})}}function Pd(){return j.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Id}.`),Id}var Fd,Id,Ld=t((()=>{N(),B(),Td(),Dd(),kd(),jd(),(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(Fd||(Fd={})),Id=1}));function Rd(e){let t={sampler:Nd()},n=Md(),r=Object.assign({},n,t,e);return r.generalLimits=Object.assign({},n.generalLimits,e.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,e.spanLimits||{}),r}function zd(e){var t,n,r,i,a,o,s,c,l,u,d,f;let p=Object.assign({},e.spanLimits);return p.attributeCountLimit=(t=(n=(r=(i=(a=e.spanLimits)==null?void 0:a.attributeCountLimit)==null?(o=e.generalLimits)==null?void 0:o.attributeCountLimit:i)==null?void 0:r)==null?void 0:n)==null?128:t,p.attributeValueLengthLimit=(s=(c=(l=(u=(d=e.spanLimits)==null?void 0:d.attributeValueLengthLimit)==null?(f=e.generalLimits)==null?void 0:f.attributeValueLengthLimit:u)==null?void 0:l)==null?void 0:c)==null?Bd:s,Object.assign({},e,{spanLimits:p})}var Bd,Vd=t((()=>{Ld(),B(),Bd=1/0})),Hd,Ud=t((()=>{N(),B(),F(),Hd=class{constructor(e,t){var n,r,i,a;P(this,`_maxExportBatchSize`,void 0),P(this,`_maxQueueSize`,void 0),P(this,`_scheduledDelayMillis`,void 0),P(this,`_exportTimeoutMillis`,void 0),P(this,`_exporter`,void 0),P(this,`_isExporting`,!1),P(this,`_finishedSpans`,[]),P(this,`_timer`,void 0),P(this,`_shutdownOnce`,void 0),P(this,`_droppedSpansCount`,0),this._exporter=e,this._maxExportBatchSize=typeof(t==null?void 0:t.maxExportBatchSize)==`number`?t.maxExportBatchSize:(n=void 0)==null?512:n,this._maxQueueSize=typeof(t==null?void 0:t.maxQueueSize)==`number`?t.maxQueueSize:(r=void 0)==null?2048:r,this._scheduledDelayMillis=typeof(t==null?void 0:t.scheduledDelayMillis)==`number`?t.scheduledDelayMillis:(i=void 0)==null?5e3:i,this._exportTimeoutMillis=typeof(t==null?void 0:t.exportTimeoutMillis)==`number`?t.exportTimeoutMillis:(a=void 0)==null?3e4:a,this._shutdownOnce=new wo(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(j.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&k.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&j.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(j.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);A.with($r(A.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,r=>{if(clearTimeout(n),r.code===ga.SUCCESS)e();else{var i;t((i=r.error)==null?Error(`BatchSpanProcessor: span export failed`):i)}}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a!=null||(a=[]),a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{Si(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,Si(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),Wd,Gd=t((()=>{Ud(),B(),F(),Wd=class extends Hd{constructor(e,t){super(e,t),P(this,`_visibilityChangeListener`,void 0),P(this,`_pageHideListener`,void 0),this.onInit(t)}onInit(e){(e==null?void 0:e.disableAutoFlushOnDocumentHide)!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{Si(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{Si(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}onShutdown(){typeof document<`u`&&(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}}}));function Kd(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function qd(e){let t=``;for(let n=0;n<e.length;n++)t+=Qd[e[n]];return t}var Jd,Yd,Xd,Zd,Qd,$d,ef=t((()=>{Jd=16,Yd=8,Xd=new Uint8Array(Jd),Zd=new Uint8Array(Yd),Qd=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)),$d=class{generateTraceId(){return Kd(Xd),qd(Xd)}generateSpanId(){return Kd(Zd),qd(Zd)}}})),tf=t((()=>{Gd(),ef()})),nf,rf,af,of,sf=t((()=>{nf=`otel.span.parent.origin`,rf=`otel.span.sampling_result`,af=`otel.sdk.span.live`,of=`otel.sdk.span.started`}));function cf(e){return e?e.isRemote?`remote`:`local`:`none`}function lf(e){switch(e){case Sd.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case Sd.RECORD:return`RECORD_ONLY`;case Sd.NOT_RECORD:return`DROP`}}var uf,df=t((()=>{Cd(),sf(),F(),uf=class{constructor(e){P(this,`startedSpans`,void 0),P(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(of,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(af,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=lf(t);if(this.startedSpans.add(1,{[nf]:cf(e),[rf]:n}),t===Sd.NOT_RECORD)return()=>{};let r={[rf]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}}})),ff,pf=t((()=>{ff=`2.7.1`})),mf,hf=t((()=>{N(),B(),xd(),Vd(),tf(),df(),pf(),F(),mf=class{constructor(e,t,n,r){P(this,`_sampler`,void 0),P(this,`_generalLimits`,void 0),P(this,`_spanLimits`,void 0),P(this,`_idGenerator`,void 0),P(this,`instrumentationScope`,void 0),P(this,`_resource`,void 0),P(this,`_spanProcessor`,void 0),P(this,`_tracerMetrics`,void 0);let i=Rd(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new $d,this._resource=n,this._spanProcessor=r,this.instrumentationScope=e;let a=i.meterProvider?i.meterProvider.getMeter(`@opentelemetry/sdk-trace`,ff):le();this._tracerMetrics=new uf(a)}startSpan(e,t={},n=A.active()){var r,i,a;t.root&&(n=M.deleteSpan(n));let o=M.getSpan(n);if(ei(n))return j.debug(`Instrumentation suppressed, returning Noop Span`),M.wrapSpanContext(Ue);let s=o==null?void 0:o.spanContext(),c=this._idGenerator.generateSpanId(),l,u,d;!s||!M.isSpanContextValid(s)?u=this._idGenerator.generateTraceId():(u=s.traceId,d=s.traceState,l=s);let f=(r=t.kind)==null?St.INTERNAL:r,p=((i=t.links)==null?[]:i).map(e=>({context:e.context,attributes:fi(e.attributes)})),m=fi(t.attributes),h=this._sampler.shouldSample(n,u,e,f,m,p),g=this._tracerMetrics.startSpan(s,h.decision);d=(a=h.traceState)==null?d:a;let _=h.decision===bt.RECORD_AND_SAMPLED?k.SAMPLED:k.NONE,v={traceId:u,spanId:c,traceFlags:_,traceState:d};if(h.decision===bt.NOT_RECORD)return j.debug(`Recording is off, propagating context in a non-recording span`),M.wrapSpanContext(v);let y=fi(Object.assign(m,h.attributes));return new bd({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:v,name:e,kind:f,links:p,parentSpanContext:l,attributes:y,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:g})}startActiveSpan(e,t,n,r){var i;let a,o,s;if(arguments.length<2)return;arguments.length===2?s=t:arguments.length===3?(a=t,s=n):(a=t,o=n,s=r);let c=(i=o)==null?A.active():i,l=this.startSpan(e,a,c),u=M.setSpan(c,l);return A.with(u,s,void 0,l)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}})),gf,_f=t((()=>{B(),F(),gf=class{constructor(e){P(this,`_spanProcessors`,void 0),this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{Si(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}}})),vf,yf,bf=t((()=>{B(),lc(),hf(),Ld(),_f(),Vd(),F(),(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(vf||(vf={})),yf=class{constructor(e={}){var t,n;P(this,`_config`,void 0),P(this,`_tracers`,new Map),P(this,`_resource`,void 0),P(this,`_activeSpanProcessor`,void 0);let r=io({},Md(),zd(e));this._resource=(t=r.resource)==null?rc():t,this._config=Object.assign({},r,{resource:this._resource});let i=[];(n=e.spanProcessors)!=null&&n.length&&i.push(...e.spanProcessors),this._activeSpanProcessor=new gf(i)}getTracer(e,t,n){let r=`${e}@${t||``}:${(n==null?void 0:n.schemaUrl)||``}`;return this._tracers.has(r)||this._tracers.set(r,new mf({name:e,version:t,schemaUrl:n==null?void 0:n.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=vf.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==vf.timeout&&(r=vf.resolved,n(r))}).catch(e=>{clearTimeout(i),r=vf.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==vf.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}})),xf,Sf=t((()=>{N(),B(),F(),H(),xf=class{constructor(e){P(this,`_exporter`,void 0),P(this,`_shutdownOnce`,void 0),P(this,`_pendingExports`,void 0),this._exporter=e,this._shutdownOnce=new wo(this._shutdown,this),this._pendingExports=new Set}forceFlush(){var e=this;return V(function*(){yield Promise.all(Array.from(e._pendingExports)),e._exporter.forceFlush&&(yield e._exporter.forceFlush())})()}onStart(e,t){}onEnd(e){if(this._shutdownOnce.isCalled||(e.spanContext().traceFlags&k.SAMPLED)===0)return;let t=this._doExport(e).catch(e=>Si(e));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}_doExport(e){var t=this;return V(function*(){if(e.resource.asyncAttributesPending){var n,r;yield(n=(r=e.resource).waitForAsyncAttributes)==null?void 0:n.call(r)}let i=yield Oo._export(t._exporter,[e]);if(i.code!==ga.SUCCESS){var a;throw(a=i.error)==null?Error(`SimpleSpanProcessor: span export failed (status ${i})`):a}})()}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}})),Cf=t((()=>{bf(),tf(),B(),F(),Sf(),Td(),Dd(),kd(),jd(),Cd()})),wf,Tf=t((()=>{N(),F(),wf=class{constructor(){P(this,`_enabled`,!1),P(this,`_currentContext`,O)}_bindFunction(e=O,t){let n=this,r=function(...r){return n.with(e,()=>t.apply(this,r))};return Object.defineProperty(r,`length`,{enumerable:!1,configurable:!0,writable:!1,value:t.length}),r}active(){return this._currentContext}bind(e,t){return e===void 0&&(e=this.active()),typeof t==`function`?this._bindFunction(e,t):t}disable(){return this._currentContext=O,this._enabled=!1,this}enable(){return this._enabled?this:(this._enabled=!0,this._currentContext=O,this)}with(e,t,n,...r){let i=this._currentContext;this._currentContext=e||O;try{return t.call(n,...r)}finally{this._currentContext=i}}}}));function Ef(e){if(e!==null){if(e===void 0){let e=new wf;e.enable(),A.setGlobalContextManager(e);return}e.enable(),A.setGlobalContextManager(e)}}function Df(e){if(e!==null){if(e===void 0){Jt.setGlobalPropagator(new va({propagators:[new Ba,new ui]}));return}Jt.setGlobalPropagator(e)}}var Of,kf=t((()=>{Cf(),Tf(),N(),B(),Of=class extends yf{constructor(e={}){super(e)}register(e={}){M.setGlobalTracerProvider(this),Df(e.propagator),Ef(e.contextManager)}}})),J,Af=t((()=>{(function(e){e.CONNECT_END=`connectEnd`,e.CONNECT_START=`connectStart`,e.DECODED_BODY_SIZE=`decodedBodySize`,e.DOM_COMPLETE=`domComplete`,e.DOM_CONTENT_LOADED_EVENT_END=`domContentLoadedEventEnd`,e.DOM_CONTENT_LOADED_EVENT_START=`domContentLoadedEventStart`,e.DOM_INTERACTIVE=`domInteractive`,e.DOMAIN_LOOKUP_END=`domainLookupEnd`,e.DOMAIN_LOOKUP_START=`domainLookupStart`,e.ENCODED_BODY_SIZE=`encodedBodySize`,e.FETCH_START=`fetchStart`,e.LOAD_EVENT_END=`loadEventEnd`,e.LOAD_EVENT_START=`loadEventStart`,e.NAVIGATION_START=`navigationStart`,e.REDIRECT_END=`redirectEnd`,e.REDIRECT_START=`redirectStart`,e.REQUEST_START=`requestStart`,e.RESPONSE_END=`responseEnd`,e.RESPONSE_START=`responseStart`,e.SECURE_CONNECTION_START=`secureConnectionStart`,e.START_TIME=`startTime`,e.UNLOAD_EVENT_END=`unloadEventEnd`,e.UNLOAD_EVENT_START=`unloadEventStart`})(J||(J={}))})),jf,Mf,Nf=t((()=>{jf=`http.response_content_length`,Mf=`http.response_content_length_uncompressed`}));function Pf(){return qf||(qf=document.createElement(`a`)),qf}function Ff(e,t){return t in e}function Y(e,t,n,r=!0){if(Ff(n,t)&&typeof n[t]==`number`&&!(r&&n[t]===0))return e.addEvent(t,n[t])}function If(e,t,n=!1,r,i){if(r===void 0&&(r=t[J.START_TIME]!==0),n||(Y(e,J.FETCH_START,t,r),Y(e,J.DOMAIN_LOOKUP_START,t,r),Y(e,J.DOMAIN_LOOKUP_END,t,r),Y(e,J.CONNECT_START,t,r),Y(e,J.SECURE_CONNECTION_START,t,r),Y(e,J.CONNECT_END,t,r),Y(e,J.REQUEST_START,t,r),Y(e,J.RESPONSE_START,t,r),Y(e,J.RESPONSE_END,t,r)),!i){let n=t[J.ENCODED_BODY_SIZE];n!==void 0&&e.setAttribute(jf,n);let r=t[J.DECODED_BODY_SIZE];r!==void 0&&n!==r&&e.setAttribute(Mf,r)}}function Lf(e){return e.slice().sort((e,t)=>{let n=e[J.FETCH_START],r=t[J.FETCH_START];return n>r?1:n<r?-1:0})}function Rf(){return typeof location<`u`?location.origin:void 0}function zf(e,t,n,r,i=new WeakSet,a){let o=Hf(e);e=o.toString();let s=Vf(e,t,n,r,i,a);if(s.length===0)return{mainRequest:void 0};if(s.length===1)return{mainRequest:s[0]};let c=Lf(s);if(o.origin!==Rf()&&c.length>1){let e=c[0],t=Bf(c,e[J.RESPONSE_END],n),r=e[J.RESPONSE_END];return t[J.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}else return{mainRequest:s[0]}}function Bf(e,t,n){let r=sa(n),i=sa(aa(t)),a=e[1],o,s=e.length;for(let t=1;t<s;t++){let n=e[t],s=sa(aa(n[J.FETCH_START])),c=r-sa(aa(n[J.RESPONSE_END]));s>=i&&(!o||c<o)&&(o=c,a=n)}return a}function Vf(e,t,n,r,i,a){let o=sa(t),s=sa(n),c=r.filter(t=>{let n=sa(aa(t[J.FETCH_START])),r=sa(aa(t[J.RESPONSE_END]));return t.initiatorType.toLowerCase()===(a||`xmlhttprequest`)&&t.name===e&&n>=o&&r<=s});return c.length>0&&(c=c.filter(e=>!i.has(e))),c}function Hf(e){if(typeof URL==`function`)return new URL(e,typeof document<`u`?document.baseURI:typeof location<`u`?location.href:void 0);let t=Pf();return t.href=e,t}function Uf(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return`/`;let n=Gf(e,t);if(t&&n.indexOf(`@id`)>0)return n;let r=``;return e.parentNode&&(r+=Uf(e.parentNode,t)),r+=n,r}function Wf(e){if(!e.parentNode)return 0;let t=[e.nodeType];e.nodeType===Node.CDATA_SECTION_NODE&&t.push(Node.TEXT_NODE);let n=Array.from(e.parentNode.childNodes);return n=n.filter(n=>{let r=n.localName;return t.indexOf(n.nodeType)>=0&&r===e.localName}),n.length>=1?n.indexOf(e)+1:0}function Gf(e,t){let n=e.nodeType,r=Wf(e),i=``;if(n===Node.ELEMENT_NODE){let n=e.getAttribute(`id`);if(t&&n)return`//*[@id="${n}"]`;i=e.localName}else if(n===Node.TEXT_NODE||n===Node.CDATA_SECTION_NODE)i=`text()`;else if(n===Node.COMMENT_NODE)i=`comment()`;else return``;return i&&r>1?`/${i}[${r}]`:`/${i}`}function Kf(e,t){let n=t||[];return(typeof n==`string`||n instanceof RegExp)&&(n=[n]),Hf(e).origin===Rf()?!0:n.some(t=>yo(e,t))}var qf,Jf=t((()=>{Af(),B(),Nf()})),Yf=t((()=>{kf(),Tf(),Af(),Jf(),Cf()}));Qu(),Yf();var X={actionType:`action.type`,deploymentEnvironmentName:`deployment.environment.name`,browserName:`browser_name`,browserVersion:`browser_version`,cacheHit:`cache_hit`,deviceType:`device_type`,durationBucket:`duration_bucket`,errorType:`error_type`,eventLabel:`event_label`,exceptionFingerprint:`exception.fingerprint`,exceptionMessageShort:`exception.message_short`,exceptionStackTopFrame:`exception.stack_top_frame`,longtaskAttributionScript:`longtask.attribution_script`,longtaskBlockingDuration:`longtask.blocking_duration`,networkEffectiveType:`network.effective_type`,nextHopProtocol:`next_hop_protocol`,result:`result`,serviceName:`service.name`,serviceVersion:`service.version`,osName:`os_name`,sessionHasReplay:`session.has_replay`,sessionId:`session.id`,sessionStartTime:`session.start_time`,spanSubtype:`span_subtype`,spanType:`span_type`,statusClass:`status_class`,targetDomain:`target_domain`,targetLabel:`target_label`,targetPathTemplate:`target_path_template`,targetTag:`target.tag`,targetTextShort:`target.text_short`,targetValue:`target_value`,traceScene:`trace_scene`,transferSize:`transfer_size`,userId:`user.id`,vitalMetric:`vital.metric`,vitalRating:`vital.rating`,vitalValue:`vital.value`,viewId:`view.id`,viewLoadingType:`view.loading_type`,viewUrl:`view.url`,viewUrlPathGroup:`view.url_path_group`};G();var Z={abort:`abort`,error:`error`,success:`success`,timeout:`timeout`,warning:`warning`},Q={action:`action`,custom:`custom`,document:`document`,error:`error`,http:`http`,longtask:`longtask`,resource:`resource`,route:`route`,vital:`vital`},Xf=e=>e<100?`<100ms`:e<500?`100~500ms`:e<2e3?`500ms~2s`:`>2s`,Zf=e=>`${Math.trunc(e/100)}xx`,Qf=e=>e===408||e===504?Z.timeout:typeof e==`number`&&e>=400?Z.error:Z.success,$f=e=>e===408||e===504?`network_timeout`:typeof e!=`number`||e<400?`none`:e>=500?`http_5xx`:`http_4xx`,ep=e=>e===`good`?Z.success:Z.warning,tp=(e,t)=>{if(!e)return{};try{let n=new URL(e,typeof location>`u`?`http://localhost`:location.href),r=t==null?n.pathname:t;return{domain:n.host,label:`${n.host}${r}`,pathTemplate:r}}catch(n){return{label:e,pathTemplate:t==null?e:t}}},$=({duration:e,errorType:t=`none`,eventLabel:n,result:r=Z.success,spanSubtype:i,spanType:a,targetLabel:o,targetValue:s,traceScene:c})=>W(W(W(W(W({[X.spanType]:a,[X.spanSubtype]:i,[X.result]:r,[X.errorType]:t},e===void 0?{}:{[X.durationBucket]:Xf(e)}),n===void 0?{}:{[X.eventLabel]:n}),o===void 0?{}:{[X.targetLabel]:o}),s===void 0?{}:{[X.targetValue]:s}),c===void 0?{}:{[X.traceScene]:c}),np=({duration:e,method:t,statusCode:n,subtype:r,url:i,urlPathTemplate:a})=>{let o=tp(i,a);return W(W(W(W(W({},$({duration:e,errorType:$f(n),eventLabel:`API 调用`,result:Qf(n),spanSubtype:r,spanType:Q.http,targetLabel:o.label,targetValue:n})),t?{"http.request.method":t.toUpperCase()}:{}),o.domain?{[X.targetDomain]:o.domain}:{}),o.pathTemplate?{[X.targetPathTemplate]:o.pathTemplate}:{}),typeof n==`number`?{"http.response.status_code":n,[X.statusClass]:Zf(n)}:{})},rp=({duration:e,initiatorType:t=`other`,responseStatus:n,transferSize:r,url:i,urlPathTemplate:a})=>{var o;let s=tp(i,a),c=typeof n==`number`?Qf(n):Z.success;return W(W(W(W({},$({duration:e,errorType:typeof n==`number`?$f(n):`none`,eventLabel:`静态资源`,result:c,spanSubtype:t,spanType:Q.resource,targetLabel:(o=s.label)==null?i:o,targetValue:r})),s.domain?{[X.targetDomain]:s.domain}:{}),s.pathTemplate?{[X.targetPathTemplate]:s.pathTemplate}:{}),typeof n==`number`?{"http.response.status_code":n,[X.statusClass]:Zf(n)}:{})};G();var ip=e=>e instanceof Element?e:void 0,ap=e=>{var t;if(!e)return;let n=((t=e.textContent)==null?void 0:t.trim())||e.getAttribute(`aria-label`)||e.getAttribute(`title`)||``;return n?n.slice(0,32):void 0},op=e=>{let t=[];return{name:`action`,enabled:e.enabled,init(n){if(typeof window>`u`)return;let r={capture:!0,passive:!0},i=e=>{var t;let r=ip(e.target),i=ap(r),a=r==null?void 0:r.tagName.toLowerCase();n.startSpan(`action.${e.type}`,W(W(W(W({},n.config.hooks.getPageAttributes()),$({errorType:`none`,eventLabel:`用户操作`,spanSubtype:e.type,spanType:Q.action,targetLabel:(t=i==null?a:i)==null?e.type:t})),{},{[X.actionType]:e.type},i?{[X.targetTextShort]:i}:{}),a?{[X.targetTag]:a}:{})).end()};for(let n of e.enabled?e.eventNames:[])window.addEventListener(n,i,r),t.push(()=>window.removeEventListener(n,i,r))},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}};G();var sp=`body`,cp=3e3,lp=.8,up=[`[data-loading="true"]`,`[aria-busy="true"]`,`.loading`,`.is-loading`,`.spinner`,`.skeleton`,`.bk-loading`],dp=[[.5,.5],[.25,.25],[.75,.25],[.25,.75],[.75,.75]],fp=e=>{if(!e)return``;let t=e.tagName.toLowerCase();return e.id?`${t}#${e.id}`:t},pp=(e,t)=>e?t.some(t=>{try{return e.matches(t)||!!e.closest(t)}catch(e){return!1}}):!1,mp=e=>{if(typeof document>`u`)return()=>{};if(document.readyState===`complete`||document.readyState===`interactive`)return e(),()=>{};let t=()=>{document.removeEventListener(`DOMContentLoaded`,t),e()};return document.addEventListener(`DOMContentLoaded`,t),()=>document.removeEventListener(`DOMContentLoaded`,t)},hp=e=>{let t,n,r=!1;return{name:`blank-screen`,enabled:e.enabled,init(i){var a,o;if(typeof window>`u`||typeof document>`u`)return;let s=e.enabled?(a=e.rootSelector)==null?sp:a:sp,c=e.enabled?e.checkDelay:cp,l=e.enabled?e.threshold:lp,u=[...up,...e.enabled?(o=e.ignoreSelectors)==null?[]:o:[]],d=i.meter.createCounter(`browser.blank_screen.count`,{description:`Number of suspected blank screen detections`}),f=()=>{try{var e,t;let n=document.querySelector(s),r=0,a=0;for(let[e,t]of dp){let i=document.elementFromPoint(window.innerWidth*e,window.innerHeight*t);if(pp(i,u)){a+=1;continue}(i===n||i===document.body||i===document.documentElement)&&(r+=1)}let o=dp.length-a;if(o===0)return;let c=r/o,f=c>=l,p=fp(document.elementFromPoint(window.innerWidth/2,window.innerHeight/2)),m=W(W({},$({errorType:f?`blank_screen`:`none`,eventLabel:`白屏`,result:f?Z.error:Z.success,spanSubtype:`blank_screen`,spanType:Q.error,targetLabel:s,targetValue:c})),{},{"blank_screen.score":c,"blank_screen.threshold":l,"blank_screen.root":s,"blank_screen.detected":f,"blank_screen.sample_total":dp.length,"blank_screen.sample_valid":o,"blank_screen.sample_loading":a,"blank_screen.center_element":p,"blank_screen.dom_node_count":(e=(t=document.body)==null?void 0:t.getElementsByTagName(`*`).length)==null?0:e});f&&(d.add(1,i.applyRedact({"blank_screen.root":s})),i.startSpan(`browser.blank_screen`,m).end())}catch(e){if(i.config.debug){var n;(n=globalThis.console)==null||n.warn(`[bk-ot][blank-screen] detection failed:`,e)}}};n=mp(()=>{r||(t=window.setTimeout(f,c))})},shutdown(){r=!0,n==null||n(),n=void 0,t!==void 0&&typeof window<`u`&&(window.clearTimeout(t),t=void 0)}}},gp=()=>typeof window>`u`?`http://localhost`:window.location.origin,_p=e=>{try{return new URL(e,gp()).href}catch(t){return e}},vp=e=>e.length>1?e.replace(/\/+$/,``):e,yp=(e,t)=>{let n=e=>vp(e.replace(/[?#].*$/,``));return n(e)===n(t)},bp=e=>{try{return new URL(e,gp()).origin===gp()}catch(e){return!1}},xp=(e,t)=>{let n=_p(t);return[e.transport.traces.endpoint,e.transport.metrics.endpoint,e.transport.logs.endpoint].some(e=>yp(n,_p(e)))},Sp=(e,t)=>xp(e,t),Cp=(e,t)=>bp(t),wp,Tp=t((()=>{(function(e){e.DOCUMENT_LOAD=`documentLoad`,e.DOCUMENT_FETCH=`documentFetch`,e.RESOURCE_FETCH=`resourceFetch`})(wp||(wp={}))})),Ep,Dp,Op=t((()=>{Ep=`0.62.0`,Dp=`@opentelemetry/instrumentation-document-load`})),kp,Ap,jp=t((()=>{kp=`http.url`,Ap=`http.user_agent`})),Mp,Np=t((()=>{(function(e){e.FIRST_PAINT=`firstPaint`,e.FIRST_CONTENTFUL_PAINT=`firstContentfulPaint`})(Mp||(Mp={}))})),Pp,Fp,Ip,Lp=t((()=>{B(),Np(),Pp=()=>{var e;let t={},n=(e=z.getEntriesByType)==null?void 0:e.call(z,`navigation`)[0];if(n)Object.values(J).forEach(e=>{if(Ff(n,e)){let r=n[e];typeof r==`number`&&(t[e]=r)}});else{let e=z.timing;e&&Object.values(J).forEach(n=>{if(Ff(e,n)){let r=e[n];typeof r==`number`&&(t[n]=r)}})}return t},Fp={"first-paint":Mp.FIRST_PAINT,"first-contentful-paint":Mp.FIRST_CONTENTFUL_PAINT},Ip=e=>{var t;let n=(t=z.getEntriesByType)==null?void 0:t.call(z,`paint`);n&&n.forEach(({name:t,startTime:n})=>{Ff(Fp,t)&&e.addEvent(Fp[t],n)})}})),Rp,zp=t((()=>{N(),B(),Yf(),Zi(),Tp(),Op(),jp(),Lp(),F(),Rp=class extends Gu{constructor(e={}){super(Dp,Ep,e),P(this,`component`,`document-load`),P(this,`version`,`1`),P(this,`moduleName`,this.component),P(this,`_semconvStability`,void 0),this._semconvStability=Xu(`http`,e==null?void 0:e.semconvStabilityOptIn)}init(){}_onDocumentLoaded(){window.setTimeout(()=>{this._collectPerformance()})}_addResourcesSpans(e){var t;let n=(t=z.getEntriesByType)==null?void 0:t.call(z,`resource`);n&&n.forEach(t=>{this._initResourceSpan(t,e)})}_collectPerformance(){let e=Array.from(document.getElementsByTagName(`meta`)).find(e=>e.getAttribute(`name`)===Ia),t=Pp(),n=e&&e.content||``;A.with(Jt.extract(O,{traceparent:n}),()=>{var e;let n=this._startSpan(wp.DOCUMENT_LOAD,J.FETCH_START,t);n&&(A.with(M.setSpan(A.active(),n),()=>{let e=this._startSpan(wp.DOCUMENT_FETCH,J.FETCH_START,t);e&&(this._semconvStability&q.OLD&&e.setAttribute(kp,location.href),this._semconvStability&q.STABLE&&e.setAttribute(Ki,location.href),A.with(M.setSpan(A.active(),e),()=>{var n;let r=!(this._semconvStability&q.OLD);If(e,t,this.getConfig().ignoreNetworkEvents,void 0,r),this._addCustomAttributesOnSpan(e,(n=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:n.documentFetch),this._endSpan(e,J.RESPONSE_END,t)}))}),this._semconvStability&q.OLD&&(n.setAttribute(kp,location.href),n.setAttribute(Ap,navigator.userAgent)),this._semconvStability&q.STABLE&&(n.setAttribute(Ki,location.href),n.setAttribute(qi,navigator.userAgent)),this._addResourcesSpans(n),this.getConfig().ignoreNetworkEvents||(Y(n,J.FETCH_START,t),Y(n,J.UNLOAD_EVENT_START,t),Y(n,J.UNLOAD_EVENT_END,t),Y(n,J.DOM_INTERACTIVE,t),Y(n,J.DOM_CONTENT_LOADED_EVENT_START,t),Y(n,J.DOM_CONTENT_LOADED_EVENT_END,t),Y(n,J.DOM_COMPLETE,t),Y(n,J.LOAD_EVENT_START,t),Y(n,J.LOAD_EVENT_END,t)),this.getConfig().ignorePerformancePaintEvents||Ip(n),this._addCustomAttributesOnSpan(n,(e=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:e.documentLoad),this._endSpan(n,J.LOAD_EVENT_END,t))})}_endSpan(e,t,n){e&&(Ff(n,t)?e.end(n[t]):e.end())}_initResourceSpan(e,t){let n=this._startSpan(wp.RESOURCE_FETCH,J.FETCH_START,e,t);if(n){var r;this._semconvStability&q.OLD&&n.setAttribute(kp,e.name),this._semconvStability&q.STABLE&&n.setAttribute(Ki,e.name);let t=!(this._semconvStability&q.OLD);If(n,e,this.getConfig().ignoreNetworkEvents,void 0,t),this._addCustomAttributesOnResourceSpan(n,e,(r=this.getConfig().applyCustomAttributesOnSpan)==null?void 0:r.resourceFetch),this._endSpan(n,J.RESPONSE_END,e)}}_startSpan(e,t,n,r){if(Ff(n,t)&&typeof n[t]==`number`)return this.tracer.startSpan(e,{startTime:n[t]},r?M.setSpan(A.active(),r):void 0)}_waitForPageLoad(){window.document.readyState===`complete`?this._onDocumentLoaded():(this._onDocumentLoaded=this._onDocumentLoaded.bind(this),window.addEventListener(`load`,this._onDocumentLoaded))}_addCustomAttributesOnSpan(e,t){t&&Ju(()=>t(e),e=>{e&&this._diag.error(`addCustomAttributesOnSpan`,e)},!0)}_addCustomAttributesOnResourceSpan(e,t,n){n&&Ju(()=>n(e,t),e=>{e&&this._diag.error(`addCustomAttributesOnResourceSpan`,e)},!0)}enable(){window.removeEventListener(`load`,this._onDocumentLoaded),this._waitForPageLoad()}disable(){window.removeEventListener(`load`,this._onDocumentLoaded)}}})),Bp=n({AttributeNames:()=>wp,DocumentLoadInstrumentation:()=>Rp}),Vp=t((()=>{zp(),Tp()})),Hp,Up=t((()=>{(function(e){e.COMPONENT=`component`,e.HTTP_STATUS_TEXT=`http.status_text`})(Hp||(Hp={}))})),Wp,Gp,Kp,qp,Jp,Yp,Xp,Zp,Qp=t((()=>{Wp=`http.host`,Gp=`http.method`,Kp=`http.request.body.size`,qp=`http.request_content_length_uncompressed`,Jp=`http.scheme`,Yp=`http.status_code`,Xp=`http.url`,Zp=`http.user_agent`}));function $p(...e){if(e[0]instanceof URL||typeof e[0]==`string`){let t=e[1];if(!(t!=null&&t.body))return Promise.resolve();if(t.body instanceof ReadableStream){let{body:e,length:n}=em(t.body);return t.body=e,n}else return Promise.resolve(nm(t.body))}else{let t=e[0];return t!=null&&t.body?t.clone().text().then(e=>rm(e)):Promise.resolve()}}function em(e){if(!e.pipeThrough)return cm.warn(`Platform has ReadableStream but not pipeThrough!`),{body:e,length:Promise.resolve(void 0)};let t=0,n,r=new Promise(e=>{n=e}),i=new TransformStream({start(){},transform(e,n){return V(function*(){let r=yield e;t+=r.byteLength,n.enqueue(e)})()},flush(){n(t)}});return{body:e.pipeThrough(i),length:r}}function tm(e){return typeof Document<`u`&&e instanceof Document}function nm(e){if(tm(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return rm(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return im(e);if(e instanceof URLSearchParams)return rm(e.toString());if(e.byteLength!==void 0)return e.byteLength;cm.warn(`unknown body type`)}function rm(e){return lm.encode(e).byteLength}function im(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function am(e){let t=om(),n=e.toUpperCase();return n in t?n:`_OTHER`}function om(){return dm===void 0&&(dm=um),dm}function sm(e){let t=Number(e.port||fm[e.protocol]);if(t&&!isNaN(t))return t}var cm,lm,um,dm,fm,pm=t((()=>{N(),B(),H(),cm=j.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-fetch/utils`}),lm=new TextEncoder,um={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},fm={"https:":`443`,"http:":`80`}})),mm,hm=t((()=>{mm=`0.217.0`})),gm,_m,vm,ym=t((()=>{N(),Qu(),B(),Yf(),Up(),Qp(),Zi(),pm(),hm(),F(),gm=300,_m=typeof PerformanceObserver<`u`,vm=class extends Gu{constructor(e={}){super(`@opentelemetry/instrumentation-fetch`,mm,e),P(this,`component`,`fetch`),P(this,`version`,mm),P(this,`moduleName`,this.component),P(this,`_usedResources`,new WeakSet),P(this,`_tasksCount`,0),P(this,`_semconvStability`,void 0),this._semconvStability=Xu(`http`,e==null?void 0:e.semconvStabilityOptIn)}init(){}_addChildSpan(e,t){let n=this.tracer.startSpan(`CORS Preflight`,{startTime:t[J.FETCH_START]},M.setSpan(A.active(),e)),r=!(this._semconvStability&q.OLD);If(n,t,this.getConfig().ignoreNetworkEvents,void 0,r),n.end(t[J.RESPONSE_END])}_addFinalSpanAttributes(e,t){let n=Hf(t.url);if(this._semconvStability&q.OLD&&(e.setAttribute(Yp,t.status),t.statusText!=null&&e.setAttribute(Hp.HTTP_STATUS_TEXT,t.statusText),e.setAttribute(Wp,n.host),e.setAttribute(Jp,n.protocol.replace(`:`,``)),typeof navigator<`u`&&e.setAttribute(Zp,navigator.userAgent)),this._semconvStability&q.STABLE){e.setAttribute(Ri,t.status),e.setAttribute(zi,n.hostname);let r=sm(n);r&&e.setAttribute(Bi,r)}}_addHeaders(e,t){if(!Kf(t,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};Jt.inject(A.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}if(e instanceof Request)Jt.inject(A.active(),e.headers,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))});else{let t=new Headers(e.headers);Jt.inject(A.active(),t,{set:(e,t,n)=>e.set(t,typeof n==`string`?n:String(n))}),e.headers=t}}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(e,t={}){if(bo(e,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let n=``,r={};if(this._semconvStability&q.OLD){let i=(t.method||`GET`).toUpperCase();n=`HTTP ${i}`,r[Hp.COMPONENT]=this.moduleName,r[Gp]=i,r[Xp]=e}if(this._semconvStability&q.STABLE){let i=t.method,a=am(t.method||`GET`);n||(n=a),r[Ii]=a,a!==i&&(r[Li]=i),r[Ki]=e}return this.tracer.startSpan(n,{kind:St.CLIENT,attributes:r})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType(`resource`)}let i=zf(t.spanUrl,t.startTime,n,r,this._usedResources,`fetch`);if(i.mainRequest){let t=i.mainRequest;this._markResourceAsUsed(t);let n=i.corsPreFlightRequest;n&&(this._addChildSpan(e,n),this._markResourceAsUsed(n));let r=!(this._semconvStability&q.OLD);If(e,t,this.getConfig().ignoreNetworkEvents,void 0,r)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){let r=ra(Date.now()),i=ia();this._addFinalSpanAttributes(e,n),this._semconvStability&q.STABLE&&n.status>=400&&(e.setStatus({code:wt.ERROR}),e.setAttribute(Mi,String(n.status))),setTimeout(()=>{var n;(n=t.observer)==null||n.disconnect(),this._findResourceAndAddNetworkEvents(e,t,i),this._tasksCount--,this._clearResources(),e.end(r)},gm)}_patchConstructor(){return e=>{let t=this;return function(...n){if(!t._isEnabled)return e.apply(this,n);let r=this,i=Hf(n[0]instanceof Request?n[0].url:String(n[0])).href,a;a=n[0]instanceof Request?n[1]==null?n[0]:new Request(n[0],n[1]):n[1]||{};let o=t._createSpan(i,a);if(!o)return e.apply(this,n);let s=t._prepareSpanData(i);t.getConfig().measureRequestSize&&$p(...n).then(e=>{e&&(t._semconvStability&q.OLD&&o.setAttribute(qp,e),t._semconvStability&q.STABLE&&o.setAttribute(Kp,e))}).catch(e=>{t._diag.warn(`getFetchBodyLength`,e)});function c(e,n){t._applyAttributesAfterFetch(e,a,n),t._endSpan(e,s,{status:n.status||0,statusText:n.message,url:i})}function l(e,n){t._applyAttributesAfterFetch(e,a,n),n.status>=200&&n.status<400?t._endSpan(e,s,n):t._endSpan(e,s,{status:n.status,statusText:n.statusText,url:i})}function u(e,n){try{let t=n.clone().body;if(t){let r=t.getReader(),i=()=>{r.read().then(({done:t})=>{t?l(e,n):i()},t=>{c(e,t)})};i()}else l(e,n)}catch(n){t._diag.error(`Failed to read fetch response body`,n),t._endSpan(e,s,{status:0,url:i})}return n}function d(e,n){try{c(e,n)}catch(r){t._diag.error(`Failed to end span on fetch error`,r),t._endSpan(e,s,{status:n.status||0,url:i})}throw n}return A.with(M.setSpan(A.active(),o),()=>(t._callRequestHook(o,a),t._addHeaders(a,i),t._tasksCount++,e.apply(r,a instanceof Request?[a]:[i,a]).then(u.bind(r,o),d.bind(r,o))))}}}_applyAttributesAfterFetch(e,t,n){let r=this.getConfig().applyCustomAttributesOnSpan;r&&Ju(()=>r(e,t,n),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_callRequestHook(e,t){let n=this.getConfig().requestHook;n&&Ju(()=>n(e,t),e=>{e&&this._diag.error(`requestHook`,e)},!0)}_prepareSpanData(e){let t=ia(),n=[];if(typeof PerformanceObserver!=`function`)return{entries:n,startTime:t,spanUrl:e};let r=new PerformanceObserver(t=>{t.getEntries().forEach(t=>{t.initiatorType===`fetch`&&t.name===e&&n.push(t)})});return r.observe({entryTypes:[`resource`]}),{entries:n,observer:r,startTime:t,spanUrl:e}}enable(){if(!_m){this._diag.warn(`this instrumentation is intended for web usage only, it does not instrument server-side fetch()`);return}if(!this._isEnabled){if(this._isFetchPatched){this._diag.debug(`fetch constructor already patched`),this._isEnabled=!0;return}try{this._wrap(globalThis,`fetch`,this._patchConstructor()),this._isFetchPatched=!0,this._isEnabled=!0}catch(e){this._diag.warn(`Failed to patch globalThis.fetch; instrumentation will not be enabled. Another script may have locked globalThis.fetch via Object.defineProperty.`,e)}}}disable(){_m&&this._isEnabled&&(this._isEnabled=!1,this._usedResources=new WeakSet)}}})),bm=n({FetchInstrumentation:()=>vm}),xm=t((()=>{ym()})),Sm,Cm,wm,Tm,Em,Dm,Om,km,Am=t((()=>{Sm=`http.host`,Cm=`http.method`,wm=`http.request.body.size`,Tm=`http.request_content_length_uncompressed`,Em=`http.scheme`,Dm=`http.status_code`,Om=`http.url`,km=`http.user_agent`})),jm,Mm=t((()=>{(function(e){e.METHOD_OPEN=`open`,e.METHOD_SEND=`send`,e.EVENT_ABORT=`abort`,e.EVENT_ERROR=`error`,e.EVENT_LOAD=`loaded`,e.EVENT_TIMEOUT=`timeout`})(jm||(jm={}))}));function Nm(e){return typeof Document<`u`&&e instanceof Document}function Pm(e){if(Nm(e))return new XMLSerializer().serializeToString(document).length;if(typeof e==`string`)return Fm(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return Im(e);if(e instanceof URLSearchParams)return Fm(e.toString());if(e.byteLength!==void 0)return e.byteLength;Bm.warn(`unknown body type`)}function Fm(e){return Vm.encode(e).byteLength}function Im(e){let t=0;for(let[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}function Lm(e){let t=Rm(),n=e.toUpperCase();return n in t?n:`_OTHER`}function Rm(){return Um===void 0&&(Um=Hm),Um}function zm(e){let t=Number(e.port||Wm[e.protocol]);if(t&&!isNaN(t))return t}var Bm,Vm,Hm,Um,Wm,Gm=t((()=>{N(),B(),Bm=j.createComponentLogger({namespace:`@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils`}),Vm=new TextEncoder,Hm={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0,QUERY:!0},Wm={"https:":`443`,"http:":`80`}})),Km,qm=t((()=>{Km=`0.217.0`})),Jm,Ym=t((()=>{(function(e){e.HTTP_STATUS_TEXT=`http.status_text`})(Jm||(Jm={}))})),Xm,Zm,Qm=t((()=>{N(),Qu(),B(),Yf(),Zi(),Am(),Mm(),Gm(),qm(),Ym(),F(),Xm=300,Zm=class extends Gu{constructor(e={}){super(`@opentelemetry/instrumentation-xml-http-request`,Km,e),P(this,`component`,`xml-http-request`),P(this,`version`,Km),P(this,`moduleName`,this.component),P(this,`_tasksCount`,0),P(this,`_xhrMem`,new WeakMap),P(this,`_usedResources`,new WeakSet),P(this,`_semconvStability`,void 0),this._semconvStability=Xu(`http`,e==null?void 0:e.semconvStabilityOptIn)}init(){}_addHeaders(e,t){let n=Hf(t).href;if(!Kf(n,this.getConfig().propagateTraceHeaderCorsUrls)){let e={};Jt.inject(A.active(),e),Object.keys(e).length>0&&this._diag.debug(`headers inject skipped due to CORS policy`);return}let r={};Jt.inject(A.active(),r),Object.keys(r).forEach(t=>{e.setRequestHeader(t,String(r[t]))})}_addChildSpan(e,t){A.with(M.setSpan(A.active(),e),()=>{let e=this.tracer.startSpan(`CORS Preflight`,{startTime:t[J.FETCH_START]}),n=!(this._semconvStability&q.OLD);If(e,t,this.getConfig().ignoreNetworkEvents,void 0,n),e.end(t[J.RESPONSE_END])})}_addFinalSpanAttributes(e,t,n){if(this._semconvStability&q.OLD){if(t.status!==void 0&&e.setAttribute(Dm,t.status),t.statusText!==void 0&&e.setAttribute(Jm.HTTP_STATUS_TEXT,t.statusText),typeof n==`string`){let t=Hf(n);e.setAttribute(Sm,t.host),e.setAttribute(Em,t.protocol.replace(`:`,``))}e.setAttribute(km,navigator.userAgent)}this._semconvStability&q.STABLE&&t.status&&e.setAttribute(Ri,t.status)}_applyAttributesAfterXHR(e,t){let n=this.getConfig().applyCustomAttributesOnSpan;typeof n==`function`&&Ju(()=>n(e,t),e=>{e&&this._diag.error(`applyCustomAttributesOnSpan`,e)},!0)}_addResourceObserver(e,t){let n=this._xhrMem.get(e);!n||typeof PerformanceObserver!=`function`||typeof PerformanceResourceTiming!=`function`||(n.createdResources={observer:new PerformanceObserver(e=>{let r=e.getEntries(),i=Hf(t);r.forEach(e=>{e.initiatorType===`xmlhttprequest`&&e.name===i.href&&n.createdResources&&n.createdResources.entries.push(e)})}),entries:[]},n.createdResources.observer.observe({entryTypes:[`resource`]}))}_clearResources(){this._tasksCount===0&&this.getConfig().clearTimingResources&&(z.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(e,t,n,r,i){if(!n||!r||!i||!e.createdResources)return;let a=e.createdResources.entries;(!a||!a.length)&&(a=z.getEntriesByType(`resource`));let o=zf(Hf(n).href,r,i,a,this._usedResources);if(o.mainRequest){let e=o.mainRequest;this._markResourceAsUsed(e);let n=o.corsPreFlightRequest;n&&(this._addChildSpan(t,n),this._markResourceAsUsed(n));let r=!(this._semconvStability&q.OLD);If(t,e,this.getConfig().ignoreNetworkEvents,void 0,r)}}_cleanPreviousSpanInformation(e){let t=this._xhrMem.get(e);if(t){let n=t.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(e)}}_createSpan(e,t,n){let r=Hf(t);if(bo(r.href,this.getConfig().ignoreUrls)){this._diag.debug(`ignoring span as url matches ignored url`);return}let i=``,a={};if(this._semconvStability&q.OLD&&(i=n.toUpperCase(),a[Cm]=n,a[Om]=r.toString()),this._semconvStability&q.STABLE){let e=n,t=Lm(n);i||(i=t),a[Ii]=t,t!==e&&(a[Li]=e),a[Ki]=r.toString(),a[zi]=r.hostname;let o=zm(r);o&&(a[Bi]=o)}let o=this.tracer.startSpan(i,{kind:St.CLIENT,attributes:a});return o.addEvent(jm.METHOD_OPEN),this._cleanPreviousSpanInformation(e),this._xhrMem.set(e,{span:o,spanUrl:t}),o}_markResourceAsUsed(e){this._usedResources.add(e)}_patchOpen(){return e=>{let t=this;return function(...n){if(!t._isEnabled)return e.apply(this,n);let r=n[0],i=n[1];return t._createSpan(this,i,r),e.apply(this,n)}}}_patchSend(){let e=this;function t(t,n,r,i){let a=n.callbackToRemoveEvents;typeof a==`function`&&a();let{span:o,spanUrl:s,sendStartTime:c}=n;o&&(e._findResourceAndAddNetworkEvents(n,o,s,c,r),o.addEvent(t,i),e._addFinalSpanAttributes(o,n,s),o.end(i),e._tasksCount--),e._clearResources()}function n(n,r,i,a){let o=e._xhrMem.get(r);if(!o)return;if(o.status=r.status,o.statusText=r.statusText,e._xhrMem.delete(r),o.span){let t=o.span;e._applyAttributesAfterXHR(t,r),e._semconvStability&q.STABLE&&(i?a&&(t.setStatus({code:wt.ERROR,message:a}),t.setAttribute(Mi,a)):o.status&&o.status>=400&&(t.setStatus({code:wt.ERROR}),t.setAttribute(Mi,String(o.status))))}let s=ia(),c=Date.now();setTimeout(()=>{t(n,o,s,c)},Xm)}function r(){n(jm.EVENT_ERROR,this,!0,`error`)}function i(){n(jm.EVENT_ABORT,this,!1)}function a(){n(jm.EVENT_TIMEOUT,this,!0,`timeout`)}function o(){this.status<299?n(jm.EVENT_LOAD,this,!1):n(jm.EVENT_ERROR,this,!1)}function s(t){t.removeEventListener(`abort`,i),t.removeEventListener(`error`,r),t.removeEventListener(`load`,o),t.removeEventListener(`timeout`,a);let n=e._xhrMem.get(t);n&&(n.callbackToRemoveEvents=void 0)}return t=>function(...n){if(!e._isEnabled)return t.apply(this,n);let c=e._xhrMem.get(this);if(!c)return t.apply(this,n);let l=c.span,u=c.spanUrl;if(l&&u){if(e.getConfig().measureRequestSize&&n!=null&&n[0]){let t=n[0],r=Pm(t);r!==void 0&&(e._semconvStability&q.OLD&&l.setAttribute(Tm,r),e._semconvStability&q.STABLE&&l.setAttribute(wm,r))}A.with(M.setSpan(A.active(),l),()=>{e._tasksCount++,c.sendStartTime=ia(),l.addEvent(jm.METHOD_SEND),this.addEventListener(`abort`,i),this.addEventListener(`error`,r),this.addEventListener(`load`,o),this.addEventListener(`timeout`,a),c.callbackToRemoveEvents=()=>{s(this),c.createdResources&&c.createdResources.observer.disconnect()},e._addHeaders(this,u),e._addResourceObserver(this,u)})}return t.apply(this,n)}}enable(){if(!this._isEnabled){if(this._isXhrPatched){this._diag.debug(`reactivating existing patch on`,this.moduleName,this.version),this._isEnabled=!0;return}try{this._diag.debug(`applying patch to`,this.moduleName,this.version),this._wrap(XMLHttpRequest.prototype,`open`,this._patchOpen()),this._wrap(XMLHttpRequest.prototype,`send`,this._patchSend()),this._isXhrPatched=!0,this._isEnabled=!0}catch(e){this._unwrap(XMLHttpRequest.prototype,`open`),this._unwrap(XMLHttpRequest.prototype,`send`),this._diag.warn(`Failed to patch globalThis.XMLHttpRequest; instrumentation will not be enabled. Another script may have locked globalThis.XMLHttpRequest via Object.defineProperty.`,e)}}}disable(){this._isEnabled&&(this._isEnabled=!1,this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}}})),$m=n({XMLHttpRequestInstrumentation:()=>Zm}),eh=t((()=>{Qm()})),th,nh=t((()=>{(function(e){e.EVENT_TYPE=`event_type`,e.TARGET_ELEMENT=`target_element`,e.TARGET_XPATH=`target_xpath`,e.HTTP_URL=`http.url`})(th||(th={}))})),rh,ih,ah=t((()=>{rh=`0.61.0`,ih=`@opentelemetry/instrumentation-user-interaction`}));function oh(){return!1}var sh,ch,lh,uh,dh=t((()=>{Qu(),N(),B(),Yf(),nh(),ah(),F(),sh=`OT_ZONE_CONTEXT`,ch=`Navigation:`,lh=[`click`],uh=class extends Gu{constructor(e={}){var t;super(ih,rh,e),P(this,`version`,rh),P(this,`moduleName`,`user-interaction`),P(this,`_spansData`,new WeakMap),P(this,`_wrappedListeners`,new WeakMap),P(this,`_eventsSpanMap`,new WeakMap),P(this,`_eventNames`,void 0),P(this,`_shouldPreventSpanCreation`,void 0),this._eventNames=new Set((t=e==null?void 0:e.eventNames)==null?lh:t),this._shouldPreventSpanCreation=typeof(e==null?void 0:e.shouldPreventSpanCreation)==`function`?e.shouldPreventSpanCreation:oh}init(){}_checkForTimeout(e,t){let n=this._spansData.get(t);n&&(e.source===`setTimeout`?n.hrTimeLastTimeout=ia():e.source!==`Promise.then`&&e.source!==`setTimeout`&&(n.hrTimeLastTimeout=void 0))}_allowEventName(e){return this._eventNames.has(e)}_createSpan(e,t,n){if(!this._isEnabled||!(e instanceof HTMLElement)||!e.getAttribute||e.hasAttribute(`disabled`)||!this._allowEventName(t))return;let r=Uf(e,!0);try{let i=this.tracer.startSpan(t,{attributes:{[th.EVENT_TYPE]:t,[th.TARGET_ELEMENT]:e.tagName,[th.TARGET_XPATH]:r,[th.HTTP_URL]:window.location.href}},n?M.setSpan(A.active(),n):void 0);return this._shouldPreventSpanCreation(t,e,i)===!0?void 0:(this._spansData.set(i,{taskCount:0}),i)}catch(e){this._diag.error(`failed to start create new user interaction span`,e)}}_decrementTask(e){let t=this._spansData.get(e);t&&(t.taskCount--,t.taskCount===0&&this._tryToEndSpan(e,t.hrTimeLastTimeout))}_getCurrentSpan(e){let t=e.get(sh);return t&&M.getSpan(t)}_incrementTask(e){let t=this._spansData.get(e);t&&t.taskCount++}addPatchedListener(e,t,n,r){let i=this._wrappedListeners.get(n);i||(i=new Map,this._wrappedListeners.set(n,i));let a=i.get(t);return a||(a=new Map,i.set(t,a)),a.has(e)?!1:(a.set(e,r),!0)}removePatchedListener(e,t,n){let r=this._wrappedListeners.get(n);if(!r)return;let i=r.get(t);if(!i)return;let a=i.get(e);return a&&(i.delete(e),i.size===0&&(r.delete(t),r.size===0&&this._wrappedListeners.delete(n))),a}_invokeListener(e,t,n){return typeof e==`function`?e.apply(t,n):e.handleEvent(n[0])}_patchAddEventListener(){let e=this;return t=>function(n,r,i){if(!r)return t.call(this,n,r,i);let a=i&&typeof i==`object`&&i.once,o=function(...t){let i,o=t[0],s=o==null?void 0:o.target;o&&(i=e._eventsSpanMap.get(o)),a&&e.removePatchedListener(this,n,r);let c=e._createSpan(s,n,i);return c?(o&&e._eventsSpanMap.set(o,c),A.with(M.setSpan(A.active(),c),()=>{let n=e._invokeListener(r,this,t);return c.end(),n})):e._invokeListener(r,this,t)};if(e.addPatchedListener(this,n,r,o))return t.call(this,n,o,i)}}_patchRemoveEventListener(){let e=this;return t=>function(n,r,i){let a=e.removePatchedListener(this,n,r);return a?t.call(this,n,a,i):t.call(this,n,r,i)}}_getPatchableEventTargets(){return window.EventTarget?[EventTarget.prototype]:[Node.prototype,Window.prototype]}_patchHistoryApi(){this._isEnabled&&(this._wrap(history,`replaceState`,this._patchHistoryMethod()),this._wrap(history,`pushState`,this._patchHistoryMethod()),this._wrap(history,`back`,this._patchHistoryMethod()),this._wrap(history,`forward`,this._patchHistoryMethod()),this._wrap(history,`go`,this._patchHistoryMethod()))}_patchHistoryMethod(){let e=this;return t=>function(...n){if(!e._isEnabled)return t.apply(this,n);let r=`${location.pathname}${location.hash}${location.search}`,i=t.apply(this,n),a=`${location.pathname}${location.hash}${location.search}`;return r!==a&&e._updateInteractionName(a),i}}_updateInteractionName(e){let t=M.getSpan(A.active());t&&typeof t.updateName==`function`&&t.updateName(`${ch} ${e}`)}_patchZoneCancelTask(){let e=this;return t=>function(n){let r=Zone.current,i=e._getCurrentSpan(r);return i&&e._shouldCountTask(n,r)&&e._decrementTask(i),t.call(this,n)}}_patchZoneScheduleTask(){let e=this;return t=>function(n){let r=Zone.current,i=e._getCurrentSpan(r);return i&&e._shouldCountTask(n,r)&&(e._incrementTask(i),e._checkForTimeout(n,i)),t.call(this,n)}}_patchZoneRunTask(){let e=this;return t=>function(n,r,i){let a=Array.isArray(i)&&i[0]instanceof Event?i[0]:void 0,o=a==null?void 0:a.target,s,c=this;if(o){if(s=e._createSpan(o,n.eventName),s)return e._incrementTask(s),c.run(()=>{try{return A.with(M.setSpan(A.active(),s),()=>{let e=Zone.current;return n._zone=e,t.call(e,n,r,i)})}finally{e._decrementTask(s)}})}else s=e._getCurrentSpan(c);try{return t.call(c,n,r,i)}finally{s&&e._shouldCountTask(n,c)&&e._decrementTask(s)}}}_shouldCountTask(e,t){if(e._zone&&(t=e._zone),!t||!e.data||e.data.isPeriodic)return!1;let n=this._getCurrentSpan(t);return!n||!this._spansData.get(n)?!1:e.type===`macroTask`||e.type===`microTask`}_tryToEndSpan(e,t){e&&this._spansData.get(e)&&(e.end(t),this._spansData.delete(e))}enable(){if(this._isEnabled||(this._isEnabled=!0,typeof this._zonePatched==`boolean`))return;let e=this._getZoneWithPrototype();this._diag.debug(`applying patch to`,this.moduleName,this.version,`zone:`,!!e),e?(this._zonePatched=!0,this._wrap(e.prototype,`runTask`,this._patchZoneRunTask()),this._wrap(e.prototype,`scheduleTask`,this._patchZoneScheduleTask()),this._wrap(e.prototype,`cancelTask`,this._patchZoneCancelTask())):(this._zonePatched=!1,this._getPatchableEventTargets().forEach(e=>{this._wrap(e,`addEventListener`,this._patchAddEventListener()),this._wrap(e,`removeEventListener`,this._patchRemoveEventListener())})),this._patchHistoryApi()}disable(){this._isEnabled&&(this._isEnabled=!1)}_getZoneWithPrototype(){return window.Zone}}})),fh=n({AttributeNames:()=>th,UserInteractionInstrumentation:()=>uh}),ph=t((()=>{dh(),nh()}));Qu(),G(),H();var mh=[`http.url`,`url.full`],hh=[`http.status_code`,`http.response.status_code`],gh=[`http.method`,`http.request.method`],_h=e=>({test:e}),vh=(e,t,n)=>{var r;t.setAttributes(e.applyRedact(e.config.hooks.getPageAttributes()));let i;for(let n of mh){var a;let r=(a=t.attributes)==null?void 0:a[n];if(typeof r==`string`){let a=e.applyRedact({[n]:e.config.hooks.redactUrl(r)})[n];typeof a==`string`&&(i=a,t.setAttribute(n,a))}}let o=hh.map(e=>{var n;return(n=t.attributes)==null?void 0:n[e]}).find(e=>typeof e==`number`),s=gh.map(e=>{var n;return(n=t.attributes)==null?void 0:n[e]}).find(e=>typeof e==`string`),c=(r=i)==null?mh.map(e=>{var n;return(n=t.attributes)==null?void 0:n[e]}).find(e=>typeof e==`string`):r;t.setAttributes(e.applyRedact(np({method:s,statusCode:o,subtype:n,url:c,urlPathTemplate:c?e.config.hooks.getViewPathGroup(c):void 0})))},yh=(e,t,n)=>{t.setAttributes(e.applyRedact(W(W({},e.config.hooks.getPageAttributes()),$({errorType:`none`,eventLabel:`文档加载`,spanSubtype:n,spanType:Q.document,targetLabel:e.config.hooks.getViewPathGroup(typeof location>`u`?``:location.href),traceScene:`page_load`}))))},bh=(e,t,n)=>{let r=e.config.hooks.redactUrl(n.name);t.setAttributes(e.applyRedact(W(W(W({},e.config.hooks.getPageAttributes()),rp({duration:n.duration,initiatorType:n.initiatorType||`other`,responseStatus:n.responseStatus,transferSize:n.transferSize,url:r,urlPathTemplate:e.config.hooks.getViewPathGroup(n.name)})),{},{"url.full":r})))},xh=e=>{let t=[];return{name:`official-instrumentations`,enabled:!!(e.documentLoad||e.fetch||e.xhr||e.userInteraction),init(n){return V(function*(){let r=[_h(e=>Sp(n.config,e))],i=[_h(e=>Cp(n.config,e))],[a,o,s,c]=yield Promise.all([e.documentLoad?Promise.resolve().then(()=>(Vp(),Bp)):Promise.resolve(null),e.fetch?Promise.resolve().then(()=>(xm(),bm)):Promise.resolve(null),e.xhr?Promise.resolve().then(()=>(eh(),$m)):Promise.resolve(null),e.userInteraction?Promise.resolve().then(()=>(ph(),fh)):Promise.resolve(null)]);if(a&&t.push(new a.DocumentLoadInstrumentation({semconvStabilityOptIn:`http`,applyCustomAttributesOnSpan:{documentLoad:e=>yh(n,e,`navigate`),documentFetch:e=>yh(n,e,`document_fetch`),resourceFetch:(e,t)=>bh(n,e,t)}})),o&&t.push(new o.FetchInstrumentation({applyCustomAttributesOnSpan:e=>vh(n,e,`fetch`),ignoreUrls:r,propagateTraceHeaderCorsUrls:i,semconvStabilityOptIn:`http`,ignoreNetworkEvents:!1})),s&&t.push(new s.XMLHttpRequestInstrumentation({applyCustomAttributesOnSpan:e=>vh(n,e,`xhr`),ignoreUrls:r,propagateTraceHeaderCorsUrls:i,semconvStabilityOptIn:`http`,ignoreNetworkEvents:!1})),c){let n=e.userInteraction!==null&&typeof e.userInteraction==`object`?{eventNames:e.userInteraction.eventNames}:void 0;t.push(new c.UserInteractionInstrumentation(n))}Pu({instrumentations:t})})()},shutdown(){for(;t.length;){var e,n;(e=t.pop())==null||(n=e.disable)==null||n.call(e)}}}},Sh=e=>{let t=5381;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);return(t>>>0).toString(36)},Ch=(e,t)=>{let n=new Map,r=0,i=t=>{if(!(t-r<e)){r=t;for(let[r,i]of n)t-i.windowStart>e&&n.delete(r)}};return{allow(r){let a=Date.now();i(a);let o=n.get(r);return!o||a-o.windowStart>e?(n.set(r,{count:1,windowStart:a}),{allowed:!0,count:1}):(o.count+=1,{allowed:o.count<=t,count:o.count})}}};G();var wh=6e4,Th=5,Eh=/^https?:|^\/\//i,Dh=(e,t)=>{if(t)return Eh.test(t)?e(t):t},Oh=e=>{let t;return{name:`csp-violation`,enabled:e.enabled,init(e){if(typeof window>`u`||typeof document>`u`)return;let n=Ch(wh,Th),r=t=>{let r=Sh(`${t.violatedDirective}|${t.blockedURI}|${t.sourceFile}|${t.lineNumber}`),i=n.allow(r);if(!i.allowed)return;let a=Dh(e.config.hooks.redactUrl,t.blockedURI),o=t.sourceFile?e.config.hooks.redactUrl(t.sourceFile):void 0,s=i.count===1;e.startSpan(`csp.violation`,W(W(W({},e.config.hooks.getPageAttributes()),$({errorType:`csp`,eventLabel:`CSP 错误`,result:Z.error,spanSubtype:`csp`,spanType:Q.error,targetLabel:a==null?t.effectiveDirective:a,targetValue:t.statusCode})),{},{"csp.blocked_uri":a,"csp.violated_directive":t.violatedDirective,"csp.effective_directive":t.effectiveDirective,"csp.disposition":t.disposition,"csp.source_file":o,"csp.line_number":t.lineNumber,"csp.column_number":t.columnNumber,"csp.status_code":t.statusCode,"csp.fingerprint":r,"csp.window_count":i.count,[X.exceptionFingerprint]:r,"error.source":`csp`},s?{"csp.original_policy":t.originalPolicy}:{})).end()};document.addEventListener(`securitypolicyviolation`,r),t=()=>document.removeEventListener(`securitypolicyviolation`,r)},shutdown(){t==null||t(),t=void 0}}},kh=e=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${e}-${Date.now()}-${Math.random().toString(16).slice(2)}`;G();var Ah=`BK_RUM_DEVICE_ID`,jh=250,Mh=()=>navigator.connection,Nh=()=>navigator.userAgentData,Ph=e=>{for(let[t,n]of[[`Edge`,/Edg\/([\d.]+)/],[`Chrome`,/Chrome\/([\d.]+)/],[`Firefox`,/Firefox\/([\d.]+)/],[`Safari`,/Version\/([\d.]+).*Safari/]]){let r=e.match(n);if(r!=null&&r[1])return{name:t,version:r[1].split(`.`)[0]}}return{name:`Other`,version:void 0}},Fh=(e,t)=>{let n=`${t==null?``:t} ${e}`;return/iphone|ipad|ipod/i.test(n)?`iOS`:/android/i.test(n)?`Android`:/mac/i.test(n)?`macOS`:/win/i.test(n)?`Windows`:/linux/i.test(n)?`Linux`:`Other`},Ih=e=>{let t=null;try{t=window.localStorage.getItem(e)}catch(e){}if(t)return t;let n=kh(`device`);try{window.localStorage.setItem(e,n)}catch(e){}return n},Lh=()=>{var e,t;return typeof window>`u`?{}:{"browser.viewport.width":window.innerWidth,"browser.viewport.height":window.innerHeight,"browser.screen.width":(e=window.screen)==null?void 0:e.width,"browser.screen.height":(t=window.screen)==null?void 0:t.height}},Rh=()=>{let e=Mh();return e?{"network.effective_type":e.effectiveType,"network.connection_type":e.type,"network.downlink":e.downlink,"network.rtt":e.rtt,"network.save_data":e.saveData}:{}},zh=()=>{if(typeof navigator>`u`)return{};let e=Nh(),t=navigator.userAgent,n=Ph(t),r=Fh(t,e==null?void 0:e.platform),i=e!=null&&e.mobile||/mobi|android|iphone|ipad|ipod/i.test(t)?`mobile`:`desktop`;return{"device.memory":navigator.deviceMemory,"device.cpu_cores":navigator.hardwareConcurrency,"device.platform":e==null?void 0:e.platform,"device.mobile":e==null?void 0:e.mobile,[X.browserName]:n.name,[X.browserVersion]:n.version,[X.deviceType]:i,[X.osName]:r,"user_agent.name":n.name,"user_agent.version":n.version,"user_agent.os.name":r}},Bh=(e,t)=>{let n;return()=>{n!==void 0&&window.clearTimeout(n),n=window.setTimeout(()=>{n=void 0,e()},t)}},Vh=e=>{let t=[];return{name:`device`,enabled:e.enabled,init(n){var r;let i=e.enabled?(r=e.storageKey)==null?Ah:r:Ah,a=typeof window>`u`?kh(`device`):Ih(i);if(n.setRuntimeAttributes(W(W(W({"device.id":a},zh()),Lh()),Rh())),typeof window>`u`)return;let o=Bh(()=>{n.setRuntimeAttributes(Lh())},jh);window.addEventListener(`resize`,o),window.addEventListener(`orientationchange`,o),t.push(()=>window.removeEventListener(`resize`,o),()=>window.removeEventListener(`orientationchange`,o));let s=Mh();if(s&&typeof s.addEventListener==`function`){let e=()=>{n.setRuntimeAttributes(Rh())};s.addEventListener(`change`,e),t.push(()=>{var t;(t=s.removeEventListener)==null||t.call(s,`change`,e)})}},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}};N(),G();var Hh=6e4,Uh=5,Wh=e=>{if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch(t){return String(e)}},Gh=e=>{var t;return e instanceof Error?(t=e.stack)==null?``:t:``},Kh=e=>e.slice(0,80),qh=e=>{var t,n;return(t=(n=e.split(`
|
|
12
|
+
`).find(e=>e.trim().startsWith(`at `)))==null?void 0:n.trim())==null?``:t},Jh=e=>e===`unhandledrejection`?`promise`:e===`resource`?`resource_load`:`js`,Yh=({context:e,error:t,exceptionType:n,extra:r={},source:i,spanName:a,throttle:o})=>{let s=Wh(t),c=Gh(t),l=Sh(`${i}|${s}|${c.slice(0,256)}`),u=o.allow(l);if(!u.allowed)return;let d=t instanceof Error?t:{message:s,name:n==null?i:n},f=W(W(W(W({},e.config.hooks.getPageAttributes()),e.config.hooks.getErrorAttributes()),$({errorType:Jh(i),eventLabel:`错误`,result:Z.error,spanSubtype:Jh(i),spanType:Q.error,targetLabel:t instanceof Error?t.name:n==null?i:n})),{},{"exception.message":s,[X.exceptionMessageShort]:Kh(s),"exception.stacktrace":c,[X.exceptionStackTopFrame]:qh(c),"exception.type":t instanceof Error?t.name:n==null?i:n,[X.exceptionFingerprint]:l,"error.handled":!1,"error.source":i,"error.window_count":u.count},r),p=e.startSpan(a,f);p.recordException(d),p.setStatus({code:wt.ERROR,message:s}),p.end()},Xh=e=>{let t=[];return{name:`error`,enabled:e.enabled,init(n){if(typeof window>`u`)return;let r=Ch(e.enabled?e.windowMs:Hh,e.enabled?e.maxPerWindow:Uh),i=e=>{var t;let i=!e.error&&!e.filename&&e.message===`Script error.`;Yh({context:n,throttle:r,spanName:`browser.error`,source:`window.error`,error:(t=e.error)==null?e.message:t,extra:W({"code.filepath":e.filename,"code.lineno":e.lineno,"code.column":e.colno},i?{"error.cross_origin":!0}:{})})},a=e=>{Yh({context:n,throttle:r,spanName:`browser.unhandledrejection`,source:`unhandledrejection`,error:e.reason,exceptionType:e.reason instanceof Error?e.reason.name:`UnhandledRejection`})},o=e=>{if(e instanceof ErrorEvent)return;let t=e.target;if(!(t instanceof Element))return;let i=t,a=i.src||i.href||t.currentSrc||``;Yh({context:n,throttle:r,spanName:`browser.resource_error`,source:`resource`,error:Error(`Resource load failed: ${t.tagName.toLowerCase()} ${a}`),exceptionType:`ResourceError`,extra:{"url.full":n.config.hooks.redactUrl(a),"html.tag":t.tagName}})};window.addEventListener(`error`,i),window.addEventListener(`unhandledrejection`,a),window.addEventListener(`error`,o,!0),t.push(()=>window.removeEventListener(`error`,i),()=>window.removeEventListener(`unhandledrejection`,a),()=>window.removeEventListener(`error`,o,!0))},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}};bn(),H(),G();var Zh=10*1024,Qh=10,$h=new WeakMap,eg=(e,t)=>e.length<=t?{body:e,truncated:!1}:{body:e.slice(0,t),truncated:!0},tg=(e,t)=>{if(!e)return;if(e instanceof Headers)return e.get(t)||void 0;let n=t.toLowerCase();if(Array.isArray(e)){var r;return(r=e.find(([e])=>e.toLowerCase()===n))==null?void 0:r[1]}let i=Object.keys(e).find(e=>e.toLowerCase()===n);return i?e[i]:void 0},ng=e=>{let t={};return e.forEach((e,n)=>{t[n]=e instanceof File?`[File name=${e.name} type=${e.type||`unknown`} size=${e.size}]`:e}),JSON.stringify(t)},rg=function(){var e=V(function*(e){return e==null?``:typeof e==`string`?e:e instanceof URLSearchParams?e.toString():e instanceof FormData?ng(e):e instanceof Blob?e.text():e instanceof ArrayBuffer||ArrayBuffer.isView(e)?new TextDecoder().decode(e):e instanceof Document?new XMLSerializer().serializeToString(e):String(e)});return function(t){return e.apply(this,arguments)}}(),ig=function(){var e=V(function*(e,t,n){let r=yield rg(e);if(r)return W(W({},eg(r,t)),{},{contentType:n})});return function(t,n,r){return e.apply(this,arguments)}}(),ag=function(){var e=V(function*(e,t,n){try{return yield ig(e,t,n)}catch(e){return}});return function(t,n,r){return e.apply(this,arguments)}}(),og=e=>e instanceof Request?e.url:String(e),sg=(e,t)=>t!=null&&t.method?t.method:e instanceof Request?e.method:`GET`,cg=(e,t,n)=>t!=null&&t.body?()=>ag(t.body,n,tg(t.headers,`content-type`)):(e instanceof Request,()=>Promise.resolve(void 0)),lg=function(){var e=V(function*(e,t){try{let n=e.headers.get(`content-type`)||void 0,r=e.headers.get(`content-length`);if(r){let e=Number(r);if(Number.isFinite(e)&&e>t*Qh)return{body:``,contentType:n,truncated:!0}}let i=e.clone();return ag(i.body?yield i.text():``,t,n)}catch(e){return}});return function(t,n){return e.apply(this,arguments)}}(),ug=(e,t)=>{if(e.responseType===``||e.responseType===`text`)return W(W({},eg(e.responseText||``,t)),{},{contentType:e.getResponseHeader(`content-type`)||void 0});if(e.responseType===`json`)return W(W({},eg(JSON.stringify(e.response),t)),{},{contentType:e.getResponseHeader(`content-type`)||void 0})},dg=(e,t,n)=>{if(n)return e.redact(W(W({},t),{},{body:n.body,truncated:n.truncated}))},fg=({context:e,duration:t,error:n,method:r,request:i,response:a,status:o,subtype:s,url:c})=>{let l=e.config.rum.plugins.httpBody;if(!l.enabled)return;let u=!!n||typeof o==`number`&&o>=400,d=r.toUpperCase(),f=u?dg(l,{contentType:i==null?void 0:i.contentType,method:d,status:o,type:`request`,url:c},i):void 0,p=u?dg(l,{contentType:a==null?void 0:a.contentType,method:d,status:o,type:`response`,url:c},a):void 0,m=W(W(W({},e.config.hooks.getPageAttributes()),np({duration:t,method:d,statusCode:o,subtype:s,url:e.config.hooks.redactUrl(c),urlPathTemplate:e.config.hooks.getViewPathGroup(c)})),{},{"http.duration":t,"http.request.method":d,"url.full":e.config.hooks.redactUrl(c)});if(typeof o==`number`&&(m[`http.response.status_code`]=o),f!=null&&(m[`http.request.body`]=f),p!=null&&(m[`http.response.body`]=p),u){var h,g;m[`http_body.request.truncated`]=(h=i==null?void 0:i.truncated)==null?!1:h,m[`http_body.response.truncated`]=(g=a==null?void 0:a.truncated)==null?!1:g}if(n instanceof Error){var _;m[`exception.message`]=n.message,m[`exception.type`]=n.name,m[`exception.stacktrace`]=(_=n.stack)==null?``:_}e.emitLog({severityNumber:u?en.ERROR:en.INFO,severityText:u?`ERROR`:`INFO`,body:u?`HTTP request completed with error`:`HTTP request completed`,attributes:m})},pg=e=>{let t=[];return{name:`http-body`,enabled:e.enabled,init(n){if(!e||typeof window>`u`)return;let r=e.enabled?e.maxBodySize:Zh,i=window.fetch;if(typeof i==`function`){let e=function(){var e=V(function*(e,t){let a=og(e);if(Sp(n.config,a))return i(e,t);let o=sg(e,t),s=cg(e,t,r),c=performance.now();try{let l=yield i(e,t),u=performance.now()-c,d=l.status>=400;return fg({context:n,duration:u,method:o,request:d?yield s():void 0,response:d?yield lg(l,r):void 0,status:l.status,subtype:`fetch`,url:a}),l}catch(e){let t=yield s();throw fg({context:n,duration:performance.now()-c,error:e,method:o,request:t,subtype:`fetch`,url:a}),e}});return function(t,n){return e.apply(this,arguments)}}();window.fetch=e,t.push(()=>{window.fetch===e&&(window.fetch=i)})}let a=XMLHttpRequest.prototype.open,o=XMLHttpRequest.prototype.send,s=XMLHttpRequest.prototype.setRequestHeader,c=function(e,t,...n){var r;return $h.set(this,{method:e,startTime:performance.now(),url:String(t)}),a.call(this,e,t,(r=n[0])==null?!0:r,n[1],n[2])},l=function(e,t){let n=$h.get(this);if(n){var r;let i=e.toLowerCase(),a=(r=n.requestHeaders)==null?{}:r,o=a[i];a[i]=o?`${o}, ${t}`:t,n.requestHeaders=a}return s.call(this,e,t)},u=function(e){var t=this;let i=$h.get(this);if(i){var a;i.requestBody=e,i.requestContentType=(a=i.requestHeaders)==null?void 0:a[`content-type`]}return this.addEventListener(`abort`,()=>{let e=$h.get(this);e&&(e.aborted=!0)},{once:!0}),this.addEventListener(`error`,()=>{let e=$h.get(this);e&&(e.networkError=!0)},{once:!0}),this.addEventListener(`loadend`,()=>{V(function*(){let e=$h.get(t);if(!e||Sp(n.config,e.url)||e.aborted)return;let i=e.networkError||t.status>=400,a=i?ug(t,r):void 0,o=i?yield ag(e.requestBody,r,e.requestContentType):void 0;fg({context:n,duration:performance.now()-e.startTime,error:e.networkError?Error(`XHR network error`):void 0,method:e.method,request:o,response:a,status:t.status,subtype:`xhr`,url:e.url})})()},{once:!0}),o.call(this,e)};XMLHttpRequest.prototype.open=c,XMLHttpRequest.prototype.setRequestHeader=l,XMLHttpRequest.prototype.send=u,t.push(()=>{XMLHttpRequest.prototype.open===c&&(XMLHttpRequest.prototype.open=a),XMLHttpRequest.prototype.setRequestHeader===l&&(XMLHttpRequest.prototype.setRequestHeader=s),XMLHttpRequest.prototype.send===u&&(XMLHttpRequest.prototype.send=o)})},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}};G();var mg=50,hg=e=>{let t;return{name:`long-task`,enabled:e.enabled,init(n){var r;if(typeof PerformanceObserver>`u`||!((r=PerformanceObserver.supportedEntryTypes)!=null&&r.includes(`longtask`)))return;let i=e.enabled?e.threshold:mg,a=n.meter.createCounter(`browser.long_task.count`,{description:`Number of long tasks observed (duration >= threshold)`}),o=n.meter.createHistogram(`browser.long_task.duration`,{unit:`ms`,description:`Duration of long tasks`});try{t=new PerformanceObserver(e=>{let t=n.applyRedact(W(W({},n.config.hooks.getPageAttributes()),n.config.hooks.getMetricAttributes()));for(let h of e.getEntries()){var r,s,c,l,u,d,f,p,m;if(h.duration<i)continue;let e=(r=h.attribution)==null?void 0:r[0],g=W(W({},t),{},{[X.longtaskAttributionScript]:(s=(c=e==null?void 0:e.containerSrc)==null?e==null?void 0:e.name:c)==null?`unknown`:s}),_=h.duration>100?Z.warning:Z.success;n.startSpan(`browser.long_task`,W(W(W({},t),$({duration:h.duration,errorType:_===Z.warning?`longtask_blocking`:`none`,eventLabel:`长任务`,result:_,spanSubtype:(l=e==null?void 0:e.name)==null?`unknown`:l,spanType:Q.longtask,targetLabel:(u=(d=(f=e==null?void 0:e.containerSrc)==null?e==null?void 0:e.containerName:f)==null?e==null?void 0:e.name:d)==null?`unknown`:u,targetValue:h.duration})),{},{[X.longtaskBlockingDuration]:h.duration,[X.longtaskAttributionScript]:(p=(m=e==null?void 0:e.containerSrc)==null?e==null?void 0:e.name:m)==null?`unknown`:p}),{startTime:performance.timeOrigin+h.startTime}).end(performance.timeOrigin+h.startTime+h.duration),a.add(1,g),o.record(h.duration,g)}}),t.observe({type:`longtask`,buffered:!0})}catch(e){t=void 0}},shutdown(){t==null||t.disconnect(),t=void 0}}},gg=new Set,_g=``,vg,yg,bg=!1,xg=()=>typeof location>`u`?``:location.href,Sg=(e,t)=>{let n=xg();_g=n;let r={fromUrl:t,source:e,toUrl:n};for(let e of Array.from(gg))e(r)},Cg=()=>{Sg(`popstate`,_g||xg())},wg=()=>{Sg(`hashchange`,_g||xg())},Tg=()=>{bg||typeof window>`u`||typeof history>`u`||(bg=!0,_g=xg(),vg=history.pushState,yg=history.replaceState,history.pushState=function(e,t,n){let r=_g||xg(),i=vg==null?void 0:vg.apply(this,[e,t,n]);return Sg(`pushState`,r),i},history.replaceState=function(e,t,n){let r=_g||xg(),i=yg==null?void 0:yg.apply(this,[e,t,n]);return Sg(`replaceState`,r),i},window.addEventListener(`popstate`,Cg),window.addEventListener(`hashchange`,wg))},Eg=()=>{!bg||typeof window>`u`||typeof history>`u`||(vg&&(history.pushState=vg),yg&&(history.replaceState=yg),window.removeEventListener(`popstate`,Cg),window.removeEventListener(`hashchange`,wg),vg=void 0,yg=void 0,bg=!1,_g=``)},Dg=e=>typeof window>`u`||typeof history>`u`?()=>{}:(Tg(),gg.add(e),()=>{gg.delete(e),gg.size===0&&Eg()});G();var Og=()=>typeof location>`u`?``:location.href,kg=e=>{let t=[];return{name:`page-view`,enabled:e.enabled,init(e){if(typeof window>`u`)return;let n=``,r,i=(t,i=n)=>{let a=Og();if(a===n)return;r==null||r.setAttribute(`view.end_reason`,t),r==null||r.end(),n=a;let o=kh(`view`),s=e.config.hooks.getViewPathGroup(a),c=t===`load`?`initial_load`:`route_change`,l=e.config.hooks.redactUrl(a),u=e.config.hooks.redactUrl(i);e.setView({id:o,loadingType:c,url:l,urlPathGroup:s});let d=t===`load`,f=W(W(W({},e.config.hooks.getPageAttributes()),$({errorType:`none`,eventLabel:d?`文档加载`:`路由切换`,spanSubtype:d?`navigate`:t,spanType:d?Q.document:Q.route,targetLabel:s,traceScene:d?`page_load`:`route_change`})),{},{[X.viewId]:o,[X.viewUrl]:l,[X.viewUrlPathGroup]:s,[X.viewLoadingType]:c,"url.previous":u,"event.source":t},d?{"document.referrer":e.config.hooks.redactUrl(document.referrer||``)}:{});r=e.startSpan(`browser.view`,f),e.startSpan(`browser.page_view`,W({},f)).end()},a=Dg(e=>{i(e.source,e.fromUrl)});i(`load`);let o=()=>{r==null||r.setAttribute(`view.end_reason`,`shutdown`),r==null||r.end(),r=void 0};window.addEventListener(`pagehide`,o),t.push(a,()=>window.removeEventListener(`pagehide`,o),o)},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}};G();var Ag=e=>e.transferSize===0&&e.decodedBodySize>0?!0:void 0,jg=e=>{let t,n=new Set;return{name:`resource`,enabled:e.enabled,init(e){var r;if(typeof PerformanceObserver>`u`||!((r=PerformanceObserver.supportedEntryTypes)!=null&&r.includes(`resource`)))return;let i=t=>{if(!t.name||Sp(e.config,t.name))return;let r=`${t.name}|${t.startTime}`;if(n.has(r))return;n.add(r);let i=e.config.hooks.redactUrl(t.name),a=t.duration;e.startSpan(`browser.resource`,W(W(W({},e.config.hooks.getPageAttributes()),rp({duration:a,initiatorType:t.initiatorType||`other`,responseStatus:t.responseStatus,transferSize:t.transferSize,url:i,urlPathTemplate:e.config.hooks.getViewPathGroup(t.name)})),{},{"url.full":i,[X.transferSize]:t.transferSize,[X.cacheHit]:Ag(t),[X.nextHopProtocol]:t.nextHopProtocol,initiator_type:t.initiatorType||`other`,"resource.encoded_body_size":t.encodedBodySize,"resource.decoded_body_size":t.decodedBodySize}),{startTime:performance.timeOrigin+t.startTime}).end(performance.timeOrigin+t.startTime+a)};try{t=new PerformanceObserver(e=>{for(let t of e.getEntries())i(t)}),t.observe({type:`resource`,buffered:!0})}catch(e){t=void 0}},shutdown(){t==null||t.disconnect(),t=void 0,n.clear()}}};G();var Mg=e=>{let t=[],n=!1;return{name:`route-timing`,enabled:e.enabled,init(e){if(typeof window>`u`||typeof history>`u`)return;let r=e.meter.createHistogram(`browser.route_change.duration`,{unit:`ms`,description:`Estimated SPA route change duration (route start to next idle)`}),i=(t,i,a)=>{if(n)return;let o=performance.now(),s=performance.timeOrigin+o,c=()=>{if(n||typeof document<`u`&&document.visibilityState===`hidden`)return;let c=performance.now()-o,l=c>500?Z.warning:Z.success,u=e.applyRedact(W(W(W({},e.config.hooks.getPageAttributes()),e.config.hooks.getMetricAttributes()),{},{"route.change.source":t}));r.record(c,u),e.startSpan(`browser.route_change`,W(W(W({},u),$({duration:c,errorType:l===Z.warning?`slow`:`none`,eventLabel:`路由切换`,result:l,spanSubtype:t,spanType:Q.route,targetLabel:e.config.hooks.getViewPathGroup(a),targetValue:c,traceScene:`route_change`})),{},{"url.full":e.config.hooks.redactUrl(a),"url.previous":e.config.hooks.redactUrl(i)}),{startTime:s}).end()};requestAnimationFrame(()=>requestAnimationFrame(()=>setTimeout(c,0)))},a=Dg(e=>{e.fromUrl!==e.toUrl&&i(e.source,e.fromUrl,e.toUrl)});t.push(a)},shutdown(){for(n=!0;t.length;){var e;(e=t.pop())==null||e()}}}};bn(),G();var Ng=1800*1e3,Pg=1440*60*1e3,Fg=6e4,Ig=5e3,Lg=[`click`,`keydown`,`scroll`,`mousemove`,`touchstart`],Rg=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>0&&e<=t+Ig,zg=(e,t)=>{if(!e)return null;try{let n=JSON.parse(e);if(typeof(n==null?void 0:n.id)==`string`&&Rg(n.ts,t)&&Rg(n.startedAt,t))return n}catch(e){}return null},Bg=(e,t)=>{if(typeof window>`u`)return null;let n=null;try{n=window.localStorage.getItem(e)}catch(e){}let r=zg(n,t);if(r)return r;try{n=window.sessionStorage.getItem(e)}catch(e){}return r=zg(n,t),r},Vg=(e,t)=>{if(typeof window>`u`)return;let n=JSON.stringify(t);try{window.sessionStorage.setItem(e,n)}catch(e){}try{window.localStorage.setItem(e,n)}catch(e){}},Hg=(e,t,n)=>{let r=Date.now(),i=Bg(e,r);if(i){let a=r-i.ts>=t,o=r-i.startedAt>=n;if(!a&&!o){let t=W(W({},i),{},{ts:r});return Vg(e,t),{id:t.id,rotated:!1}}let s=a?`inactivity`:`maxLifetime`,c={id:kh(`session`),startedAt:r,ts:r};return Vg(e,c),{id:c.id,prevId:i.id,reason:s,rotated:!0}}let a={id:kh(`session`),startedAt:r,ts:r};return Vg(e,a),{id:a.id,reason:`init`,rotated:!0}},Ug=e=>{let t=``;try{t=new URL(e).host}catch(n){t=e}return`bk_ot_session__${Sh(t||`default`)}`},Wg=(e,t)=>{if(!t.rotated||!t.reason)return;let n=Date.now();e.emitLog({severityNumber:en.INFO,severityText:`INFO`,body:t.reason===`init`?`session.start`:`session.rotate`,attributes:W(W({},e.config.hooks.getPageAttributes()),{},{[X.sessionHasReplay]:!1,[X.sessionId]:t.id,[X.sessionStartTime]:n,"session.rotate.reason":t.reason},t.prevId?{"session.previous_id":t.prevId}:{})})},Gg=e=>{let t=[];return{name:`session`,enabled:e.enabled,init(n){var r;let i=e.enabled?(r=e.storageKey)==null?Ug(n.config.transport.endpoint):r:Ug(n.config.transport.endpoint),a=e.enabled?e.inactivityMs:Ng,o=e.enabled?e.maxLifetimeMs:Pg,s=``,c=()=>{if(typeof window>`u`){s||(s=kh(`session`),n.setRuntimeAttributes({[X.sessionHasReplay]:!1,[X.sessionId]:s}));return}let e=Hg(i,a,o);n.setRuntimeAttributes({[X.sessionHasReplay]:!1,[X.sessionId]:e.id}),e.id!==s&&(s=e.id,Wg(n,e))};if(c(),typeof window>`u`||typeof document>`u`)return;let l=Date.now(),u=()=>{let e=Date.now();e-l<Fg||(l=e,c())},d={capture:!0,passive:!0};Lg.forEach(e=>{window.addEventListener(e,u,d)}),t.push(()=>{Lg.forEach(e=>{window.removeEventListener(e,u,d)})});let f=()=>{document.visibilityState===`visible`&&c()};document.addEventListener(`visibilitychange`,f),t.push(()=>document.removeEventListener(`visibilitychange`,f));let p=e=>{if(e.storageArea!==window.localStorage||e.key!==i||!e.newValue)return;let t=Date.now(),r=zg(e.newValue,t);if(!(!r||r.id===s)){s=r.id;try{window.sessionStorage.setItem(i,e.newValue)}catch(e){}n.setRuntimeAttributes({[X.sessionId]:r.id})}};window.addEventListener(`storage`,p),t.push(()=>window.removeEventListener(`storage`,p))},shutdown(){for(;t.length;){var e;(e=t.pop())==null||e()}}}},Kg=n({CLSThresholds:()=>__,FCPThresholds:()=>h_,INPThresholds:()=>j_,LCPThresholds:()=>P_,TTFBThresholds:()=>I_,onCLS:()=>y_,onFCP:()=>b_,onINP:()=>M_,onLCP:()=>F_,onTTFB:()=>R_});function qg(e,t){return $g.get(e)||$g.set(e,new t),$g.get(e)}var Jg,Yg,Xg,Zg,Qg,$g,e_,t_,n_,r_,i_,a_,o_,s_,c_,l_,u_,d_,f_,p_,m_,h_,g_,__,v_,y_,b_,x_,S_,C_,w_,T_,E_,D_,O_,k_,A_,j_,M_,N_,P_,F_,I_,L_,R_,z_=t((()=>{F(),G(),Jg=class{constructor(){P(this,`t`,void 0),P(this,`o`,0),P(this,`i`,[])}u(e){var t;if(e.hadRecentInput)return;let n=this.i[0],r=this.i.at(-1);this.o&&n&&r&&e.startTime-r.startTime<1e3&&e.startTime-n.startTime<5e3?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),(t=this.t)==null||t.call(this,e)}},Yg=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Xg=e=>{if(document.readyState===`loading`)return`loading`;let t=Yg();if(t){if(e<t.domInteractive)return`loading`;if(t.domContentLoadedEventStart===0||e<t.domContentLoadedEventStart)return`dom-interactive`;if(t.domComplete===0||e<t.domComplete)return`dom-content-loaded`}return`complete`},Zg=e=>{let t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,``)},Qg=e=>{let t=``;try{for(;(e==null?void 0:e.nodeType)!==9;){let n=e,r=n.id?`#`+n.id:[Zg(n),...Array.from(n.classList).sort()].join(`.`);if(t.length+r.length>99)return t||r;if(t=t?r+`>`+t:r,n.id)break;e=n.parentNode}}catch(e){}return t},$g=new WeakMap,e_=-1,t_=()=>e_,n_=e=>{addEventListener(`pageshow`,t=>{t.persisted&&(e_=t.timeStamp,e(t))},!0)},r_=(e,t,n,r)=>{let i,a;return o=>{var s;t.value>=0&&(o||r)&&(a=t.value-((s=i)==null?0:s),(a||i===void 0)&&(i=t.value,t.delta=a,t.rating=((e,t)=>e>t[1]?`poor`:e>t[0]?`needs-improvement`:`good`)(t.value,n),e(t)))}},i_=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},a_=()=>{var e,t;return(e=(t=Yg())==null?void 0:t.activationStart)==null?0:e},o_=(e,t=-1)=>{let n=Yg(),r=`navigate`;return t_()>=0?r=`back-forward-cache`:n&&(document.prerendering||a_()>0?r=`prerender`:document.wasDiscarded?r=`restore`:n.type&&(r=n.type.replace(/_/g,`-`))),{name:e,value:t,rating:`good`,delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+0xe8d4a51000}`,navigationType:r}},s_=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let r=new PerformanceObserver(e=>{queueMicrotask(()=>{t(e.getEntries())})});return r.observe(W({type:e,buffered:!0},n)),r}}catch(e){}},c_=e=>{let t=!1;return()=>{t||(e(),t=!0)}},l_=-1,u_=new Set,d_=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,f_=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of u_)e();isFinite(l_)||(l_=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,f_,!0))}},p_=()=>{if(l_<0){var e;let t=a_(),n=document.prerendering||(e=globalThis.performance.getEntriesByType(`visibility-state`).find(e=>e.name===`hidden`&&e.startTime>=t))==null?void 0:e.startTime;l_=n==null?d_():n,addEventListener(`visibilitychange`,f_,!0),addEventListener(`prerenderingchange`,f_,!0),n_(()=>{setTimeout(()=>{l_=d_()})})}return{get firstHiddenTime(){return l_},onHidden(e){u_.add(e)}}},m_=e=>{document.prerendering?addEventListener(`prerenderingchange`,e,!0):e()},h_=[1800,3e3],g_=(e,t={})=>{m_(()=>{let n=p_(),r,i=o_(`FCP`),a=s_(`paint`,e=>{for(let t of e)t.name===`first-contentful-paint`&&(a.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-a_(),0),i.entries.push(t),r(!0)))});a&&(r=r_(e,i,h_,t.reportAllChanges),n_(n=>{i=o_(`FCP`),r=r_(e,i,h_,t.reportAllChanges),i_(()=>{i.value=performance.now()-n.timeStamp,r(!0)})}))})},__=[.1,.25],v_=e=>e.find(e=>{var t;return((t=e.node)==null?void 0:t.nodeType)===1})||e[0],y_=(e,t={})=>{let n=qg(t=Object.assign({},t),Jg),r=new WeakMap;n.t=e=>{var n;if(!(e==null||(n=e.sources)==null)&&n.length){let n=v_(e.sources),o=n==null?void 0:n.node;if(o){var i,a;let e=(i=(a=t.generateTarget)==null?void 0:a.call(t,o))==null?Qg(o):i;r.set(n,e)}}},((e,t={})=>{let n=p_();g_(c_(()=>{let r,i=o_(`CLS`,0),a=qg(t,Jg),o=e=>{for(let t of e)a.u(t);a.o>i.value&&(i.value=a.o,i.entries=a.i,r())},s=s_(`layout-shift`,o);s&&(r=r_(e,i,__,t.reportAllChanges),n.onHidden(()=>{o(s.takeRecords()),r(!0)}),n_(()=>{a.o=0,i=o_(`CLS`,0),r=r_(e,i,__,t.reportAllChanges),i_(r)}),setTimeout(r))}))})(t=>{e((e=>{let t={};if(e.entries.length){var n;let i=e.entries.reduce((e,t)=>e.value>t.value?e:t);if(!(i==null||(n=i.sources)==null)&&n.length){let e=v_(i.sources);e&&(t={largestShiftTarget:r.get(e),largestShiftTime:i.startTime,largestShiftValue:i.value,largestShiftSource:e,largestShiftEntry:i,loadState:Xg(i.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},b_=(e,t={})=>{g_(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:Xg(t_())};if(e.entries.length){let n=Yg(),r=e.entries.at(-1);if(n){let i=n.activationStart||0,a=Math.max(0,n.responseStart-i);t={timeToFirstByte:a,firstByteToFCP:e.value-a,loadState:Xg(e.entries[0].startTime),navigationEntry:n,fcpEntry:r}}}return Object.assign(e,{attribution:t})})(t))},t)},x_=0,S_=1/0,C_=0,w_=e=>{for(let t of e)t.interactionId&&(S_=Math.min(S_,t.interactionId),C_=Math.max(C_,t.interactionId),x_=C_?(C_-S_)/7+1:0)},E_=()=>{var e;return T_?x_:(e=performance.interactionCount)==null?0:e},D_=()=>{`interactionCount`in performance||T_||(T_=s_(`event`,w_,{durationThreshold:0}))},O_=0,k_=class{constructor(){P(this,`l`,[]),P(this,`h`,new Map),P(this,`m`,void 0),P(this,`p`,void 0)}v(){O_=E_(),this.l.length=0,this.h.clear()}M(){let e=Math.min(this.l.length-1,Math.floor((E_()-O_)/50));return this.l[e]}u(e){var t;if((t=this.m)==null||t.call(this,e),!e.interactionId&&e.entryType!==`first-input`)return;let n=this.l.at(-1),r=this.h.get(e.interactionId);if(r||this.l.length<10||e.duration>n.T){var i;if(r?e.duration>r.T?(r.entries=[e],r.T=e.duration):e.duration===r.T&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],T:e.duration},this.h.set(r.id,r),this.l.push(r)),this.l.sort((e,t)=>t.T-e.T),this.l.length>10){let e=this.l.splice(10);for(let t of e)this.h.delete(t.id)}(i=this.p)==null||i.call(this,r)}}},A_=e=>{let t=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState===`hidden`)e();else{let r=c_(e),i=-1,a=()=>{n(i),r()};addEventListener(`visibilitychange`,a,{once:!0,capture:!0}),i=t(()=>{removeEventListener(`visibilitychange`,a,{capture:!0}),r()})}},j_=[200,500],M_=(e,t={})=>{let n=qg(t=Object.assign({},t),k_),r=[],i=[],a=0,o=new WeakMap,s=new WeakMap,c=!1,l=()=>{c||(A_(u),c=!0)},u=()=>{let e=new Set(n.l.map(e=>o.get(e.entries[0]))),t=i.length-10;i=i.filter((n,r)=>r>=t||e.has(n));let s=new Set;for(let e of i){let t=d(e.startTime,e.processingEnd);for(let e of t)s.add(e)}r=r.filter(e=>e.startTime>a||s.has(e)),c=!1};n.m=e=>{let n=e.startTime+e.duration,r;a=Math.max(a,e.processingEnd);for(let a=i.length-1;a>=0;a--){let o=i[a];if(Math.abs(n-o.renderTime)<=8){r=o,r.startTime=Math.min(e.startTime,r.startTime),r.processingStart=Math.min(e.processingStart,r.processingStart),r.processingEnd=Math.max(e.processingEnd,r.processingEnd),!1!==t.includeProcessedEventEntries&&r.entries.push(e);break}}r||(r={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:n,entries:!1===t.includeProcessedEventEntries?[]:[e]},i.push(r)),(e.interactionId||e.entryType===`first-input`)&&o.set(e,r),l()},n.p=e=>{if(!s.get(e)){let i=e.entries[0].target;if(i){var n,r;let a=(n=(r=t.generateTarget)==null?void 0:r.call(t,i))==null?Qg(i):n;s.set(e,a)}}};let d=(e,t)=>{let n=[];for(let i of r)if(!(i.startTime+i.duration<e)){if(i.startTime>t)break;n.push(i)}return n},f=e=>{let t=e.entries[0],r=o.get(t),i=t.processingStart,a=Math.max(t.startTime+t.duration,i),c=Math.min(r.processingEnd,a),l=r.entries.sort((e,t)=>e.processingStart-t.processingStart),u=d(t.startTime,c),f=n.h.get(t.interactionId),p={interactionTarget:s.get(f),interactionType:t.name.startsWith(`key`)?`keyboard`:`pointer`,interactionTime:t.startTime,nextPaintTime:a,processedEventEntries:l,longAnimationFrameEntries:u,inputDelay:i-t.startTime,processingDuration:c-i,presentationDelay:a-c,loadState:Xg(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(e=>{var t;if(!((t=e.longAnimationFrameEntries)!=null&&t.length))return;let n=e.interactionTime,r=e.inputDelay,i=e.processingDuration,a,o,s=0,c=0,l=0,u=0;for(let t of e.longAnimationFrameEntries){c=c+t.startTime+t.duration-t.styleAndLayoutStart;for(let e of t.scripts){let t=e.startTime+e.duration;if(t<n)continue;let l=t-Math.max(n,e.startTime),d=e.duration?l/e.duration*e.forcedStyleAndLayoutDuration:0;s+=l-d,c+=d,l>u&&(o=e.startTime<n+r?`input-delay`:e.startTime>=n+r+i?`presentation-delay`:`processing-duration`,a=e,u=l)}}let d=e.longAnimationFrameEntries.at(-1),f=d?d.startTime+d.duration:0;f>=n+r+i&&(l=e.nextPaintTime-f),a&&o&&(e.longestScript={entry:a,subpart:o,intersectingDuration:u}),e.totalScriptDuration=s,e.totalStyleAndLayoutDuration=c,e.totalPaintDuration=l,e.totalUnattributedDuration=e.nextPaintTime-n-s-c-l})(p),Object.assign(e,{attribution:p})};s_(`long-animation-frame`,e=>{r=r.concat(e),l()}),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=p_();m_(()=>{var r;D_();let i,a=o_(`INP`),o=qg(t,k_),s=e=>{A_(()=>{for(let t of e)o.u(t);let t=o.M();t&&t.T!==a.value&&(a.value=t.T,a.entries=t.entries,i())})},c=s_(`event`,s,{durationThreshold:(r=t.durationThreshold)==null?40:r});i=r_(e,a,j_,t.reportAllChanges),c&&(c.observe({type:`first-input`,buffered:!0}),n.onHidden(()=>{s(c.takeRecords()),i(!0)}),n_(()=>{o.v(),a=o_(`INP`),i=r_(e,a,j_,t.reportAllChanges)}))})})(t=>{e(f(t))},t)},N_=class{constructor(){P(this,`m`,void 0)}u(e){var t;(t=this.m)==null||t.call(this,e)}},P_=[2500,4e3],F_=(e,t={})=>{let n=qg(t=Object.assign({},t),N_),r=new WeakMap;n.m=e=>{let n=e.element;if(n){var i,a;let o=(i=(a=t.generateTarget)==null?void 0:a.call(t,n))==null?Qg(n):i;r.set(e,o)}else e.id&&r.set(e,`#${e.id}`)},((e,t={})=>{m_(()=>{let n=p_(),r,i=o_(`LCP`),a=qg(t,N_),o=e=>{t.reportAllChanges||(e=e.slice(-1));for(let t of e)a.u(t),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-a_(),0),i.entries=[t],r())},s=s_(`largest-contentful-paint`,o);if(s){r=r_(e,i,P_,t.reportAllChanges);let n=c_(()=>{o(s.takeRecords()),s.disconnect(),r(!0)}),a=e=>{e.isTrusted&&(A_(n),removeEventListener(e.type,a,{capture:!0}))};for(let e of[`keydown`,`click`,`visibilitychange`])addEventListener(e,a,{capture:!0});n_(n=>{i=o_(`LCP`),r=r_(e,i,P_,t.reportAllChanges),i_(()=>{i.value=performance.now()-n.timeStamp,r(!0)})})}})})(t=>{e((e=>{let t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){let n=e.entries.at(-1),i=n.url&&performance.getEntriesByType(`resource`).find(e=>e.name===n.url);t.target=r.get(n),t.lcpEntry=n,n.url&&(t.url=n.url),i&&(t.lcpResourceEntry=i);let a=Yg();if(a){let n=a.activationStart||0,r=Math.max(0,a.responseStart-n),o=Math.max(r,i?(i.requestStart||i.startTime)-n:0),s=Math.min(e.value,Math.max(o,i?i.responseEnd-n:0));t=W(W({},t),{},{timeToFirstByte:r,resourceLoadDelay:o-r,resourceLoadDuration:s-o,elementRenderDelay:e.value-s,navigationEntry:a})}}return Object.assign(e,{attribution:t})})(t))},t)},I_=[800,1800],L_=e=>{document.prerendering?m_(()=>L_(e)):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,()=>L_(e),!0)},R_=(e,t={})=>{((e,t={})=>{let n=o_(`TTFB`),r=r_(e,n,I_,t.reportAllChanges);L_(()=>{let i=Yg();i&&(n.value=Math.max(i.responseStart-a_(),0),n.entries=[i],r(!0),n_(()=>{n=o_(`TTFB`,0),r=r_(e,n,I_,t.reportAllChanges),r(!0)}))})})(t=>{e((e=>{let t={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(e.entries.length){let n=e.entries[0],r=n.activationStart||0,i=Math.max((n.workerStart||n.fetchStart)-r,0),a=Math.max(n.domainLookupStart-r,0),o=Math.max(n.connectStart-r,0),s=Math.max(n.connectEnd-r,0);t={waitingDuration:i,cacheDuration:a-i,dnsDuration:o-a,connectionDuration:s-o,requestDuration:e.value-s,navigationEntry:n}}return Object.assign(e,{attribution:t})})(t))},t)}}));G(),H();var B_=`unknown`,V_=e=>e?e.replace(/_/g,`-`):B_,H_=()=>{if(typeof performance>`u`)return B_;let e=performance.getEntriesByType(`navigation`)[0];return V_(e==null?void 0:e.type)},U_=(e,t)=>{var n;return{"rum.navigation.type":(n=e.navigationType)==null?t:n,[X.vitalMetric]:e.name.toLowerCase(),[X.vitalRating]:e.rating}},W_=(e,t)=>{var n;let r=(n=e.attribution)==null?{}:n,i={},a=e=>r[e],o=(e,t,n)=>{t!=null&&(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)&&(i[e]=typeof t==`string`&&n?n(t):t)};switch(e.name){case`LCP`:o(`vital.lcp.url`,a(`url`),t),o(`vital.lcp.target`,a(`target`)),o(`vital.lcp.element_render_delay`,a(`elementRenderDelay`)),o(`vital.lcp.resource_load_duration`,a(`resourceLoadDuration`)),o(`vital.lcp.time_to_first_byte`,a(`timeToFirstByte`));break;case`CLS`:o(`vital.cls.largest_shift_target`,a(`largestShiftTarget`)),o(`vital.cls.largest_shift_value`,a(`largestShiftValue`)),o(`vital.cls.load_state`,a(`loadState`));break;case`INP`:o(`vital.inp.interaction_target`,a(`interactionTarget`)),o(`vital.inp.interaction_type`,a(`interactionType`)),o(`vital.inp.input_delay`,a(`inputDelay`)),o(`vital.inp.processing_duration`,a(`processingDuration`)),o(`vital.inp.presentation_delay`,a(`presentationDelay`));break;case`FCP`:o(`vital.fcp.time_to_first_byte`,a(`timeToFirstByte`)),o(`vital.fcp.load_state`,a(`loadState`));break;case`TTFB`:o(`vital.ttfb.waiting_duration`,a(`waitingDuration`)),o(`vital.ttfb.dns_duration`,a(`dnsDuration`)),o(`vital.ttfb.connection_duration`,a(`connectionDuration`)),o(`vital.ttfb.request_duration`,a(`requestDuration`));break;default:break}return i},G_=e=>{let t=!1;return{name:`web-vitals`,enabled:e.enabled,init(e){return V(function*(){if(typeof window>`u`)return;let n;try{n=yield Promise.resolve().then(()=>(z_(),Kg))}catch(t){if(e.config.debug){var r;(r=globalThis.console)==null||r.warn(`[bk-ot] web-vitals load failed:`,t)}return}if(t)return;let{onCLS:i,onFCP:a,onINP:o,onLCP:s,onTTFB:c}=n,l=H_(),u=e.meter.createHistogram(`browser.web_vital.cls`,{unit:`1`,description:`Cumulative Layout Shift`}),d=e.meter.createHistogram(`browser.web_vital.duration`,{unit:`ms`,description:`Web Vitals duration metrics, including FCP, INP, LCP and TTFB`}),f=t=>{let n=t.name.toLowerCase();e.startSpan(`browser.web_vital`,W(W(W(W(W({},e.config.hooks.getPageAttributes()),e.config.hooks.getMetricAttributes()),U_(t,l)),$({duration:t.name===`CLS`?void 0:t.value,errorType:t.rating===`good`?`none`:`slow`,eventLabel:`Web 指标`,result:ep(t.rating),spanSubtype:n,spanType:Q.vital,targetLabel:n,targetValue:t.value})),{},{[X.vitalMetric]:n,[X.vitalValue]:t.value,[X.vitalRating]:t.rating,"vital.id":t.id},W_(t,e.config.hooks.redactUrl))).end()},p=n=>{t||!Number.isFinite(n.value)||(d.record(n.value,e.applyRedact(W(W(W({},e.config.hooks.getPageAttributes()),e.config.hooks.getMetricAttributes()),U_(n,l)))),f(n))};i(n=>{t||!Number.isFinite(n.value)||(u.record(n.value,e.applyRedact(W(W(W({},e.config.hooks.getPageAttributes()),e.config.hooks.getMetricAttributes()),U_(n,l)))),f(n))}),a(p),o(p),s(p),c(p)})()},shutdown(){t=!0}}};N(),bn(),G();var K_=64*1024,q_=6e4,J_=5,Y_=e=>e==null?0:typeof e==`string`?e.length>K_||typeof TextEncoder>`u`?e.length:new TextEncoder().encode(e).byteLength:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:typeof Blob<`u`&&e instanceof Blob?e.size:0,X_=(e,t)=>{let n={"network.protocol.name":`websocket`,"url.full":t(e)},r={"network.protocol.name":`websocket`};try{let t=new URL(e,typeof location>`u`?`http://localhost`:location.href);n[`server.address`]=t.host,n[`url.scheme`]=t.protocol.replace(`:`,``),r[`server.address`]=t.host,r[`url.scheme`]=n[`url.scheme`]}catch(e){}return{metricAttributes:r,spanAttributes:n}},Z_=(e,t)=>{var n;let{bytesCounter:r,connectDurationHistogram:i,context:a,errorCounter:o,errorThrottle:s,isDisposed:c,messageCounter:l,url:u}=t,{metricAttributes:d,spanAttributes:f}=X_(u,a.config.hooks.redactUrl),p=(n=f[`server.address`])==null?f[`url.full`]:n,m=a.startSpan(`websocket.connect`,W(W(W({},f),$({errorType:`none`,eventLabel:`WebSocket`,spanSubtype:`websocket`,spanType:Q.custom,targetLabel:p})),f[`server.address`]?{[X.targetDomain]:f[`server.address`]}:{})),h=performance.now(),g=!1,_=e=>{if(g)return;g=!0;let t=performance.now()-h;e===`error`&&m.setStatus({code:wt.ERROR,message:`websocket connect failed`}),m.setAttributes($({duration:t,errorType:e===`error`?`network`:`none`,eventLabel:`WebSocket`,result:e===`error`?Z.error:Z.success,spanSubtype:`websocket`,spanType:Q.custom,targetLabel:p,targetValue:t})),m.end(),e===`opened`&&!c()&&i.record(t,d)};e.addEventListener(`open`,()=>{c()||_(`opened`)}),e.addEventListener(`message`,e=>{if(c())return;let t=W(W({},d),{},{"websocket.direction":`in`});l.add(1,t),r.add(Y_(e.data),t)}),e.addEventListener(`error`,()=>{if(c())return;let e=g?`runtime`:`connect`;o.add(1,W(W({},d),{},{"websocket.error.phase":e})),_(`error`);let t=s.allow(`ws:error:${u}`);t.allowed&&a.emitLog({severityNumber:en.ERROR,severityText:`ERROR`,body:`websocket.error`,attributes:W(W(W({},f),$({errorType:`network`,eventLabel:`WebSocket 错误`,result:Z.error,spanSubtype:`websocket`,spanType:Q.custom,targetLabel:p})),{},{"websocket.error.phase":e,"websocket.error.window_count":t.count})})}),e.addEventListener(`close`,e=>{c()||(g||_(`error`),a.emitLog({severityNumber:en.INFO,severityText:`INFO`,body:`websocket.close`,attributes:W(W(W({},f),$({errorType:e.wasClean?`none`:`network`,eventLabel:`WebSocket 关闭`,result:e.wasClean?Z.success:Z.warning,spanSubtype:`websocket`,spanType:Q.custom,targetLabel:p,targetValue:e.code})),{},{"websocket.close.code":e.code,"websocket.close.reason":e.reason,"websocket.close.was_clean":e.wasClean})}))});let v=e.send.bind(e);e.send=e=>{if(!c()){let t=W(W({},d),{},{"websocket.direction":`out`});l.add(1,t),r.add(Y_(e),t)}return v(e)}},Q_=e=>{let t,n,r=!1;return{name:`websocket`,enabled:e.enabled,init(e){if(typeof window>`u`||window.WebSocket===void 0)return;let i=window.WebSocket;t=i;let a=e.meter.createCounter(`browser.websocket.message.count`,{description:`Total number of WebSocket messages observed`}),o=e.meter.createCounter(`browser.websocket.message.bytes`,{unit:`By`,description:`Total bytes transferred over WebSocket (best-effort)`}),s=e.meter.createCounter(`browser.websocket.error.count`,{description:`Total number of WebSocket error events`}),c=e.meter.createHistogram(`browser.websocket.connect.duration`,{unit:`ms`,description:`WebSocket connection establishment duration (only successful connects)`}),l=Ch(q_,J_),u=()=>r;n=new Proxy(i,{construct(t,n,i){let d=Reflect.construct(t,n,i);if(r)return d;let f=n[0]==null?``:String(n[0]);return!f||Sp(e.config,f)||Z_(d,{bytesCounter:o,connectDurationHistogram:c,context:e,errorCounter:s,errorThrottle:l,isDisposed:u,messageCounter:a,url:f}),d}}),window.WebSocket=n},shutdown(){r=!0,typeof window<`u`&&t&&window.WebSocket===n&&(window.WebSocket=t),n=void 0,t=void 0}}};G();var $_=`http://localhost:4318`,ev=60*1e3,tv=`unknown_service`,nv=e=>e.replace(/\/+$/,``),rv=(e,t)=>{let n=nv(e||$_);return n.endsWith(`/v1/${t}`)?n:n.endsWith(`/v1`)?`${n}/${t}`:`${n}/v1/${t}`},iv=(e,t)=>{var n,r,i,a,o;let s=e==null||(n=e.signals)==null?void 0:n[t],c=e==null||(r=e.signals)==null||(r=r.endpoints)==null?void 0:r[t],l=e!=null&&e.token||e!=null&&e.headers||s!=null&&s.headers?W(W(W({},e!=null&&e.token?{Authorization:`Bearer ${e.token}`}:{}),(i=e==null?void 0:e.headers)==null?{}:i),(a=s==null?void 0:s.headers)==null?{}:a):void 0;return{concurrencyLimit:s==null?void 0:s.concurrencyLimit,endpoint:c?nv(c):rv((o=s==null?void 0:s.endpoint)==null?e==null?void 0:e.endpoint:o,t),headers:l,timeoutMillis:s==null?void 0:s.timeoutMillis}},av=e=>typeof e!=`number`||!Number.isFinite(e)?1:Math.max(0,Math.min(1,e)),ov=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:t,sv=(e,t)=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:t,cv=(e,t)=>typeof e!=`number`||!Number.isFinite(e)?t:Math.max(0,Math.min(1,e)),lv=e=>e.body,uv=()=>({enabled:!1}),dv=e=>W({enabled:!0},e),fv=e=>e?{enabled:!0}:uv(),pv=e=>e===!1?uv():{enabled:!0},mv=e=>{var t;return e?dv(typeof e==`boolean`?{maxBodySize:10*1024,redact:lv}:{maxBodySize:ov(e.maxBodySize,10*1024),redact:(t=e.redact)==null?lv:t}):uv()},hv=e=>{var t;return{action:typeof(e==null?void 0:e.action)==`object`?dv({eventNames:(t=e.action.eventNames)==null?[`click`,`submit`,`keydown`]:t}):e!=null&&e.action?dv({eventNames:[`click`,`submit`,`keydown`]}):uv(),device:typeof(e==null?void 0:e.device)==`object`?dv({storageKey:e.device.storageKey}):(e==null?void 0:e.device)===!1?uv():dv({}),httpBody:mv(e==null?void 0:e.httpBody),session:typeof(e==null?void 0:e.session)==`object`?dv({inactivityMs:ov(e.session.inactivityMs,1800*1e3),maxLifetimeMs:ov(e.session.maxLifetimeMs,1440*60*1e3),storageKey:e.session.storageKey}):(e==null?void 0:e.session)===!1?uv():dv({inactivityMs:1800*1e3,maxLifetimeMs:1440*60*1e3}),pageView:pv(e==null?void 0:e.pageView),resource:pv(e==null?void 0:e.resource),error:typeof(e==null?void 0:e.error)==`object`?dv({maxPerWindow:ov(e.error.maxPerWindow,5),windowMs:ov(e.error.windowMs,6e4)}):(e==null?void 0:e.error)===!1?uv():dv({maxPerWindow:5,windowMs:6e4}),webVitals:pv(e==null?void 0:e.webVitals),blankScreen:typeof(e==null?void 0:e.blankScreen)==`object`?dv({checkDelay:sv(e.blankScreen.checkDelay,3e3),ignoreSelectors:e.blankScreen.ignoreSelectors,rootSelector:e.blankScreen.rootSelector,threshold:cv(e.blankScreen.threshold,.8)}):(e==null?void 0:e.blankScreen)===!1?uv():dv({checkDelay:3e3,threshold:.8}),websocket:fv(e==null?void 0:e.websocket),longTask:typeof(e==null?void 0:e.longTask)==`object`?dv({threshold:sv(e.longTask.threshold,50)}):e!=null&&e.longTask?dv({threshold:50}):uv(),cspViolation:fv(e==null?void 0:e.cspViolation),routeTiming:fv(e==null?void 0:e.routeTiming)}},gv=e=>{var t,n,r,i,a,o,s,c;return{instrumentations:{documentLoad:(t=e==null||(n=e.instrumentations)==null?void 0:n.documentLoad)==null?!0:t,fetch:(r=e==null||(i=e.instrumentations)==null?void 0:i.fetch)==null?!0:r,xhr:(a=e==null||(o=e.instrumentations)==null?void 0:o.xhr)==null?!0:a,userInteraction:(s=e==null||(c=e.instrumentations)==null?void 0:c.userInteraction)==null?!0:s},plugins:hv(e==null?void 0:e.plugins)}},_v=e=>e,vv=e=>e,yv=e=>{try{return new URL(e,typeof location>`u`?`http://localhost`:location.href).pathname||`/`}catch(t){return e||`/`}},bv=e=>{var t,n;return{environment:(t=e==null?void 0:e.environment)==null?`production`:t,name:(n=e==null?void 0:e.name)==null?tv:n,version:e==null?void 0:e.version}},xv=e=>W(W({[X.deploymentEnvironmentName]:e.environment,"rum.provider":`blueking`,[X.serviceName]:e.name},e.version?{[X.serviceVersion]:e.version}:{}),{},{"telemetry.sdk.language":`webjs`}),Sv=e=>({endpoint:nv((e==null?void 0:e.endpoint)||$_),traces:iv(e,`traces`),metrics:iv(e,`metrics`),logs:iv(e,`logs`)}),Cv=e=>({rate:av(e==null?void 0:e.rate)}),wv=e=>{var t,n,r,i,a,o,s,c,l,u,d,f;return{getPageAttributes:(t=(n=e.attributes)==null?void 0:n.page)==null?(()=>({"rum.page.host":typeof window>`u`?``:window.location.host,"rum.page.path":typeof window>`u`?``:window.location.pathname})):t,getMetricAttributes:(r=(i=e.attributes)==null?void 0:i.metric)==null?(()=>({})):r,getErrorAttributes:(a=(o=e.attributes)==null?void 0:o.error)==null?(()=>({})):a,getCustomAttributes:(s=(c=e.attributes)==null?void 0:c.custom)==null?(()=>({})):s,getViewPathGroup:t=>{var n,r,i;return(n=(r=e.route)==null||(i=r.getPathGroup)==null?void 0:i.call(r,t))==null?yv(t):n},redactAttributes:(l=(u=e.privacy)==null?void 0:u.redactAttributes)==null?_v:l,redactUrl:(d=(f=e.privacy)==null?void 0:f.redactUrl)==null?vv:d}},Tv=e=>{var t,n,r,i,a,o;let s=bv(e.app);return{app:s,autoStart:(t=e.autoStart)==null?!0:t,debug:(n=e.debug)==null?!1:n,enabled:(r=e.enabled)==null?!0:r,hooks:wv(e),instrumentations:(i=e.instrumentations)==null?[]:i,metricIntervalMillis:ev,plugins:(a=e.plugins)==null?[]:a,resourceAttributes:xv(s),rum:gv(e.rum),sampling:Cv(e.sampling),spanBatch:e.spanBatch,spanProcessor:(o=e.spanProcessor)==null?`batch`:o,transport:Sv(e.transport),user:e.user}};F(),H();var Ev=(e,t)=>typeof e.enabled==`function`?e.enabled(t):e.enabled!==!1,Dv=class{constructor(e){P(this,`plugins`,void 0),P(this,`startedPlugins`,[]),this.plugins=e}flush(){var e=this;return V(function*(){yield Promise.all(e.startedPlugins.map(e=>Promise.resolve().then(()=>{var t;return(t=e.flush)==null?void 0:t.call(e)})))})()}shutdown(){var e=this;return V(function*(){let t=[...e.startedPlugins].reverse();for(let e of t){var n;yield(n=e.shutdown)==null?void 0:n.call(e)}e.startedPlugins=[]})()}start(e){var t=this;return V(function*(){for(let r of t.plugins)if(Ev(r,e.config))try{yield r.init(e),t.startedPlugins.push(r)}catch(t){if(e.config.debug){var n;(n=globalThis.console)==null||n.warn(`[bk-ot] plugin "${r.name}" init failed:`,t)}}})()}},Ov=[`http.url`,`url.full`],kv=e=>{for(let n of Ov){var t;let r=(t=e.attributes)==null?void 0:t[n];if(typeof r==`string`)return r}},Av=class{constructor(e,t){this.inner=e,this.config=t}forceFlush(){return this.inner.forceFlush()}onEnd(e){let t=kv(e);t&&xp(this.config,t)||this.inner.onEnd(e)}onStart(e,t){this.inner.onStart(e,t)}shutdown(){return this.inner.shutdown()}};F(),G();var jv=class{constructor(e={},t){P(this,`attributes`,{}),P(this,`setOptionalAttribute`,(e,t)=>{if(t===void 0){delete this.attributes[e];return}this.attributes[e]=t}),P(this,`user`,{}),P(this,`view`,{}),P(this,`getAttributes`,()=>W({},this.attributes)),P(this,`getUser`,()=>W({},this.user)),P(this,`getView`,()=>W({},this.view)),P(this,`setAttributes`,e=>{for(let[t,n]of Object.entries(e)){if(n===void 0){delete this.attributes[t];continue}this.attributes[t]=n}}),P(this,`setUser`,e=>{if(this.user=W(W({},this.user),e),`id`in e){if(e.id===void 0){delete this.attributes[X.userId];return}this.attributes[X.userId]=e.id}}),P(this,`setView`,e=>{this.view=W(W({},this.view),e),this.setOptionalAttribute(X.viewId,e.id),this.setOptionalAttribute(X.viewUrl,e.url),this.setOptionalAttribute(X.viewUrlPathGroup,e.urlPathGroup),this.setOptionalAttribute(X.viewLoadingType,e.loadingType)}),this.setAttributes(e),t&&this.setUser(t)}},Mv=`BK_RUM_SAMPLING`,Nv=new Map,Pv=e=>Nv.get(e),Fv=(e,t)=>(Nv.set(e,t),t),Iv=({sampling:e})=>{if(e.rate<=0)return!1;if(e.rate>=1)return!0;try{let t=sessionStorage.getItem(Mv);if(t)return t===`1`;let n=Math.random()<e.rate;return sessionStorage.setItem(Mv,n?`1`:`0`),Fv(Mv,n),n}catch(t){let n=Pv(Mv);return typeof n==`boolean`?n:Fv(Mv,Math.random()<e.rate)}};N(),bn(),B(),Qu(),lc(),Cf(),Yf(),F(),G(),H();var Lv=e=>({url:e.endpoint,headers:e.headers,concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis}),Rv=`bk-rum`,zv=(e,t,n)=>n?new Proxy(e,{get(e,n,r){if(n===`export`)return(n,r)=>{var i;return(i=globalThis.console)==null||i.log(`[bk-ot][${t}]`,n),e.export(n,r)};let i=Reflect.get(e,n,r);return typeof i==`function`?i.bind(e):i}}):e,Bv=e=>[xh(e.rum.instrumentations)],Vv=e=>[op(e.rum.plugins.action),Vh(e.rum.plugins.device),pg(e.rum.plugins.httpBody),Gg(e.rum.plugins.session),kg(e.rum.plugins.pageView),Xh(e.rum.plugins.error),G_(e.rum.plugins.webVitals),jg(e.rum.plugins.resource),hp(e.rum.plugins.blankScreen),Q_(e.rum.plugins.websocket),hg(e.rum.plugins.longTask),Oh(e.rum.plugins.cspViolation),Mg(e.rum.plugins.routeTiming)],Hv=class{assertBeforeStart(e){if(this.phase!==`idle`)throw Error(`[bk-ot] ${e}() must be called before start(); set autoStart: false before registration.`)}constructor(e){var t=this;P(this,`loggerProvider`,void 0),P(this,`meterProvider`,void 0),P(this,`phase`,`idle`),P(this,`pluginManager`,void 0),P(this,`plugins`,void 0),P(this,`registeredInstrumentations`,void 0),P(this,`runtimeContext`,void 0),P(this,`sampled`,void 0),P(this,`teardownCallbacks`,[]),P(this,`tracerProvider`,void 0),P(this,`applyRedact`,e=>this.config.hooks.redactAttributes(e)),P(this,`config`,void 0),P(this,`emitLog`,e=>{var t;let n=W(W({},e),{},{attributes:this.applyRedact(W(W({},this.getRuntimeAttributes()),(t=e.attributes)==null?{}:t))});this.logger.emit(n)}),P(this,`flush`,V(function*(){yield t.pluginManager.flush(),yield t.tracerProvider.forceFlush(),yield t.meterProvider.forceFlush(),yield t.loggerProvider.forceFlush()})),P(this,`getRuntimeAttributes`,()=>this.runtimeContext.getAttributes()),P(this,`logger`,void 0),P(this,`meter`,void 0),P(this,`reportAction`,({attributes:e={},targetTag:t,targetText:n,type:r})=>{var i;if(!this.sampled)return;let a=n==null?void 0:n.slice(0,32);this.startSpan(`action.${r}`,W(W(W(W(W({},this.config.hooks.getPageAttributes()),$({errorType:`none`,eventLabel:`用户操作`,spanSubtype:r,spanType:Q.action,targetLabel:(i=a==null?t:a)==null?r:i})),{},{[X.actionType]:r},a?{[X.targetTextShort]:a}:{}),t?{[X.targetTag]:t}:{}),e)).end()}),P(this,`reportCustomEvent`,({attributes:e={},error:t,name:n})=>{if(!this.sampled){if(this.config.debug){var r;(r=globalThis.console)==null||r.warn(`[bk-ot] custom event dropped (not sampled):`,n)}return}let i=this.startSpan(`custom.${n}`,W(W(W(W(W({},this.config.hooks.getPageAttributes()),this.config.hooks.getCustomAttributes()),$({errorType:t?`custom`:`none`,eventLabel:`自定义事件`,result:t?Z.error:Z.success,spanSubtype:n,spanType:Q.custom,targetLabel:n})),e),{},{"rum.custom.name":n}));t&&(i.recordException(t),i.setStatus({code:wt.ERROR,message:t.message})),i.end()}),P(this,`setRuntimeAttributes`,e=>{this.runtimeContext.setAttributes(e)}),P(this,`setUser`,e=>{this.runtimeContext.setUser(e)}),P(this,`setView`,e=>{this.runtimeContext.setView(e)}),P(this,`shutdown`,V(function*(){if(t.phase!==`stopped`){for(yield t.flush();t.teardownCallbacks.length;){var e;(e=t.teardownCallbacks.pop())==null||e()}for(yield t.pluginManager.shutdown();t.registeredInstrumentations.length;){var n,r;(n=t.registeredInstrumentations.pop())==null||(r=n.disable)==null||r.call(n)}yield t.tracerProvider.shutdown(),yield t.meterProvider.shutdown(),yield t.loggerProvider.shutdown(),M.disable(),Pt.disable(),A.disable(),t.phase=`stopped`}})),P(this,`start`,V(function*(){if(!(t.phase===`started`||t.phase===`starting`)){if(t.phase===`stopped`)throw Error(`[bk-ot] instance has been shut down and cannot be restarted; create a new instance instead.`);if(!t.config.enabled){t.phase=`started`;return}t.phase=`starting`,Jt.setGlobalPropagator(new Ba),t.tracerProvider.register({contextManager:new kn}),Pt.setGlobalMeterProvider(t.meterProvider),yn.setGlobalLoggerProvider(t.loggerProvider);try{if(t.registeredInstrumentations.length&&Pu({instrumentations:t.registeredInstrumentations,meterProvider:t.meterProvider,tracerProvider:t.tracerProvider}),yield t.pluginManager.start(t),typeof window<`u`&&typeof document<`u`){let e=()=>{t.flush()},n=()=>{document.visibilityState===`hidden`&&t.flush()};window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,n),t.teardownCallbacks.push(()=>window.removeEventListener(`pagehide`,e),()=>document.removeEventListener(`visibilitychange`,n))}}catch(r){for(;t.teardownCallbacks.length;){var e;(e=t.teardownCallbacks.pop())==null||e()}yield t.pluginManager.shutdown();for(let e of t.registeredInstrumentations){var n;(n=e.disable)==null||n.call(e)}throw M.disable(),Pt.disable(),A.disable(),t.phase=`idle`,r}t.phase=`started`}})),P(this,`startSpan`,(e,t={},n)=>this.tracer.startSpan(e,{kind:St.INTERNAL,startTime:n==null?void 0:n.startTime,attributes:this.applyRedact(W(W({},this.getRuntimeAttributes()),t))})),P(this,`tracer`,void 0),P(this,`use`,e=>(this.assertBeforeStart(`use`),this.sampled&&this.plugins.push(e),this)),P(this,`useInstrumentation`,e=>(this.assertBeforeStart(`useInstrumentation`),this.config.enabled&&this.registeredInstrumentations.push(e),this)),this.config=Tv(e),this.sampled=this.config.enabled&&Iv(this.config);let n=nc(this.config.resourceAttributes),r=zv(new Au(Lv(this.config.transport.traces)),`traces`,this.config.debug),i=zv(new ku(Lv(this.config.transport.metrics)),`metrics`,this.config.debug),a=zv(new yu(Lv(this.config.transport.logs)),`logs`,this.config.debug),o=new Av(this.config.spanProcessor===`simple`?new xf(r):new Wd(r,this.config.spanBatch),this.config),s=new Xs({exporter:i,exportIntervalMillis:this.config.metricIntervalMillis}),c=new _d(a);this.tracerProvider=new Of({resource:n,sampler:new Od({root:new Ad(+!!this.sampled)}),spanProcessors:[o]}),this.meterProvider=new cl({resource:n,readers:[s]}),this.loggerProvider=new fd({resource:n,processors:[c]}),this.tracer=this.tracerProvider.getTracer(Rv),this.meter=this.meterProvider.getMeter(Rv),this.logger=this.loggerProvider.getLogger(Rv),this.runtimeContext=new jv({"rum.sampled":this.sampled},this.config.user),this.registeredInstrumentations=this.config.enabled?[...this.config.instrumentations]:[],this.plugins=[...this.config.enabled?Bv(this.config):[],...this.sampled?[...Vv(this.config),...this.config.plugins]:[]],this.pluginManager=new Dv(this.plugins),this.config.autoStart&&this.start().catch(e=>{var t;(t=globalThis.console)==null||t.warn(`[bk-ot] auto start failed:`,e)})}};return typeof window<`u`&&Object.assign(window,{BkOpenTelemetry:Hv}),Hv})();
|