@monoscopetech/browser 0.4.2 → 0.4.4
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/LICENSE +21 -0
- package/README.md +108 -0
- package/dist/browser.js +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/index.js +0 -1
- package/dist/monoscope.min.js +21 -0
- package/dist/monoscope.min.js.map +1 -0
- package/dist/monoscope.umd.js +21 -0
- package/dist/monoscope.umd.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/package.json +3 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Monoscopetech
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Monoscope Browser SDK
|
|
2
|
+
|
|
3
|
+
The **Monoscope Browser SDK** is a lightweight JavaScript library for adding **session replay**, **performance tracing**, and **frontend logging** to your web applications.
|
|
4
|
+
|
|
5
|
+
When used together with the [Monoscope Server SDKs](https://apitoolkit.io/docs/sdks/), you gain **end-to-end observability** — seamlessly connecting user interactions in the browser to backend services, APIs, and databases.
|
|
6
|
+
|
|
7
|
+
This means you can:
|
|
8
|
+
|
|
9
|
+
- **Replay user sessions** to see exactly what happened.
|
|
10
|
+
- **Trace requests** from the frontend, through your backend, and into your database.
|
|
11
|
+
- **Capture logs and errors** with full context for faster debugging.
|
|
12
|
+
|
|
13
|
+
With the sdk, you can seamlessly monitor how users interact with your app, measure performance, and gain insights into issues — all in one place.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Install via **npm/bun**:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @monoscopetech/browser
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or include it directly in your HTML using a `<script>` tag:
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<script src="https://unpkg.com/@monoscopetech/browser@latest/dist/monoscope.min.js"></script>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
Initialize Monoscope with your **project ID** and configuration:
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
import Monoscope from "@monoscopetech/browser";
|
|
39
|
+
|
|
40
|
+
const monoscope = new Monoscope({
|
|
41
|
+
projectId: "YOUR_PROJECT_ID",
|
|
42
|
+
serviceName: "my-web-app",
|
|
43
|
+
// ...other configuration options
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Configuration
|
|
50
|
+
|
|
51
|
+
The `Monoscope` constructor accepts the following options:
|
|
52
|
+
|
|
53
|
+
| Name | Type | Description |
|
|
54
|
+
| ------------------------------ | --------------------- | ---------------------------------------------------------------------------- |
|
|
55
|
+
| `projectId` | `string` | **Required** – Your Monoscope project ID. |
|
|
56
|
+
| `serviceName` | `string` | **Required** – Name of your service or application. |
|
|
57
|
+
| `exporterEndpoint` | `string` | Endpoint for exporting traces/logs. Defaults to Monoscope's ingest endpoint. |
|
|
58
|
+
| `propagateTraceHeaderCorsUrls` | `RegExp[]` | Array of regex patterns for URLs where trace headers should be propagated. |
|
|
59
|
+
| `resourceAttributes` | `Record<string, any>` | Additional resource-level attributes. |
|
|
60
|
+
| `instrumentations` | `any[]` | OpenTelemetry instrumentations to enable. |
|
|
61
|
+
| `replayEventsBaseUrl` | `string` | Base URL for session replay events. Defaults to Monoscope's ingest endpoint. |
|
|
62
|
+
| `user` | `MonoscopeUser` | Default user information for the session. |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### User Object
|
|
67
|
+
|
|
68
|
+
The `MonoscopeUser` object can contain:
|
|
69
|
+
|
|
70
|
+
| Name | Type | Description |
|
|
71
|
+
| ---------- | ---------- | ------------------------- |
|
|
72
|
+
| `email` | `string` | User's email address. |
|
|
73
|
+
| `fullName` | `string` | User's full name. |
|
|
74
|
+
| `name` | `string` | User's preferred name. |
|
|
75
|
+
| `id` | `string` | User's unique identifier. |
|
|
76
|
+
| `roles` | `string[]` | User's roles. |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## API
|
|
81
|
+
|
|
82
|
+
### `setUser(user: MonoscopeUser)`
|
|
83
|
+
|
|
84
|
+
Associates the given user with the current session.
|
|
85
|
+
|
|
86
|
+
```javascript
|
|
87
|
+
monoscope.setUser({
|
|
88
|
+
id: "user-123",
|
|
89
|
+
email: "user@example.com",
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### `getSessionId(): string`
|
|
96
|
+
|
|
97
|
+
Retrieves the current session ID — useful for tagging custom spans or events.
|
|
98
|
+
|
|
99
|
+
```javascript
|
|
100
|
+
const sessionId = monoscope.getSessionId();
|
|
101
|
+
console.log(sessionId);
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
This SDK is licensed under the [MIT License](LICENSE).
|
package/dist/browser.js
CHANGED
|
@@ -17,5 +17,5 @@ var Monoscope=function(e,t,n,r,o,s,i,a,l){"use strict";function c(e){var t=Objec
|
|
|
17
17
|
* @license Angular v<unknown>
|
|
18
18
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
19
19
|
* License: MIT
|
|
20
|
-
*/const vg=globalThis;function bg(e){return(vg.__Zone_symbol_prefix||"__zone_symbol__")+e}const wg=Object.getOwnPropertyDescriptor,Cg=Object.defineProperty,_g=Object.getPrototypeOf,Sg=Object.create,Ig=Array.prototype.slice,Eg="addEventListener",Ag="removeEventListener",Tg=bg(Eg),kg=bg(Ag),Og="true",xg="false",Rg=bg("");function Ng(e,t){return Zone.current.wrap(e,t)}function Mg(e,t,n,r,o){return Zone.current.scheduleMacroTask(e,t,n,r,o)}const Lg=bg,Pg="undefined"!=typeof window,Dg=Pg?window:void 0,Fg=Pg&&Dg||globalThis;function Ug(e,t){for(let n=e.length-1;n>=0;n--)"function"==typeof e[n]&&(e[n]=Ng(e[n],t+"_"+n));return e}function Bg(e){return!e||!1!==e.writable&&!("function"==typeof e.get&&void 0===e.set)}const jg="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,Zg=!("nw"in Fg)&&void 0!==Fg.process&&"[object process]"===Fg.process.toString(),zg=!Zg&&!jg&&!(!Pg||!Dg.HTMLElement),Vg=void 0!==Fg.process&&"[object process]"===Fg.process.toString()&&!jg&&!(!Pg||!Dg.HTMLElement),Gg={},Wg=Lg("enable_beforeunload"),$g=function(e){if(!(e=e||Fg.event))return;let t=Gg[e.type];t||(t=Gg[e.type]=Lg("ON_PROPERTY"+e.type));const n=this||e.target||Fg,r=n[t];let o;if(zg&&n===Dg&&"error"===e.type){const t=e;o=r&&r.call(this,t.message,t.filename,t.lineno,t.colno,t.error),!0===o&&e.preventDefault()}else o=r&&r.apply(this,arguments),"beforeunload"===e.type&&Fg[Wg]&&"string"==typeof o?e.returnValue=o:null==o||o||e.preventDefault();return o};function Hg(e,t,n){let r=wg(e,t);if(!r&&n){wg(n,t)&&(r={enumerable:!0,configurable:!0})}if(!r||!r.configurable)return;const o=Lg("on"+t+"patched");if(e.hasOwnProperty(o)&&e[o])return;delete r.writable,delete r.value;const s=r.get,i=r.set,a=t.slice(2);let l=Gg[a];l||(l=Gg[a]=Lg("ON_PROPERTY"+a)),r.set=function(t){let n=this;if(n||e!==Fg||(n=Fg),!n)return;"function"==typeof n[l]&&n.removeEventListener(a,$g),i?.call(n,null),n[l]=t,"function"==typeof t&&n.addEventListener(a,$g,!1)},r.get=function(){let n=this;if(n||e!==Fg||(n=Fg),!n)return null;const o=n[l];if(o)return o;if(s){let e=s.call(this);if(e)return r.set.call(this,e),"function"==typeof n.removeAttribute&&n.removeAttribute(t),e}return null},Cg(e,t,r),e[o]=!0}function Yg(e,t,n){if(t)for(let r=0;r<t.length;r++)Hg(e,"on"+t[r],n);else{const t=[];for(const n in e)"on"==n.slice(0,2)&&t.push(n);for(let r=0;r<t.length;r++)Hg(e,t[r],n)}}const Kg=Lg("originalInstance");function qg(e){const t=Fg[e];if(!t)return;Fg[Lg(e)]=t,Fg[e]=function(){const n=Ug(arguments,e);switch(n.length){case 0:this[Kg]=new t;break;case 1:this[Kg]=new t(n[0]);break;case 2:this[Kg]=new t(n[0],n[1]);break;case 3:this[Kg]=new t(n[0],n[1],n[2]);break;case 4:this[Kg]=new t(n[0],n[1],n[2],n[3]);break;default:throw new Error("Arg list too long.")}},Qg(Fg[e],t);const n=new t(function(){});let r;for(r in n)"XMLHttpRequest"===e&&"responseBlob"===r||function(t){"function"==typeof n[t]?Fg[e].prototype[t]=function(){return this[Kg][t].apply(this[Kg],arguments)}:Cg(Fg[e].prototype,t,{set:function(n){"function"==typeof n?(this[Kg][t]=Ng(n,e+"."+t),Qg(this[Kg][t],n)):this[Kg][t]=n},get:function(){return this[Kg][t]}})}(r);for(r in t)"prototype"!==r&&t.hasOwnProperty(r)&&(Fg[e][r]=t[r])}function Xg(e,t,n){let r=e;for(;r&&!r.hasOwnProperty(t);)r=_g(r);!r&&e[t]&&(r=e);const o=Lg(t);let s=null;if(r&&(!(s=r[o])||!r.hasOwnProperty(o))){s=r[o]=r[t];if(Bg(r&&wg(r,t))){const e=n(s,o,t);r[t]=function(){return e(this,arguments)},Qg(r[t],s)}}return s}function Jg(e,t,n){let r=null;function o(e){const t=e.data;return t.args[t.cbIdx]=function(){e.invoke.apply(this,arguments)},r.apply(t.target,t.args),e}r=Xg(e,t,e=>function(t,r){const s=n(t,r);return s.cbIdx>=0&&"function"==typeof r[s.cbIdx]?Mg(s.name,r[s.cbIdx],s,o):e.apply(t,r)})}function Qg(e,t){e[Lg("OriginalDelegate")]=t}let ey=!1,ty=!1;function ny(){if(ey)return ty;ey=!0;try{const e=Dg.navigator.userAgent;-1===e.indexOf("MSIE ")&&-1===e.indexOf("Trident/")&&-1===e.indexOf("Edge/")||(ty=!0)}catch(e){}return ty}function ry(e){return"function"==typeof e}function oy(e){return"number"==typeof e}const sy={useG:!0},iy={},ay={},ly=new RegExp("^"+Rg+"(\\w+)(true|false)$"),cy=Lg("propagationStopped");function uy(e,t){const n=(t?t(e):e)+xg,r=(t?t(e):e)+Og,o=Rg+n,s=Rg+r;iy[e]={},iy[e][xg]=o,iy[e][Og]=s}function hy(e,t,n,r){const o=r&&r.add||Eg,s=r&&r.rm||Ag,i=r&&r.listeners||"eventListeners",a=r&&r.rmAll||"removeAllListeners",l=Lg(o),c="."+o+":",u="prependListener",h="."+u+":",p=function(e,t,n){if(e.isRemoved)return;const r=e.callback;let o;"object"==typeof r&&r.handleEvent&&(e.callback=e=>r.handleEvent(e),e.originalDelegate=r);try{e.invoke(e,t,[n])}catch(e){o=e}const i=e.options;if(i&&"object"==typeof i&&i.once){const r=e.originalDelegate?e.originalDelegate:e.callback;t[s].call(t,n.type,r,i)}return o};function d(n,r,o){if(!(r=r||e.event))return;const s=n||r.target||e,i=s[iy[r.type][o?Og:xg]];if(i){const e=[];if(1===i.length){const t=p(i[0],s,r);t&&e.push(t)}else{const t=i.slice();for(let n=0;n<t.length&&(!r||!0!==r[cy]);n++){const o=p(t[n],s,r);o&&e.push(o)}}if(1===e.length)throw e[0];for(let n=0;n<e.length;n++){const r=e[n];t.nativeScheduleMicroTask(()=>{throw r})}}}const f=function(e){return d(this,e,!1)},m=function(e){return d(this,e,!0)};function g(t,n){if(!t)return!1;let r=!0;n&&void 0!==n.useG&&(r=n.useG);const p=n&&n.vh;let d=!0;n&&void 0!==n.chkDup&&(d=n.chkDup);let g=!1;n&&void 0!==n.rt&&(g=n.rt);let y=t;for(;y&&!y.hasOwnProperty(o);)y=_g(y);if(!y&&t[o]&&(y=t),!y)return!1;if(y[l])return!1;const v=n&&n.eventNameToString,b={},w=y[l]=y[o],C=y[Lg(s)]=y[s],_=y[Lg(i)]=y[i],S=y[Lg(a)]=y[a];let I;n&&n.prepend&&(I=y[Lg(n.prepend)]=y[n.prepend]);const E=function(e){return I.call(b.target,b.eventName,e.invoke,b.options)},A=r?function(e){if(!b.isExisting)return w.call(b.target,b.eventName,b.capture?m:f,b.options)}:function(e){return w.call(b.target,b.eventName,e.invoke,b.options)},T=r?function(e){if(!e.isRemoved){const t=iy[e.eventName];let n;t&&(n=t[e.capture?Og:xg]);const 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),0===r.length&&(e.allRemoved=!0,e.target[n]=null);break}}}if(e.allRemoved)return C.call(e.target,e.eventName,e.capture?m:f,e.options)}:function(e){return C.call(e.target,e.eventName,e.invoke,e.options)},k=n?.diff||function(e,t){const n=typeof t;return"function"===n&&e.callback===t||"object"===n&&e.originalDelegate===t},O=Zone[Lg("UNPATCHED_EVENTS")],x=e[Lg("PASSIVE_EVENTS")];const R=function(t,o,s,i,a=!1,l=!1){return function(){const c=this||e;let u=arguments[0];n&&n.transferEventName&&(u=n.transferEventName(u));let h=arguments[1];if(!h)return t.apply(this,arguments);if(Zg&&"uncaughtException"===u)return t.apply(this,arguments);let f=!1;if("function"!=typeof h){if(!h.handleEvent)return t.apply(this,arguments);f=!0}if(p&&!p(t,h,c,arguments))return;const m=!!x&&-1!==x.indexOf(u),g=function(e){if("object"==typeof e&&null!==e){const t={...e};return e.signal&&(t.signal=e.signal),t}return e}(function(e,t){return t?"boolean"==typeof e?{capture:e,passive:!0}:e?"object"==typeof e&&!1!==e.passive?{...e,passive:!0}:e:{passive:!0}:e}(arguments[2],m)),y=g?.signal;if(y?.aborted)return;if(O)for(let e=0;e<O.length;e++)if(u===O[e])return m?t.call(c,u,h,g):t.apply(this,arguments);const w=!!g&&("boolean"==typeof g||g.capture),C=!(!g||"object"!=typeof g)&&g.once,_=Zone.current;let S=iy[u];S||(uy(u,v),S=iy[u]);const I=S[w?Og:xg];let E,A=c[I],T=!1;if(A){if(T=!0,d)for(let e=0;e<A.length;e++)if(k(A[e],h))return}else A=c[I]=[];const R=c.constructor.name,N=ay[R];N&&(E=N[u]),E||(E=R+o+(v?v(u):u)),b.options=g,C&&(b.options.once=!1),b.target=c,b.capture=w,b.eventName=u,b.isExisting=T;const M=r?sy:void 0;M&&(M.taskData=b),y&&(b.options.signal=void 0);const L=_.scheduleEventTask(E,h,M,s,i);if(y){b.options.signal=y;const e=()=>L.zone.cancelTask(L);t.call(y,"abort",e,{once:!0}),L.removeAbortListener=()=>y.removeEventListener("abort",e)}return b.target=null,M&&(M.taskData=null),C&&(b.options.once=!0),"boolean"!=typeof L.options&&(L.options=g),L.target=c,L.capture=w,L.eventName=u,f&&(L.originalDelegate=h),l?A.unshift(L):A.push(L),a?c:void 0}};return y[o]=R(w,c,A,T,g),I&&(y[u]=R(I,h,E,T,g,!0)),y[s]=function(){const t=this||e;let r=arguments[0];n&&n.transferEventName&&(r=n.transferEventName(r));const o=arguments[2],s=!!o&&("boolean"==typeof o||o.capture),i=arguments[1];if(!i)return C.apply(this,arguments);if(p&&!p(C,i,t,arguments))return;const a=iy[r];let l;a&&(l=a[s?Og:xg]);const c=l&&t[l];if(c)for(let e=0;e<c.length;e++){const n=c[e];if(k(n,i)){if(c.splice(e,1),n.isRemoved=!0,0===c.length&&(n.allRemoved=!0,t[l]=null,!s&&"string"==typeof r)){t[Rg+"ON_PROPERTY"+r]=null}return n.zone.cancelTask(n),g?t:void 0}}return C.apply(this,arguments)},y[i]=function(){const t=this||e;let r=arguments[0];n&&n.transferEventName&&(r=n.transferEventName(r));const o=[],s=py(t,v?v(r):r);for(let e=0;e<s.length;e++){const t=s[e];let n=t.originalDelegate?t.originalDelegate:t.callback;o.push(n)}return o},y[a]=function(){const t=this||e;let r=arguments[0];if(r){n&&n.transferEventName&&(r=n.transferEventName(r));const e=iy[r];if(e){const n=e[xg],o=e[Og],i=t[n],a=t[o];if(i){const e=i.slice();for(let t=0;t<e.length;t++){const n=e[t];let o=n.originalDelegate?n.originalDelegate:n.callback;this[s].call(this,r,o,n.options)}}if(a){const e=a.slice();for(let t=0;t<e.length;t++){const n=e[t];let o=n.originalDelegate?n.originalDelegate:n.callback;this[s].call(this,r,o,n.options)}}}}else{const e=Object.keys(t);for(let t=0;t<e.length;t++){const n=e[t],r=ly.exec(n);let o=r&&r[1];o&&"removeListener"!==o&&this[a].call(this,o)}this[a].call(this,"removeListener")}if(g)return this},Qg(y[o],w),Qg(y[s],C),S&&Qg(y[a],S),_&&Qg(y[i],_),!0}let y=[];for(let e=0;e<n.length;e++)y[e]=g(n[e],r);return y}function py(e,t){if(!t){const n=[];for(let r in e){const o=ly.exec(r);let s=o&&o[1];if(s&&(!t||s===t)){const t=e[r];if(t)for(let e=0;e<t.length;e++)n.push(t[e])}}return n}let n=iy[t];n||(uy(t),n=iy[t]);const r=e[n[xg]],o=e[n[Og]];return r?o?r.concat(o):r.slice():o?o.slice():[]}function dy(e,t){const n=e.Event;n&&n.prototype&&t.patchMethod(n.prototype,"stopImmediatePropagation",e=>function(t,n){t[cy]=!0,e&&e.apply(t,n)})}function fy(e,t){t.patchMethod(e,"queueMicrotask",e=>function(e,t){Zone.current.scheduleMicroTask("queueMicrotask",t[0])})}const my=Lg("zoneTask");function gy(e,t,n,r){let o=null,s=null;n+=r;const i={};function a(t){const n=t.data;n.args[0]=function(){return t.invoke.apply(this,arguments)};const r=o.apply(e,n.args);return oy(r)?n.handleId=r:(n.handle=r,n.isRefreshable=ry(r.refresh)),t}function l(t){const{handle:n,handleId:r}=t.data;return s.call(e,n??r)}o=Xg(e,t+=r,n=>function(o,s){if(ry(s[0])){const e={isRefreshable:!1,isPeriodic:"Interval"===r,delay:"Timeout"===r||"Interval"===r?s[1]||0:void 0,args:s},n=s[0];s[0]=function(){try{return n.apply(this,arguments)}finally{const{handle:t,handleId:n,isPeriodic:r,isRefreshable:o}=e;r||o||(n?delete i[n]:t&&(t[my]=null))}};const o=Mg(t,s[0],e,a,l);if(!o)return o;const{handleId:c,handle:u,isRefreshable:h,isPeriodic:p}=o.data;if(c)i[c]=o;else if(u&&(u[my]=o,h&&!p)){const e=u.refresh;u.refresh=function(){const{zone:t,state:n}=o;return"notScheduled"===n?(o._state="scheduled",t._updateTaskCount(o,1)):"running"===n&&(o._state="scheduling"),e.call(this)}}return u??c??o}return n.apply(e,s)}),s=Xg(e,n,t=>function(n,r){const o=r[0];let s;oy(o)?(s=i[o],delete i[o]):(s=o?.[my],s?o[my]=null:s=o),s?.type?s.cancelFn&&s.zone.cancelTask(s):t.apply(e,r)})}function yy(e,t){if(Zone[t.symbol("patchEventTarget")])return;const{eventNames:n,zoneSymbolEventNames:r,TRUE_STR:o,FALSE_STR:s,ZONE_SYMBOL_PREFIX:i}=t.getGlobalObjects();for(let e=0;e<n.length;e++){const t=n[e],a=i+(t+s),l=i+(t+o);r[t]={},r[t][s]=a,r[t][o]=l}const a=e.EventTarget;return a&&a.prototype?(t.patchEventTarget(e,t,[a&&a.prototype]),!0):void 0}function vy(e,t,n){if(!n||0===n.length)return t;const r=n.filter(t=>t.target===e);if(0===r.length)return t;const o=r[0].ignoreProperties;return t.filter(e=>-1===o.indexOf(e))}function by(e,t,n,r){if(!e)return;Yg(e,vy(e,t,n),r)}function wy(e){return Object.getOwnPropertyNames(e).filter(e=>e.startsWith("on")&&e.length>2).map(e=>e.substring(2))}function Cy(e,t){if(Zg&&!Vg)return;if(Zone[e.symbol("patchEvents")])return;const n=t.__Zone_ignore_on_properties;let r=[];if(zg){const e=window;r=r.concat(["Document","SVGElement","Element","HTMLElement","HTMLBodyElement","HTMLMediaElement","HTMLFrameSetElement","HTMLFrameElement","HTMLIFrameElement","HTMLMarqueeElement","Worker"]);const t=[];by(e,wy(e),n?n.concat(t):n,_g(e))}r=r.concat(["XMLHttpRequest","XMLHttpRequestEventTarget","IDBIndex","IDBRequest","IDBOpenDBRequest","IDBDatabase","IDBTransaction","IDBCursor","WebSocket"]);for(let e=0;e<r.length;e++){const o=t[r[e]];o?.prototype&&by(o.prototype,wy(o.prototype),n)}}function _y(e){e.__load_patch("ZoneAwarePromise",(e,t,n)=>{const r=Object.getOwnPropertyDescriptor,o=Object.defineProperty;const s=n.symbol,i=[],a=!1!==e[s("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")],l=s("Promise"),c=s("then");n.onUnhandledError=e=>{if(n.showUncaughtError()){const 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(;i.length;){const e=i.shift();try{e.zone.runGuarded(()=>{if(e.throwOriginal)throw e.rejection;throw e})}catch(e){h(e)}}};const u=s("unhandledPromiseRejectionHandler");function h(e){n.onUnhandledError(e);try{const n=t[u];"function"==typeof n&&n.call(this,e)}catch(e){}}function p(e){return e&&"function"==typeof e.then}function d(e){return e}function f(e){return M.reject(e)}const m=s("state"),g=s("value"),y=s("finally"),v=s("parentPromiseValue"),b=s("parentPromiseState"),w=null,C=!0,_=!1;function S(e,t){return n=>{try{T(e,t,n)}catch(t){T(e,!1,t)}}}const I=function(){let e=!1;return function(t){return function(){e||(e=!0,t.apply(null,arguments))}}},E="Promise resolved with itself",A=s("currentTaskTrace");function T(e,r,s){const l=I();if(e===s)throw new TypeError(E);if(e[m]===w){let c=null;try{"object"!=typeof s&&"function"!=typeof s||(c=s&&s.then)}catch(t){return l(()=>{T(e,!1,t)})(),e}if(r!==_&&s instanceof M&&s.hasOwnProperty(m)&&s.hasOwnProperty(g)&&s[m]!==w)O(s),T(e,s[m],s[g]);else if(r!==_&&"function"==typeof c)try{c.call(s,l(S(e,r)),l(S(e,!1)))}catch(t){l(()=>{T(e,!1,t)})()}else{e[m]=r;const l=e[g];if(e[g]=s,e[y]===y&&r===C&&(e[m]=e[b],e[g]=e[v]),r===_&&s instanceof Error){const e=t.currentTask&&t.currentTask.data&&t.currentTask.data.__creationTrace__;e&&o(s,A,{configurable:!0,enumerable:!1,writable:!0,value:e})}for(let t=0;t<l.length;)x(e,l[t++],l[t++],l[t++],l[t++]);if(0==l.length&&r==_){e[m]=0;let r=s;try{throw new Error("Uncaught (in promise): "+function(e){if(e&&e.toString===Object.prototype.toString){return(e.constructor&&e.constructor.name||"")+": "+JSON.stringify(e)}return e?e.toString():Object.prototype.toString.call(e)}(s)+(s&&s.stack?"\n"+s.stack:""))}catch(e){r=e}a&&(r.throwOriginal=!0),r.rejection=s,r.promise=e,r.zone=t.current,r.task=t.currentTask,i.push(r),n.scheduleMicroTask()}}}return e}const k=s("rejectionHandledHandler");function O(e){if(0===e[m]){try{const n=t[k];n&&"function"==typeof n&&n.call(this,{rejection:e[g],promise:e})}catch(e){}e[m]=_;for(let t=0;t<i.length;t++)e===i[t].promise&&i.splice(t,1)}}function x(e,t,n,r,o){O(e);const s=e[m],i=s?"function"==typeof r?r:d:"function"==typeof o?o:f;t.scheduleMicroTask("Promise.then",()=>{try{const r=e[g],o=!!n&&y===n[y];o&&(n[v]=r,n[b]=s);const a=t.run(i,void 0,o&&i!==f&&i!==d?[]:[r]);T(n,!0,a)}catch(e){T(n,!1,e)}},n)}const R=function(){},N=e.AggregateError;class M{static toString(){return"function ZoneAwarePromise() { [native code] }"}static resolve(e){return e instanceof M?e:T(new this(null),C,e)}static reject(e){return T(new this(null),_,e)}static withResolvers(){const e={};return e.promise=new M((t,n)=>{e.resolve=t,e.reject=n}),e}static any(e){if(!e||"function"!=typeof e[Symbol.iterator])return Promise.reject(new N([],"All promises were rejected"));const t=[];let n=0;try{for(let r of e)n++,t.push(M.resolve(r))}catch(e){return Promise.reject(new N([],"All promises were rejected"))}if(0===n)return Promise.reject(new N([],"All promises were rejected"));let r=!1;const o=[];return new M((e,s)=>{for(let i=0;i<t.length;i++)t[i].then(t=>{r||(r=!0,e(t))},e=>{o.push(e),n--,0===n&&(r=!0,s(new N(o,"All promises were rejected")))})})}static race(e){let t,n,r=new this((e,r)=>{t=e,n=r});function o(e){t(e)}function s(e){n(e)}for(let t of e)p(t)||(t=this.resolve(t)),t.then(o,s);return r}static all(e){return M.allWithCallback(e)}static allSettled(e){return(this&&this.prototype instanceof M?this:M).allWithCallback(e,{thenCallback:e=>({status:"fulfilled",value:e}),errorCallback:e=>({status:"rejected",reason:e})})}static allWithCallback(e,t){let n,r,o=new this((e,t)=>{n=e,r=t}),s=2,i=0;const a=[];for(let o of e){p(o)||(o=this.resolve(o));const e=i;try{o.then(r=>{a[e]=t?t.thenCallback(r):r,s--,0===s&&n(a)},o=>{t?(a[e]=t.errorCallback(o),s--,0===s&&n(a)):r(o)})}catch(e){r(e)}s++,i++}return s-=2,0===s&&n(a),o}constructor(e){const t=this;if(!(t instanceof M))throw new Error("Must be an instanceof Promise.");t[m]=w,t[g]=[];try{const n=I();e&&e(n(S(t,C)),n(S(t,_)))}catch(e){T(t,!1,e)}}get[Symbol.toStringTag](){return"Promise"}get[Symbol.species](){return M}then(e,n){let r=this.constructor?.[Symbol.species];r&&"function"==typeof r||(r=this.constructor||M);const o=new r(R),s=t.current;return this[m]==w?this[g].push(s,o,e,n):x(this,s,o,e,n),o}catch(e){return this.then(null,e)}finally(e){let n=this.constructor?.[Symbol.species];n&&"function"==typeof n||(n=M);const r=new n(R);r[y]=y;const o=t.current;return this[m]==w?this[g].push(o,r,e,e):x(this,o,r,e,e),r}}M.resolve=M.resolve,M.reject=M.reject,M.race=M.race,M.all=M.all;const L=e[l]=e.Promise;e.Promise=M;const P=s("thenPatched");function D(e){const t=e.prototype,n=r(t,"then");if(n&&(!1===n.writable||!n.configurable))return;const o=t.then;t[c]=o,e.prototype.then=function(e,t){const n=new M((e,t)=>{o.call(this,e,t)});return n.then(e,t)},e[P]=!0}return n.patchThen=D,L&&(D(L),Xg(e,"fetch",e=>{return t=e,function(e,n){let r=t.apply(e,n);if(r instanceof M)return r;let o=r.constructor;return o[P]||D(o),r};var t})),Promise[t.__symbol__("uncaughtPromiseErrors")]=i,M})}function Sy(e,t,n,r,o){const s=Zone.__symbol__(r);if(t[s])return;const i=t[s]=t[r];t[r]=function(s,a,l){return a&&a.prototype&&o.forEach(function(t){const o=`${n}.${r}::`+t,s=a.prototype;try{if(s.hasOwnProperty(t)){const n=e.ObjectGetOwnPropertyDescriptor(s,t);n&&n.value?(n.value=e.wrapWithCurrentZone(n.value,o),e._redefineProperty(a.prototype,t,n)):s[t]&&(s[t]=e.wrapWithCurrentZone(s[t],o))}else s[t]&&(s[t]=e.wrapWithCurrentZone(s[t],o))}catch{}}),i.call(t,s,a,l)},e.attachOriginToPatched(t[r],i)}const Iy=function(){const e=globalThis,t=!0===e[bg("forceDuplicateZoneCheck")];if(e.Zone&&(t||"function"!=typeof e.Zone.__symbol__))throw new Error("Zone already loaded.");return e.Zone??=function(){const e=vg.performance;function t(t){e&&e.mark&&e.mark(t)}function n(t,n){e&&e.measure&&e.measure(t,n)}t("Zone");class r{static __symbol__=bg;static assertZonePatched(){if(vg.Promise!==A.ZoneAwarePromise)throw new 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 e=r.current;for(;e.parent;)e=e.parent;return e}static get current(){return k.zone}static get currentTask(){return O}static __load_patch(e,o,s=!1){if(A.hasOwnProperty(e)){const t=!0===vg[bg("forceDuplicateZoneCheck")];if(!s&&t)throw Error("Already loaded patch: "+e)}else if(!vg["__Zone_disable_"+e]){const s="Zone:"+e;t(s),A[e]=o(vg,r,T),n(s,s)}}get parent(){return this._parent}get name(){return this._name}_parent;_name;_properties;_zoneDelegate;constructor(e,t){this._parent=e,this._name=t?t.name||"unnamed":"<root>",this._properties=t&&t.properties||{},this._zoneDelegate=new s(this,this._parent&&this._parent._zoneDelegate,t)}get(e){const 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 new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,e)}wrap(e,t){if("function"!=typeof e)throw new Error("Expecting function got: "+e);const n=this._zoneDelegate.intercept(this,e,t),r=this;return function(){return r.runGuarded(n,this,arguments,t)}}run(e,t,n,r){k={parent:k,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{k=k.parent}}runGuarded(e,t=null,n,r){k={parent:k,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{k=k.parent}}runTask(e,t,n){if(e.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(e.zone||g).name+"; Execution: "+this.name+")");const r=e,{type:o,data:{isPeriodic:s=!1,isRefreshable:i=!1}={}}=e;if(e.state===y&&(o===E||o===I))return;const a=e.state!=w;a&&r._transitionTo(w,b);const l=O;O=r,k={parent:k,zone:this};try{o!=I||!e.data||s||i||(e.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,r,t,n)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{const t=e.state;if(t!==y&&t!==_)if(o==E||s||i&&t===v)a&&r._transitionTo(b,w,v);else{const e=r._zoneDelegates;this._updateTaskCount(r,-1),a&&r._transitionTo(y,w,y),i&&(r._zoneDelegates=e)}k=k.parent,O=l}}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(v,y);const t=[];e._zoneDelegates=t,e._zone=this;try{e=this._zoneDelegate.scheduleTask(this,e)}catch(t){throw e._transitionTo(_,v,y),this._zoneDelegate.handleError(this,t),t}return e._zoneDelegates===t&&this._updateTaskCount(e,1),e.state==v&&e._transitionTo(b,v),e}scheduleMicroTask(e,t,n,r){return this.scheduleTask(new i(S,e,t,n,r,void 0))}scheduleMacroTask(e,t,n,r,o){return this.scheduleTask(new i(I,e,t,n,r,o))}scheduleEventTask(e,t,n,r,o){return this.scheduleTask(new i(E,e,t,n,r,o))}cancelTask(e){if(e.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(e.zone||g).name+"; Execution: "+this.name+")");if(e.state===b||e.state===w){e._transitionTo(C,b,w);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(_,C),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(y,C),e.runCount=-1,e}}_updateTaskCount(e,t){const n=e._zoneDelegates;-1==t&&(e._zoneDelegates=null);for(let r=0;r<n.length;r++)n[r]._updateTaskCount(e.type,t)}}const o={name:"",onHasTask:(e,t,n,r)=>e.hasTask(n,r),onScheduleTask:(e,t,n,r)=>e.scheduleTask(n,r),onInvokeTask:(e,t,n,r,o,s)=>e.invokeTask(n,r,o,s),onCancelTask:(e,t,n,r)=>e.cancelTask(n,r)};class s{get zone(){return this._zone}_zone;_taskCounts={microTask:0,macroTask:0,eventTask:0};_parentDelegate;_forkDlgt;_forkZS;_forkCurrZone;_interceptDlgt;_interceptZS;_interceptCurrZone;_invokeDlgt;_invokeZS;_invokeCurrZone;_handleErrorDlgt;_handleErrorZS;_handleErrorCurrZone;_scheduleTaskDlgt;_scheduleTaskZS;_scheduleTaskCurrZone;_invokeTaskDlgt;_invokeTaskZS;_invokeTaskCurrZone;_cancelTaskDlgt;_cancelTaskZS;_cancelTaskCurrZone;_hasTaskDlgt;_hasTaskDlgtOwner;_hasTaskZS;_hasTaskCurrZone;constructor(e,t,n){this._zone=e,this._parentDelegate=t,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;const r=n&&n.onHasTask,s=t&&t._hasTaskZS;(r||s)&&(this._hasTaskZS=r?n:o,this._hasTaskDlgt=t,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=this._zone,n.onScheduleTask||(this._scheduleTaskZS=o,this._scheduleTaskDlgt=t,this._scheduleTaskCurrZone=this._zone),n.onInvokeTask||(this._invokeTaskZS=o,this._invokeTaskDlgt=t,this._invokeTaskCurrZone=this._zone),n.onCancelTask||(this._cancelTaskZS=o,this._cancelTaskDlgt=t,this._cancelTaskCurrZone=this._zone))}fork(e,t){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,e,t):new r(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,o){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,e,t,n,r,o):t.apply(n,r)}handleError(e,t){return!this._handleErrorZS||this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,e,t)}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!=S)throw new Error("Task is missing scheduleFn.");f(t)}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){const n=this._taskCounts,r=n[e],o=n[e]=r+t;if(o<0)throw new Error("More tasks executed then were scheduled.");if(0==r||0==o){const t={microTask:n.microTask>0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:e};this.hasTask(this._zone,t)}}}class i{type;source;invoke;callback;data;scheduleFn;cancelFn;_zone=null;runCount=0;_zoneDelegates=null;_state="notScheduled";constructor(e,t,n,r,o,s){if(this.type=e,this.source=t,this.data=r,this.scheduleFn=o,this.cancelFn=s,!n)throw new Error("callback is not defined");this.callback=n;const a=this;e===E&&r&&r.useG?this.invoke=i.invokeTask:this.invoke=function(){return i.invokeTask.call(vg,a,this,arguments)}}static invokeTask(e,t,n){e||(e=this),x++;try{return e.runCount++,e.zone.runTask(e,t,n)}finally{1==x&&m(),x--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(y,v)}_transitionTo(e,t,n){if(this._state!==t&&this._state!==n)throw new Error(`${this.type} '${this.source}': can not transition to '${e}', expecting state '${t}'${n?" or '"+n+"'":""}, was '${this._state}'.`);this._state=e,e==y&&(this._zoneDelegates=null)}toString(){return this.data&&void 0!==this.data.handleId?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}}}const a=bg("setTimeout"),l=bg("Promise"),c=bg("then");let u,h=[],p=!1;function d(e){if(u||vg[l]&&(u=vg[l].resolve(0)),u){let t=u[c];t||(t=u.then),t.call(u,e)}else vg[a](e,0)}function f(e){0===x&&0===h.length&&d(m),e&&h.push(e)}function m(){if(!p){for(p=!0;h.length;){const e=h;h=[];for(let t=0;t<e.length;t++){const n=e[t];try{n.zone.runTask(n,null,null)}catch(e){T.onUnhandledError(e)}}}T.microtaskDrainDone(),p=!1}}const g={name:"NO ZONE"},y="notScheduled",v="scheduling",b="scheduled",w="running",C="canceling",_="unknown",S="microTask",I="macroTask",E="eventTask",A={},T={symbol:bg,currentZoneFrame:()=>k,onUnhandledError:R,microtaskDrainDone:R,scheduleMicroTask:f,showUncaughtError:()=>!r[bg("ignoreConsoleErrorUncaughtError")],patchEventTarget:()=>[],patchOnProperties:R,patchMethod:()=>R,bindArguments:()=>[],patchThen:()=>R,patchMacroTask:()=>R,patchEventPrototype:()=>R,isIEOrEdge:()=>!1,getGlobalObjects:()=>{},ObjectDefineProperty:()=>R,ObjectGetOwnPropertyDescriptor:()=>{},ObjectCreate:()=>{},ArraySlice:()=>[],patchClass:()=>R,wrapWithCurrentZone:()=>R,filterProperties:()=>[],attachOriginToPatched:()=>R,_redefineProperty:()=>R,patchCallbacks:()=>R,nativeScheduleMicroTask:d};let k={parent:null,zone:new r(null,null)},O=null,x=0;function R(){}return n("Zone","Zone"),r}(),e.Zone}();!function(e){_y(e),function(e){e.__load_patch("toString",e=>{const t=Function.prototype.toString,n=Lg("OriginalDelegate"),r=Lg("Promise"),o=Lg("Error"),s=function(){if("function"==typeof this){const s=this[n];if(s)return"function"==typeof s?t.call(s):Object.prototype.toString.call(s);if(this===Promise){const n=e[r];if(n)return t.call(n)}if(this===Error){const n=e[o];if(n)return t.call(n)}}return t.call(this)};s[n]=t,Function.prototype.toString=s;const i=Object.prototype.toString;Object.prototype.toString=function(){return"function"==typeof Promise&&this instanceof Promise?"[object Promise]":i.call(this)}})}(e),function(e){e.__load_patch("util",(e,t,n)=>{const r=wy(e);n.patchOnProperties=Yg,n.patchMethod=Xg,n.bindArguments=Ug,n.patchMacroTask=Jg;const o=t.__symbol__("BLACK_LISTED_EVENTS"),s=t.__symbol__("UNPATCHED_EVENTS");e[s]&&(e[o]=e[s]),e[o]&&(t[o]=t[s]=e[o]),n.patchEventPrototype=dy,n.patchEventTarget=hy,n.isIEOrEdge=ny,n.ObjectDefineProperty=Cg,n.ObjectGetOwnPropertyDescriptor=wg,n.ObjectCreate=Sg,n.ArraySlice=Ig,n.patchClass=qg,n.wrapWithCurrentZone=Ng,n.filterProperties=vy,n.attachOriginToPatched=Qg,n._redefineProperty=Object.defineProperty,n.patchCallbacks=Sy,n.getGlobalObjects=()=>({globalSources:ay,zoneSymbolEventNames:iy,eventNames:r,isBrowser:zg,isMix:Vg,isNode:Zg,TRUE_STR:Og,FALSE_STR:xg,ZONE_SYMBOL_PREFIX:Rg,ADD_EVENT_LISTENER_STR:Eg,REMOVE_EVENT_LISTENER_STR:Ag})})}(e)}(Iy),function(e){e.__load_patch("legacy",t=>{const n=t[e.__symbol__("legacyPatch")];n&&n()}),e.__load_patch("timers",e=>{const t="set",n="clear";gy(e,t,n,"Timeout"),gy(e,t,n,"Interval"),gy(e,t,n,"Immediate")}),e.__load_patch("requestAnimationFrame",e=>{gy(e,"request","cancel","AnimationFrame"),gy(e,"mozRequest","mozCancel","AnimationFrame"),gy(e,"webkitRequest","webkitCancel","AnimationFrame")}),e.__load_patch("blocking",(e,t)=>{const n=["alert","prompt","confirm"];for(let r=0;r<n.length;r++){Xg(e,n[r],(n,r,o)=>function(r,s){return t.current.run(n,e,s,o)})}}),e.__load_patch("EventTarget",(e,t,n)=>{!function(e,t){t.patchEventPrototype(e,t)}(e,n),yy(e,n);const r=e.XMLHttpRequestEventTarget;r&&r.prototype&&n.patchEventTarget(e,n,[r.prototype])}),e.__load_patch("MutationObserver",(e,t,n)=>{qg("MutationObserver"),qg("WebKitMutationObserver")}),e.__load_patch("IntersectionObserver",(e,t,n)=>{qg("IntersectionObserver")}),e.__load_patch("FileReader",(e,t,n)=>{qg("FileReader")}),e.__load_patch("on_property",(e,t,n)=>{Cy(n,e)}),e.__load_patch("customElements",(e,t,n)=>{!function(e,t){const{isBrowser:n,isMix:r}=t.getGlobalObjects();if(!n&&!r||!e.customElements||!("customElements"in e))return;t.patchCallbacks(t,e.customElements,"customElements","define",["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","formAssociatedCallback","formDisabledCallback","formResetCallback","formStateRestoreCallback"])}(e,n)}),e.__load_patch("XHR",(e,t)=>{!function(e){const l=e.XMLHttpRequest;if(!l)return;const c=l.prototype;let u=c[Tg],h=c[kg];if(!u){const t=e.XMLHttpRequestEventTarget;if(t){const e=t.prototype;u=e[Tg],h=e[kg]}}const p="readystatechange",d="scheduled";function f(e){const r=e.data,i=r.target;i[s]=!1,i[a]=!1;const l=i[o];u||(u=i[Tg],h=i[kg]),l&&h.call(i,p,l);const c=i[o]=()=>{if(i.readyState===i.DONE)if(!r.aborted&&i[s]&&e.state===d){const n=i[t.__symbol__("loadfalse")];if(0!==i.status&&n&&n.length>0){const o=e.invoke;e.invoke=function(){const n=i[t.__symbol__("loadfalse")];for(let t=0;t<n.length;t++)n[t]===e&&n.splice(t,1);r.aborted||e.state!==d||o.call(e)},n.push(e)}else e.invoke()}else r.aborted||!1!==i[s]||(i[a]=!0)};u.call(i,p,c);return i[n]||(i[n]=e),w.apply(i,r.args),i[s]=!0,e}function m(){}function g(e){const t=e.data;return t.aborted=!0,C.apply(t.target,t.args)}const y=Xg(c,"open",()=>function(e,t){return e[r]=0==t[2],e[i]=t[1],y.apply(e,t)}),v=Lg("fetchTaskAborting"),b=Lg("fetchTaskScheduling"),w=Xg(c,"send",()=>function(e,n){if(!0===t.current[b])return w.apply(e,n);if(e[r])return w.apply(e,n);{const t={target:e,url:e[i],isPeriodic:!1,args:n,aborted:!1},r=Mg("XMLHttpRequest.send",m,t,f,g);e&&!0===e[a]&&!t.aborted&&r.state===d&&r.invoke()}}),C=Xg(c,"abort",()=>function(e,r){const o=e[n];if(o&&"string"==typeof o.type){if(null==o.cancelFn||o.data&&o.data.aborted)return;o.zone.cancelTask(o)}else if(!0===t.current[v])return C.apply(e,r)})}(e);const n=Lg("xhrTask"),r=Lg("xhrSync"),o=Lg("xhrListener"),s=Lg("xhrScheduled"),i=Lg("xhrURL"),a=Lg("xhrErrorBeforeScheduled")}),e.__load_patch("geolocation",e=>{e.navigator&&e.navigator.geolocation&&function(e,t){const n=e.constructor.name;for(let r=0;r<t.length;r++){const o=t[r],s=e[o];if(s){if(!Bg(wg(e,o)))continue;e[o]=(e=>{const t=function(){return e.apply(this,Ug(arguments,n+"."+o))};return Qg(t,e),t})(s)}}}(e.navigator.geolocation,["getCurrentPosition","watchPosition"])}),e.__load_patch("PromiseRejectionEvent",(e,t)=>{function n(t){return function(n){py(e,t).forEach(r=>{const o=e.PromiseRejectionEvent;if(o){const e=new o(t,{promise:n.promise,reason:n.rejection});r.invoke(e)}})}}e.PromiseRejectionEvent&&(t[Lg("unhandledPromiseRejectionHandler")]=n("unhandledrejection"),t[Lg("rejectionHandledHandler")]=n("rejectionhandled"))}),e.__load_patch("queueMicrotask",(e,t,n)=>{fy(e,n)})}(Iy);var Ey;!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"}(Ey||(Ey={}));const Ay=mh.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function Ty(e){return t=e,"undefined"!=typeof Document&&t instanceof Document?(new XMLSerializer).serializeToString(document).length:"string"==typeof e?Oy(e):e instanceof Blob?e.size:e instanceof FormData?function(e){let t=0;for(const[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}(e):e instanceof URLSearchParams?Oy(e.toString()):void 0!==e.byteLength?e.byteLength:void Ay.warn("unknown body type");var t}const ky=new TextEncoder;function Oy(e){return ky.encode(e).byteLength}function xy(e){const t=function(){if(void 0===Ny){const e=$h("OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS");e&&e.length>0?(Ny={},e.forEach(e=>{Ny[e]=!0})):Ny=Ry}return Ny}(),n=e.toUpperCase();return n in t?n:"_OTHER"}const Ry={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0};let Ny;const My={"https:":"443","http:":"80"};const Ly="0.203.0";var Py;!function(e){e.HTTP_STATUS_TEXT="http.status_text"}(Py||(Py={}));class Dy extends ug{component="xml-http-request";version=Ly;moduleName=this.component;_tasksCount=0;_xhrMem=new WeakMap;_usedResources=new WeakSet;_semconvStability;constructor(e={}){super("@opentelemetry/instrumentation-xml-http-request",Ly,e),this._semconvStability=pg("http",e?.semconvStabilityOptIn)}init(){}_addHeaders(e,t){if(!Nd(Rd(t).href,this.getConfig().propagateTraceHeaderCorsUrls)){const e={};return kh.inject(fh.active(),e),void(Object.keys(e).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}const n={};kh.inject(fh.active(),n),Object.keys(n).forEach(t=>{e.setRequestHeader(t,String(n[t]))})}_addChildSpan(e,t){fh.with(xh.setSpan(fh.active(),e),()=>{const e=this.tracer.startSpan("CORS Preflight",{startTime:t[Cd.FETCH_START]}),n=!(this._semconvStability&sg.OLD);kd(e,t,this.getConfig().ignoreNetworkEvents,void 0,n),e.end(t[Cd.RESPONSE_END])})}_addFinalSpanAttributes(e,t,n){if(this._semconvStability&sg.OLD){if(void 0!==t.status&&e.setAttribute("http.status_code",t.status),void 0!==t.statusText&&e.setAttribute(Py.HTTP_STATUS_TEXT,t.statusText),"string"==typeof n){const t=Rd(n);e.setAttribute("http.host",t.host),e.setAttribute("http.scheme",t.protocol.replace(":",""))}e.setAttribute("http.user_agent",navigator.userAgent)}this._semconvStability&sg.STABLE&&t.status&&e.setAttribute(tp,t.status)}_applyAttributesAfterXHR(e,t){const n=this.getConfig().applyCustomAttributesOnSpan;"function"==typeof n&&lg(()=>n(e,t),e=>{e&&this._diag.error("applyCustomAttributesOnSpan",e)})}_addResourceObserver(e,t){const n=this._xhrMem.get(e);n&&"function"==typeof PerformanceObserver&&"function"==typeof PerformanceResourceTiming&&(n.createdResources={observer:new PerformanceObserver(e=>{const r=e.getEntries(),o=Rd(t);r.forEach(e=>{"xmlhttprequest"===e.initiatorType&&e.name===o.href&&n.createdResources&&n.createdResources.entries.push(e)})}),entries:[]},n.createdResources.observer.observe({entryTypes:["resource"]}))}_clearResources(){0===this._tasksCount&&this.getConfig().clearTimingResources&&(Yh.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(e,t,n,r,o){if(!(n&&r&&o&&e.createdResources))return;let s=e.createdResources.entries;s&&s.length||(s=Yh.getEntriesByType("resource"));const i=xd(Rd(n).href,r,o,s,this._usedResources);if(i.mainRequest){const e=i.mainRequest;this._markResourceAsUsed(e);const n=i.corsPreFlightRequest;n&&(this._addChildSpan(t,n),this._markResourceAsUsed(n));const r=!(this._semconvStability&sg.OLD);kd(t,e,this.getConfig().ignoreNetworkEvents,void 0,r)}}_cleanPreviousSpanInformation(e){const t=this._xhrMem.get(e);if(t){const n=t.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(e)}}_createSpan(e,t,n){if(qp(t,this.getConfig().ignoreUrls))return void this._diag.debug("ignoring span as url matches ignored url");let r="";const o=Rd(t),s={};if(this._semconvStability&sg.OLD&&(r=n.toUpperCase(),s["http.method"]=n,s["http.url"]=o.toString()),this._semconvStability&sg.STABLE){const e=n,t=xy(n);r||(r=t),s[Qh]=t,t!==e&&(s[ep]=e),s[lp]=o.toString(),s[np]=o.hostname;const i=function(e){const t=Number(e.port||My[e.protocol]);return t&&!isNaN(t)?t:void 0}(o);i&&(s[rp]=i)}const i=this.tracer.startSpan(r,{kind:lh.CLIENT,attributes:s});return i.addEvent(Ey.METHOD_OPEN),this._cleanPreviousSpanInformation(e),this._xhrMem.set(e,{span:i,spanUrl:t}),i}_markResourceAsUsed(e){this._usedResources.add(e)}_patchOpen(){return e=>{const t=this;return function(...n){const r=n[0],o=n[1];return t._createSpan(this,o,r),e.apply(this,n)}}}_patchSend(){const e=this;function t(t,n,r,o){const s=e._xhrMem.get(n);if(!s)return;if(s.status=n.status,s.statusText=n.statusText,e._xhrMem.delete(n),s.span){const t=s.span;e._applyAttributesAfterXHR(t,n),e._semconvStability&sg.STABLE&&(r?o&&(t.setStatus({code:ch.ERROR,message:o}),t.setAttribute(qh,o)):s.status&&s.status>=400&&(t.setStatus({code:ch.ERROR}),t.setAttribute(qh,String(s.status))))}const i=mp(),a=Date.now();setTimeout(()=>{!function(t,n,r,o){const s=n.callbackToRemoveEvents;"function"==typeof s&&s();const{span:i,spanUrl:a,sendStartTime:l}=n;i&&(e._findResourceAndAddNetworkEvents(n,i,a,l,r),i.addEvent(t,o),e._addFinalSpanAttributes(i,n,a),i.end(o),e._tasksCount--),e._clearResources()}(t,s,i,a)},300)}function n(){t(Ey.EVENT_ERROR,this,!0,"error")}function r(){t(Ey.EVENT_ABORT,this,!1)}function o(){t(Ey.EVENT_TIMEOUT,this,!0,"timeout")}function s(){this.status<299?t(Ey.EVENT_LOAD,this,!1):t(Ey.EVENT_ERROR,this,!1)}return t=>function(...i){const a=e._xhrMem.get(this);if(!a)return t.apply(this,i);const l=a.span,c=a.spanUrl;if(l&&c){if(e.getConfig().measureRequestSize&&i?.[0]){const t=Ty(i[0]);void 0!==t&&(e._semconvStability&sg.OLD&&l.setAttribute("http.request_content_length_uncompressed",t),e._semconvStability&sg.STABLE&&l.setAttribute("http.request.body.size",t))}fh.with(xh.setSpan(fh.active(),l),()=>{e._tasksCount++,a.sendStartTime=mp(),l.addEvent(Ey.METHOD_SEND),this.addEventListener("abort",r),this.addEventListener("error",n),this.addEventListener("load",s),this.addEventListener("timeout",o),a.callbackToRemoveEvents=()=>{!function(t){t.removeEventListener("abort",r),t.removeEventListener("error",n),t.removeEventListener("load",s),t.removeEventListener("timeout",o);const i=e._xhrMem.get(t);i&&(i.callbackToRemoveEvents=void 0)}(this),a.createdResources&&a.createdResources.observer.disconnect()},e._addHeaders(this,c),e._addResourceObserver(this,c)})}return t.apply(this,i)}}enable(){this._diag.debug("applying patch to",this.moduleName,this.version),cg(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,"open"),this._diag.debug("removing previous patch from method open")),cg(XMLHttpRequest.prototype.send)&&(this._unwrap(XMLHttpRequest.prototype,"send"),this._diag.debug("removing previous patch from method send")),this._wrap(XMLHttpRequest.prototype,"open",this._patchOpen()),this._wrap(XMLHttpRequest.prototype,"send",this._patchSend())}disable(){this._diag.debug("removing patch from",this.moduleName,this.version),this._unwrap(XMLHttpRequest.prototype,"open"),this._unwrap(XMLHttpRequest.prototype,"send"),this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet}}var Fy;!function(e){e.COMPONENT="component",e.HTTP_STATUS_TEXT="http.status_text"}(Fy||(Fy={}));var Uy={};Object.defineProperty(Uy,"__esModule",{value:!0});var By=Uy.ATTR_HTTP_USER_AGENT=Uy.ATTR_HTTP_URL=Uy.ATTR_HTTP_STATUS_CODE=Uy.ATTR_HTTP_SCHEME=Uy.ATTR_HTTP_RESPONSE_CONTENT_LENGTH=Uy.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED=Uy.ATTR_HTTP_REQUEST_BODY_SIZE=Uy.ATTR_HTTP_METHOD=Uy.ATTR_HTTP_HOST=void 0,jy=Uy.ATTR_HTTP_HOST="http.host",Zy=Uy.ATTR_HTTP_METHOD="http.method",zy=Uy.ATTR_HTTP_REQUEST_BODY_SIZE="http.request.body.size",Vy=Uy.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED="http.request_content_length_uncompressed";Uy.ATTR_HTTP_RESPONSE_CONTENT_LENGTH="http.response_content_length";var Gy=Uy.ATTR_HTTP_SCHEME="http.scheme",Wy=Uy.ATTR_HTTP_STATUS_CODE="http.status_code",$y=Uy.ATTR_HTTP_URL="http.url";By=Uy.ATTR_HTTP_USER_AGENT="http.user_agent";const Hy=mh.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function Yy(...e){if(e[0]instanceof URL||"string"==typeof e[0]){const t=e[1];if(!t?.body)return Promise.resolve();if(t.body instanceof ReadableStream){const{body:e,length:n}=function(e){if(!e.pipeThrough)return Hy.warn("Platform has ReadableStream but not pipeThrough!"),{body:e,length:Promise.resolve(void 0)};let t,n=0;const r=new Promise(e=>{t=e}),o=new TransformStream({start(){},async transform(e,t){const r=await e;n+=r.byteLength,t.enqueue(e)},flush(){t(n)}});return{body:e.pipeThrough(o),length:r}}(t.body);return t.body=e,n}return Promise.resolve(function(e){if(t=e,"undefined"!=typeof Document&&t instanceof Document)return(new XMLSerializer).serializeToString(document).length;var t;if("string"==typeof e)return qy(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return function(e){let t=0;for(const[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}(e);if(e instanceof URLSearchParams)return qy(e.toString());if(void 0!==e.byteLength)return e.byteLength;return void Hy.warn("unknown body type")}(t.body))}{const t=e[0];return t?.body?t.clone().text().then(e=>qy(e)):Promise.resolve()}}const Ky=new TextEncoder;function qy(e){return Ky.encode(e).byteLength}const Xy={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0};let Jy;function Qy(){if(void 0===Jy){const e=$h("OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS");e&&e.length>0?(Jy={},e.forEach(e=>{Jy[e]=!0})):Jy=Xy}return Jy}const ev={"https:":"443","http:":"80"};const tv="0.203.0",nv="object"==typeof process&&"node"===process.release?.name;class rv extends ug{component="fetch";version=tv;moduleName=this.component;_usedResources=new WeakSet;_tasksCount=0;_semconvStability;constructor(e={}){super("@opentelemetry/instrumentation-fetch",tv,e),this._semconvStability=pg("http",e?.semconvStabilityOptIn)}init(){}_addChildSpan(e,t){const n=this.tracer.startSpan("CORS Preflight",{startTime:t[Cd.FETCH_START]},xh.setSpan(fh.active(),e)),r=!(this._semconvStability&sg.OLD);kd(n,t,this.getConfig().ignoreNetworkEvents,void 0,r),n.end(t[Cd.RESPONSE_END])}_addFinalSpanAttributes(e,t){const n=Rd(t.url);if(this._semconvStability&sg.OLD&&(e.setAttribute(Wy,t.status),null!=t.statusText&&e.setAttribute(Fy.HTTP_STATUS_TEXT,t.statusText),e.setAttribute(jy,n.host),e.setAttribute(Gy,n.protocol.replace(":","")),"undefined"!=typeof navigator&&e.setAttribute(By,navigator.userAgent)),this._semconvStability&sg.STABLE){e.setAttribute(tp,t.status),e.setAttribute(np,n.hostname);const r=function(e){const t=Number(e.port||ev[e.protocol]);return t&&!isNaN(t)?t:void 0}(n);r&&e.setAttribute(rp,r)}}_addHeaders(e,t){if(!Nd(t,this.getConfig().propagateTraceHeaderCorsUrls)){const e={};return kh.inject(fh.active(),e),void(Object.keys(e).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}if(e instanceof Request)kh.inject(fh.active(),e.headers,{set:(e,t,n)=>e.set(t,"string"==typeof n?n:String(n))});else if(e.headers instanceof Headers)kh.inject(fh.active(),e.headers,{set:(e,t,n)=>e.set(t,"string"==typeof n?n:String(n))});else if(e.headers instanceof Map)kh.inject(fh.active(),e.headers,{set:(e,t,n)=>e.set(t,"string"==typeof n?n:String(n))});else{const t={};kh.inject(fh.active(),t),e.headers=Object.assign({},t,e.headers||{})}}_clearResources(){0===this._tasksCount&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(e,t={}){if(qp(e,this.getConfig().ignoreUrls))return void this._diag.debug("ignoring span as url matches ignored url");let n="";const r={};if(this._semconvStability&sg.OLD){const o=(t.method||"GET").toUpperCase();n=`HTTP ${o}`,r[Fy.COMPONENT]=this.moduleName,r[Zy]=o,r[$y]=e}if(this._semconvStability&sg.STABLE){const o=t.method,s=function(e){const t=Qy(),n=e.toUpperCase();return n in t?n:"_OTHER"}(t.method||"GET");n||(n=s),r[Qh]=s,s!==o&&(r[ep]=o),r[lp]=e}return this.tracer.startSpan(n,{kind:lh.CLIENT,attributes:r})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType("resource")}const o=xd(t.spanUrl,t.startTime,n,r,this._usedResources,"fetch");if(o.mainRequest){const t=o.mainRequest;this._markResourceAsUsed(t);const n=o.corsPreFlightRequest;n&&(this._addChildSpan(e,n),this._markResourceAsUsed(n));const r=!(this._semconvStability&sg.OLD);kd(e,t,this.getConfig().ignoreNetworkEvents,void 0,r)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){const r=dp(Date.now()),o=mp();this._addFinalSpanAttributes(e,n),this._semconvStability&sg.STABLE&&n.status>=400&&(e.setStatus({code:ch.ERROR}),e.setAttribute(qh,String(n.status))),setTimeout(()=>{t.observer?.disconnect(),this._findResourceAndAddNetworkEvents(e,t,o),this._tasksCount--,this._clearResources(),e.end(r)},300)}_patchConstructor(){return e=>{const t=this;return function(...n){const r=this,o=Rd(n[0]instanceof Request?n[0].url:String(n[0])).href,s=n[0]instanceof Request?n[0]:n[1]||{},i=t._createSpan(o,s);if(!i)return e.apply(this,n);const a=t._prepareSpanData(o);function l(e,n){t._applyAttributesAfterFetch(e,s,n),t._endSpan(e,a,{status:n.status||0,statusText:n.message,url:o})}function c(e,n){t._applyAttributesAfterFetch(e,s,n),n.status>=200&&n.status<400?t._endSpan(e,a,n):t._endSpan(e,a,{status:n.status,statusText:n.statusText,url:o})}function u(e,t,n){try{const t=n.clone().body;if(t){const r=t.getReader(),o=()=>{r.read().then(({done:t})=>{t?c(e,n):o()},t=>{l(e,t)})};o()}else c(e,n)}finally{t(n)}}function h(e,t,n){try{l(e,n)}finally{t(n)}}return t.getConfig().measureRequestSize&&Yy(...n).then(e=>{e&&(t._semconvStability&sg.OLD&&i.setAttribute(Vy,e),t._semconvStability&sg.STABLE&&i.setAttribute(zy,e))}).catch(e=>{t._diag.warn("getFetchBodyLength",e)}),new Promise((n,a)=>fh.with(xh.setSpan(fh.active(),i),()=>(t._addHeaders(s,o),t._callRequestHook(i,s),t._tasksCount++,e.apply(r,s instanceof Request?[s]:[o,s]).then(u.bind(r,i,n),h.bind(r,i,a)))))}}}_applyAttributesAfterFetch(e,t,n){const r=this.getConfig().applyCustomAttributesOnSpan;r&&lg(()=>r(e,t,n),e=>{e&&this._diag.error("applyCustomAttributesOnSpan",e)})}_callRequestHook(e,t){const n=this.getConfig().requestHook;n&&lg(()=>n(e,t),e=>{e&&this._diag.error("requestHook",e)})}_prepareSpanData(e){const t=mp(),n=[];if("function"!=typeof PerformanceObserver)return{entries:n,startTime:t,spanUrl:e};const r=new PerformanceObserver(t=>{t.getEntries().forEach(t=>{"fetch"===t.initiatorType&&t.name===e&&n.push(t)})});return r.observe({entryTypes:["resource"]}),{entries:n,observer:r,startTime:t,spanUrl:e}}enable(){nv?this._diag.warn("this instrumentation is intended for web usage only, it does not instrument Node.js's fetch()"):(cg(fetch)&&(this._unwrap(Hh,"fetch"),this._diag.debug("removing previous patch for constructor")),this._wrap(Hh,"fetch",this._patchConstructor()))}disable(){nv||(this._unwrap(Hh,"fetch"),this._usedResources=new WeakSet)}}class ov{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}class sv extends Error{code;name="OTLPExporterError";data;constructor(e,t,n){super(e),this.data=n,this.code=t}}function iv(e){if(Number.isFinite(e)&&e>0)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function av(e){if(null!=e)return()=>e}function lv(e,t,n){return{timeoutMillis:iv(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}class cv{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(e);const t=()=>{const t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function uv(e){return new cv(e.concurrencyLimit)}function hv(){return{handleResponse(e){null!=e&&function(e){return Object.prototype.hasOwnProperty.call(e,"partialSuccess")}(e)&&null!=e.partialSuccess&&0!==Object.keys(e.partialSuccess).length&&mh.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}class pv{_transport;_serializer;_responseHandler;_promiseQueue;_timeout;_diagLogger;constructor(e,t,n,r,o){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=o,this._diagLogger=mh.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,t){if(this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit())return void t({code:Cp.FAILED,error:new Error("Concurrent export limit reached")});const n=this._serializer.serializeRequest(e);null!=n?this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if("success"!==e.status)"failure"===e.status&&e.error?t({code:Cp.FAILED,error:e.error}):"retryable"===e.status?t({code:Cp.FAILED,error:new sv("Export failed with retryable status")}):t({code:Cp.FAILED,error:new sv("Export failed with unknown error")});else{if(null!=e.data)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:Cp.SUCCESS})}},e=>t({code:Cp.FAILED,error:e}))):t({code:Cp.FAILED,error:new Error("Nothing to send")})}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function dv(e){return e>=48&&e<=57?e-48:e>=97&&e<=102?e-87:e-55}function fv(e){const t=new Uint8Array(e.length/2);let n=0;for(let r=0;r<e.length;r+=2){const o=dv(e.charCodeAt(r)),s=dv(e.charCodeAt(r+1));t[n++]=o<<4|s}return t}function mv(e){const t=BigInt(1e9);return BigInt(e[0])*t+BigInt(e[1])}const gv="undefined"!=typeof BigInt?function(e){return mv(e).toString()}:yp;function yv(e){return e}const vv={encodeHrTime:function(e){const t=mv(e);return n=t,{low:Number(BigInt.asUintN(32,n)),high:Number(BigInt.asUintN(32,n>>BigInt(32)))};var n},encodeSpanContext:fv,encodeOptionalSpanContext:function(e){if(void 0!==e)return fv(e)}};function bv(e){return{attributes:Cv(e.attributes),droppedAttributesCount:0}}function wv(e){return{name:e.name,version:e.version}}function Cv(e){return Object.keys(e).map(t=>_v(t,e[t]))}function _v(e,t){return{key:e,value:Sv(t)}}function Sv(e){const t=typeof e;return"string"===t?{stringValue:e}:"number"===t?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:"boolean"===t?{boolValue:e}:e instanceof Uint8Array?{bytesValue:e}:Array.isArray(e)?{arrayValue:{values:e.map(Sv)}}:"object"===t&&null!=e?{kvlistValue:{values:Object.entries(e).map(([e,t])=>_v(e,t))}}:{}}function Iv(e,t){const n=e.spanContext(),r=e.status,o=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(n.traceId),spanId:t.encodeSpanContext(n.spanId),parentSpanId:o,traceState:n.traceState?.serialize(),name:e.name,kind:null==e.kind?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:Cv(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>function(e,t){return{attributes:e.attributes?Cv(e.attributes):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>function(e,t){return{attributes:e.attributes?Cv(e.attributes):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0}}(e,t)),droppedLinksCount:e.droppedLinksCount}}function Ev(e,t){const n=function(e){return void 0===e?vv:{encodeHrTime:gv,encodeSpanContext:yv,encodeOptionalSpanContext:yv}}(t);return{resourceSpans:Av(e,n)}}function Av(e,t){const n=function(e){const t=new Map;for(const n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));const r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||""}:${n.instrumentationScope.schemaUrl||""}`;let o=e.get(r);o||(o=[],e.set(r,o)),o.push(n)}return t}(e),r=[],o=n.entries();let s=o.next();for(;!s.done;){const[e,n]=s.value,i=[],a=n.values();let l=a.next();for(;!l.done;){const e=l.value;if(e.length>0){const n=e.map(e=>Iv(e,t));i.push({scope:wv(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}l=a.next()}const c={resource:bv(e),scopeSpans:i,schemaUrl:void 0};r.push(c),s=o.next()}return r}const Tv={serializeRequest:e=>{const t=Ev(e,{});return(new TextEncoder).encode(JSON.stringify(t))},deserializeResponse:e=>{if(0===e.length)return{};const t=new TextDecoder;return JSON.parse(t.decode(e))}};class kv{_parameters;_utils=null;constructor(e){this._parameters=e}async send(e,t){const{agent:n,send:r}=this._loadUtils();return new Promise(o=>{r(this._parameters,n,e,e=>{o(e)},t)})}shutdown(){}_loadUtils(){let e=this._utils;if(null===e){const{sendWithHttp:t,createHttpAgent:n}=require("./http-transport-utils");e=this._utils={agent:n(this._parameters.url,this._parameters.agentOptions),send:t}}return e}}function Ov(){return.4*Math.random()-.2}class xv{_transport;constructor(e){this._transport=e}retry(e,t,n){return new Promise((r,o)=>{setTimeout(()=>{this._transport.send(e,t).then(r,o)},n)})}async send(e,t){const n=Date.now()+t;let r=await this._transport.send(e,t),o=5,s=1e3;for(;"retryable"===r.status&&o>0;){o--;const t=Math.max(Math.min(s,5e3)+Ov(),0);s*=1.5;const i=r.retryInMillis??t,a=n-Date.now();if(i>a)return r;r=await this.retry(e,a,i)}return r}shutdown(){return this._transport.shutdown()}}function Rv(e){return new xv(e.transport)}function Nv(e,t){return n={transport:Rv({transport:(o=e,new kv(o))}),serializer:t,promiseHandler:uv(e)},r={timeout:e.timeoutMillis},new pv(n.transport,n.serializer,hv(),n.promiseHandler,r.timeout);var n,r,o}function Mv(e){const t=process.env[e]?.trim();if(null!=t&&""!==t){const n=Number(t);if(Number.isFinite(n)&&n>0)return n;mh.warn(`Configuration: ${e} is invalid, expected number greater than 0 (actual: ${t})`)}}function Lv(e){const t=Mv(`OTEL_EXPORTER_OTLP_${e}_TIMEOUT`),n=Mv("OTEL_EXPORTER_OTLP_TIMEOUT");return t??n}function Pv(e){const t=process.env[e]?.trim();if(""!==t)return null==t||"none"===t||"gzip"===t?t:void mh.warn(`Configuration: ${e} is invalid, expected 'none' or 'gzip' (actual: '${t}')`)}function Dv(e){const t=Pv(`OTEL_EXPORTER_OTLP_${e}_COMPRESSION`),n=Pv("OTEL_EXPORTER_OTLP_COMPRESSION");return t??n}function Fv(e){return{timeoutMillis:Lv(e),compression:Dv(e)}}function Uv(e,t,n){const r={...n()},o={};return()=>(null!=t&&Object.assign(o,t()),null!=e&&Object.assign(o,e()),Object.assign(o,r))}function Bv(e){if(null!=e)try{return new URL(e),e}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function jv(e){const t=process.env[`OTEL_EXPORTER_OTLP_${e}_HEADERS`]?.trim(),n=process.env.OTEL_EXPORTER_OTLP_HEADERS?.trim(),r=Dh(t),o=Dh(n);if(0!==Object.keys(r).length||0!==Object.keys(o).length)return Object.assign({},Dh(n),Dh(t))}function Zv(e){const t=process.env.OTEL_EXPORTER_OTLP_ENDPOINT?.trim();if(null!=t&&""!==t)return function(e,t){try{new URL(e)}catch{return void mh.warn(`Configuration: Could not parse environment-provided export URL: '${e}', falling back to undefined`)}e.endsWith("/")||(e+="/"),e+=t;try{new URL(e)}catch{return void mh.warn(`Configuration: Provided URL appended with '${t}' is not a valid URL, using 'undefined' instead of '${e}'`)}return e}(t,e)}function zv(e){const t=process.env[`OTEL_EXPORTER_OTLP_${e}_ENDPOINT`]?.trim();if(null!=t&&""!==t)return function(e){try{return new URL(e).toString()}catch{return void mh.warn(`Configuration: Could not parse environment-provided export URL: '${e}', falling back to undefined`)}}(t)}function Vv(e){return null!=e?.keepAlive&&(null!=e.httpAgentOptions?null==e.httpAgentOptions.keepAlive&&(e.httpAgentOptions.keepAlive=e.keepAlive):e.httpAgentOptions={keepAlive:e.keepAlive}),e.httpAgentOptions}function Gv(e,t,n,r){return e.metadata&&mh.warn("Metadata cannot be set when using http"),o={url:e.url,headers:av(e.headers),concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis,compression:e.compression,agentOptions:Vv(e)},s=function(e,t){return{...Fv(e),url:zv(e)??Zv(t),headers:av(jv(e))}}(t,n),i=function(e,t){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none",headers:()=>e,url:"http://localhost:4318/"+t,agentOptions:{keepAlive:!0}}}(r,n),{...lv(o,s,i),headers:Uv((a=o.headers,()=>{const e={};return Object.entries(a?.()??{}).forEach(([t,n])=>{void 0!==n?e[t]=String(n):mh.warn(`Header "${t}" has invalid value (${n}) and will be ignored`)}),e}),s.headers,i.headers),url:Bv(o.url)??s.url??i.url,agentOptions:o.agentOptions??s.agentOptions??i.agentOptions};var o,s,i,a}class Wv extends ov{constructor(e={}){super(Nv(Gv(e,"TRACES","v1/traces",{"User-Agent":"OTel-OTLP-Exporter-JavaScript/0.203.0","Content-Type":"application/json"}),Tv))}}class $v{constructor(e,t){this.config=e,this.sessionId=t,this.provider=this.createProvider()}createProvider(){const{serviceName:e,resourceAttributes:t,exporterEndpoint:n,projectId:r}=this.config,o=td({[op]:e,"at-project-id":r,...t||{}}),s=new Wv({url:n||"http://otelcol.apitoolkit.io:4318/v1/traces",headers:{}});return new Id({resource:o,spanProcessors:[new fd(s)]})}configure(){this.provider.register({contextManager:new yg,propagator:new Rp});const e=this.config.propagateTraceHeaderCorsUrls||[/^https?:\/\/.*/],t=[/^https?:\/\/(?:[^\/]+\.)?apitoolkit\.io\//,/^https?:\/\/(?:[^\/]+\.)?monoscope\.tech\//];!function(e){const t=e.tracerProvider||xh.getTracerProvider(),n=e.meterProvider||vh.getMeterProvider(),r=e.loggerProvider||zd.getLoggerProvider(),o=e.instrumentations?.flat()??[];(function(e,t,n,r){for(let o=0,s=e.length;o<s;o++){const s=e[o];t&&s.setTracerProvider(t),n&&s.setMeterProvider(n),r&&s.setLoggerProvider&&s.setLoggerProvider(r),s.getConfig().enabled||s.enable()}})(o,t,n,r)}({tracerProvider:this.provider,instrumentations:[...this.config.instrumentations||[],new mg({applyCustomAttributesOnSpan:{documentLoad:e=>{e.setAttribute("session.id",this.sessionId),this.setUserAttributes(e)},documentFetch:e=>{e.setAttribute("session.id",this.sessionId),this.setUserAttributes(e)},resourceFetch:e=>{e.setAttribute("session.id",this.sessionId),this.setUserAttributes(e)}}}),new Dy({propagateTraceHeaderCorsUrls:e,ignoreUrls:t,applyCustomAttributesOnSpan:e=>{e.setAttribute("session.id",this.sessionId),this.setUserAttributes(e)}}),new rv({propagateTraceHeaderCorsUrls:e,ignoreUrls:t,applyCustomAttributesOnSpan:e=>{e.setAttribute("session.id",this.sessionId),this.setUserAttributes(e)}})]})}setUserAttributes(e){if(this.config.user)for(let t in this.config.user)e.setAttribute(`user.${t}`,this.config.user[t])}async shutdown(){await this.provider.shutdown()}setUser(e){this.config={...this.config,user:{...this.config.user,...e}}}}const Hv=[];for(let e=0;e<256;++e)Hv.push((e+256).toString(16).slice(1));let Yv;const Kv=new Uint8Array(16);var qv={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Xv(e,t,n){if(qv.randomUUID&&!e)return qv.randomUUID();const r=(e=e||{}).random??e.rng?.()??function(){if(!Yv){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Yv=crypto.getRandomValues.bind(crypto)}return Yv(Kv)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(e,t=0){return(Hv[e[t+0]]+Hv[e[t+1]]+Hv[e[t+2]]+Hv[e[t+3]]+"-"+Hv[e[t+4]]+Hv[e[t+5]]+"-"+Hv[e[t+6]]+Hv[e[t+7]]+"-"+Hv[e[t+8]]+Hv[e[t+9]]+"-"+Hv[e[t+10]]+Hv[e[t+11]]+Hv[e[t+12]]+Hv[e[t+13]]+Hv[e[t+14]]+Hv[e[t+15]]).toLowerCase()}(r)}return class{constructor(e){if(!e.projectId)throw new Error("MonoscopeConfig must include projectId");const t=sessionStorage.getItem("monoscope-session-id");t?this.sessionId=t:(this.sessionId=Xv(),sessionStorage.setItem("monoscope-session-id",this.sessionId)),this.config=e,this.replay=new Uc(e,this.sessionId),this.otel=new $v(e,this.sessionId),this.otel.configure(),this.replay.configure(),window.monoscope=this}getSessionId(){return this.sessionId}setUser(e){this.otel.setUser(e)}}}(perf_hooks$2,path$4,require$$1$2,require$$1$3,require$$0,require$$0$1,os$2,require$$2$2,require$$3);
|
|
20
|
+
*/const vg=globalThis;function bg(e){return(vg.__Zone_symbol_prefix||"__zone_symbol__")+e}const wg=Object.getOwnPropertyDescriptor,Cg=Object.defineProperty,_g=Object.getPrototypeOf,Sg=Object.create,Ig=Array.prototype.slice,Eg="addEventListener",Ag="removeEventListener",Tg=bg(Eg),kg=bg(Ag),Og="true",xg="false",Rg=bg("");function Ng(e,t){return Zone.current.wrap(e,t)}function Mg(e,t,n,r,o){return Zone.current.scheduleMacroTask(e,t,n,r,o)}const Lg=bg,Pg="undefined"!=typeof window,Dg=Pg?window:void 0,Fg=Pg&&Dg||globalThis;function Ug(e,t){for(let n=e.length-1;n>=0;n--)"function"==typeof e[n]&&(e[n]=Ng(e[n],t+"_"+n));return e}function Bg(e){return!e||!1!==e.writable&&!("function"==typeof e.get&&void 0===e.set)}const jg="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,Zg=!("nw"in Fg)&&void 0!==Fg.process&&"[object process]"===Fg.process.toString(),zg=!Zg&&!jg&&!(!Pg||!Dg.HTMLElement),Vg=void 0!==Fg.process&&"[object process]"===Fg.process.toString()&&!jg&&!(!Pg||!Dg.HTMLElement),Gg={},Wg=Lg("enable_beforeunload"),$g=function(e){if(!(e=e||Fg.event))return;let t=Gg[e.type];t||(t=Gg[e.type]=Lg("ON_PROPERTY"+e.type));const n=this||e.target||Fg,r=n[t];let o;if(zg&&n===Dg&&"error"===e.type){const t=e;o=r&&r.call(this,t.message,t.filename,t.lineno,t.colno,t.error),!0===o&&e.preventDefault()}else o=r&&r.apply(this,arguments),"beforeunload"===e.type&&Fg[Wg]&&"string"==typeof o?e.returnValue=o:null==o||o||e.preventDefault();return o};function Hg(e,t,n){let r=wg(e,t);if(!r&&n){wg(n,t)&&(r={enumerable:!0,configurable:!0})}if(!r||!r.configurable)return;const o=Lg("on"+t+"patched");if(e.hasOwnProperty(o)&&e[o])return;delete r.writable,delete r.value;const s=r.get,i=r.set,a=t.slice(2);let l=Gg[a];l||(l=Gg[a]=Lg("ON_PROPERTY"+a)),r.set=function(t){let n=this;if(n||e!==Fg||(n=Fg),!n)return;"function"==typeof n[l]&&n.removeEventListener(a,$g),i?.call(n,null),n[l]=t,"function"==typeof t&&n.addEventListener(a,$g,!1)},r.get=function(){let n=this;if(n||e!==Fg||(n=Fg),!n)return null;const o=n[l];if(o)return o;if(s){let e=s.call(this);if(e)return r.set.call(this,e),"function"==typeof n.removeAttribute&&n.removeAttribute(t),e}return null},Cg(e,t,r),e[o]=!0}function Yg(e,t,n){if(t)for(let r=0;r<t.length;r++)Hg(e,"on"+t[r],n);else{const t=[];for(const n in e)"on"==n.slice(0,2)&&t.push(n);for(let r=0;r<t.length;r++)Hg(e,t[r],n)}}const Kg=Lg("originalInstance");function qg(e){const t=Fg[e];if(!t)return;Fg[Lg(e)]=t,Fg[e]=function(){const n=Ug(arguments,e);switch(n.length){case 0:this[Kg]=new t;break;case 1:this[Kg]=new t(n[0]);break;case 2:this[Kg]=new t(n[0],n[1]);break;case 3:this[Kg]=new t(n[0],n[1],n[2]);break;case 4:this[Kg]=new t(n[0],n[1],n[2],n[3]);break;default:throw new Error("Arg list too long.")}},Qg(Fg[e],t);const n=new t(function(){});let r;for(r in n)"XMLHttpRequest"===e&&"responseBlob"===r||function(t){"function"==typeof n[t]?Fg[e].prototype[t]=function(){return this[Kg][t].apply(this[Kg],arguments)}:Cg(Fg[e].prototype,t,{set:function(n){"function"==typeof n?(this[Kg][t]=Ng(n,e+"."+t),Qg(this[Kg][t],n)):this[Kg][t]=n},get:function(){return this[Kg][t]}})}(r);for(r in t)"prototype"!==r&&t.hasOwnProperty(r)&&(Fg[e][r]=t[r])}function Xg(e,t,n){let r=e;for(;r&&!r.hasOwnProperty(t);)r=_g(r);!r&&e[t]&&(r=e);const o=Lg(t);let s=null;if(r&&(!(s=r[o])||!r.hasOwnProperty(o))){s=r[o]=r[t];if(Bg(r&&wg(r,t))){const e=n(s,o,t);r[t]=function(){return e(this,arguments)},Qg(r[t],s)}}return s}function Jg(e,t,n){let r=null;function o(e){const t=e.data;return t.args[t.cbIdx]=function(){e.invoke.apply(this,arguments)},r.apply(t.target,t.args),e}r=Xg(e,t,e=>function(t,r){const s=n(t,r);return s.cbIdx>=0&&"function"==typeof r[s.cbIdx]?Mg(s.name,r[s.cbIdx],s,o):e.apply(t,r)})}function Qg(e,t){e[Lg("OriginalDelegate")]=t}let ey=!1,ty=!1;function ny(){if(ey)return ty;ey=!0;try{const e=Dg.navigator.userAgent;-1===e.indexOf("MSIE ")&&-1===e.indexOf("Trident/")&&-1===e.indexOf("Edge/")||(ty=!0)}catch(e){}return ty}function ry(e){return"function"==typeof e}function oy(e){return"number"==typeof e}const sy={useG:!0},iy={},ay={},ly=new RegExp("^"+Rg+"(\\w+)(true|false)$"),cy=Lg("propagationStopped");function uy(e,t){const n=(t?t(e):e)+xg,r=(t?t(e):e)+Og,o=Rg+n,s=Rg+r;iy[e]={},iy[e][xg]=o,iy[e][Og]=s}function hy(e,t,n,r){const o=r&&r.add||Eg,s=r&&r.rm||Ag,i=r&&r.listeners||"eventListeners",a=r&&r.rmAll||"removeAllListeners",l=Lg(o),c="."+o+":",u="prependListener",h="."+u+":",p=function(e,t,n){if(e.isRemoved)return;const r=e.callback;let o;"object"==typeof r&&r.handleEvent&&(e.callback=e=>r.handleEvent(e),e.originalDelegate=r);try{e.invoke(e,t,[n])}catch(e){o=e}const i=e.options;if(i&&"object"==typeof i&&i.once){const r=e.originalDelegate?e.originalDelegate:e.callback;t[s].call(t,n.type,r,i)}return o};function d(n,r,o){if(!(r=r||e.event))return;const s=n||r.target||e,i=s[iy[r.type][o?Og:xg]];if(i){const e=[];if(1===i.length){const t=p(i[0],s,r);t&&e.push(t)}else{const t=i.slice();for(let n=0;n<t.length&&(!r||!0!==r[cy]);n++){const o=p(t[n],s,r);o&&e.push(o)}}if(1===e.length)throw e[0];for(let n=0;n<e.length;n++){const r=e[n];t.nativeScheduleMicroTask(()=>{throw r})}}}const f=function(e){return d(this,e,!1)},m=function(e){return d(this,e,!0)};function g(t,n){if(!t)return!1;let r=!0;n&&void 0!==n.useG&&(r=n.useG);const p=n&&n.vh;let d=!0;n&&void 0!==n.chkDup&&(d=n.chkDup);let g=!1;n&&void 0!==n.rt&&(g=n.rt);let y=t;for(;y&&!y.hasOwnProperty(o);)y=_g(y);if(!y&&t[o]&&(y=t),!y)return!1;if(y[l])return!1;const v=n&&n.eventNameToString,b={},w=y[l]=y[o],C=y[Lg(s)]=y[s],_=y[Lg(i)]=y[i],S=y[Lg(a)]=y[a];let I;n&&n.prepend&&(I=y[Lg(n.prepend)]=y[n.prepend]);const E=function(e){return I.call(b.target,b.eventName,e.invoke,b.options)},A=r?function(e){if(!b.isExisting)return w.call(b.target,b.eventName,b.capture?m:f,b.options)}:function(e){return w.call(b.target,b.eventName,e.invoke,b.options)},T=r?function(e){if(!e.isRemoved){const t=iy[e.eventName];let n;t&&(n=t[e.capture?Og:xg]);const 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),0===r.length&&(e.allRemoved=!0,e.target[n]=null);break}}}if(e.allRemoved)return C.call(e.target,e.eventName,e.capture?m:f,e.options)}:function(e){return C.call(e.target,e.eventName,e.invoke,e.options)},k=n?.diff||function(e,t){const n=typeof t;return"function"===n&&e.callback===t||"object"===n&&e.originalDelegate===t},O=Zone[Lg("UNPATCHED_EVENTS")],x=e[Lg("PASSIVE_EVENTS")];const R=function(t,o,s,i,a=!1,l=!1){return function(){const c=this||e;let u=arguments[0];n&&n.transferEventName&&(u=n.transferEventName(u));let h=arguments[1];if(!h)return t.apply(this,arguments);if(Zg&&"uncaughtException"===u)return t.apply(this,arguments);let f=!1;if("function"!=typeof h){if(!h.handleEvent)return t.apply(this,arguments);f=!0}if(p&&!p(t,h,c,arguments))return;const m=!!x&&-1!==x.indexOf(u),g=function(e){if("object"==typeof e&&null!==e){const t={...e};return e.signal&&(t.signal=e.signal),t}return e}(function(e,t){return t?"boolean"==typeof e?{capture:e,passive:!0}:e?"object"==typeof e&&!1!==e.passive?{...e,passive:!0}:e:{passive:!0}:e}(arguments[2],m)),y=g?.signal;if(y?.aborted)return;if(O)for(let e=0;e<O.length;e++)if(u===O[e])return m?t.call(c,u,h,g):t.apply(this,arguments);const w=!!g&&("boolean"==typeof g||g.capture),C=!(!g||"object"!=typeof g)&&g.once,_=Zone.current;let S=iy[u];S||(uy(u,v),S=iy[u]);const I=S[w?Og:xg];let E,A=c[I],T=!1;if(A){if(T=!0,d)for(let e=0;e<A.length;e++)if(k(A[e],h))return}else A=c[I]=[];const R=c.constructor.name,N=ay[R];N&&(E=N[u]),E||(E=R+o+(v?v(u):u)),b.options=g,C&&(b.options.once=!1),b.target=c,b.capture=w,b.eventName=u,b.isExisting=T;const M=r?sy:void 0;M&&(M.taskData=b),y&&(b.options.signal=void 0);const L=_.scheduleEventTask(E,h,M,s,i);if(y){b.options.signal=y;const e=()=>L.zone.cancelTask(L);t.call(y,"abort",e,{once:!0}),L.removeAbortListener=()=>y.removeEventListener("abort",e)}return b.target=null,M&&(M.taskData=null),C&&(b.options.once=!0),"boolean"!=typeof L.options&&(L.options=g),L.target=c,L.capture=w,L.eventName=u,f&&(L.originalDelegate=h),l?A.unshift(L):A.push(L),a?c:void 0}};return y[o]=R(w,c,A,T,g),I&&(y[u]=R(I,h,E,T,g,!0)),y[s]=function(){const t=this||e;let r=arguments[0];n&&n.transferEventName&&(r=n.transferEventName(r));const o=arguments[2],s=!!o&&("boolean"==typeof o||o.capture),i=arguments[1];if(!i)return C.apply(this,arguments);if(p&&!p(C,i,t,arguments))return;const a=iy[r];let l;a&&(l=a[s?Og:xg]);const c=l&&t[l];if(c)for(let e=0;e<c.length;e++){const n=c[e];if(k(n,i)){if(c.splice(e,1),n.isRemoved=!0,0===c.length&&(n.allRemoved=!0,t[l]=null,!s&&"string"==typeof r)){t[Rg+"ON_PROPERTY"+r]=null}return n.zone.cancelTask(n),g?t:void 0}}return C.apply(this,arguments)},y[i]=function(){const t=this||e;let r=arguments[0];n&&n.transferEventName&&(r=n.transferEventName(r));const o=[],s=py(t,v?v(r):r);for(let e=0;e<s.length;e++){const t=s[e];let n=t.originalDelegate?t.originalDelegate:t.callback;o.push(n)}return o},y[a]=function(){const t=this||e;let r=arguments[0];if(r){n&&n.transferEventName&&(r=n.transferEventName(r));const e=iy[r];if(e){const n=e[xg],o=e[Og],i=t[n],a=t[o];if(i){const e=i.slice();for(let t=0;t<e.length;t++){const n=e[t];let o=n.originalDelegate?n.originalDelegate:n.callback;this[s].call(this,r,o,n.options)}}if(a){const e=a.slice();for(let t=0;t<e.length;t++){const n=e[t];let o=n.originalDelegate?n.originalDelegate:n.callback;this[s].call(this,r,o,n.options)}}}}else{const e=Object.keys(t);for(let t=0;t<e.length;t++){const n=e[t],r=ly.exec(n);let o=r&&r[1];o&&"removeListener"!==o&&this[a].call(this,o)}this[a].call(this,"removeListener")}if(g)return this},Qg(y[o],w),Qg(y[s],C),S&&Qg(y[a],S),_&&Qg(y[i],_),!0}let y=[];for(let e=0;e<n.length;e++)y[e]=g(n[e],r);return y}function py(e,t){if(!t){const n=[];for(let r in e){const o=ly.exec(r);let s=o&&o[1];if(s&&(!t||s===t)){const t=e[r];if(t)for(let e=0;e<t.length;e++)n.push(t[e])}}return n}let n=iy[t];n||(uy(t),n=iy[t]);const r=e[n[xg]],o=e[n[Og]];return r?o?r.concat(o):r.slice():o?o.slice():[]}function dy(e,t){const n=e.Event;n&&n.prototype&&t.patchMethod(n.prototype,"stopImmediatePropagation",e=>function(t,n){t[cy]=!0,e&&e.apply(t,n)})}function fy(e,t){t.patchMethod(e,"queueMicrotask",e=>function(e,t){Zone.current.scheduleMicroTask("queueMicrotask",t[0])})}const my=Lg("zoneTask");function gy(e,t,n,r){let o=null,s=null;n+=r;const i={};function a(t){const n=t.data;n.args[0]=function(){return t.invoke.apply(this,arguments)};const r=o.apply(e,n.args);return oy(r)?n.handleId=r:(n.handle=r,n.isRefreshable=ry(r.refresh)),t}function l(t){const{handle:n,handleId:r}=t.data;return s.call(e,n??r)}o=Xg(e,t+=r,n=>function(o,s){if(ry(s[0])){const e={isRefreshable:!1,isPeriodic:"Interval"===r,delay:"Timeout"===r||"Interval"===r?s[1]||0:void 0,args:s},n=s[0];s[0]=function(){try{return n.apply(this,arguments)}finally{const{handle:t,handleId:n,isPeriodic:r,isRefreshable:o}=e;r||o||(n?delete i[n]:t&&(t[my]=null))}};const o=Mg(t,s[0],e,a,l);if(!o)return o;const{handleId:c,handle:u,isRefreshable:h,isPeriodic:p}=o.data;if(c)i[c]=o;else if(u&&(u[my]=o,h&&!p)){const e=u.refresh;u.refresh=function(){const{zone:t,state:n}=o;return"notScheduled"===n?(o._state="scheduled",t._updateTaskCount(o,1)):"running"===n&&(o._state="scheduling"),e.call(this)}}return u??c??o}return n.apply(e,s)}),s=Xg(e,n,t=>function(n,r){const o=r[0];let s;oy(o)?(s=i[o],delete i[o]):(s=o?.[my],s?o[my]=null:s=o),s?.type?s.cancelFn&&s.zone.cancelTask(s):t.apply(e,r)})}function yy(e,t){if(Zone[t.symbol("patchEventTarget")])return;const{eventNames:n,zoneSymbolEventNames:r,TRUE_STR:o,FALSE_STR:s,ZONE_SYMBOL_PREFIX:i}=t.getGlobalObjects();for(let e=0;e<n.length;e++){const t=n[e],a=i+(t+s),l=i+(t+o);r[t]={},r[t][s]=a,r[t][o]=l}const a=e.EventTarget;return a&&a.prototype?(t.patchEventTarget(e,t,[a&&a.prototype]),!0):void 0}function vy(e,t,n){if(!n||0===n.length)return t;const r=n.filter(t=>t.target===e);if(0===r.length)return t;const o=r[0].ignoreProperties;return t.filter(e=>-1===o.indexOf(e))}function by(e,t,n,r){if(!e)return;Yg(e,vy(e,t,n),r)}function wy(e){return Object.getOwnPropertyNames(e).filter(e=>e.startsWith("on")&&e.length>2).map(e=>e.substring(2))}function Cy(e,t){if(Zg&&!Vg)return;if(Zone[e.symbol("patchEvents")])return;const n=t.__Zone_ignore_on_properties;let r=[];if(zg){const e=window;r=r.concat(["Document","SVGElement","Element","HTMLElement","HTMLBodyElement","HTMLMediaElement","HTMLFrameSetElement","HTMLFrameElement","HTMLIFrameElement","HTMLMarqueeElement","Worker"]);const t=[];by(e,wy(e),n?n.concat(t):n,_g(e))}r=r.concat(["XMLHttpRequest","XMLHttpRequestEventTarget","IDBIndex","IDBRequest","IDBOpenDBRequest","IDBDatabase","IDBTransaction","IDBCursor","WebSocket"]);for(let e=0;e<r.length;e++){const o=t[r[e]];o?.prototype&&by(o.prototype,wy(o.prototype),n)}}function _y(e){e.__load_patch("ZoneAwarePromise",(e,t,n)=>{const r=Object.getOwnPropertyDescriptor,o=Object.defineProperty;const s=n.symbol,i=[],a=!1!==e[s("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")],l=s("Promise"),c=s("then");n.onUnhandledError=e=>{if(n.showUncaughtError()){const 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(;i.length;){const e=i.shift();try{e.zone.runGuarded(()=>{if(e.throwOriginal)throw e.rejection;throw e})}catch(e){h(e)}}};const u=s("unhandledPromiseRejectionHandler");function h(e){n.onUnhandledError(e);try{const n=t[u];"function"==typeof n&&n.call(this,e)}catch(e){}}function p(e){return e&&"function"==typeof e.then}function d(e){return e}function f(e){return M.reject(e)}const m=s("state"),g=s("value"),y=s("finally"),v=s("parentPromiseValue"),b=s("parentPromiseState"),w=null,C=!0,_=!1;function S(e,t){return n=>{try{T(e,t,n)}catch(t){T(e,!1,t)}}}const I=function(){let e=!1;return function(t){return function(){e||(e=!0,t.apply(null,arguments))}}},E="Promise resolved with itself",A=s("currentTaskTrace");function T(e,r,s){const l=I();if(e===s)throw new TypeError(E);if(e[m]===w){let c=null;try{"object"!=typeof s&&"function"!=typeof s||(c=s&&s.then)}catch(t){return l(()=>{T(e,!1,t)})(),e}if(r!==_&&s instanceof M&&s.hasOwnProperty(m)&&s.hasOwnProperty(g)&&s[m]!==w)O(s),T(e,s[m],s[g]);else if(r!==_&&"function"==typeof c)try{c.call(s,l(S(e,r)),l(S(e,!1)))}catch(t){l(()=>{T(e,!1,t)})()}else{e[m]=r;const l=e[g];if(e[g]=s,e[y]===y&&r===C&&(e[m]=e[b],e[g]=e[v]),r===_&&s instanceof Error){const e=t.currentTask&&t.currentTask.data&&t.currentTask.data.__creationTrace__;e&&o(s,A,{configurable:!0,enumerable:!1,writable:!0,value:e})}for(let t=0;t<l.length;)x(e,l[t++],l[t++],l[t++],l[t++]);if(0==l.length&&r==_){e[m]=0;let r=s;try{throw new Error("Uncaught (in promise): "+function(e){if(e&&e.toString===Object.prototype.toString){return(e.constructor&&e.constructor.name||"")+": "+JSON.stringify(e)}return e?e.toString():Object.prototype.toString.call(e)}(s)+(s&&s.stack?"\n"+s.stack:""))}catch(e){r=e}a&&(r.throwOriginal=!0),r.rejection=s,r.promise=e,r.zone=t.current,r.task=t.currentTask,i.push(r),n.scheduleMicroTask()}}}return e}const k=s("rejectionHandledHandler");function O(e){if(0===e[m]){try{const n=t[k];n&&"function"==typeof n&&n.call(this,{rejection:e[g],promise:e})}catch(e){}e[m]=_;for(let t=0;t<i.length;t++)e===i[t].promise&&i.splice(t,1)}}function x(e,t,n,r,o){O(e);const s=e[m],i=s?"function"==typeof r?r:d:"function"==typeof o?o:f;t.scheduleMicroTask("Promise.then",()=>{try{const r=e[g],o=!!n&&y===n[y];o&&(n[v]=r,n[b]=s);const a=t.run(i,void 0,o&&i!==f&&i!==d?[]:[r]);T(n,!0,a)}catch(e){T(n,!1,e)}},n)}const R=function(){},N=e.AggregateError;class M{static toString(){return"function ZoneAwarePromise() { [native code] }"}static resolve(e){return e instanceof M?e:T(new this(null),C,e)}static reject(e){return T(new this(null),_,e)}static withResolvers(){const e={};return e.promise=new M((t,n)=>{e.resolve=t,e.reject=n}),e}static any(e){if(!e||"function"!=typeof e[Symbol.iterator])return Promise.reject(new N([],"All promises were rejected"));const t=[];let n=0;try{for(let r of e)n++,t.push(M.resolve(r))}catch(e){return Promise.reject(new N([],"All promises were rejected"))}if(0===n)return Promise.reject(new N([],"All promises were rejected"));let r=!1;const o=[];return new M((e,s)=>{for(let i=0;i<t.length;i++)t[i].then(t=>{r||(r=!0,e(t))},e=>{o.push(e),n--,0===n&&(r=!0,s(new N(o,"All promises were rejected")))})})}static race(e){let t,n,r=new this((e,r)=>{t=e,n=r});function o(e){t(e)}function s(e){n(e)}for(let t of e)p(t)||(t=this.resolve(t)),t.then(o,s);return r}static all(e){return M.allWithCallback(e)}static allSettled(e){return(this&&this.prototype instanceof M?this:M).allWithCallback(e,{thenCallback:e=>({status:"fulfilled",value:e}),errorCallback:e=>({status:"rejected",reason:e})})}static allWithCallback(e,t){let n,r,o=new this((e,t)=>{n=e,r=t}),s=2,i=0;const a=[];for(let o of e){p(o)||(o=this.resolve(o));const e=i;try{o.then(r=>{a[e]=t?t.thenCallback(r):r,s--,0===s&&n(a)},o=>{t?(a[e]=t.errorCallback(o),s--,0===s&&n(a)):r(o)})}catch(e){r(e)}s++,i++}return s-=2,0===s&&n(a),o}constructor(e){const t=this;if(!(t instanceof M))throw new Error("Must be an instanceof Promise.");t[m]=w,t[g]=[];try{const n=I();e&&e(n(S(t,C)),n(S(t,_)))}catch(e){T(t,!1,e)}}get[Symbol.toStringTag](){return"Promise"}get[Symbol.species](){return M}then(e,n){let r=this.constructor?.[Symbol.species];r&&"function"==typeof r||(r=this.constructor||M);const o=new r(R),s=t.current;return this[m]==w?this[g].push(s,o,e,n):x(this,s,o,e,n),o}catch(e){return this.then(null,e)}finally(e){let n=this.constructor?.[Symbol.species];n&&"function"==typeof n||(n=M);const r=new n(R);r[y]=y;const o=t.current;return this[m]==w?this[g].push(o,r,e,e):x(this,o,r,e,e),r}}M.resolve=M.resolve,M.reject=M.reject,M.race=M.race,M.all=M.all;const L=e[l]=e.Promise;e.Promise=M;const P=s("thenPatched");function D(e){const t=e.prototype,n=r(t,"then");if(n&&(!1===n.writable||!n.configurable))return;const o=t.then;t[c]=o,e.prototype.then=function(e,t){const n=new M((e,t)=>{o.call(this,e,t)});return n.then(e,t)},e[P]=!0}return n.patchThen=D,L&&(D(L),Xg(e,"fetch",e=>{return t=e,function(e,n){let r=t.apply(e,n);if(r instanceof M)return r;let o=r.constructor;return o[P]||D(o),r};var t})),Promise[t.__symbol__("uncaughtPromiseErrors")]=i,M})}function Sy(e,t,n,r,o){const s=Zone.__symbol__(r);if(t[s])return;const i=t[s]=t[r];t[r]=function(s,a,l){return a&&a.prototype&&o.forEach(function(t){const o=`${n}.${r}::`+t,s=a.prototype;try{if(s.hasOwnProperty(t)){const n=e.ObjectGetOwnPropertyDescriptor(s,t);n&&n.value?(n.value=e.wrapWithCurrentZone(n.value,o),e._redefineProperty(a.prototype,t,n)):s[t]&&(s[t]=e.wrapWithCurrentZone(s[t],o))}else s[t]&&(s[t]=e.wrapWithCurrentZone(s[t],o))}catch{}}),i.call(t,s,a,l)},e.attachOriginToPatched(t[r],i)}const Iy=function(){const e=globalThis,t=!0===e[bg("forceDuplicateZoneCheck")];if(e.Zone&&(t||"function"!=typeof e.Zone.__symbol__))throw new Error("Zone already loaded.");return e.Zone??=function(){const e=vg.performance;function t(t){e&&e.mark&&e.mark(t)}function n(t,n){e&&e.measure&&e.measure(t,n)}t("Zone");class r{static __symbol__=bg;static assertZonePatched(){if(vg.Promise!==A.ZoneAwarePromise)throw new 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 e=r.current;for(;e.parent;)e=e.parent;return e}static get current(){return k.zone}static get currentTask(){return O}static __load_patch(e,o,s=!1){if(A.hasOwnProperty(e)){const t=!0===vg[bg("forceDuplicateZoneCheck")];if(!s&&t)throw Error("Already loaded patch: "+e)}else if(!vg["__Zone_disable_"+e]){const s="Zone:"+e;t(s),A[e]=o(vg,r,T),n(s,s)}}get parent(){return this._parent}get name(){return this._name}_parent;_name;_properties;_zoneDelegate;constructor(e,t){this._parent=e,this._name=t?t.name||"unnamed":"<root>",this._properties=t&&t.properties||{},this._zoneDelegate=new s(this,this._parent&&this._parent._zoneDelegate,t)}get(e){const 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 new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,e)}wrap(e,t){if("function"!=typeof e)throw new Error("Expecting function got: "+e);const n=this._zoneDelegate.intercept(this,e,t),r=this;return function(){return r.runGuarded(n,this,arguments,t)}}run(e,t,n,r){k={parent:k,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{k=k.parent}}runGuarded(e,t=null,n,r){k={parent:k,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{k=k.parent}}runTask(e,t,n){if(e.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(e.zone||g).name+"; Execution: "+this.name+")");const r=e,{type:o,data:{isPeriodic:s=!1,isRefreshable:i=!1}={}}=e;if(e.state===y&&(o===E||o===I))return;const a=e.state!=w;a&&r._transitionTo(w,b);const l=O;O=r,k={parent:k,zone:this};try{o!=I||!e.data||s||i||(e.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,r,t,n)}catch(e){if(this._zoneDelegate.handleError(this,e))throw e}}finally{const t=e.state;if(t!==y&&t!==_)if(o==E||s||i&&t===v)a&&r._transitionTo(b,w,v);else{const e=r._zoneDelegates;this._updateTaskCount(r,-1),a&&r._transitionTo(y,w,y),i&&(r._zoneDelegates=e)}k=k.parent,O=l}}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(v,y);const t=[];e._zoneDelegates=t,e._zone=this;try{e=this._zoneDelegate.scheduleTask(this,e)}catch(t){throw e._transitionTo(_,v,y),this._zoneDelegate.handleError(this,t),t}return e._zoneDelegates===t&&this._updateTaskCount(e,1),e.state==v&&e._transitionTo(b,v),e}scheduleMicroTask(e,t,n,r){return this.scheduleTask(new i(S,e,t,n,r,void 0))}scheduleMacroTask(e,t,n,r,o){return this.scheduleTask(new i(I,e,t,n,r,o))}scheduleEventTask(e,t,n,r,o){return this.scheduleTask(new i(E,e,t,n,r,o))}cancelTask(e){if(e.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(e.zone||g).name+"; Execution: "+this.name+")");if(e.state===b||e.state===w){e._transitionTo(C,b,w);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(_,C),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(y,C),e.runCount=-1,e}}_updateTaskCount(e,t){const n=e._zoneDelegates;-1==t&&(e._zoneDelegates=null);for(let r=0;r<n.length;r++)n[r]._updateTaskCount(e.type,t)}}const o={name:"",onHasTask:(e,t,n,r)=>e.hasTask(n,r),onScheduleTask:(e,t,n,r)=>e.scheduleTask(n,r),onInvokeTask:(e,t,n,r,o,s)=>e.invokeTask(n,r,o,s),onCancelTask:(e,t,n,r)=>e.cancelTask(n,r)};class s{get zone(){return this._zone}_zone;_taskCounts={microTask:0,macroTask:0,eventTask:0};_parentDelegate;_forkDlgt;_forkZS;_forkCurrZone;_interceptDlgt;_interceptZS;_interceptCurrZone;_invokeDlgt;_invokeZS;_invokeCurrZone;_handleErrorDlgt;_handleErrorZS;_handleErrorCurrZone;_scheduleTaskDlgt;_scheduleTaskZS;_scheduleTaskCurrZone;_invokeTaskDlgt;_invokeTaskZS;_invokeTaskCurrZone;_cancelTaskDlgt;_cancelTaskZS;_cancelTaskCurrZone;_hasTaskDlgt;_hasTaskDlgtOwner;_hasTaskZS;_hasTaskCurrZone;constructor(e,t,n){this._zone=e,this._parentDelegate=t,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;const r=n&&n.onHasTask,s=t&&t._hasTaskZS;(r||s)&&(this._hasTaskZS=r?n:o,this._hasTaskDlgt=t,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=this._zone,n.onScheduleTask||(this._scheduleTaskZS=o,this._scheduleTaskDlgt=t,this._scheduleTaskCurrZone=this._zone),n.onInvokeTask||(this._invokeTaskZS=o,this._invokeTaskDlgt=t,this._invokeTaskCurrZone=this._zone),n.onCancelTask||(this._cancelTaskZS=o,this._cancelTaskDlgt=t,this._cancelTaskCurrZone=this._zone))}fork(e,t){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,e,t):new r(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,o){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,e,t,n,r,o):t.apply(n,r)}handleError(e,t){return!this._handleErrorZS||this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,e,t)}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!=S)throw new Error("Task is missing scheduleFn.");f(t)}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){const n=this._taskCounts,r=n[e],o=n[e]=r+t;if(o<0)throw new Error("More tasks executed then were scheduled.");if(0==r||0==o){const t={microTask:n.microTask>0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:e};this.hasTask(this._zone,t)}}}class i{type;source;invoke;callback;data;scheduleFn;cancelFn;_zone=null;runCount=0;_zoneDelegates=null;_state="notScheduled";constructor(e,t,n,r,o,s){if(this.type=e,this.source=t,this.data=r,this.scheduleFn=o,this.cancelFn=s,!n)throw new Error("callback is not defined");this.callback=n;const a=this;e===E&&r&&r.useG?this.invoke=i.invokeTask:this.invoke=function(){return i.invokeTask.call(vg,a,this,arguments)}}static invokeTask(e,t,n){e||(e=this),x++;try{return e.runCount++,e.zone.runTask(e,t,n)}finally{1==x&&m(),x--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(y,v)}_transitionTo(e,t,n){if(this._state!==t&&this._state!==n)throw new Error(`${this.type} '${this.source}': can not transition to '${e}', expecting state '${t}'${n?" or '"+n+"'":""}, was '${this._state}'.`);this._state=e,e==y&&(this._zoneDelegates=null)}toString(){return this.data&&void 0!==this.data.handleId?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}}}const a=bg("setTimeout"),l=bg("Promise"),c=bg("then");let u,h=[],p=!1;function d(e){if(u||vg[l]&&(u=vg[l].resolve(0)),u){let t=u[c];t||(t=u.then),t.call(u,e)}else vg[a](e,0)}function f(e){0===x&&0===h.length&&d(m),e&&h.push(e)}function m(){if(!p){for(p=!0;h.length;){const e=h;h=[];for(let t=0;t<e.length;t++){const n=e[t];try{n.zone.runTask(n,null,null)}catch(e){T.onUnhandledError(e)}}}T.microtaskDrainDone(),p=!1}}const g={name:"NO ZONE"},y="notScheduled",v="scheduling",b="scheduled",w="running",C="canceling",_="unknown",S="microTask",I="macroTask",E="eventTask",A={},T={symbol:bg,currentZoneFrame:()=>k,onUnhandledError:R,microtaskDrainDone:R,scheduleMicroTask:f,showUncaughtError:()=>!r[bg("ignoreConsoleErrorUncaughtError")],patchEventTarget:()=>[],patchOnProperties:R,patchMethod:()=>R,bindArguments:()=>[],patchThen:()=>R,patchMacroTask:()=>R,patchEventPrototype:()=>R,isIEOrEdge:()=>!1,getGlobalObjects:()=>{},ObjectDefineProperty:()=>R,ObjectGetOwnPropertyDescriptor:()=>{},ObjectCreate:()=>{},ArraySlice:()=>[],patchClass:()=>R,wrapWithCurrentZone:()=>R,filterProperties:()=>[],attachOriginToPatched:()=>R,_redefineProperty:()=>R,patchCallbacks:()=>R,nativeScheduleMicroTask:d};let k={parent:null,zone:new r(null,null)},O=null,x=0;function R(){}return n("Zone","Zone"),r}(),e.Zone}();!function(e){_y(e),function(e){e.__load_patch("toString",e=>{const t=Function.prototype.toString,n=Lg("OriginalDelegate"),r=Lg("Promise"),o=Lg("Error"),s=function(){if("function"==typeof this){const s=this[n];if(s)return"function"==typeof s?t.call(s):Object.prototype.toString.call(s);if(this===Promise){const n=e[r];if(n)return t.call(n)}if(this===Error){const n=e[o];if(n)return t.call(n)}}return t.call(this)};s[n]=t,Function.prototype.toString=s;const i=Object.prototype.toString;Object.prototype.toString=function(){return"function"==typeof Promise&&this instanceof Promise?"[object Promise]":i.call(this)}})}(e),function(e){e.__load_patch("util",(e,t,n)=>{const r=wy(e);n.patchOnProperties=Yg,n.patchMethod=Xg,n.bindArguments=Ug,n.patchMacroTask=Jg;const o=t.__symbol__("BLACK_LISTED_EVENTS"),s=t.__symbol__("UNPATCHED_EVENTS");e[s]&&(e[o]=e[s]),e[o]&&(t[o]=t[s]=e[o]),n.patchEventPrototype=dy,n.patchEventTarget=hy,n.isIEOrEdge=ny,n.ObjectDefineProperty=Cg,n.ObjectGetOwnPropertyDescriptor=wg,n.ObjectCreate=Sg,n.ArraySlice=Ig,n.patchClass=qg,n.wrapWithCurrentZone=Ng,n.filterProperties=vy,n.attachOriginToPatched=Qg,n._redefineProperty=Object.defineProperty,n.patchCallbacks=Sy,n.getGlobalObjects=()=>({globalSources:ay,zoneSymbolEventNames:iy,eventNames:r,isBrowser:zg,isMix:Vg,isNode:Zg,TRUE_STR:Og,FALSE_STR:xg,ZONE_SYMBOL_PREFIX:Rg,ADD_EVENT_LISTENER_STR:Eg,REMOVE_EVENT_LISTENER_STR:Ag})})}(e)}(Iy),function(e){e.__load_patch("legacy",t=>{const n=t[e.__symbol__("legacyPatch")];n&&n()}),e.__load_patch("timers",e=>{const t="set",n="clear";gy(e,t,n,"Timeout"),gy(e,t,n,"Interval"),gy(e,t,n,"Immediate")}),e.__load_patch("requestAnimationFrame",e=>{gy(e,"request","cancel","AnimationFrame"),gy(e,"mozRequest","mozCancel","AnimationFrame"),gy(e,"webkitRequest","webkitCancel","AnimationFrame")}),e.__load_patch("blocking",(e,t)=>{const n=["alert","prompt","confirm"];for(let r=0;r<n.length;r++){Xg(e,n[r],(n,r,o)=>function(r,s){return t.current.run(n,e,s,o)})}}),e.__load_patch("EventTarget",(e,t,n)=>{!function(e,t){t.patchEventPrototype(e,t)}(e,n),yy(e,n);const r=e.XMLHttpRequestEventTarget;r&&r.prototype&&n.patchEventTarget(e,n,[r.prototype])}),e.__load_patch("MutationObserver",(e,t,n)=>{qg("MutationObserver"),qg("WebKitMutationObserver")}),e.__load_patch("IntersectionObserver",(e,t,n)=>{qg("IntersectionObserver")}),e.__load_patch("FileReader",(e,t,n)=>{qg("FileReader")}),e.__load_patch("on_property",(e,t,n)=>{Cy(n,e)}),e.__load_patch("customElements",(e,t,n)=>{!function(e,t){const{isBrowser:n,isMix:r}=t.getGlobalObjects();if(!n&&!r||!e.customElements||!("customElements"in e))return;t.patchCallbacks(t,e.customElements,"customElements","define",["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","formAssociatedCallback","formDisabledCallback","formResetCallback","formStateRestoreCallback"])}(e,n)}),e.__load_patch("XHR",(e,t)=>{!function(e){const l=e.XMLHttpRequest;if(!l)return;const c=l.prototype;let u=c[Tg],h=c[kg];if(!u){const t=e.XMLHttpRequestEventTarget;if(t){const e=t.prototype;u=e[Tg],h=e[kg]}}const p="readystatechange",d="scheduled";function f(e){const r=e.data,i=r.target;i[s]=!1,i[a]=!1;const l=i[o];u||(u=i[Tg],h=i[kg]),l&&h.call(i,p,l);const c=i[o]=()=>{if(i.readyState===i.DONE)if(!r.aborted&&i[s]&&e.state===d){const n=i[t.__symbol__("loadfalse")];if(0!==i.status&&n&&n.length>0){const o=e.invoke;e.invoke=function(){const n=i[t.__symbol__("loadfalse")];for(let t=0;t<n.length;t++)n[t]===e&&n.splice(t,1);r.aborted||e.state!==d||o.call(e)},n.push(e)}else e.invoke()}else r.aborted||!1!==i[s]||(i[a]=!0)};u.call(i,p,c);return i[n]||(i[n]=e),w.apply(i,r.args),i[s]=!0,e}function m(){}function g(e){const t=e.data;return t.aborted=!0,C.apply(t.target,t.args)}const y=Xg(c,"open",()=>function(e,t){return e[r]=0==t[2],e[i]=t[1],y.apply(e,t)}),v=Lg("fetchTaskAborting"),b=Lg("fetchTaskScheduling"),w=Xg(c,"send",()=>function(e,n){if(!0===t.current[b])return w.apply(e,n);if(e[r])return w.apply(e,n);{const t={target:e,url:e[i],isPeriodic:!1,args:n,aborted:!1},r=Mg("XMLHttpRequest.send",m,t,f,g);e&&!0===e[a]&&!t.aborted&&r.state===d&&r.invoke()}}),C=Xg(c,"abort",()=>function(e,r){const o=e[n];if(o&&"string"==typeof o.type){if(null==o.cancelFn||o.data&&o.data.aborted)return;o.zone.cancelTask(o)}else if(!0===t.current[v])return C.apply(e,r)})}(e);const n=Lg("xhrTask"),r=Lg("xhrSync"),o=Lg("xhrListener"),s=Lg("xhrScheduled"),i=Lg("xhrURL"),a=Lg("xhrErrorBeforeScheduled")}),e.__load_patch("geolocation",e=>{e.navigator&&e.navigator.geolocation&&function(e,t){const n=e.constructor.name;for(let r=0;r<t.length;r++){const o=t[r],s=e[o];if(s){if(!Bg(wg(e,o)))continue;e[o]=(e=>{const t=function(){return e.apply(this,Ug(arguments,n+"."+o))};return Qg(t,e),t})(s)}}}(e.navigator.geolocation,["getCurrentPosition","watchPosition"])}),e.__load_patch("PromiseRejectionEvent",(e,t)=>{function n(t){return function(n){py(e,t).forEach(r=>{const o=e.PromiseRejectionEvent;if(o){const e=new o(t,{promise:n.promise,reason:n.rejection});r.invoke(e)}})}}e.PromiseRejectionEvent&&(t[Lg("unhandledPromiseRejectionHandler")]=n("unhandledrejection"),t[Lg("rejectionHandledHandler")]=n("rejectionhandled"))}),e.__load_patch("queueMicrotask",(e,t,n)=>{fy(e,n)})}(Iy);var Ey;!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"}(Ey||(Ey={}));const Ay=mh.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-xml-http-request/utils"});function Ty(e){return t=e,"undefined"!=typeof Document&&t instanceof Document?(new XMLSerializer).serializeToString(document).length:"string"==typeof e?Oy(e):e instanceof Blob?e.size:e instanceof FormData?function(e){let t=0;for(const[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}(e):e instanceof URLSearchParams?Oy(e.toString()):void 0!==e.byteLength?e.byteLength:void Ay.warn("unknown body type");var t}const ky=new TextEncoder;function Oy(e){return ky.encode(e).byteLength}function xy(e){const t=function(){if(void 0===Ny){const e=$h("OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS");e&&e.length>0?(Ny={},e.forEach(e=>{Ny[e]=!0})):Ny=Ry}return Ny}(),n=e.toUpperCase();return n in t?n:"_OTHER"}const Ry={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0};let Ny;const My={"https:":"443","http:":"80"};const Ly="0.203.0";var Py;!function(e){e.HTTP_STATUS_TEXT="http.status_text"}(Py||(Py={}));class Dy extends ug{component="xml-http-request";version=Ly;moduleName=this.component;_tasksCount=0;_xhrMem=new WeakMap;_usedResources=new WeakSet;_semconvStability;constructor(e={}){super("@opentelemetry/instrumentation-xml-http-request",Ly,e),this._semconvStability=pg("http",e?.semconvStabilityOptIn)}init(){}_addHeaders(e,t){if(!Nd(Rd(t).href,this.getConfig().propagateTraceHeaderCorsUrls)){const e={};return kh.inject(fh.active(),e),void(Object.keys(e).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}const n={};kh.inject(fh.active(),n),Object.keys(n).forEach(t=>{e.setRequestHeader(t,String(n[t]))})}_addChildSpan(e,t){fh.with(xh.setSpan(fh.active(),e),()=>{const e=this.tracer.startSpan("CORS Preflight",{startTime:t[Cd.FETCH_START]}),n=!(this._semconvStability&sg.OLD);kd(e,t,this.getConfig().ignoreNetworkEvents,void 0,n),e.end(t[Cd.RESPONSE_END])})}_addFinalSpanAttributes(e,t,n){if(this._semconvStability&sg.OLD){if(void 0!==t.status&&e.setAttribute("http.status_code",t.status),void 0!==t.statusText&&e.setAttribute(Py.HTTP_STATUS_TEXT,t.statusText),"string"==typeof n){const t=Rd(n);e.setAttribute("http.host",t.host),e.setAttribute("http.scheme",t.protocol.replace(":",""))}e.setAttribute("http.user_agent",navigator.userAgent)}this._semconvStability&sg.STABLE&&t.status&&e.setAttribute(tp,t.status)}_applyAttributesAfterXHR(e,t){const n=this.getConfig().applyCustomAttributesOnSpan;"function"==typeof n&&lg(()=>n(e,t),e=>{e&&this._diag.error("applyCustomAttributesOnSpan",e)})}_addResourceObserver(e,t){const n=this._xhrMem.get(e);n&&"function"==typeof PerformanceObserver&&"function"==typeof PerformanceResourceTiming&&(n.createdResources={observer:new PerformanceObserver(e=>{const r=e.getEntries(),o=Rd(t);r.forEach(e=>{"xmlhttprequest"===e.initiatorType&&e.name===o.href&&n.createdResources&&n.createdResources.entries.push(e)})}),entries:[]},n.createdResources.observer.observe({entryTypes:["resource"]}))}_clearResources(){0===this._tasksCount&&this.getConfig().clearTimingResources&&(Yh.clearResourceTimings(),this._xhrMem=new WeakMap,this._usedResources=new WeakSet)}_findResourceAndAddNetworkEvents(e,t,n,r,o){if(!(n&&r&&o&&e.createdResources))return;let s=e.createdResources.entries;s&&s.length||(s=Yh.getEntriesByType("resource"));const i=xd(Rd(n).href,r,o,s,this._usedResources);if(i.mainRequest){const e=i.mainRequest;this._markResourceAsUsed(e);const n=i.corsPreFlightRequest;n&&(this._addChildSpan(t,n),this._markResourceAsUsed(n));const r=!(this._semconvStability&sg.OLD);kd(t,e,this.getConfig().ignoreNetworkEvents,void 0,r)}}_cleanPreviousSpanInformation(e){const t=this._xhrMem.get(e);if(t){const n=t.callbackToRemoveEvents;n&&n(),this._xhrMem.delete(e)}}_createSpan(e,t,n){if(qp(t,this.getConfig().ignoreUrls))return void this._diag.debug("ignoring span as url matches ignored url");let r="";const o=Rd(t),s={};if(this._semconvStability&sg.OLD&&(r=n.toUpperCase(),s["http.method"]=n,s["http.url"]=o.toString()),this._semconvStability&sg.STABLE){const e=n,t=xy(n);r||(r=t),s[Qh]=t,t!==e&&(s[ep]=e),s[lp]=o.toString(),s[np]=o.hostname;const i=function(e){const t=Number(e.port||My[e.protocol]);return t&&!isNaN(t)?t:void 0}(o);i&&(s[rp]=i)}const i=this.tracer.startSpan(r,{kind:lh.CLIENT,attributes:s});return i.addEvent(Ey.METHOD_OPEN),this._cleanPreviousSpanInformation(e),this._xhrMem.set(e,{span:i,spanUrl:t}),i}_markResourceAsUsed(e){this._usedResources.add(e)}_patchOpen(){return e=>{const t=this;return function(...n){const r=n[0],o=n[1];return t._createSpan(this,o,r),e.apply(this,n)}}}_patchSend(){const e=this;function t(t,n,r,o){const s=e._xhrMem.get(n);if(!s)return;if(s.status=n.status,s.statusText=n.statusText,e._xhrMem.delete(n),s.span){const t=s.span;e._applyAttributesAfterXHR(t,n),e._semconvStability&sg.STABLE&&(r?o&&(t.setStatus({code:ch.ERROR,message:o}),t.setAttribute(qh,o)):s.status&&s.status>=400&&(t.setStatus({code:ch.ERROR}),t.setAttribute(qh,String(s.status))))}const i=mp(),a=Date.now();setTimeout(()=>{!function(t,n,r,o){const s=n.callbackToRemoveEvents;"function"==typeof s&&s();const{span:i,spanUrl:a,sendStartTime:l}=n;i&&(e._findResourceAndAddNetworkEvents(n,i,a,l,r),i.addEvent(t,o),e._addFinalSpanAttributes(i,n,a),i.end(o),e._tasksCount--),e._clearResources()}(t,s,i,a)},300)}function n(){t(Ey.EVENT_ERROR,this,!0,"error")}function r(){t(Ey.EVENT_ABORT,this,!1)}function o(){t(Ey.EVENT_TIMEOUT,this,!0,"timeout")}function s(){this.status<299?t(Ey.EVENT_LOAD,this,!1):t(Ey.EVENT_ERROR,this,!1)}return t=>function(...i){const a=e._xhrMem.get(this);if(!a)return t.apply(this,i);const l=a.span,c=a.spanUrl;if(l&&c){if(e.getConfig().measureRequestSize&&i?.[0]){const t=Ty(i[0]);void 0!==t&&(e._semconvStability&sg.OLD&&l.setAttribute("http.request_content_length_uncompressed",t),e._semconvStability&sg.STABLE&&l.setAttribute("http.request.body.size",t))}fh.with(xh.setSpan(fh.active(),l),()=>{e._tasksCount++,a.sendStartTime=mp(),l.addEvent(Ey.METHOD_SEND),this.addEventListener("abort",r),this.addEventListener("error",n),this.addEventListener("load",s),this.addEventListener("timeout",o),a.callbackToRemoveEvents=()=>{!function(t){t.removeEventListener("abort",r),t.removeEventListener("error",n),t.removeEventListener("load",s),t.removeEventListener("timeout",o);const i=e._xhrMem.get(t);i&&(i.callbackToRemoveEvents=void 0)}(this),a.createdResources&&a.createdResources.observer.disconnect()},e._addHeaders(this,c),e._addResourceObserver(this,c)})}return t.apply(this,i)}}enable(){this._diag.debug("applying patch to",this.moduleName,this.version),cg(XMLHttpRequest.prototype.open)&&(this._unwrap(XMLHttpRequest.prototype,"open"),this._diag.debug("removing previous patch from method open")),cg(XMLHttpRequest.prototype.send)&&(this._unwrap(XMLHttpRequest.prototype,"send"),this._diag.debug("removing previous patch from method send")),this._wrap(XMLHttpRequest.prototype,"open",this._patchOpen()),this._wrap(XMLHttpRequest.prototype,"send",this._patchSend())}disable(){this._diag.debug("removing patch from",this.moduleName,this.version),this._unwrap(XMLHttpRequest.prototype,"open"),this._unwrap(XMLHttpRequest.prototype,"send"),this._tasksCount=0,this._xhrMem=new WeakMap,this._usedResources=new WeakSet}}var Fy;!function(e){e.COMPONENT="component",e.HTTP_STATUS_TEXT="http.status_text"}(Fy||(Fy={}));var Uy={};Object.defineProperty(Uy,"__esModule",{value:!0});var By=Uy.ATTR_HTTP_USER_AGENT=Uy.ATTR_HTTP_URL=Uy.ATTR_HTTP_STATUS_CODE=Uy.ATTR_HTTP_SCHEME=Uy.ATTR_HTTP_RESPONSE_CONTENT_LENGTH=Uy.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED=Uy.ATTR_HTTP_REQUEST_BODY_SIZE=Uy.ATTR_HTTP_METHOD=Uy.ATTR_HTTP_HOST=void 0,jy=Uy.ATTR_HTTP_HOST="http.host",Zy=Uy.ATTR_HTTP_METHOD="http.method",zy=Uy.ATTR_HTTP_REQUEST_BODY_SIZE="http.request.body.size",Vy=Uy.ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED="http.request_content_length_uncompressed";Uy.ATTR_HTTP_RESPONSE_CONTENT_LENGTH="http.response_content_length";var Gy=Uy.ATTR_HTTP_SCHEME="http.scheme",Wy=Uy.ATTR_HTTP_STATUS_CODE="http.status_code",$y=Uy.ATTR_HTTP_URL="http.url";By=Uy.ATTR_HTTP_USER_AGENT="http.user_agent";const Hy=mh.createComponentLogger({namespace:"@opentelemetry/opentelemetry-instrumentation-fetch/utils"});function Yy(...e){if(e[0]instanceof URL||"string"==typeof e[0]){const t=e[1];if(!t?.body)return Promise.resolve();if(t.body instanceof ReadableStream){const{body:e,length:n}=function(e){if(!e.pipeThrough)return Hy.warn("Platform has ReadableStream but not pipeThrough!"),{body:e,length:Promise.resolve(void 0)};let t,n=0;const r=new Promise(e=>{t=e}),o=new TransformStream({start(){},async transform(e,t){const r=await e;n+=r.byteLength,t.enqueue(e)},flush(){t(n)}});return{body:e.pipeThrough(o),length:r}}(t.body);return t.body=e,n}return Promise.resolve(function(e){if(t=e,"undefined"!=typeof Document&&t instanceof Document)return(new XMLSerializer).serializeToString(document).length;var t;if("string"==typeof e)return qy(e);if(e instanceof Blob)return e.size;if(e instanceof FormData)return function(e){let t=0;for(const[n,r]of e.entries())t+=n.length,r instanceof Blob?t+=r.size:t+=r.length;return t}(e);if(e instanceof URLSearchParams)return qy(e.toString());if(void 0!==e.byteLength)return e.byteLength;return void Hy.warn("unknown body type")}(t.body))}{const t=e[0];return t?.body?t.clone().text().then(e=>qy(e)):Promise.resolve()}}const Ky=new TextEncoder;function qy(e){return Ky.encode(e).byteLength}const Xy={CONNECT:!0,DELETE:!0,GET:!0,HEAD:!0,OPTIONS:!0,PATCH:!0,POST:!0,PUT:!0,TRACE:!0};let Jy;function Qy(){if(void 0===Jy){const e=$h("OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS");e&&e.length>0?(Jy={},e.forEach(e=>{Jy[e]=!0})):Jy=Xy}return Jy}const ev={"https:":"443","http:":"80"};const tv="0.203.0",nv="object"==typeof process&&"node"===process.release?.name;class rv extends ug{component="fetch";version=tv;moduleName=this.component;_usedResources=new WeakSet;_tasksCount=0;_semconvStability;constructor(e={}){super("@opentelemetry/instrumentation-fetch",tv,e),this._semconvStability=pg("http",e?.semconvStabilityOptIn)}init(){}_addChildSpan(e,t){const n=this.tracer.startSpan("CORS Preflight",{startTime:t[Cd.FETCH_START]},xh.setSpan(fh.active(),e)),r=!(this._semconvStability&sg.OLD);kd(n,t,this.getConfig().ignoreNetworkEvents,void 0,r),n.end(t[Cd.RESPONSE_END])}_addFinalSpanAttributes(e,t){const n=Rd(t.url);if(this._semconvStability&sg.OLD&&(e.setAttribute(Wy,t.status),null!=t.statusText&&e.setAttribute(Fy.HTTP_STATUS_TEXT,t.statusText),e.setAttribute(jy,n.host),e.setAttribute(Gy,n.protocol.replace(":","")),"undefined"!=typeof navigator&&e.setAttribute(By,navigator.userAgent)),this._semconvStability&sg.STABLE){e.setAttribute(tp,t.status),e.setAttribute(np,n.hostname);const r=function(e){const t=Number(e.port||ev[e.protocol]);return t&&!isNaN(t)?t:void 0}(n);r&&e.setAttribute(rp,r)}}_addHeaders(e,t){if(!Nd(t,this.getConfig().propagateTraceHeaderCorsUrls)){const e={};return kh.inject(fh.active(),e),void(Object.keys(e).length>0&&this._diag.debug("headers inject skipped due to CORS policy"))}if(e instanceof Request)kh.inject(fh.active(),e.headers,{set:(e,t,n)=>e.set(t,"string"==typeof n?n:String(n))});else if(e.headers instanceof Headers)kh.inject(fh.active(),e.headers,{set:(e,t,n)=>e.set(t,"string"==typeof n?n:String(n))});else if(e.headers instanceof Map)kh.inject(fh.active(),e.headers,{set:(e,t,n)=>e.set(t,"string"==typeof n?n:String(n))});else{const t={};kh.inject(fh.active(),t),e.headers=Object.assign({},t,e.headers||{})}}_clearResources(){0===this._tasksCount&&this.getConfig().clearTimingResources&&(performance.clearResourceTimings(),this._usedResources=new WeakSet)}_createSpan(e,t={}){if(qp(e,this.getConfig().ignoreUrls))return void this._diag.debug("ignoring span as url matches ignored url");let n="";const r={};if(this._semconvStability&sg.OLD){const o=(t.method||"GET").toUpperCase();n=`HTTP ${o}`,r[Fy.COMPONENT]=this.moduleName,r[Zy]=o,r[$y]=e}if(this._semconvStability&sg.STABLE){const o=t.method,s=function(e){const t=Qy(),n=e.toUpperCase();return n in t?n:"_OTHER"}(t.method||"GET");n||(n=s),r[Qh]=s,s!==o&&(r[ep]=o),r[lp]=e}return this.tracer.startSpan(n,{kind:lh.CLIENT,attributes:r})}_findResourceAndAddNetworkEvents(e,t,n){let r=t.entries;if(!r.length){if(!performance.getEntriesByType)return;r=performance.getEntriesByType("resource")}const o=xd(t.spanUrl,t.startTime,n,r,this._usedResources,"fetch");if(o.mainRequest){const t=o.mainRequest;this._markResourceAsUsed(t);const n=o.corsPreFlightRequest;n&&(this._addChildSpan(e,n),this._markResourceAsUsed(n));const r=!(this._semconvStability&sg.OLD);kd(e,t,this.getConfig().ignoreNetworkEvents,void 0,r)}}_markResourceAsUsed(e){this._usedResources.add(e)}_endSpan(e,t,n){const r=dp(Date.now()),o=mp();this._addFinalSpanAttributes(e,n),this._semconvStability&sg.STABLE&&n.status>=400&&(e.setStatus({code:ch.ERROR}),e.setAttribute(qh,String(n.status))),setTimeout(()=>{t.observer?.disconnect(),this._findResourceAndAddNetworkEvents(e,t,o),this._tasksCount--,this._clearResources(),e.end(r)},300)}_patchConstructor(){return e=>{const t=this;return function(...n){const r=this,o=Rd(n[0]instanceof Request?n[0].url:String(n[0])).href,s=n[0]instanceof Request?n[0]:n[1]||{},i=t._createSpan(o,s);if(!i)return e.apply(this,n);const a=t._prepareSpanData(o);function l(e,n){t._applyAttributesAfterFetch(e,s,n),t._endSpan(e,a,{status:n.status||0,statusText:n.message,url:o})}function c(e,n){t._applyAttributesAfterFetch(e,s,n),n.status>=200&&n.status<400?t._endSpan(e,a,n):t._endSpan(e,a,{status:n.status,statusText:n.statusText,url:o})}function u(e,t,n){try{const t=n.clone().body;if(t){const r=t.getReader(),o=()=>{r.read().then(({done:t})=>{t?c(e,n):o()},t=>{l(e,t)})};o()}else c(e,n)}finally{t(n)}}function h(e,t,n){try{l(e,n)}finally{t(n)}}return t.getConfig().measureRequestSize&&Yy(...n).then(e=>{e&&(t._semconvStability&sg.OLD&&i.setAttribute(Vy,e),t._semconvStability&sg.STABLE&&i.setAttribute(zy,e))}).catch(e=>{t._diag.warn("getFetchBodyLength",e)}),new Promise((n,a)=>fh.with(xh.setSpan(fh.active(),i),()=>(t._addHeaders(s,o),t._callRequestHook(i,s),t._tasksCount++,e.apply(r,s instanceof Request?[s]:[o,s]).then(u.bind(r,i,n),h.bind(r,i,a)))))}}}_applyAttributesAfterFetch(e,t,n){const r=this.getConfig().applyCustomAttributesOnSpan;r&&lg(()=>r(e,t,n),e=>{e&&this._diag.error("applyCustomAttributesOnSpan",e)})}_callRequestHook(e,t){const n=this.getConfig().requestHook;n&&lg(()=>n(e,t),e=>{e&&this._diag.error("requestHook",e)})}_prepareSpanData(e){const t=mp(),n=[];if("function"!=typeof PerformanceObserver)return{entries:n,startTime:t,spanUrl:e};const r=new PerformanceObserver(t=>{t.getEntries().forEach(t=>{"fetch"===t.initiatorType&&t.name===e&&n.push(t)})});return r.observe({entryTypes:["resource"]}),{entries:n,observer:r,startTime:t,spanUrl:e}}enable(){nv?this._diag.warn("this instrumentation is intended for web usage only, it does not instrument Node.js's fetch()"):(cg(fetch)&&(this._unwrap(Hh,"fetch"),this._diag.debug("removing previous patch for constructor")),this._wrap(Hh,"fetch",this._patchConstructor()))}disable(){nv||(this._unwrap(Hh,"fetch"),this._usedResources=new WeakSet)}}class ov{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}class sv extends Error{code;name="OTLPExporterError";data;constructor(e,t,n){super(e),this.data=n,this.code=t}}function iv(e){if(Number.isFinite(e)&&e>0)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function av(e){if(null!=e)return()=>e}function lv(e,t,n){return{timeoutMillis:iv(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}class cv{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(e);const t=()=>{const t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function uv(e){return new cv(e.concurrencyLimit)}function hv(){return{handleResponse(e){null!=e&&function(e){return Object.prototype.hasOwnProperty.call(e,"partialSuccess")}(e)&&null!=e.partialSuccess&&0!==Object.keys(e.partialSuccess).length&&mh.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}class pv{_transport;_serializer;_responseHandler;_promiseQueue;_timeout;_diagLogger;constructor(e,t,n,r,o){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=o,this._diagLogger=mh.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,t){if(this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit())return void t({code:Cp.FAILED,error:new Error("Concurrent export limit reached")});const n=this._serializer.serializeRequest(e);null!=n?this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if("success"!==e.status)"failure"===e.status&&e.error?t({code:Cp.FAILED,error:e.error}):"retryable"===e.status?t({code:Cp.FAILED,error:new sv("Export failed with retryable status")}):t({code:Cp.FAILED,error:new sv("Export failed with unknown error")});else{if(null!=e.data)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:Cp.SUCCESS})}},e=>t({code:Cp.FAILED,error:e}))):t({code:Cp.FAILED,error:new Error("Nothing to send")})}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function dv(e){return e>=48&&e<=57?e-48:e>=97&&e<=102?e-87:e-55}function fv(e){const t=new Uint8Array(e.length/2);let n=0;for(let r=0;r<e.length;r+=2){const o=dv(e.charCodeAt(r)),s=dv(e.charCodeAt(r+1));t[n++]=o<<4|s}return t}function mv(e){const t=BigInt(1e9);return BigInt(e[0])*t+BigInt(e[1])}const gv="undefined"!=typeof BigInt?function(e){return mv(e).toString()}:yp;function yv(e){return e}const vv={encodeHrTime:function(e){const t=mv(e);return n=t,{low:Number(BigInt.asUintN(32,n)),high:Number(BigInt.asUintN(32,n>>BigInt(32)))};var n},encodeSpanContext:fv,encodeOptionalSpanContext:function(e){if(void 0!==e)return fv(e)}};function bv(e){return{attributes:Cv(e.attributes),droppedAttributesCount:0}}function wv(e){return{name:e.name,version:e.version}}function Cv(e){return Object.keys(e).map(t=>_v(t,e[t]))}function _v(e,t){return{key:e,value:Sv(t)}}function Sv(e){const t=typeof e;return"string"===t?{stringValue:e}:"number"===t?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:"boolean"===t?{boolValue:e}:e instanceof Uint8Array?{bytesValue:e}:Array.isArray(e)?{arrayValue:{values:e.map(Sv)}}:"object"===t&&null!=e?{kvlistValue:{values:Object.entries(e).map(([e,t])=>_v(e,t))}}:{}}function Iv(e,t){const n=e.spanContext(),r=e.status,o=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(n.traceId),spanId:t.encodeSpanContext(n.spanId),parentSpanId:o,traceState:n.traceState?.serialize(),name:e.name,kind:null==e.kind?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:Cv(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>function(e,t){return{attributes:e.attributes?Cv(e.attributes):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>function(e,t){return{attributes:e.attributes?Cv(e.attributes):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0}}(e,t)),droppedLinksCount:e.droppedLinksCount}}function Ev(e,t){const n=function(e){return void 0===e?vv:{encodeHrTime:gv,encodeSpanContext:yv,encodeOptionalSpanContext:yv}}(t);return{resourceSpans:Av(e,n)}}function Av(e,t){const n=function(e){const t=new Map;for(const n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));const r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||""}:${n.instrumentationScope.schemaUrl||""}`;let o=e.get(r);o||(o=[],e.set(r,o)),o.push(n)}return t}(e),r=[],o=n.entries();let s=o.next();for(;!s.done;){const[e,n]=s.value,i=[],a=n.values();let l=a.next();for(;!l.done;){const e=l.value;if(e.length>0){const n=e.map(e=>Iv(e,t));i.push({scope:wv(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}l=a.next()}const c={resource:bv(e),scopeSpans:i,schemaUrl:void 0};r.push(c),s=o.next()}return r}const Tv={serializeRequest:e=>{const t=Ev(e,{});return(new TextEncoder).encode(JSON.stringify(t))},deserializeResponse:e=>{if(0===e.length)return{};const t=new TextDecoder;return JSON.parse(t.decode(e))}};class kv{_parameters;_utils=null;constructor(e){this._parameters=e}async send(e,t){const{agent:n,send:r}=this._loadUtils();return new Promise(o=>{r(this._parameters,n,e,e=>{o(e)},t)})}shutdown(){}_loadUtils(){let e=this._utils;if(null===e){const{sendWithHttp:t,createHttpAgent:n}=require("./http-transport-utils");e=this._utils={agent:n(this._parameters.url,this._parameters.agentOptions),send:t}}return e}}function Ov(){return.4*Math.random()-.2}class xv{_transport;constructor(e){this._transport=e}retry(e,t,n){return new Promise((r,o)=>{setTimeout(()=>{this._transport.send(e,t).then(r,o)},n)})}async send(e,t){const n=Date.now()+t;let r=await this._transport.send(e,t),o=5,s=1e3;for(;"retryable"===r.status&&o>0;){o--;const t=Math.max(Math.min(s,5e3)+Ov(),0);s*=1.5;const i=r.retryInMillis??t,a=n-Date.now();if(i>a)return r;r=await this.retry(e,a,i)}return r}shutdown(){return this._transport.shutdown()}}function Rv(e){return new xv(e.transport)}function Nv(e,t){return n={transport:Rv({transport:(o=e,new kv(o))}),serializer:t,promiseHandler:uv(e)},r={timeout:e.timeoutMillis},new pv(n.transport,n.serializer,hv(),n.promiseHandler,r.timeout);var n,r,o}function Mv(e){const t=process.env[e]?.trim();if(null!=t&&""!==t){const n=Number(t);if(Number.isFinite(n)&&n>0)return n;mh.warn(`Configuration: ${e} is invalid, expected number greater than 0 (actual: ${t})`)}}function Lv(e){const t=Mv(`OTEL_EXPORTER_OTLP_${e}_TIMEOUT`),n=Mv("OTEL_EXPORTER_OTLP_TIMEOUT");return t??n}function Pv(e){const t=process.env[e]?.trim();if(""!==t)return null==t||"none"===t||"gzip"===t?t:void mh.warn(`Configuration: ${e} is invalid, expected 'none' or 'gzip' (actual: '${t}')`)}function Dv(e){const t=Pv(`OTEL_EXPORTER_OTLP_${e}_COMPRESSION`),n=Pv("OTEL_EXPORTER_OTLP_COMPRESSION");return t??n}function Fv(e){return{timeoutMillis:Lv(e),compression:Dv(e)}}function Uv(e,t,n){const r={...n()},o={};return()=>(null!=t&&Object.assign(o,t()),null!=e&&Object.assign(o,e()),Object.assign(o,r))}function Bv(e){if(null!=e)try{return new URL(e),e}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function jv(e){const t=process.env[`OTEL_EXPORTER_OTLP_${e}_HEADERS`]?.trim(),n=process.env.OTEL_EXPORTER_OTLP_HEADERS?.trim(),r=Dh(t),o=Dh(n);if(0!==Object.keys(r).length||0!==Object.keys(o).length)return Object.assign({},Dh(n),Dh(t))}function Zv(e){const t=process.env.OTEL_EXPORTER_OTLP_ENDPOINT?.trim();if(null!=t&&""!==t)return function(e,t){try{new URL(e)}catch{return void mh.warn(`Configuration: Could not parse environment-provided export URL: '${e}', falling back to undefined`)}e.endsWith("/")||(e+="/"),e+=t;try{new URL(e)}catch{return void mh.warn(`Configuration: Provided URL appended with '${t}' is not a valid URL, using 'undefined' instead of '${e}'`)}return e}(t,e)}function zv(e){const t=process.env[`OTEL_EXPORTER_OTLP_${e}_ENDPOINT`]?.trim();if(null!=t&&""!==t)return function(e){try{return new URL(e).toString()}catch{return void mh.warn(`Configuration: Could not parse environment-provided export URL: '${e}', falling back to undefined`)}}(t)}function Vv(e){return null!=e?.keepAlive&&(null!=e.httpAgentOptions?null==e.httpAgentOptions.keepAlive&&(e.httpAgentOptions.keepAlive=e.keepAlive):e.httpAgentOptions={keepAlive:e.keepAlive}),e.httpAgentOptions}function Gv(e,t,n,r){return e.metadata&&mh.warn("Metadata cannot be set when using http"),o={url:e.url,headers:av(e.headers),concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis,compression:e.compression,agentOptions:Vv(e)},s=function(e,t){return{...Fv(e),url:zv(e)??Zv(t),headers:av(jv(e))}}(t,n),i=function(e,t){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none",headers:()=>e,url:"http://localhost:4318/"+t,agentOptions:{keepAlive:!0}}}(r,n),{...lv(o,s,i),headers:Uv((a=o.headers,()=>{const e={};return Object.entries(a?.()??{}).forEach(([t,n])=>{void 0!==n?e[t]=String(n):mh.warn(`Header "${t}" has invalid value (${n}) and will be ignored`)}),e}),s.headers,i.headers),url:Bv(o.url)??s.url??i.url,agentOptions:o.agentOptions??s.agentOptions??i.agentOptions};var o,s,i,a}class Wv extends ov{constructor(e={}){super(Nv(Gv(e,"TRACES","v1/traces",{"User-Agent":"OTel-OTLP-Exporter-JavaScript/0.203.0","Content-Type":"application/json"}),Tv))}}class $v{constructor(e,t){this.config=e,this.sessionId=t,this.provider=this.createProvider()}createProvider(){const{serviceName:e,resourceAttributes:t,exporterEndpoint:n,projectId:r}=this.config,o=td({[op]:e,"at-project-id":r,...t||{}}),s=new Wv({url:n||"http://otelcol.apitoolkit.io:4318/v1/traces",headers:{}});return new Id({resource:o,spanProcessors:[new fd(s)]})}configure(){this.provider.register({contextManager:new yg,propagator:new Rp});const e=this.config.propagateTraceHeaderCorsUrls||[/^https?:\/\/.*/],t=[/^https?:\/\/(?:[^\/]+\.)?apitoolkit\.io\//,/^https?:\/\/(?:[^\/]+\.)?monoscope\.tech\//];!function(e){const t=e.tracerProvider||xh.getTracerProvider(),n=e.meterProvider||vh.getMeterProvider(),r=e.loggerProvider||zd.getLoggerProvider(),o=e.instrumentations?.flat()??[];(function(e,t,n,r){for(let o=0,s=e.length;o<s;o++){const s=e[o];t&&s.setTracerProvider(t),n&&s.setMeterProvider(n),r&&s.setLoggerProvider&&s.setLoggerProvider(r),s.getConfig().enabled||s.enable()}})(o,t,n,r)}({tracerProvider:this.provider,instrumentations:[...this.config.instrumentations||[],new mg({applyCustomAttributesOnSpan:{documentLoad:e=>{e.setAttribute("session.id",this.sessionId),this.setUserAttributes(e)},documentFetch:e=>{e.setAttribute("session.id",this.sessionId),this.setUserAttributes(e)},resourceFetch:e=>{e.setAttribute("session.id",this.sessionId),this.setUserAttributes(e)}}}),new Dy({propagateTraceHeaderCorsUrls:e,ignoreUrls:t,applyCustomAttributesOnSpan:e=>{e.setAttribute("session.id",this.sessionId),this.setUserAttributes(e)}}),new rv({propagateTraceHeaderCorsUrls:e,ignoreUrls:t,applyCustomAttributesOnSpan:e=>{e.setAttribute("session.id",this.sessionId),this.setUserAttributes(e)}})]})}setUserAttributes(e){if(this.config.user)for(let t in this.config.user)e.setAttribute(`user.${t}`,this.config.user[t])}async shutdown(){await this.provider.shutdown()}setUser(e){this.config={...this.config,user:{...this.config.user,...e}}}}const Hv=[];for(let e=0;e<256;++e)Hv.push((e+256).toString(16).slice(1));let Yv;const Kv=new Uint8Array(16);var qv={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Xv(e,t,n){if(qv.randomUUID&&!e)return qv.randomUUID();const r=(e=e||{}).random??e.rng?.()??function(){if(!Yv){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Yv=crypto.getRandomValues.bind(crypto)}return Yv(Kv)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(e,t=0){return(Hv[e[t+0]]+Hv[e[t+1]]+Hv[e[t+2]]+Hv[e[t+3]]+"-"+Hv[e[t+4]]+Hv[e[t+5]]+"-"+Hv[e[t+6]]+Hv[e[t+7]]+"-"+Hv[e[t+8]]+Hv[e[t+9]]+"-"+Hv[e[t+10]]+Hv[e[t+11]]+Hv[e[t+12]]+Hv[e[t+13]]+Hv[e[t+14]]+Hv[e[t+15]]).toLowerCase()}(r)}class Jv{constructor(e){if(!e.projectId)throw new Error("MonoscopeConfig must include projectId");const t=sessionStorage.getItem("monoscope-session-id");t?this.sessionId=t:(this.sessionId=Xv(),sessionStorage.setItem("monoscope-session-id",this.sessionId)),this.config=e,this.replay=new Uc(e,this.sessionId),this.otel=new $v(e,this.sessionId),this.otel.configure(),this.replay.configure(),"undefined"!=typeof window&&(window.monoscope=this)}getSessionId(){return this.sessionId}setUser(e){this.otel.setUser(e)}}return"undefined"!=typeof window&&(window.Monoscope=Jv),Jv}(perf_hooks$2,path$4,require$$1$2,require$$1$3,require$$0,require$$0$1,os$2,require$$2$2,require$$3);
|
|
21
21
|
//# sourceMappingURL=browser.js.map
|